Re: Pre-proposal: unicode normalized text

2023-10-10 Thread Peter Eisentraut
On 11.10.23 03:08, Jeff Davis wrote: * unicode_is_valid(text): returns true if all codepoints are assigned, false otherwise We need to be careful about precise terminology. "Valid" has a defined meaning for Unicode. A byte sequence can be valid or not as UTF-8. But a string containing u

Re: Pre-proposal: unicode normalized text

2023-10-10 Thread Peter Eisentraut
On 10.10.23 16:02, Robert Haas wrote: On Tue, Oct 10, 2023 at 2:44 AM Peter Eisentraut wrote: Can you restate what this is supposed to be for? This thread appears to have morphed from "let's normalize everything" to "let's check for unassigned code points", but I'm not sure what we are aiming

Add null termination to string received in parallel apply worker

2023-10-10 Thread Zhijie Hou (Fujitsu)
Hi, The parallel apply worker didn't add null termination to the string received from the leader apply worker via the shared memory queue. This action doesn't bring bugs as it's binary data but violates the rule established in StringInfo, which guarantees the presence of a terminating '\0' at the

Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag

2023-10-10 Thread Drouvot, Bertrand
Hi, On 10/11/23 5:40 AM, Michael Paquier wrote: On Wed, Oct 11, 2023 at 08:26:42AM +0900, Michael Paquier wrote: /* flags for InitPostgres() */ #define INIT_PG_LOAD_SESSION_LIBS 0x0001 #define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002 +#define INIT_PG_BYPASS_ROLE_LOGIN 0x0004 In 00

Re: [PoC] run SQL over ciphertext

2023-10-10 Thread Peter Eisentraut
On 10.10.23 08:42, Mingyu Li wrote: We have developed an extension, allowing PostgreSQL to run queries over encrypted data. This functionality is achieved via user-defined functions that extend encrypted data types and support commonly used expression operations. Our tests validated its effecti

Re: CREATE DATABASE with filesystem cloning

2023-10-10 Thread Peter Eisentraut
On 07.10.23 07:51, Thomas Munro wrote: Here is an experimental POC of fast/cheap database cloning. Here are some previous discussions of this: https://www.postgresql.org/message-id/flat/20131001223108.GG23410%40saarenmaa.fi https://www.postgresql.org/message-id/flat/511B5D11.4040507%40socials

Re: Doc: Minor update for enable_partitionwise_aggregate

2023-10-10 Thread David Rowley
On Wed, 11 Oct 2023 at 16:26, Andrew Atkinson wrote: > > Thank you for the feedback and clarifications Ashutosh. How about this? > > "which allows grouping or aggregation on partitioned tables to be performed > separately for each partition." This looks good to me. I can take care of this. Davi

Re: remaining sql/json patches

2023-10-10 Thread Amit Langote
Hi Andres, On Sat, Oct 7, 2023 at 6:49 AM Andres Freund wrote: > Hi, > > On 2023-09-29 13:57:46 +0900, Amit Langote wrote: > > Thanks. I will push the attached 0001 shortly. > > Sorry for not looking at this earlier. Thanks for the review. Replying here only to your comments on 0001. > Have y

Re: SQL:2011 application time

2023-10-10 Thread Paul Jungwirth
On 9/25/23 14:00, Peter Eisentraut wrote: Looking through the tests in v16-0001: +-- PK with no columns just WITHOUT OVERLAPS: +CREATE TABLE temporal_rng ( +   valid_at tsrange, +   CONSTRAINT temporal_rng_pk PRIMARY KEY (valid_at WITHOUT OVERLAPS) +); +ERROR:  syntax error at or near "W

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Peter Geoghegan
On Tue, Oct 10, 2023 at 8:51 PM Peter Geoghegan wrote: > I don't see any reason to delay committing your fix. The issue that > you've highlighted is exactly the kind of issue that I anticipated > might happen at some point. This seems straightforward. BTW, we don't need to recommend the heapallin

Re: SQL:2011 application time

2023-10-10 Thread Paul Jungwirth
Hi Peter et al, On 9/1/23 12:56, Paul Jungwirth wrote: On 9/1/23 11:30, Peter Eisentraut wrote: I think the WITHOUT OVERLAPS clause should be per-column, so that something like UNIQUE (a WITHOUT OVERLAPS, b, c WITHOUT OVERLAPS) would be possible.  Then the WITHOUT OVERLAPS clause would directl

Re: stopgap fix for signal handling during restore_command

2023-10-10 Thread Michael Paquier
On Tue, Oct 10, 2023 at 08:39:29PM -0700, Andres Freund wrote: > We shouldn't call proc_exit() in a signal handler. We perhaps have a few > remaining calls left, but we should (and I think in some cases are) working on > removing those. Hmm. I don't recall anything remaining, even after a quick c

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Peter Geoghegan
On Tue, Oct 10, 2023 at 8:29 PM Noah Misch wrote: > My friend got an amcheck "lacks matching index tuple" failure, and they asked > me about it. I ran into the assertion failure while reproducing things. Reminds me of the time that amcheck found a bug in the default btree opclass for PostGIS's g

Re: Removing unneeded self joins

2023-10-10 Thread Andrei Lepikhov
On 11/10/2023 02:29, Alena Rybakina wrote: I have reviewed your patch and I noticed a few things. Thanks for your efforts, I have looked at the latest version of the code, I assume that the error lies in the replace_varno_walker function, especially in the place where we check the node by ty

Re: Problem, partition pruning for prepared statement with IS NULL clause.

2023-10-10 Thread tender wang
For hash partition table, if partition key is IS NULL clause, the condition in if in get_steps_using_prefix_recurse: if (cur_keyno < step_lastkeyno - 1) is not enough. Like the decode crashed case, explain select * from hp where a = 1 and b is null and c = 1; prefix list just has a = 1 clause. I

Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag

2023-10-10 Thread Michael Paquier
On Wed, Oct 11, 2023 at 08:26:42AM +0900, Michael Paquier wrote: > On Tue, Oct 10, 2023 at 09:12:49AM +0200, Drouvot, Bertrand wrote: > > On 10/10/23 7:58 AM, Michael Paquier wrote: > >> I was looking at v8 just before you sent this v9, and still got > >> annoyed by the extra boolean argument added

Re: REL_15_STABLE: pgbench tests randomly failing on CI, Windows only

2023-10-10 Thread Noah Misch
On Sun, Oct 08, 2023 at 10:00:03PM -0700, David G. Johnston wrote: > On Sun, Oct 8, 2023 at 9:10 PM Noah Misch wrote: > > I didn't think of any phrasing that clearly explained things without the > > reader consulting the code. I considered these: I'm leaning toward: "socket file descriptor ou

Re: stopgap fix for signal handling during restore_command

2023-10-10 Thread Andres Freund
Hi, On 2023-10-10 22:29:34 -0500, Nathan Bossart wrote: > On Tue, Oct 10, 2023 at 09:54:18PM -0500, Nathan Bossart wrote: > > On Tue, Oct 10, 2023 at 04:40:28PM -0700, Andres Freund wrote: > >> I'd make these elog(PANIC), I think. The paths are not performance critical > >> enough that a single br

Re: stopgap fix for signal handling during restore_command

2023-10-10 Thread Nathan Bossart
On Tue, Oct 10, 2023 at 09:54:18PM -0500, Nathan Bossart wrote: > On Tue, Oct 10, 2023 at 04:40:28PM -0700, Andres Freund wrote: >> I'd make these elog(PANIC), I think. The paths are not performance critical >> enough that a single branch hurts, so the overhead of the check is >> irrelevant, >> an

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Noah Misch
On Tue, Oct 10, 2023 at 08:12:36PM -0700, Peter Geoghegan wrote: > On Tue, Oct 10, 2023 at 6:33 PM Noah Misch wrote: > > interval_ops, however, recognizes equal-but-distinguishable values: > > > Fails with: > > > > 2498151 2023-10-10 05:06:46.177 GMT DEBUG: building index "ti" on table > > "t

Re: Doc: Minor update for enable_partitionwise_aggregate

2023-10-10 Thread Andrew Atkinson
Thank you for the feedback and clarifications Ashutosh. How about this? "which allows grouping or aggregation on partitioned tables to be performed separately for each partition." Attached a v2 patch file with this change. Here is a gist w/ a partitioned table and 2 partitions, comparing executi

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Peter Geoghegan
On Tue, Oct 10, 2023 at 6:33 PM Noah Misch wrote: > interval_ops, however, recognizes equal-but-distinguishable values: > Fails with: > > 2498151 2023-10-10 05:06:46.177 GMT DEBUG: building index "ti" on table > "t" serially > 2498151 2023-10-10 05:06:46.178 GMT DEBUG: index "ti" can safel

Re: stopgap fix for signal handling during restore_command

2023-10-10 Thread Nathan Bossart
On Tue, Oct 10, 2023 at 04:40:28PM -0700, Andres Freund wrote: > On 2023-03-01 14:47:51 -0800, Nathan Bossart wrote: >> diff --git a/src/backend/storage/lmgr/proc.c >> b/src/backend/storage/lmgr/proc.c >> index 22b4278610..b9e2c3aafe 100644 >> --- a/src/backend/storage/lmgr/proc.c >> +++ b/src/bac

Re: Fix typo in psql zh_CN.po

2023-10-10 Thread Tom Lane
Richard Guo writes: > On Wed, Oct 11, 2023 at 4:30 AM jinser wrote: >> I found a typo here while using psql. I think this should be a trivial >> patch. >> The typo is that there is an extra `l` before `列出所有事件触发器`. > +1. FYI, we have a slightly odd process around this: PG's translated messages a

Re: Problem, partition pruning for prepared statement with IS NULL clause.

2023-10-10 Thread David Rowley
On Tue, 10 Oct 2023 at 21:31, Sergei Glukhov wrote: > create table hp (a int, b text, c int, d int) >partition by hash (a part_test_int4_ops, b part_test_text_ops, c > part_test_int4_ops); > create table hp0 partition of hp for values with (modulus 4, remainder 0); > create table hp3 partition

Re: Lowering the default wal_blocksize to 4K

2023-10-10 Thread Andres Freund
Hi, On 2023-10-11 14:39:12 +1300, Thomas Munro wrote: > On Wed, Oct 11, 2023 at 12:29 PM Andres Freund wrote: > > On 2023-10-10 21:30:44 +0200, Matthias van de Meent wrote: > > > On Tue, 10 Oct 2023 at 06:14, Andres Freund wrote: > > > > I was thinking we should perhaps do the opposite, namely g

Re: Retire has_multiple_baserels()

2023-10-10 Thread Richard Guo
On Wed, Oct 11, 2023 at 1:13 AM Tom Lane wrote: > I thought this test wasn't too complete, because has_multiple_baserels > isn't reached at all in many cases thanks to the way the calling if() > is coded. I tried testing like this instead: > > diff --git a/src/backend/optimizer/path/allpaths.c >

Re: Fix typo in psql zh_CN.po

2023-10-10 Thread Richard Guo
On Wed, Oct 11, 2023 at 4:30 AM jinser wrote: > Hi, > I found a typo here while using psql. I think this should be a trivial > patch. > The typo is that there is an extra `l` before `列出所有事件触发器`. +1. Thanks Richard

Re: Lowering the default wal_blocksize to 4K

2023-10-10 Thread Thomas Munro
On Wed, Oct 11, 2023 at 12:29 PM Andres Freund wrote: > On 2023-10-10 21:30:44 +0200, Matthias van de Meent wrote: > > On Tue, 10 Oct 2023 at 06:14, Andres Freund wrote: > > > I was thinking we should perhaps do the opposite, namely getting rid of > > > short > > > page headers. The overhead in

interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Noah Misch
The btequalimage() header comment says: * Generic "equalimage" support function. * * B-Tree operator classes whose equality function could safely be replaced by * datum_image_eq() in all cases can use this as their "equalimage" support * function. interval_ops, however, recognizes equal-but-

Re: broken master regress tests

2023-10-10 Thread Andres Freund
Hi, On 2023-10-10 17:08:25 -0700, Jeff Davis wrote: > On Mon, 2023-09-11 at 19:23 -0700, Andres Freund wrote: > > > So I think injecting --no-locale to the initdb line that creates > > > the > > > template is a better approach; something like the attached. > > > > Makes sense, thanks for taking c

Re: PGDOCS - add more links in the pub/sub reference pages

2023-10-10 Thread Peter Smith
On Tue, Oct 10, 2023 at 5:10 PM vignesh C wrote: > > Few more instances in other logical replication related pages: > 1) Another instance was in alter_subscription.sgml: > Fetch missing table information from publisher. This will start > replication of tables that were added to the su

Re: PGDOCS - add more links in the pub/sub reference pages

2023-10-10 Thread Peter Smith
On Tue, Oct 10, 2023 at 11:33 PM Amit Kapila wrote: > > On Tue, Oct 10, 2023 at 11:40 AM vignesh C wrote: > > > > On Tue, 10 Oct 2023 at 08:47, Peter Smith wrote: > > > PSA v3. > > > > Few more instances in other logical replication related pages: > > 1) Another instance was in alter_subscriptio

Re: broken master regress tests

2023-10-10 Thread Jeff Davis
On Mon, 2023-09-11 at 19:23 -0700, Andres Freund wrote: > > So I think injecting --no-locale to the initdb line that creates > > the > > template is a better approach; something like the attached. > > Makes sense, thanks for taking care of this. After this, it seems "make check" no longer picks u

Re: stopgap fix for signal handling during restore_command

2023-10-10 Thread Andres Freund
On 2023-03-01 14:47:51 -0800, Nathan Bossart wrote: > Subject: [PATCH v10 1/2] Move extra code out of the Pre/PostRestoreCommand() > block. LGTM > From fb6957da01f11b75d1a1966f32b00e2e77c789a0 Mon Sep 17 00:00:00 2001 > From: Nathan Bossart > Date: Tue, 14 Feb 2023 09:44:53 -0800 > Subject: [P

Re: [PATCH] hstore: Fix parsing on Mac OS X: isspace() is locale specific

2023-10-10 Thread Michael Paquier
On Tue, Oct 10, 2023 at 10:51:10AM -0400, Evan Jones wrote: > Here is a quick demonstration of this issue, showing that the quoting > behavior is different between these two. Mac OS X with the "default" locale > includes quotes because ą includes 0x85 in its UTF-8 encoding: Ugh. rowtypes.c has r

Re: Lowering the default wal_blocksize to 4K

2023-10-10 Thread Andres Freund
Hi, On 2023-10-10 21:30:44 +0200, Matthias van de Meent wrote: > On Tue, 10 Oct 2023 at 06:14, Andres Freund wrote: > > On 2023-10-09 23:16:30 -0400, Tom Lane wrote: > >> Andres Freund writes: > >>> There's an alternative approach we could take, which is to write in 4KB > >>> increments, while k

Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag

2023-10-10 Thread Michael Paquier
On Tue, Oct 10, 2023 at 09:12:49AM +0200, Drouvot, Bertrand wrote: > On 10/10/23 7:58 AM, Michael Paquier wrote: >> I was looking at v8 just before you sent this v9, and still got >> annoyed by the extra boolean argument added to InitPostgres(). > > Arf, I did not look at it as I had in mind to lo

Re: FDW pushdown of non-collated functions

2023-10-10 Thread Jean-Christophe Arnu
Hi Ashutosh, Le ven. 6 oct. 2023 à 14:16, Ashutosh Bapat a écrit : > Hi Jean-Christophe, > > On Fri, Sep 8, 2023 at 11:30 PM Jean-Christophe Arnu > wrote: > > > > Maybe we could add another condition to the first if statement in order > to allow a “no-collation” function to be pushed down even

Re: Transaction timeout

2023-10-10 Thread Nikolay Samokhvalov
On Wed, Sep 6, 2023 at 1:16 AM Fujii Masao wrote: > With the v4 patch, I found that timeout errors no longer occur during the > idle in > transaction phase. Instead, they occur when the next statement is executed. > Is this > the intended behavior? I thought some users might want to use the tran

Re: The danger of deleting backup_label

2023-10-10 Thread David Steele
On 9/28/23 22:30, Michael Paquier wrote: On Thu, Sep 28, 2023 at 05:14:22PM -0400, David Steele wrote: Recovery worked perfectly as long as backup_label was present and failed hard when it was not: LOG: invalid primary checkpoint record PANIC: could not locate a valid checkpoint record It's

Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges

2023-10-10 Thread Tom Lane
Tommy Pavlicek writes: > I did notice one further potential bug. When creating an operator and > adding a commutator, PostgreSQL only links the commutator back to the > operator if the commutator has no commutator of its own, but the > create operation succeeds regardless of whether this linkage h

Fix typo in psql zh_CN.po

2023-10-10 Thread jinser
Hi, I found a typo here while using psql. I think this should be a trivial patch. The typo is that there is an extra `l` before `列出所有事件触发器`. -- regards, Jinser Kafak. 0001-Fix-typo-in-psql-zh_CN.po.patch Description: Binary data

Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges

2023-10-10 Thread Tommy Pavlicek
On Thu, Sep 28, 2023 at 9:18 PM Tom Lane wrote: > > Tommy Pavlicek writes: > > I've attached a new version of the ALTER OPERATOR patch that allows > > no-ops. It should be ready to review now. > > I got around to looking through this finally (sorry about the delay). > I'm mostly on board with the

Re: Is this a problem in GenericXLogFinish()?

2023-10-10 Thread Jeff Davis
I committed and backported 0001 (the GenericXLogFinish() fix but not the Assert). Strangely I didn't see the -committers email come through yet. If anyone notices anything wrong, please let me know before the final v11 release. On Thu, 2023-09-28 at 12:05 -0700, Jeff Davis wrote: > Also, I ran in

Re: Making aggregate deserialization (and WAL receive) functions slightly faster

2023-10-10 Thread Tom Lane
David Rowley writes: > I've attached a slightly more worked on patch that makes maxlen == 0 > mean read-only. Unsure if a macro is worthwhile there or not. A few thoughts: * initStringInfoFromStringWithLen() is kind of a mouthful. How about "initStringInfoWithBuf", or something like that? * lo

Re: Tab completion for ATTACH PARTITION

2023-10-10 Thread David Zhang
On 2023-09-13 12:19 a.m., Alvaro Herrera wrote: On 2023-Sep-13, bt23nguyent wrote: Hi, Currently, the psql's tab completion feature does not support properly for ATTACH PARTITION. When key is typed after "ALTER TABLE ATTACH PARTITION ", all possible table names should be displayed, however,

Re: On login trigger: take three

2023-10-10 Thread Alexander Korotkov
Hi, Robert! Thank you for your feedback. On Tue, Oct 10, 2023 at 5:51 PM Robert Haas wrote: > > On Mon, Oct 9, 2023 at 10:11 AM Alexander Korotkov > wrote: > > * Hold lock during setting of pg_database.dathasloginevt flag (v32 > > version actually didn't prevent race condition). > > So ... ho

Re: On login trigger: take three

2023-10-10 Thread Alexander Korotkov
Hi! Thank you for the review. On Tue, Oct 10, 2023 at 7:37 PM Andres Freund wrote: > On 2023-10-10 08:18:46 +0300, Alexander Korotkov wrote: > > @@ -968,7 +969,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) > > > > if (!get_db_info(dbtemplate, ShareLock, > >

Re: Lowering the default wal_blocksize to 4K

2023-10-10 Thread Matthias van de Meent
On Tue, 10 Oct 2023 at 06:14, Andres Freund wrote: > > Hi, > > On 2023-10-09 23:16:30 -0400, Tom Lane wrote: >> Andres Freund writes: >>> There's an alternative approach we could take, which is to write in 4KB >>> increments, while keeping 8KB pages. With the current format that's not >>> obvious

Re: Removing unneeded self joins

2023-10-10 Thread Alena Rybakina
Hi! I have reviewed your patch and I noticed a few things. First of all, I think I found a bug in your latest patch version, and this query shows it: EXPLAIN (COSTS OFF) SELECT c.oid, e.oid FROM pg_class c FULL JOIN (   SELECT e1.oid FROM pg_extension e1, pg_extension e2   WHERE e1.oid=e2.oid

Re: document the need to analyze partitioned tables

2023-10-10 Thread Bruce Momjian
On Fri, Oct 6, 2023 at 06:49:05PM +0200, Laurenz Albe wrote: > On Fri, 2023-10-06 at 12:20 -0400, Bruce Momjian wrote: > > Good points, updated patch attached. > > That patch is good to go, as far as I am concerned. Patch applied back to PG 11, thanks. -- Bruce Momjian https://momji

Re: New WAL record to detect the checkpoint redo location

2023-10-10 Thread Robert Haas
On Mon, Oct 9, 2023 at 4:47 PM Andres Freund wrote: > As noted in my email from a few minutes ago, I agree that optimizing this > shouldn't be a requirement for merging the patch. Here's a new patch set. I think I've incorporated the performance fixes that you've suggested so far into this versio

Re: Suggestion. Optional local ORDER BY clause for DISTINCT ON

2023-10-10 Thread Tom Lane
Stefan Stefanov writes: > Gents, I have a suggestion for DISTINCT ON clause syntax. >DISTINCT ON (expression(s) [ORDER BY expression(s)]) > Determines the precedence within each DISTINCT ON group (i.e. the ‘first’ row > to be picked) > Motivation > • Using the query-wide ORDER BY clause to

Re: Check each of base restriction clauses for constant-FALSE-or-NULL

2023-10-10 Thread Tom Lane
I wrote: > Also, if you compare that test case to the one immediately following > it, it's downright weird that we are presently smarter about > optimizing the more complicated case. (I've not dug into exactly > why that is; maybe worth running it to ground?) The reason seems to be that joinrels.

Re: Check each of base restriction clauses for constant-FALSE-or-NULL

2023-10-10 Thread Tom Lane
Richard Guo writes: > On Tue, Oct 10, 2023 at 5:10 PM David Rowley wrote: >> After making the change, I saw the same regression test change as you >> did, but didn't really feel like it was worth tackling separately from >> the patch that we were working on. > I was thinking that this change may

Suggestion. Optional local ORDER BY clause for DISTINCT ON

2023-10-10 Thread Stefan Stefanov
Gents, I have a suggestion for DISTINCT ON clause syntax. DISTINCT ON (expression(s) [ORDER BY expression(s)]) Determines the precedence within each DISTINCT ON group (i.e. the ‘first’ row to be picked) Motivation • Using the query-wide ORDER BY clause to determine which record to pick m

Re: Retire has_multiple_baserels()

2023-10-10 Thread Tom Lane
Aleksander Alekseev writes: >> The function has_multiple_baserels() is used in set_subquery_pathlist() >> to check and see if there are more than 1 base rel, by looping through >> simple_rel_array[]. I think one simpler way to do that is to leverage >> root->all_baserels by >> bms_membership

Re: On login trigger: take three

2023-10-10 Thread Andres Freund
Hi, On 2023-10-10 08:18:46 +0300, Alexander Korotkov wrote: > @@ -968,7 +969,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) > > if (!get_db_info(dbtemplate, ShareLock, >&src_dboid, &src_owner, &src_encoding, > -

Re: Fwd: Advice about preloaded libraries

2023-10-10 Thread Alvaro Herrera
On 2023-Oct-10, Esteban Zimanyi wrote: > As can be seen above, it is not REALLY mandatory to have > shared_preload_libraries = 'postgis-3' but then the user is responsible for > issuing a query to load PostGIS (select st_point(1,1); above) and then she > is able to execute MobilityDB queries. Cal

Re: [PATCH] hstore: Fix parsing on Mac OS X: isspace() is locale specific

2023-10-10 Thread Evan Jones
Thanks for bringing this up! I just looked at the uses if isspace() in that file. It looks like it is the usual thing: it is allowing leading or trailing whitespace when parsing values, or for this "needs quoting" logic on output. The fix would be the same: this *should* be using scanner_isspace. T

Re: On login trigger: take three

2023-10-10 Thread Robert Haas
On Mon, Oct 9, 2023 at 10:11 AM Alexander Korotkov wrote: > * Hold lock during setting of pg_database.dathasloginevt flag (v32 > version actually didn't prevent race condition). So ... how does getting this flag set actually work? And how does clearing it work? In the case of row-level security

Re: Request for comment on setting binary format output per session

2023-10-10 Thread Robert Haas
On Tue, Oct 10, 2023 at 10:30 AM Dave Cramer wrote: > Correct me if I am wrong, but the client has to request this. So I'm not sure > how we would be surprised ? Consider an application, a connection pooler, and a stored procedure or function on the server. If this is controlled by a GUC, any of

Re: Request for comment on setting binary format output per session

2023-10-10 Thread Robert Haas
On Mon, Oct 9, 2023 at 5:02 PM Jelte Fennema wrote: > Honestly I think the main difference is the need to introduce this > explicit protocol message. If we do, I think it might be best to have > this be a way of setting a GUC at the Protocol level, and expand the > GucContext enum to have a way to

Re: Request for comment on setting binary format output per session

2023-10-10 Thread Dave Cramer
On Tue, 10 Oct 2023 at 10:25, Robert Haas wrote: > On Mon, Oct 9, 2023 at 4:25 PM Jeff Davis wrote: > > Another thing to consider is that using a GUC for binary formats is a > > protocol change in a way that client_encoding is not. The existing > > documentation for the protocol already specifie

Re: Request for comment on setting binary format output per session

2023-10-10 Thread Robert Haas
On Mon, Oct 9, 2023 at 4:25 PM Jeff Davis wrote: > Another thing to consider is that using a GUC for binary formats is a > protocol change in a way that client_encoding is not. The existing > documentation for the protocol already specifies when binary formats > will be used, and a GUC would chang

Re: Comparing two double values method

2023-10-10 Thread Tom Lane
Heikki Linnakangas writes: > On 10/10/2023 13:31, Bowen Shi wrote: >> I noticed that in the `check_GUC_init` function, there is a direct >> comparison using the != operator for two double values, which seems >> problematic. > No, the compile-time initial values should match exactly. Right. The

Re: CHECK Constraint Deferrable

2023-10-10 Thread Robert Haas
On Mon, Oct 9, 2023 at 5:07 PM David G. Johnston wrote: >> 2. I don't think it's a good idea for the same patch to try to solve >> two problems unless they are so closely related that solving one >> without solving the other is not sensible. > > A NOT NULL constraint apparently is just a special c

Re: Pre-proposal: unicode normalized text

2023-10-10 Thread Robert Haas
On Tue, Oct 10, 2023 at 2:44 AM Peter Eisentraut wrote: > Can you restate what this is supposed to be for? This thread appears to > have morphed from "let's normalize everything" to "let's check for > unassigned code points", but I'm not sure what we are aiming for now. Jeff can say what he want

Re: RFC: Logging plan of the running query

2023-10-10 Thread torikoshia
On 2023-10-04 03:00, James Coleman wrote: and I think what we need to do is explicitly disallow running this code any time we are inside of lock acquisition code. Updated patch to check if any locks have already been acquired by examining MyProc->heldLocks. I'm not sure this change can "disa

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-10-10 Thread Amit Kapila
On Tue, Oct 10, 2023 at 4:51 PM Hayato Kuroda (Fujitsu) wrote: > > > > > Isn't it sufficient to add a test for silent mode in > > begin/stream_start/begin_prepare kind of APIs and set > > ctx->did_process? In all other APIs, we can assert that did_process > > shouldn't be set and we never reach th

Re: PGDOCS - add more links in the pub/sub reference pages

2023-10-10 Thread Amit Kapila
On Tue, Oct 10, 2023 at 11:40 AM vignesh C wrote: > > On Tue, 10 Oct 2023 at 08:47, Peter Smith wrote: > > PSA v3. > > Few more instances in other logical replication related pages: > 1) Another instance was in alter_subscription.sgml: > Fetch missing table information from publisher. This

Re: Request for comment on setting binary format output per session

2023-10-10 Thread Dave Cramer
On Mon, 9 Oct 2023 at 17:11, Jelte Fennema wrote: > On Mon, 9 Oct 2023 at 21:08, Dave Cramer wrote: > > So if we use . would it be possible to have something like > which represents a set of well known types? > > My goal here is to reduce the overhead of naming all the types the > client wants

Re: Comparing two double values method

2023-10-10 Thread Bowen Shi
You're right, I made a mistake. Thanks for your explanation.

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-10-10 Thread Hayato Kuroda (Fujitsu)
Dear Bharath, Thanks for giving comments and apologize for late reply. New version is available in [1]. > +1 for this approach. It looks neat. > > I think we also need to add TAP tests to generate decodable WAL > records (RUNNING_XACT, CHECKPOINT_ONLINE, XLOG_FPI_FOR_HINT, > XLOG_SWITCH, XLOG_PA

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-10-10 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for reviewing! You can available new version in [1]. > > Few comments: > 1) Should we add binary upgrade check "CHECK_IS_BINARY_UPGRADE" for > this funcion too: > +binary_upgrade_create_logical_replication_slot(PG_FUNCTION_ARGS) > +{ > + Namename = PG_GETA

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-10-10 Thread Hayato Kuroda (Fujitsu)
Dear Amit, Thank you for reviewing! PSA new version. > > Internally, I added a new decoding mode - DECODING_MODE_SILENT - and > used it. > > If the decoding context is in the mode, the output plugin is not loaded, but > > any WALs are decoded without skipping. > > > > I think it may be okay not

Re: Retire has_multiple_baserels()

2023-10-10 Thread Richard Guo
On Tue, Oct 10, 2023 at 5:43 PM Aleksander Alekseev < aleksan...@timescale.com> wrote: > I used the following patch to double check that nothing was missed: > > ``` > --- a/src/backend/optimizer/path/allpaths.c > +++ b/src/backend/optimizer/path/allpaths.c > @@ -2207,8 +2207,13 @@ has_multiple_bas

Re: Lowering the default wal_blocksize to 4K

2023-10-10 Thread Matthias van de Meent
On Tue, 10 Oct 2023 at 01:08, Andres Freund wrote: > > Hi, > > I've mentioned this to a few people before, but forgot to start an actual > thread. So here we go: > > I think we should lower the default wal_blocksize / XLOG_BLCKSZ to 4096, from > the current 8192. Seems like a good idea. > It's I

Re: Comparing two double values method

2023-10-10 Thread Heikki Linnakangas
On 10/10/2023 13:31, Bowen Shi wrote: Dears, I noticed that in the `check_GUC_init` function, there is a direct comparison using the != operator for two double values, which seems problematic. I wrote this patch to fix this. No, the compile-time initial values should match exactly. -- Heikki

Re: Comparing two double values method

2023-10-10 Thread Matthias van de Meent
On Tue, 10 Oct 2023 at 12:33, Bowen Shi wrote: > > Dears, > > I noticed that in the `check_GUC_init` function, there is a direct > comparison using the != operator for two double values, which seems > problematic. I don't think I understand the problem. The code checks that the dynamic initializa

Re: pg_resetwal: Corrections around -c option

2023-10-10 Thread Alvaro Herrera
On 2023-Oct-10, Peter Eisentraut wrote: > On 09.10.23 17:48, Alvaro Herrera wrote: > > Hmm, not sure about this. [...] > > Would those issues also apply to the other SLRU-based guides on this man > page? Are they all a bit wrong? I didn't verify, but I think it's likely that they do and they a

Re: Check each of base restriction clauses for constant-FALSE-or-NULL

2023-10-10 Thread Richard Guo
On Tue, Oct 10, 2023 at 5:10 PM David Rowley wrote: > On Sat, 7 Oct 2023 at 22:44, Richard Guo wrote: > > > > In relation_excluded_by_constraints() when we're trying to figure out > > whether the relation need not be scanned, one of the checks we do is to > > detect constant-FALSE-or-NULL restri

Re: Making aggregate deserialization (and WAL receive) functions slightly faster

2023-10-10 Thread vignesh C
On Mon, 9 Oct 2023 at 16:20, David Rowley wrote: > > On Mon, 9 Oct 2023 at 21:17, David Rowley wrote: > > Here are some more thoughts on how we could improve this: > > > > 1. Adjust the definition of StringInfoData.maxlen to define that -1 > > means the StringInfoData's buffer is externally manag

Comparing two double values method

2023-10-10 Thread Bowen Shi
Dears, I noticed that in the `check_GUC_init` function, there is a direct comparison using the != operator for two double values, which seems problematic. I wrote this patch to fix this. -- Regard, Bowen Shi v1-0001-Fix-double-value-compare-problem.patch Description: Binary data

Re: UUID v7

2023-10-10 Thread Brad Peabody
> > Well, as far as I know, RFC discourages extracting timestamps from UUIDs. > > But we still can have such functions...maybe as an extension? > Do you know of any reason for that? I guess some of the detail may have been edited out over time with all of the changes, but it’s basically this: h

Re: [PoC] run SQL over ciphertext

2023-10-10 Thread Giampaolo Capelli
Hello, I think this is a very interesting topic, especially for European companies where data sovereignty in the cloud has become critical. If I understand correctly, the idea is to split users into 'client users' who can see data unencrypted, and 'server users', who are administrators unable to d

Re: Advice about preloaded libraries

2023-10-10 Thread Aleksander Alekseev
Hi, > MobilityDB > https://github.com/MobilityDB/MobilityDB > is a PostgreSQL extension that depends on PosGIS. > > Bradford Boyle who has been working on packaging MobilityDB > https://www.postgresql.org/message-id/capqrbe716d3gpd0jdbafab72elajrppg1luzvobelnbgl3r...@mail.gmail.com > highlighted t

Re: Retire has_multiple_baserels()

2023-10-10 Thread Aleksander Alekseev
Hi, > The function has_multiple_baserels() is used in set_subquery_pathlist() > to check and see if there are more than 1 base rel, by looping through > simple_rel_array[]. I think one simpler way to do that is to leverage > root->all_baserels by > > bms_membership(root->all_baserels) == BMS_

Re: Add const to values and nulls arguments

2023-10-10 Thread Aleksander Alekseev
Hi, > >> The 0002 patch, which I'm not proposing to commit at this time, makes > >> similar changes but in a way that breaks the table and index AM APIs. > >> So I'm just including that here in case anyone wonders, why didn't you > >> touch those. And also maybe if we ever change that API incompa

Re: Check each of base restriction clauses for constant-FALSE-or-NULL

2023-10-10 Thread David Rowley
On Sat, 7 Oct 2023 at 22:44, Richard Guo wrote: > > In relation_excluded_by_constraints() when we're trying to figure out > whether the relation need not be scanned, one of the checks we do is to > detect constant-FALSE-or-NULL restriction clauses. Currently we perform > this check only when ther

Fwd: Advice about preloaded libraries

2023-10-10 Thread Esteban Zimanyi
MobilityDB https://github.com/MobilityDB/MobilityDB is a PostgreSQL extension that depends on PosGIS. Bradford Boyle who has been working on packaging MobilityDB https://www.postgresql.org/message-id/capqrbe716d3gpd0jdbafab72elajrppg1luzvobelnbgl3r...@mail.gmail.com highlighted the issue of which

Re: Use virtual tuple slot for Unique node

2023-10-10 Thread David Rowley
On Wed, 27 Sept 2023 at 20:01, David Rowley wrote: > > On Sat, 23 Sept 2023 at 03:15, Heikki Linnakangas wrote: > > So not a win in this case. Could you peek at the outer slot type, and > > use the same kind of slot for the Unique's result? Or some more > > complicated logic, like use a virtual s

Re: Check each of base restriction clauses for constant-FALSE-or-NULL

2023-10-10 Thread Richard Guo
On Tue, Oct 10, 2023 at 1:45 PM Ashutosh Bapat wrote: > On Tue, Oct 10, 2023 at 11:09 AM Richard Guo > wrote: > > Hm, I don't think so. get_gating_quals is called in createplan.c, where > > we've selected the best path, while the optimization with my code > > happens much earlier, when we set s

Re: Problem, partition pruning for prepared statement with IS NULL clause.

2023-10-10 Thread Sergei Glukhov
Hi David, On 10/9/23 03:26, David Rowley wrote: On Sat, 7 Oct 2023 at 03:11, Sergei Glukhov wrote: I noticed that combination of prepared statement with generic plan and 'IS NULL' clause could lead partition pruning to crash. Test case: -- set plan_cache_mode to force_generic_plan; prepar

Retire has_multiple_baserels()

2023-10-10 Thread Richard Guo
The function has_multiple_baserels() is used in set_subquery_pathlist() to check and see if there are more than 1 base rel, by looping through simple_rel_array[]. I think one simpler way to do that is to leverage root->all_baserels by bms_membership(root->all_baserels) == BMS_MULTIPLE all_ba

Re: Clean up some pg_dump tests

2023-10-10 Thread Peter Eisentraut
On 09.10.23 11:20, Alvaro Herrera wrote: I tried this out. I agree it's a good change. BTW, this made me realize that "unlike" is not a good name: maybe it should be called "except". right I would add quotes to the words "like" and "unlike" there. Otherwise, these sentences are hard to par

Re: Problem, partition pruning for prepared statement with IS NULL clause.

2023-10-10 Thread tender wang
The comment /* not needed for Consts */ may be more better close to if (!IsA(expr, Const)). Others look good to me. David Rowley 于2023年10月9日周一 07:28写道: > On Sat, 7 Oct 2023 at 03:11, Sergei Glukhov > wrote: > > I noticed that combination of prepared statement with generic plan and > > 'IS NUL

Re: Add annotation syntax to pg_hba.conf entries

2023-10-10 Thread Jim Jones
Hi Robert, Hi Tom, Thanks for the feedback! On 05.10.23 00:55, Tom Lane wrote: > Robert Haas writes: >> You're probably not going to like this answer very much, but this >> doesn't seem particularly worthwhile to me. > Yeah, I was unconvinced about the number of use-cases too. > As you say, some

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-10-10 Thread Amit Kapila
On Sat, Oct 7, 2023 at 3:46 AM Amit Kapila wrote: > > On Fri, Oct 6, 2023 at 6:30 PM Hayato Kuroda (Fujitsu) > > > > Based on that, I added another binary function > > binary_upgrade_create_logical_replication_slot(). > > This function is similar to pg_create_logical_replication_slot(), but the >

  1   2   >