Re: altering a column's collation leaves an invalid foreign key

2024-10-24 Thread jian he
On Thu, Oct 17, 2024 at 7:14 PM Peter Eisentraut wrote: > > > So I took the v5 patch you had posted and started working from there. > The rule that you had picked isn't quite what we want, I think. It's > okay to have nondeterministic collations on foreign keys, as long as the > collation is the

Re: altering a column's collation leaves an invalid foreign key

2024-10-24 Thread jian he
> So for the moment this is a master-only patch. I think once we have > tied down the behavior we want for the future /* * ri_GenerateQualCollation --- add a COLLATE spec to a WHERE clause * - * At present, we intentionally do not use this function for RI queries that - * compare a variable

Re: Pgoutput not capturing the generated columns

2024-10-24 Thread Amit Kapila
On Thu, Oct 24, 2024 at 8:50 PM vignesh C wrote: > > The v42 version patch attached at [1] has the changes for the same. > Some more comments: 1. @@ -1017,7 +1089,31 @@ pgoutput_column_list_init(PGOutputData *data, List *publications, { ListCell *lc; bool first = true; + Bitmapset *relcol

Re: [PoC] Partition path cache

2024-10-24 Thread Andy Fan
Bykov Ivan writes: > Our customers use databases (1-10 TB) with big tables. Often these tables are > big and split on sections. For example, we have tables with almost > thousand sections. In most cases, those sections have a similar set of > indexes > and contain similar data. Often this par

Re: Changing the default random_page_cost value

2024-10-24 Thread Greg Sabino Mullane
On Mon, Oct 14, 2024 at 5:15 PM Bruce Momjian wrote: > I am not a fan of this patch. I don't see why _removing_ the magnetic > part helps because you then have no logic for any 1.2 was chosen. Okay, but we have no documented logic on why 4.0 was chosen either. :) I would put the magnetic in a

Re: [PoC] Federated Authn/z with OAUTHBEARER

2024-10-24 Thread Jacob Champion
On Fri, Oct 18, 2024 at 4:38 AM Daniel Gustafsson wrote: > In validate() it seems to me we should clear out ret->authn_id on failure to > pair belts with suspenders. Fixed by calling explicit_bzero on it in the error > path. The new hunk says: > cleanup: > /* > * Clear and free the vali

Re: Refactor to use common function 'get_publications_str'.

2024-10-24 Thread Michael Paquier
On Fri, Oct 25, 2024 at 09:28:47AM +1100, Peter Smith wrote: > I've attached the patch v4. Looks OK to me. Thanks. I'll see to get that done through the day. -- Michael signature.asc Description: PGP signature

Re: Add isolation test template in injection_points for wait/wakeup/detach

2024-10-24 Thread Michael Paquier
On Mon, Oct 21, 2024 at 11:13:59AM +0900, Michael Paquier wrote: > Used "basic" as test name at the end, tweaked the comment close to > what you have suggested, and applied the result. I have spotted a race condition with this test in some CF bot runs. Here are some of them: https://github.com/mic

Re: pgbench: Improve result outputs related to failed transactinos

2024-10-24 Thread Tatsuo Ishii
Hello Alexander, > Hello Tatsuo-san, > > 11.10.2024 07:54, Tatsuo Ishii wrote: > ... > - number of transactions actually pocessed: 1 (tps = 410.846343) > ... >> Patch pushed. > > Please consider fixing a typo sneaked in that commit: pocessed -> > processed? Thank you for the repor

RE: Conflict detection for update_deleted in logical replication

2024-10-24 Thread Hayato Kuroda (Fujitsu)
Dear Hou, > Here is the V5 patch set which addressed above comments. Thanks for updating the patch! While reviewing yours, I found a corner case that a recently deleted tuple cannot be detected when index scan is chosen. This can happen when indices are re-built during the replication. Unfortunat

Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails

2024-10-24 Thread Tender Wang
Alexander Lakhin 于2024年10月24日周四 22:00写道: > Hello Alvaro, > > 22.10.2024 17:32, Alvaro Herrera wrote: > > Yeah. I pushed these patches finally, thanks! > > Please look at a new anomaly introduced with 53af9491a. When running the > following script: > CREATE TABLE t (a int, b int, PRIMARY KEY (a,

cache lookup failed when \d t concurrent with DML change column data type

2024-10-24 Thread jian he
hi. I think I found a bug. PostgreSQL 18devel_debug_build_45188c2ea2 on x86_64-linux, compiled by gcc-14.1.0, 64-bit commit at 45188c2ea2. Ubuntu 22.04.4 LTS setup: drop table t cascade; create table t(a int PRIMARY key); IN session1: step "change data type" {begin; alter table t alter column a

Re: general purpose array_sort

2024-10-24 Thread Aleksander Alekseev
Hi, > I can accept this outcome though an optional three-valued boolean sort order > (ascending and descending only) I'd argue is worth keeping. null value > placement too I guess, three-valued boolean (nulls_first). Perhaps these optional arguments deserve separate discussions. I suggest merg

Re: Enhancing Memory Context Statistics Reporting

2024-10-24 Thread torikoshia
On 2024-10-24 14:59, Rahila Syed wrote: Hi Torikoshia, Thank you for reviewing the patch! On Wed, Oct 23, 2024 at 9:28 AM torikoshia wrote: On 2024-10-22 03:24, Rahila Syed wrote: Hi, PostgreSQL provides following capabilities for reporting memory contexts statistics. 1. pg_get_backend_mem

Re: cache lookup failed when \d t concurrent with DML change column data type

2024-10-24 Thread Andrei Lepikhov
On 10/24/24 22:30, jian he wrote: hi. I think I found a bug. PostgreSQL 18devel_debug_build_45188c2ea2 on x86_64-linux, compiled by gcc-14.1.0, 64-bit commit at 45188c2ea2. Ubuntu 22.04.4 LTS setup: drop table t cascade; create table t(a int PRIMARY key); IN session1: step "change data type" {

Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails

2024-10-24 Thread Tender Wang
Alexander Lakhin 于2024年10月24日周四 22:00写道: > Hello Alvaro, > > 22.10.2024 17:32, Alvaro Herrera wrote: > > Yeah. I pushed these patches finally, thanks! > > Please look at a new anomaly introduced with 53af9491a. When running the > following script: > CREATE TABLE t (a int, b int, PRIMARY KEY (a,

Useless field ispartitioned in CreateStmtContext

2024-10-24 Thread hugo
Hi!    When looking at the partition-related code, I found that the ispartitioned field in CreateStmtContext is not used. It looks like we can safely remove it and avoid invalid assignment logic. Here's a very simple fix, any suggestion? diff --git a/src/backend/parser/parse_utilc

Re: execute prepared statement passing parameter expression with COLLATE clause

2024-10-24 Thread Tender Wang
jian he 于2024年10月24日周四 16:56写道: > hi. > > $Subject setup > > CREATE COLLATION case_insensitive (provider = icu, locale = > '@colStrength=secondary', deterministic = false); > CREATE COLLATION ignore_accents (provider = icu, locale = > '@colStrength=primary;colCaseLevel=yes', deterministic = false

Re: Fix for consume_xids advancing XIDs incorrectly

2024-10-24 Thread Fujii Masao
On 2024/10/24 5:23, Masahiko Sawada wrote: if (xids_left > 2000 && consumed - last_reported_at < REPORT_INTERVAL && MyProc->subxidStatus.overflowed) { int64 consumed_by_shortcut = consume_xids_shortcut();

Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)

2024-10-24 Thread Tom Lane
In the no-good-deed-goes-unpunished department: buildfarm member hamerkop doesn't like this patch [1]. The diffs look like @@ -77,7 +77,7 @@ ERROR: syntax error at or near "FUNCTIN" LINE 1: CREATE FUNCTIN my_erroneous_func(int) RETURNS int LANGUAGE S... ^ -QUERY: CREATE FUNCTI

Re: Useless field ispartitioned in CreateStmtContext

2024-10-24 Thread Alena Rybakina
Hi! On 24.10.2024 16:07, hugo wrote: Hi!    When looking at the partition-related code, I found that the ispartitioned field in CreateStmtContext is not used. It looks like we can safely remove it and avoid invalid assignment logic. Here's a very simple fix, any suggestion? diff --

Re: execute prepared statement passing parameter expression with COLLATE clause

2024-10-24 Thread Tom Lane
jian he writes: > select * from pktable where x = 'Å' collate ignore_accents; > --return one row > execute q6('Å' collate ignore_accents); > --return zero rows > not sure return zero rows is desired. The parameter symbol just represents a value, which does not carry any collation information.

Re: general purpose array_sort

2024-10-24 Thread Tom Lane
"David G. Johnston" writes: > Composing function calls here seems quite undesirable from a performance > standpoint, but maybe I over-estimate the cost of > exploding-manipulating-freezing an array datum. Also, while I'm not in a > good position to judge the challenge of implementing the sort par

vacuumdb --analyze-only (e.g., after a major upgrade) vs. partitioned tables: pg_statistic missing stats for the partitioned table itself

2024-10-24 Thread Nikolay Samokhvalov
Nikolay Samokhvalov 2:47 PM (0 minutes ago) to pglsql-hackers I just learned that vacuumdb --analyze-only doesn't update stats for the partitioned table itself, taking care only about individual partitions: (DDL doesn't matter here) # vacuumdb --analyze-only -U postgres test --verbose ... INFO:

Re: Using read_stream in index vacuum

2024-10-24 Thread Rahila Syed
Hi Andrey, I ran the following test with v7-0001-Prototype-B-tree-vacuum-streamlineing.patch to measure the performance improvement. --Table size of approx 2GB (Fits in RAM) postgres=# create unlogged table x_big as select i from generate_series(1,6e7) i; SELECT 6000 postgres=# create index o

Re: Conflict detection for update_deleted in logical replication

2024-10-24 Thread Peter Smith
Hi Hou-san, here are my review comments for patch v5-0001. == General 1. Sometimes in the commit message and code comments the patch refers to "transaction id" and other times to "transaction ID". The patch should use the same wording everywhere. == Commit message. 2. "While for concurr

Re: Inconsistent use of relpages = -1

2024-10-24 Thread Laurenz Albe
On Thu, 2024-10-24 at 08:03 -0700, Jeff Davis wrote: > On Thu, 2024-10-24 at 05:01 +0300, Laurenz Albe wrote: > > What you write above indicates that "relpages" = 0 and "reltuples" > > > 0 > > would also be acceptable. > > As Tom pointed out, that creates a risk that it's interpreted as > infinite

Re: Commutation of array SOME/ANY and ALL operators

2024-10-24 Thread Matthew Morrissette Vance
> Inventing commutator operators for LIKE etc could be a path of > much less resistance (unless the operator names get bikeshedded > to death). Are there really that many that people need? > A quick query of pg_operator suggests that the LIKE/regex family > is the bulk of the problem for real-worl

Re: Can rs_cindex be < 0 for bitmap heap scans?

2024-10-24 Thread Melanie Plageman
Thanks for the reply, Dilip! On Thu, Oct 24, 2024 at 12:50 AM Dilip Kumar wrote: > > On Thu, Oct 24, 2024 at 3:45 AM Melanie Plageman > wrote: >> >> HeapScanDescData->rs_cindex (the current index into the array of >> visible tuples stored in the heap scan descriptor) is used for >> multiple sca

Re: Pgoutput not capturing the generated columns

2024-10-24 Thread Amit Kapila
On Thu, Oct 24, 2024 at 12:15 PM vignesh C wrote: > > The attached v41 version patch has the changes for the same. > Please find comments for the new version as follows: 1. + Generated columns may be skipped during logical replication according to the + CREATE PUBLICATION option +

Re: Add support to TLS 1.3 cipher suites and curves lists

2024-10-24 Thread Daniel Gustafsson
> On 16 Oct 2024, at 17:30, Jacob Champion > wrote: > Other than that, LGTM! Thanks for all the review work, I went ahead and pushed this patchseries today after a little bit more polishing of comments and docs. So far plover has failed which was expected due to the raised OpenSSL/LibreSSL req

Re: Using Expanded Objects other than Arrays from plpgsql

2024-10-24 Thread Tom Lane
I wrote: > ... I'm still writing up > details, but right now I'm envisioning completely separate sets of > rules for the prosupport case versus the no-prosupport case. So here is the design I've come up with for optimizing R/W expanded object updates in plpgsql without any special knowledge from a

Re: Inconsistent use of relpages = -1

2024-10-24 Thread Laurenz Albe
On Wed, 2024-10-23 at 10:05 -0700, Jeff Davis wrote: > On Wed, 2024-10-23 at 04:47 +0200, Laurenz Albe wrote: > > On Tue, 2024-10-22 at 10:41 -0700, Jeff Davis wrote: > > > I attached a patch that creates partitioned tables with relpages=- > > > 1, > > > and updates the docs. > > > > Does this nee

Re: general purpose array_sort

2024-10-24 Thread Aleksander Alekseev
Hi, > It's hardly "general purpose" if it randomly refuses to > sort certain types. I would say it should be able to sort > anything that ORDER BY will handle --- and that certainly > includes the cases shown here. I wonder how useful / convenient the new function will be considering that we alr

Re: general purpose array_sort

2024-10-24 Thread Aleksander Alekseev
Hi David, >> > It's hardly "general purpose" if it randomly refuses to >> > sort certain types. I would say it should be able to sort >> > anything that ORDER BY will handle --- and that certainly >> > includes the cases shown here. >> >> I wonder how useful / convenient the new function will be

Re: Changing the default random_page_cost value

2024-10-24 Thread David Rowley
On Fri, 25 Oct 2024 at 13:14, Greg Sabino Mullane wrote: > > On Mon, Oct 14, 2024 at 10:20 PM David Rowley wrote: >> >> Yeah, I think any effort to change the default value for this setting would >> require some analysis to prove that the newly proposed default >> is a more suitable setting than

Re: POC: make mxidoff 64 bits

2024-10-24 Thread wenhui qiu
HI Maxim Orlov > After a bit of thought, I've realized that to be conservative here is the way to go. >We can reuse a maximum of existing logic. I mean, we can remove offset wraparound "error logic" and reuse "warning logic". But set the threshold for "warning >logic" to a much higher value. For no

Re: Changing the default random_page_cost value

2024-10-24 Thread wenhui qiu
HI Greg Sabino Mullane Another thing is that you simply change the configuration template is not effective, need to modify the DEFAULT_RANDOM_PAGE_COST values { {"random_page_cost", PGC_USERSET, QUERY_TUNING_COST, gettext_noop("Sets the planner's estimate of the cost of a " "nonsequentially fe

Re: Changing the default random_page_cost value

2024-10-24 Thread Greg Sabino Mullane
On Mon, Oct 14, 2024 at 10:20 PM David Rowley wrote: > Yeah, I think any effort to change the default value for this setting > would require some analysis to prove that the newly proposed default > is a more suitable setting than the current default. I mean, why 1.2 and > not 1.1 or 1.3? Where's

Re: Missing installation of Kerberos.pm and AdjustUpgrade.pm

2024-10-24 Thread Michael Paquier
On Thu, Oct 24, 2024 at 02:51:05PM +0900, Michael Paquier wrote: > While catching up with some other thing, I've been reminded that this > has not been addressed. Any objections if I were to apply the > attached to add install and uninstall rules for Kerberos.pm and > AdjustUpgrade.pm? > > If peo

Re: pgbench: Improve result outputs related to failed transactinos

2024-10-24 Thread Alexander Lakhin
Hello Tatsuo-san, 11.10.2024 07:54, Tatsuo Ishii wrote: ... - number of transactions actually pocessed: 1 (tps = 410.846343) ... Patch pushed. Please consider fixing a typo sneaked in that commit: pocessed -> processed? Best regards, Alexander

Re: Refactor to use common function 'get_publications_str'.

2024-10-24 Thread Peter Smith
On Fri, Oct 25, 2024 at 10:00 AM Michael Paquier wrote: > > On Fri, Oct 25, 2024 at 09:28:47AM +1100, Peter Smith wrote: > > I've attached the patch v4. > > Looks OK to me. Thanks. I'll see to get that done through the day. > -- Thanks for pushing! == Kind Regards, Peter Smith. Fujitsu Aus

Re: proposal: schema variables

2024-10-24 Thread Pavel Stehule
st 23. 10. 2024 v 6:11 odesílatel Laurenz Albe napsal: > I have gone over patch 3 from the set and worked on the comments. > > Apart from that, I have modified your patch as follows: > > > +/* > > + * pg_session_variables - designed for testing > > + * > > + * This is a function designed for test

Re: Docs Build in CI failing with "failed to load external entity"

2024-10-24 Thread Thomas Munro
On Fri, Oct 25, 2024 at 4:44 AM Tom Lane wrote: > Melanie Plageman writes: > > I know in the past docs builds failing with "failed to load external > > entity" have happened on macos. But, recently I've noticed this > > failure for docs build on CI (not on macos) -- docs build is one of > > the j

Re: Retire support for OpenSSL 1.1.1 due to raised API requirements

2024-10-24 Thread Daniel Gustafsson
This has now been committed via the TLS 1.3 ciphersuite patchset. -- Daniel Gustafsson

Re: Docs Build in CI failing with "failed to load external entity"

2024-10-24 Thread Tom Lane
Melanie Plageman writes: > I know in the past docs builds failing with "failed to load external > entity" have happened on macos. But, recently I've noticed this > failure for docs build on CI (not on macos) -- docs build is one of > the jobs run under the "Compiler Warnings" task. It looks to me

Re: Wrong results with grouping sets

2024-10-24 Thread Richard Guo
On Thu, Oct 10, 2024 at 6:51 PM Richard Guo wrote: > On Thu, Oct 10, 2024 at 4:06 PM Richard Guo wrote: > > While we can fix this issue by propagating the hasGroupRTE mark from > > the EXISTS subquery to the parent, a better fix might be to remove the > > subquery's RTE_GROUP entry, since we have

Re: Can rs_cindex be < 0 for bitmap heap scans?

2024-10-24 Thread Dilip Kumar
On Thu, Oct 24, 2024 at 7:11 PM Melanie Plageman wrote: > Thanks for the reply, Dilip! > > On Thu, Oct 24, 2024 at 12:50 AM Dilip Kumar > wrote: > > > > On Thu, Oct 24, 2024 at 3:45 AM Melanie Plageman < > melanieplage...@gmail.com> wrote: > >> > >> HeapScanDescData->rs_cindex (the current index

Re: cache lookup failed when \d t concurrent with DML change column data type

2024-10-24 Thread Andrei Lepikhov
On 10/25/24 10:05, Andrei Lepikhov wrote: On 10/24/24 22:30, jian he wrote: hi. I think I found a bug. PostgreSQL 18devel_debug_build_45188c2ea2 on x86_64-linux, compiled by gcc-14.1.0, 64-bit commit at 45188c2ea2. Ubuntu 22.04.4 LTS setup: drop table t cascade; create table t(a int PRIMARY ke

Re: Retire support for OpenSSL 1.1.1 due to raised API requirements

2024-10-24 Thread Michael Paquier
On Thu, Oct 24, 2024 at 07:00:52PM +0200, Daniel Gustafsson wrote: > This has now been committed via the TLS 1.3 ciphersuite patchset. Nice, thanks for 6c66b7443ceb! -- Michael signature.asc Description: PGP signature

execute prepared statement passing parameter expression with COLLATE clause

2024-10-24 Thread jian he
hi. $Subject setup CREATE COLLATION case_insensitive (provider = icu, locale = '@colStrength=secondary', deterministic = false); CREATE COLLATION ignore_accents (provider = icu, locale = '@colStrength=primary;colCaseLevel=yes', deterministic = false); DROP TABLE IF EXISTS pktable cascade; CREATE

Re: proposal: schema variables

2024-10-24 Thread Laurenz Albe
... and here is a review for patch 4 I didn't change any code, just added the odd article to a comment. While running the regression tests with "make installcheck", I noticed two problems: --- /home/laurenz/postgresql/src/test/regress/expected/session_variables.out 2024-10-24 11:14:06.717

Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.

2024-10-24 Thread Tender Wang
Amit Langote 于2024年10月24日周四 14:33写道: > Hi, > > On Thu, Oct 24, 2024 at 1:46 PM Tender Wang wrote: > > Tender Wang 于2024年10月23日周三 21:48写道: > >> > >> Hi all, > >> > >> I find another issue as $SUBJECT when I work on [1]. > > > > When I continue to work on this, I find below issue. But I'm not sur

Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL

2024-10-24 Thread Michael Paquier
On Thu, Oct 24, 2024 at 09:41:03AM +0300, Joel Jacobson wrote: > Therefore closing this patch and marking it as Committed. Thanks. I have managed to miss the CF entry. -- Michael signature.asc Description: PGP signature

Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.

2024-10-24 Thread Amit Langote
Hi, On Thu, Oct 24, 2024 at 1:46 PM Tender Wang wrote: > Tender Wang 于2024年10月23日周三 21:48写道: >> >> Hi all, >> >> I find another issue as $SUBJECT when I work on [1]. > > When I continue to work on this, I find below issue. But I'm not sure whether > it is a bug. > > postgres=# create table part

Re: Pgoutput not capturing the generated columns

2024-10-24 Thread Amit Kapila
On Wed, Oct 23, 2024 at 11:51 AM Amit Kapila wrote: > > Thanks. One more thing that I didn't like about the patch is that it > used column_list to address the "publish_generated_columns = false" > case such that we build column_list without generated columns for the > same. The first problem is th

Typo spotted in GetFileBackupMethod comment(?)

2024-10-24 Thread Haoran Zhang
Hey Robert, I'm investigating how PostgresQL 17 does incremental backup and find this comment of GetFileBackupMethod a bit off. relative_block_numbers being an array of at *most* RELSEG_SIZE makes more sense to me. So I made this patch to address it. Note that this is the first time I made a patc

Re: Using read_stream in index vacuum

2024-10-24 Thread Andrey M. Borodin
I've also added GiST vacuum to the patchset. > On 24 Oct 2024, at 01:04, Melanie Plageman wrote: > > On Wed, Oct 23, 2024 at 4:29 PM Andrey M. Borodin > wrote: >> >>> On 23 Oct 2024, at 20:57, Andrey M. Borodin wrote: >>> >>> I'll think how to restructure flow there... >> >> OK, I've under

Re: Enhancing Memory Context Statistics Reporting

2024-10-24 Thread Rahila Syed
Hi Torikoshia, Thank you for reviewing the patch! On Wed, Oct 23, 2024 at 9:28 AM torikoshia wrote: > On 2024-10-22 03:24, Rahila Syed wrote: > > Hi, > > > > PostgreSQL provides following capabilities for reporting memory > > contexts statistics. > > 1. pg_get_backend_memory_contexts(); [1] > >

Re: Can rs_cindex be < 0 for bitmap heap scans?

2024-10-24 Thread Dilip Kumar
On Thu, Oct 24, 2024 at 3:45 AM Melanie Plageman wrote: > Hi, > > HeapScanDescData->rs_cindex (the current index into the array of > visible tuples stored in the heap scan descriptor) is used for > multiple scan types, but for bitmap heap scans, AFAICT, it should > never be < 0. > > As such, I fi

Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL

2024-10-24 Thread Joel Jacobson
On Sat, Oct 19, 2024, at 09:52, Joel Jacobson wrote: > However, since my last email, I've found some other problems in this area, > and think we should do a more ambitious improvement, by rearranging the > incorrect options tests into three categories: > > 1. incorrect COPY {FROM|TO} options > 2. i

Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.

2024-10-24 Thread Tender Wang
Tender Wang 于2024年10月23日周三 21:48写道: > Hi all, > > I find another issue as $SUBJECT when I work on [1]. > When I continue to work on this, I find below issue. But I'm not sure whether it is a bug. postgres=# create table part_index(a text primary key) partition by list ( a collate "POSIX"); ERRO

Re: Using Expanded Objects other than Arrays from plpgsql

2024-10-24 Thread Tom Lane
Michel Pelletier writes: > On Wed, Oct 23, 2024 at 8:21 AM Tom Lane wrote: >> Another thing that confuses me is why there's a second flatten_matrix >> operation happening here. Shouldn't set_element return its result >> as a R/W expanded object? > That confuses me too, and my default assumption