Re: Determine if a user and database are available

2022-09-02 Thread Christophe Pettus
> On Sep 2, 2022, at 14:22, Jeffrey Walton wrote: > Given the NOTES in the man page, how do we determine if a user and > database are present using the shell? Is there another utility we > should be using? pg_isready literally only checks that the server can be reached over the connection pat

Re: Changing the admin/postgres user password

2022-09-05 Thread Christophe Pettus
> On Sep 5, 2022, at 19:40, Jeffrey Walton wrote: > And finally, try the new password: > >PGPASSWORD=hi...HS psql -U postgres >psql: error: connection to server on socket > "/var/run/postgresql/.s.PGSQL.5432" failed: >FATAL: Peer authentication failed for user "postgres" If it's

Re: Postgres SQL unable to handle Null values for Text datatype

2022-09-06 Thread Christophe Pettus
> On Sep 5, 2022, at 23:10, Karthik K L V wrote: > The above query fails with the below exception when the value of ?1 resolves > to null. > org.postgresql.util.PSQLException: ERROR: operator does not exist: character > varying = bytea > Hint: No operator matches the given name and argument

Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?

2022-09-12 Thread Christophe Pettus
> On Sep 12, 2022, at 15:51, Bryn Llewellyn wrote: > The implication is that every client program must follow every database call > with defensive code to detect error "57P01" and programmatically re-try. That situation exists even without the ability for a role to kill other sessions author

Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?

2022-09-12 Thread Christophe Pettus
> On Sep 12, 2022, at 20:44, Bryn Llewellyn wrote: > Version 16? Thus might be the clue, then. It behaves as David describes on: PostgreSQL 14.5 on x86_64-apple-darwin19.6.0, compiled by Apple clang version 12.0.0 (clang-1200.0.32.29), 64-bit

Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?

2022-09-13 Thread Christophe Pettus
> On Sep 13, 2022, at 11:23, Bryn Llewellyn wrote: > > There must be some-or-other non-standard setting in my environment that > results in the behavior that I see and that other's don't. From the documentation: > superuser status > A database superuser bypasses all permission checks,

Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?

2022-09-13 Thread Christophe Pettus
> On Sep 13, 2022, at 11:39, Bryn Llewellyn wrote: > > What are you seeing that I'm failing to? It works correctly for me, on MacOS: swift-239:~ xof$ psql psql (14.5) Type "help" for help. xof=# create user r1; CREATE ROLE xof=# revoke execute on function pg_terminate_backend from r1; REVOK

Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?

2022-09-13 Thread Christophe Pettus
> On Sep 13, 2022, at 14:10, Tom Lane wrote: > > Perhaps you'd already revoked from public in this database? Very possible!

Extension rpath issues on MacOS

2022-09-16 Thread Christophe Pettus
I'm attempting to build the pgspider JDBC foreign data wrapper on MacOS, and not having an enormously successful time. The driver source is at: https://github.com/pgspider/jdbc_fdw It (unsurprisingly) needs to link with libjvm.dylib, so I've included the path to it in the PostgreSQL ./

Re: Extension rpath issues on MacOS

2022-09-16 Thread Christophe Pettus
> On Sep 16, 2022, at 14:20, Tom Lane wrote: > IOW: I think they want you to get that from macports or homebrew instead. > It certainly works a lot easier if you do. Yeah, I installed openjdk8 using MacPorts, but it puts its stuff in a rather idiosyncratic location. I guess it's "create-a-sy

Re: problem with on conflict / do update using psql 14.4

2022-09-24 Thread Christophe Pettus
> On Sep 24, 2022, at 07:29, Barry Kimelman wrote: > > CREATE UNIQUE INDEX my_companies_company_name_unique ON > my_companies(company_name) WHERE delete_timestamp IS NULL; The issue here is that the unique index is partial (it has a WHERE clause). In order to use that as an arbiter, you ne

Re: problem with on conflict / do update using psql 14.4

2022-09-24 Thread Christophe Pettus
> On Sep 24, 2022, at 08:29, Barry Kimelman wrote: > Thanks for the response. When I ran the INSERT with your suggested change I > got an error message telling me > "column reference 'company_name' is ambiguous" As previously noted, you'll need to do both: add "excluded." to qualify the colu

Re: problem with on conflict / do update using psql 14.4

2022-09-24 Thread Christophe Pettus
> On Sep 24, 2022, at 08:49, Barry Kimelman wrote: > I thought the whole point of ON CONFLICT DO UPDATE was so that you could > modify the data so that it would be inserted ON CONFLICT DO UPDATE allows you to modify the existing row that conflicted with the row being inserted, but it won't a

Re: problem with on conflict / do update using psql 14.4

2022-09-24 Thread Christophe Pettus
> On Sep 24, 2022, at 09:04, Barry Kimelman wrote: > Unfortunately, that is exactly what I need to do, I need to modify the data > on the 2nd request so that it also gets inserted. The best approach is to optimistically insert the row, catch the error if there's a conflict, and modify the da

Re: Replication between Master PostgreSQL database version 9.6.1 and Standby/Slave PostgreSQL database version 10.17.

2022-10-05 Thread Christophe Pettus
> On Oct 5, 2022, at 09:32, Kaushal Shriyan wrote: > > Hi, > > Is replication possible between PostgreSQL support Master database running > 9.6.1 version which is a lower version to Standby/Slave running version > 10.17? Binary replication is not possible between different major versions.

Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE

2022-10-05 Thread Christophe Pettus
> On Oct 5, 2022, at 17:16, Bryn Llewellyn wrote: > B.t.w, the value of "quote_ident()" rests on the distinction between a name > (what you provide with the function's actual argument) and an identifier > (what it returns). There is no first-class "identifier" type in PostgreSQL, so a functi

Re: pg_restore creates public schema?

2022-10-06 Thread Christophe Pettus
> On Oct 6, 2022, at 09:46, Ron wrote: > Because installing new software on production servers requires hurdles > (Service Now change ticket approved by the application support manager, > Delivery Service Manager, Engineering Change Board, and a one week lead time > before installing during

Re: Replication between Master PostgreSQL database version 9.6.1 and Standby/Slave PostgreSQL database version 10.17.

2022-10-06 Thread Christophe Pettus
> On Oct 6, 2022, at 10:20, Kaushal Shriyan wrote: > > I am not sure if I understand the difference between binary and logical > replication between PostgreSQL Master and Standby/Slave server. It's best to review the documentation here: https://www.postgresql.org/docs/10/logical-rep

Re: pg_restore creates public schema?

2022-10-06 Thread Christophe Pettus
> On Oct 6, 2022, at 10:44, Ron wrote: > Sadly, that VM doesn't have nearly enough disk space to hold the backup > folder. Use file mode, and stream the output via scp/ssh to a different machine?

Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE

2022-10-07 Thread Christophe Pettus
> On Oct 7, 2022, at 17:16, Bryn Llewellyn wrote: > What does "make for a good bug report" mean, David? Well, first of all, brevity. :-) > Is it: > > (1.1) You, David, or somebody else who has been officially recognized as a PG > Contributor (https://www.postgresql.org/community/contributor

Re: TF card for PGDATA

2022-10-08 Thread Christophe Pettus
> On Oct 8, 2022, at 17:14, Theodore M Rolle, Jr. wrote: > > What are the pros and cons of using a TF card to store data? Assuming by TF you mean Transflash, a trade name for SD cards, the bandwidth on them is not particularly spectacular. The absolute fastest is an SDUC card at ~980Mb/s,

Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP

2022-10-18 Thread Christophe Pettus
> On Oct 18, 2022, at 13:14, Ravi Krishna wrote: > > I am getting error at COMMIT -> cannot commit while a subtransaction is > active. > Is commit not possible in a loop You can commit in a loop, but not in BEGIN / END block that has an exception handler: that creates a subtransaction for t

Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP

2022-10-18 Thread Christophe Pettus
> On Oct 18, 2022, at 14:29, Ravi Krishna wrote: > > > You can commit in a loop, but not in BEGIN / END block that has an > > exception handler: > > that creates a subtransaction for the duration of the BEGIN / END. > > The reason I have to deal with error exception is that I want to ignore

Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP

2022-10-18 Thread Christophe Pettus
> On Oct 18, 2022, at 14:15, Bryn Llewellyn wrote: > Could the limitation be lifted by making tractable internal implementation > changes? Or is it rooted in profoundly deep features of the > architecture—meaning that it could never be lifted? That is a very good question. One of the issues

Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP

2022-10-18 Thread Christophe Pettus
> On Oct 18, 2022, at 19:18, gogala.mla...@gmail.com wrote: > > Commit within a loop is an extremely bad idea. This is an over-generalization. There are many use-cases for this (if there were not, procedures wouldn't have been nearly as important a feature). For example, if you are processi

Re: Explain returns different number of rows

2022-10-20 Thread Christophe Pettus
> On Oct 20, 2022, at 09:52, Vince McMahon > wrote: > The number of rows are different. This isn't unexpected. EXPLAIN does not actually run the query and determine how many rows are returned; it calculates an estimate based on the current system statistics, which vary constantly dependin

Re: Does standalone postfrsql have autogrowth/ manual growth on table space?

2022-10-20 Thread Christophe Pettus
> On Oct 20, 2022, at 10:29, Ron wrote: > There's no pre-allocation in Postgresql. This is correct in that you can't say "please allocate 3GB for this table for me now." The number of pages that are added to the end of a file isn't always one though; it can allocate more based on recent act

Re: Does standalone postfrsql have autogrowth/ manual growth on table space?

2022-10-20 Thread Christophe Pettus
> On Oct 20, 2022, at 11:45, Vince McMahon > wrote: > > Thanks. I guess it is time for vacuum. 😂 Ironically, vacuum is the main issue. The main reason that you can't just slap a few gigabytes onto the end of a table is that the next time vacuum runs, it will happily truncate it all away.

Re: Some questions about Postgres

2022-11-03 Thread Christophe Pettus
> On Nov 3, 2022, at 10:38, Siddharth Jain wrote: > I read an old article comparing MySQL to Postgres and wanted to get answers > to following questions. Given your questions, I suspect that you read the technical note from Uber about why they switched back to MySQL from PostgreSQL. There

Re: PCI:SSF - Safe SQL Query & operators filter

2022-11-07 Thread Christophe Pettus
> On Nov 7, 2022, at 17:24, Jan Bilek wrote: > Would there be any way to go around this? The typical configuration is to not permit the PostgreSQL superuser to log in remotely. The database can be managed by a different, non-superuser role, including schema migrations. > CREATE OR REPLACE

Re: PCI:SSF - Safe SQL Query & operators filter

2022-11-07 Thread Christophe Pettus
> On Nov 7, 2022, at 17:43, Jan Bilek wrote: > > Well, superuser (our App) is already logged in and as it is designed > very much as an "appliance" it simply does that job - manages its > database. Well... don't do that. :) The problem is analogous to having root log into a Linux box and

Re: Q: fixing collation version mismatches

2022-11-13 Thread Christophe Pettus
> On Nov 13, 2022, at 12:45, Karsten Hilbert wrote: > REINDEX DATABASE db_in_question; > ALTER DATABASE db_in_question REFRESH COLLATION VERSION; > ALTER COLLATION every_collation_from_pg_collation REFRESH VERSION; I may be totally off-base here, but shouldn't the REINDEX be

Re: How to avoid having to run the GRANT command for newly added tables?

2022-11-23 Thread Christophe Pettus
> On Nov 23, 2022, at 12:06, Siddharth Jain wrote: > Is there any way to accomplish what I want? Thanks. There is: https://www.postgresql.org/docs/current/sql-alterdefaultprivileges.html

Re: Get table catalog from pg_indexes

2022-11-27 Thread Christophe Pettus
> On Nov 27, 2022, at 10:42, Igor Korot wrote: > > It doesn't say anything about "current" DB - only the DB. In PostgreSQL terminology, a single PostgreSQL instance (the cluster) can have multiple databases. The database the connection is currently open to is the current database.

Re: Get table catalog from pg_indexes

2022-11-27 Thread Christophe Pettus
> On Nov 27, 2022, at 10:53, Igor Korot wrote: > Are you saying I can't run any query on other DB? Or connect to DB and > run select? The query you run only looks at the system catalogs for the database you are connected to (with the exception of the small number of global catalogs, like pg_

Re: postgres large database backup

2022-11-30 Thread Christophe Pettus
> On Nov 30, 2022, at 07:40, Atul Kumar wrote: > So please let me know how I should do it in a quicker backup for my 10TB > database ? Is there any tool to take backups and subsequently incremental > backups in a faster way and restore it for PITR in a faster way when required. For an initia

Re: how to secure pg_hba.conf

2022-12-01 Thread Christophe Pettus
> On Dec 1, 2022, at 05:45, Rizwan Shaukat wrote: > we hv requiremnt from security to secure pg_hba.conf file was encryption or > password protected on server to protect ip visibilty because these server > access by application n thy can amend as well. how we can achive it pls The only prac

Re: Stored procedure code no longer stored in v14 and v15, changed behaviour

2022-12-01 Thread Christophe Pettus
> On Dec 1, 2022, at 11:05, Dominique Devienne wrote: > > I see. Still, Oracle preserves SQL as-is. SQLite preserve SQL as-is. > Would be nice if PostgreSQL did too. That's all I'm saying. Since this is a custom-built system, there is nothing keeping you from creating your own table in the d

Re: Stored procedure code no longer stored in v14 and v15, changed behaviour

2022-12-02 Thread Christophe Pettus
> On Dec 2, 2022, at 08:02, Tom Lane wrote: > > Pasi Oja-Nisula writes: >> I would be perfectly satisfied, if the sql that produced the procedure >> would be stored "as is" read-only copy when it was compiled. > If you want an audit comparison point, I'd suggest capturing > the result of pg_

Get size of variable-length attribute as stored on disk

2022-12-15 Thread Christophe Pettus
Hi, Is there a way from SQL to get the size of a particular attribute (field in a row) with a variable-length typed as stored on disk (including compression)? The use case is to determine the size distribution for setting TOAST_TUPLE_TARGET and making other decisions about what to store in tha

Re: Get size of variable-length attribute as stored on disk

2022-12-15 Thread Christophe Pettus
> On Dec 15, 2022, at 10:23, Christophe Pettus wrote: > Is there a way from SQL to get the size of a particular attribute (field in a > row) with a variable-length typed as stored on disk (including compression)? > The use case is to determine the size distribution

postgres_fdw does not push down DISTINCT

2022-12-15 Thread Christophe Pettus
While working on a different FDW, I discovered that postgres_fdw doesn't push a DISTINCT clause to the foreign server, unless it's part of an aggregate function: k=# explain verbose select distinct i from tf; QUERY PLAN

Re: PG replicas and transactions atomicity

2023-01-05 Thread Christophe Pettus
> On Jan 5, 2023, at 12:07, Louis Laborde wrote: > > Are PG replicas updated atomically following the same transactions boundaries > as the source DB ? Yes. The same transactional guarantees apply to the replica as do to the original transactions on the primary.

Re: PG replicas and transactions atomicity

2023-01-05 Thread Christophe Pettus
> On Jan 5, 2023, at 16:03, Ron wrote: > > Even in asynchronous replication? Yes. Asynchronous replication controls when the client doing the transaction is told that the transaction is complete; it doesn't allow for dirty reads on either the primary or secondary.

Re: PG replicas and transactions atomicity

2023-01-05 Thread Christophe Pettus
> On Jan 5, 2023, at 19:38, Bhautik Chudasama > wrote: > > Does it mean when we commit transaction, client will wait until all replicas > successfully committed the transaction. It depends. If all the settings are the defaults, no, the client won't wait for the replicas to acknowledge the

Re: postgres restore & needed history files

2023-01-05 Thread Christophe Pettus
> On Jan 5, 2023, at 21:28, Laurenz Albe wrote: > > On Tue, 2023-01-03 at 16:03 +, Zwettler Markus (OIZ) wrote: >> We are using a DIY Postgres backup: >> --- >> psql -c "select pg_start_backup ('Full');" >> save -s "${NSR_SERVER}" -g "${NSR_POOL}" "${PGDATA}" >> psql -c "select pg_stop_bac

Re: EXPLAIN and FK references?

2023-01-11 Thread Christophe Pettus
> On Jan 11, 2023, at 22:07, Tom Lane wrote: > No, not directly, but you could look at EXPLAIN ANALYZE to see which > of the RI triggers is eating the time. It's not going to be hard to > figure out which one(s) are using indexed plans and which are not. Also, IIRC, the SELECTs generated to d

Re: No function matches the given name and argument types.

2023-01-16 Thread Christophe Pettus
> On Jan 16, 2023, at 09:53, David G. Johnston > wrote: > > I don't see any good way to say: "given this function signature, and the fact > it cannot be found, what are the next closest function signatures that are > present". I can see a use-case for such functionality, though: A "did you

Re: Is a logical replication crash recovery safe?

2023-01-24 Thread Christophe Pettus
> On Jan 24, 2023, at 07:37, Zwettler Markus (OIZ) > wrote: > > Is a logical replication crash recovery safe? You might want to give more detail about the scenario you are concerned about. Changes that are received by a subscriber as part of logical replication are WAL-logged, observe tra

Re: [EXT] DBeaver session populating pg_stat_activity.backend_xmin

2023-01-25 Thread Christophe Pettus
> On Jan 25, 2023, at 14:21, Dirschel, Steve > wrote: > From my perspective "idle in transaction" isn't necessarily a problem > (although I don't like seeing sessions sitting like that for a long time). > The problem is when pg_stat_activity.backend_xmin is populated- that can > prevent a

Re: Sequence vs UUID

2023-01-26 Thread Christophe Pettus
> On Jan 26, 2023, at 11:17, veem v wrote: > So we want to understand from experts here, if there are any clear rules > available or if we have any pros vs cons list available for each of those to > understand the exact scenario in which we should go for one over other? Clear rules are a bit

Re: Indexes mysteriously change to ON ONLY

2023-01-27 Thread Christophe Pettus
> On Jan 27, 2023, at 13:01, Rumpi Gravenstein wrote: > > We are using the pg_indexes view (indexdef) to retrieve the index definition. This is as expected. Once the index is created on the partitioned set of tables, the index on the *root* table will be ON ONLY that table; the child table

Re: Why is this SELECT evaluated?

2023-01-28 Thread Christophe Pettus
> On Jan 28, 2023, at 11:29, Miles Elam wrote: > Why does this error result? While the standard order of operations is to evaluate the WHERE before the SELECT list, it's not guaranteed to result in short-cut execution. In particular, constant folding happens very early in the processing of

Re: SELECT * FROM huge_table LIMIT 10; Why does it take more than 10 min to complete, with cold caches

2023-01-31 Thread Christophe Pettus
> On Jan 31, 2023, at 07:40, Dimitrios Apostolou wrote: > Is this bloat even affecting queries that do not use the index? No, but a bloated index often (although not always) goes along with a bloated table. > It seems I have to add VACUUM FULL to nightly maintainance. I wouldn't go that far

Re: VACUUM vs VACUUM FULL (was: SELECT * FROM huge_table LIMIT 10; Why does it take more than 10 min to complete, with cold caches)

2023-02-01 Thread Christophe Pettus
> On Feb 1, 2023, at 10:45, David G. Johnston > wrote: > The system just isn't that intelligent for "sequential scan", instead it does > literally what the label says, goes through the table one page at a time and > returns any live rows it finds. Although this does raise a question: Could

Re: How to use the BRIN index properly?

2023-02-08 Thread Christophe Pettus
> On Feb 8, 2023, at 13:17, Siddharth Jain wrote: > > As I explained in my question that is indeed our dilemma. Our insertion order > will not be equal to index order. i.e., referring to your response: > > > who's data is added in the same order as the key in the BRIN index > > does NOT hol

Re: How to use the BRIN index properly?

2023-02-08 Thread Christophe Pettus
> On Feb 8, 2023, at 14:14, Siddharth Jain wrote: > > If the B-Tree index will be so large that it cannot fit in memory, then is it > worth creating it at all? Yes. Of course, more memory is better, and more recently versions of PostgreSQL have optimizations that are valuable for large B-

Re: Does Postgres 14 have a query cache?

2023-02-18 Thread Christophe Pettus
> On Feb 18, 2023, at 06:59, Peter J. Holzer wrote: > I think the reason > is that the use case (the exact same query is submitted repeatedly) is > sufficiently rare that it isn't all that effective in practice. And, in this use case, a prepared statement is in effect a cache of the parsing a

Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?

2023-02-18 Thread Christophe Pettus
> On Feb 18, 2023, at 15:49, Bryn Llewellyn wrote: > > Or is it done server-side? It's done server-side. Note that what really happens is that, when a statement begins execution and there is no open transaction, a snapshot is taken and then released when the statement finishes (just as hap

Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?

2023-02-18 Thread Christophe Pettus
> On Feb 18, 2023, at 15:49, Bryn Llewellyn wrote: > > I’ve searched in vain for an account of how "autocommit" mode actually works. I realize now I may have misinterpreted your question... apologies if so! If you mean the BEGIN and COMMIT statement that some client libraries insert into t

Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?

2023-02-18 Thread Christophe Pettus
> On Feb 18, 2023, at 18:52, Ian Lawrence Barwick wrote: > > Historical trivia: PostgreSQL had a (backend) "autocommit" GUC in 7.3 > only, which remained as > a dummy GUC until 9.5 (see: https://pgpedia.info/a/autocommit.html ). Well, that was a pretty whacky idea. :-)

Re: Thanks! Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?

2023-02-20 Thread Christophe Pettus
> On Feb 20, 2023, at 11:57, Bryn Llewellyn wrote: > 2. If I send over "begin" and then "insert into s.t(v) values(42)", then (so > far) a second session will not see the effect of my SQL's. It sees this only > when I send over "commit". (If I send over "rollback" instead of "commit", > then

Re: Thanks! Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?

2023-02-20 Thread Christophe Pettus
> On Feb 20, 2023, at 17:54, Bryn Llewellyn wrote: > > > I’ve no idea how I might have found this without human help. That sounds like an excellent documentation patch!

Re: Is Autovacuum running?

2023-02-21 Thread Christophe Pettus
> On Feb 21, 2023, at 09:54, Brad White wrote: > Any suggestions on how to proceed? First, look at pg_stat_user_tables to see how many inserts etc. have occurred on the tables that are not showing an autovacuum; they may have simply not reached the threshold yet. If they have, do a VACUUM V

Re: Is Autovacuum running?

2023-02-21 Thread Christophe Pettus
> On Feb 21, 2023, at 10:48, Brad White wrote: > > Running the table_bloat_check query from here > https://github.com/pgexperts/pgx_scripts/blob/master/bloat/table_bloat_check.sql > > shows some tables with over 20MB and over 20% bloat while my threshold is set > to 0.1. Apples-to-oranges

Re: How does Postgres store a B-Tree on disk while using the OS file system?

2023-03-06 Thread Christophe Pettus
> On Mar 6, 2023, at 16:24, Siddharth Jain wrote: > My question: How can it then store a B Tree on disk? I would think storing a > B Tree requires storing disk offset addresses and so on (for a node to > navigate to another etc.). For this, one would need to write directly to the > disk usin

Re: Oracle to PostgreSQL Migration

2023-03-24 Thread Christophe Pettus
> We have an Oracle DB which is around 1TB and we want to migrate to > PostgreSQL that have a new table structure, so we want to perform > data transformation and real time CDC from Oracle to PostgreSQL. Do > we have any good open source tool to achieve this with No Coding > involved.?? To meet al

Re: Using CTID system column as a "temporary" primary key

2023-03-28 Thread Christophe Pettus
> On Mar 28, 2023, at 03:39, Sebastien Flaesch > wrote: > Do I have to cast() ? Yes: select * from t where ctid='(0,1)'::tid; The string representation can be up to 17 characters: 10 for the page number, 4 for the tuple number, and three for the delimiters. Remember that updating

Re: Using CTID system column as a "temporary" primary key

2023-03-29 Thread Christophe Pettus
> On Mar 29, 2023, at 12:11, Sebastien Flaesch > wrote: > But to make PostgreSQL more Informix-compatible, zero should have been > considered as well. There is an infinite family of strange features that various databases have (DUAL from Oracle, anyone?); PostgreSQL will rapidly become unus

Re: Logical Replication Sync Validation

2023-04-18 Thread Christophe Pettus
> On Apr 18, 2023, at 01:20, Robert Sjöblom wrote: > Another idea we've had would be to use CTID to fetch the last row > (update/insert) in each table on both sides and compare row content, is this > feasible? Is it safe to rely on CTIDs across logical replication? No. CTIDs aren't sent ove

Re: Logical Replication Sync Validation

2023-04-18 Thread Christophe Pettus
> On Apr 18, 2023, at 03:45, Robert Sjöblom wrote: > I'm aware of that. But you can, however, do something like: > > SELECT * FROM FOO WHERE CTID = (SELECT MAX(CTID) FROM FOO); > > on both sides. The idea being that if I change FOO, the CTID of the changed > row will not be the same on both

VACUUM (INDEX_CLEANUP OFF) and GIN indexes

2023-04-25 Thread Christophe Pettus
Does VACUUM (INDEX_CLEANUP OFF) flush the pending list for GIN indexes, or is that skipped as well?

Re: VACUUM (INDEX_CLEANUP OFF) and GIN indexes

2023-04-25 Thread Christophe Pettus
> On Apr 25, 2023, at 09:35, Peter Geoghegan wrote: > > It's skipped by VACUUM, but not by ANALYZE. So if you're using the > reloption version of index_cleanup=off, it isn't necessarily going to > stop autovacuum/autoanalyze from doing pending list cleanup. Ugh, thanks. I wasn't aware that i

Re: Postgres query doesn't accept double quote around schema name in query statement

2023-04-27 Thread Christophe Pettus
> On Apr 27, 2023, at 12:40, Michael Xu wrote: > In our env, it throws 42P01:relation "ads.MyTableName" does not exist. The function of double quotes in SQL is to allow you do include characters that would otherwise not be legal in an identifier (as well as making the identifier case-sensiti

Re: Regarding SSL Enablement in PostgreSQL Database on different port

2023-05-02 Thread Christophe Pettus
> On May 2, 2023, at 12:15, Tomas Pospisek wrote: > > Oh, I think your idea to use pgbouncer to take care of the SSL termination is > elegant. I don't think me I'd characterize it as a hack if properly set up. > Why do you consider it a hack? It's really only a hack in the sense that pgboun

Re: What type of Compiler to SQL? Memory-Image (Load-and-Go) Format?

2023-05-04 Thread Christophe Pettus
> On May 4, 2023, at 18:00, Wen Yi wrote: > > Hi team, > I am a newbie to the postgres. > When I am studying the compiler,the text book tell me there is there type of > compiler. > • Assembly Language Format > • Relocatable Binary Format > • Memory-Image (Load-and-Go) Format

xid type? (was :)

2023-05-15 Thread Christophe Pettus
> On May 15, 2023, at 08:41, Fabrice Chapuis wrote: > What is the xid type and how can I cast integer value to make > pg_xact_commit_timestamp to work? The xid type is... xid. You'll need to cast as a string instead of an integer: xof=# select pg_xact_commit_timestamp('53013547'::xid); p

Re: Would PostgreSQL 16 native transparent data encryption support database level encryption?

2023-05-22 Thread Christophe Pettus
> On May 22, 2023, at 11:02, Tony Xu wrote: > there are still some shared area between clusters. That's not quite right. A PostgreSQL cluster (in the traditional sense, which means one PostgreSQL server handling a particular endpoint) is isolated from any other clusters on the same machine.

Re: Would PostgreSQL 16 native transparent data encryption support database level encryption?

2023-05-22 Thread Christophe Pettus
> On May 22, 2023, at 13:06, Adrian Klaver wrote: > As I understand TDE whether you can get to the files is not really the point. > It is that someone/thing can and if they do the files are encrypted. Pretty > sure RDS is not magical enough to have no access from any source to the file > sys

Re: pg_upgrade and schema complexity...

2023-06-02 Thread Christophe Pettus
> On Jun 2, 2023, at 17:44, Ron wrote: > Is this to be expected of such a huge schema? pg_upgrade time is pretty much proportional to the number of database objects in the schema, so a much larger schema taking much longer is to be expected.

Re: SOC II Type 2 report.

2023-06-13 Thread Christophe Pettus
Hi, > On Jun 12, 2023, at 11:57, Raj Kiran wrote: > Prokopto is completing our annual vendor review process. Please share your > most recent SOC II Type 2 report. The PostgreSQL project isn't SOC2 certified, and will almost certainly never be. If you require SOC2 compliance, you'll need to wo

Re: INSERT UNIQUE row?

2023-07-09 Thread Christophe Pettus
A UNIQUE index can have any number of columns, so you can create an index with all of the appropriate columns listed. This is different from having a UNIQUE index on each individual column. In the former case, all of the columns together must be unique; in the latter case, as you mention, each

Re: Trigger Function question

2023-07-10 Thread Christophe Pettus
> On Jul 10, 2023, at 11:20, DAVID ROTH wrote: > > In a trigger function, is there a way to get a list of all of the columns in > the triggering table? You can get the table that the trigger fired on with TG_TABLE_SCHEMA and TG_TABLE_NAME, and then query the system catalogs to get a list of

Re: Trigger Function question

2023-07-10 Thread Christophe Pettus
> On Jul 10, 2023, at 11:29, DAVID ROTH wrote: > > I want to use a single trigger function to log multiple tables and the tables > have different columns. I can get the names of the columns from the catalog. > But I have not been able to figure out how to get NEW.x when x is not known > u

Re: Trigger Function question

2023-07-10 Thread Christophe Pettus
> On Jul 10, 2023, at 11:37, DAVID ROTH wrote: > > Thanks for the example. I have a test trigger now that does that but my > application needs all of the columns. I'm not quite sure I understanding. Logging NEW.* and OLD.* *does* get all the columns, without having to specific query to fin

Re: Trigger Function question

2023-07-10 Thread Christophe Pettus
> On Jul 10, 2023, at 11:46, DAVID ROTH wrote: > > Is there a way to get new.* into a jsonb column? The to_jsonb() function accepts a row type like NEW.*, and returns a JSONB object with the keys as column names.

Re: Using "exit" to bring "goto" functionality.

2023-07-10 Thread Christophe Pettus
> On Jul 10, 2023, at 11:54, Bryn Llewellyn wrote: > > What is the rationale for supporting what seems to be on its face this > strange functionality? It allows you to EXIT or CONTINUE a loop that is not the innermost one, by naming the label of an outer loop. One can debate endlessly whet

Re: Sample pg_hba.conf allows local users to access all databases

2023-08-01 Thread Christophe Pettus
> On Aug 1, 2023, at 10:13, William Edwards wrote: > This allows all local users connecting over TCP to access all databases, not > only the databases that the user is a member of as one might expect. There's really no notion of a user being "a member of" a database in PostgreSQL. Users are

Re: Dropping all tables in a database

2023-08-06 Thread Christophe Pettus
> On Aug 6, 2023, at 18:17, H wrote: > > Is there some setting I have to change in the database to have the first SQL > statement to work or have I run into a possible bug? The first statement just generates a line of text output that contains the statement. There's nothing in it that woul

Re: [EXTERNAL] Oracle FDW version

2023-08-22 Thread Christophe Pettus
> On Aug 22, 2023, at 19:57, Jethro Elmer Sanidad > wrote: > > Hello, > > I tried both the 1.5.0 and 2.0.0. Both returned error during 'make' command. > Please see below: The API between PostgreSQL and foreign data wrappers has changed significantly since 9.4. As Tom mentioned, you need

Re: Database selection

2023-09-20 Thread Christophe Pettus
> On Sep 20, 2023, at 14:11, veem v wrote: > > Does AWS aurora postgres depend on the same vacuuming technology for > maintaining the transactions? Yes. Aurora has replaced the PostgreSQL storage engine, but the MVCC part is largely the same. The issues with vacuuming are largely oversta

Re: Purely declarative FKs

2023-10-16 Thread Christophe Pettus
> On Oct 16, 2023, at 00:51, Thiemo Kellner wrote: > Question: Are there plans to provide a feature in PostgreSQL that one can > have foreign keys for purely documentation purpose - I know, one could use a > modelling tool and just not implement the FKs, but my reality is, there is > hardly

Re: PostgreSQL inheritance vs https://wiki.postgresql.org/wiki/Don%27t_Do_This

2023-10-23 Thread Christophe Pettus
> On Oct 23, 2023, at 04:45, Achilleas Mantzios - cloud > wrote: > I believe this text is false on too many accounts. So, what's the consensus > about Inheritance in PostgreSQL, I am going to give a talk on it in November > and I wouldn't like to advertise/promote/teach something that the co

Re: setting up streaming replication

2023-10-24 Thread Christophe Pettus
> On Oct 24, 2023, at 11:31, Brad White wrote: > Are you saying that once I get streaming replication set up, it quits working > when I reboot the servers once a week? Not unless the downtime is sufficiently long that the replica can't find the WAL information it needs. You can avoid this w

Re: Problem with CAST-ing - am I missing something?

2023-10-25 Thread Christophe Pettus
> On Oct 25, 2023, at 17:21, Pól Ua Laoínecháin wrote: > > SELECT (ts, te)::TSTZRANGE FROM test; That syntax doesn't mean what you probably think it does. (ts, te) defines a record type with two fields. PostgreSQL constructs that, and then attempts to apply the cast. There's no conversio

Re: purpose of an entry in pg_hba.conf file

2023-10-26 Thread Christophe Pettus
> On Oct 26, 2023, at 11:44, Atul Kumar wrote: > There is already one line to serve your stated purpose > local all alltrust > > > That's why I specifically raised this question for below from postgresql > experts > hostall all

Re: purpose of an entry in pg_hba.conf file

2023-10-26 Thread Christophe Pettus
> On Oct 26, 2023, at 11:53, Atul Kumar wrote: > > Please share the required link having such information in detail, It would be > more helpful to me. https://www.postgresql.org/docs/current/auth-pg-hba-conf.html

Re: Postgres limitation in user management

2023-11-04 Thread Christophe Pettus
> On Nov 2, 2023, at 23:26, Kar, Swapnil (TR Technology) > wrote: > We want Support users to have no SELECT or DML privilege but only ALTER TABLE > to perform any troubleshooting in the database. If a user has no ability to do SELECT or DML, they won't be able to "troubleshoot" the database

Re: Aren't regex_*() functions built-in?

2023-11-11 Thread Christophe Pettus
> On Nov 11, 2023, at 17:20, p...@pfortin.com wrote: > Actually, it's more eusbtle... I can make it work as "postgres"; but not > as a RO user (SELECT only): > An error occurred when executing the SQL command: > select * from a,b where regexp_replace(a.address,' ','','g') = > regexp_replace(b.

Re: Can user specification of a column value be required when querying a view ?

2023-11-20 Thread Christophe Pettus
> On Nov 20, 2023, at 13:41, David Gauthier wrote: > I want the users to be required to provide a value for ssn in the following > query... > "select * from huge_view where ssn = '106-91-9930' " > I never want them to query the view without specifying ssn. > It has to do with resources and pr

<    1   2   3   4   >