Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Gabriele Bartolini
Hi Magnus, On Fri, 8 Sept 2023 at 23:43, Magnus Hagander wrote: > +1. And to make that happen, the appropriate thing is to identify > *why* they are using superuser today, and focus efforts on finding > ways for them to do that without being superuser. > As I am explaining in the other post (co

Add pg_basetype() function to obtain a DOMAIN base type

2023-09-08 Thread Steve Chavez
Hello hackers, Currently obtaining the base type of a domain involves a somewhat long recursive query. Consider: ``` create domain mytext as text; create domain mytext_child_1 as mytext; create domain mytext_child_2 as mytext_child_1; ``` To get `mytext_child_2` base type we can do: ``` WITH RE

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

2023-09-08 Thread Amit Kapila
On Fri, Sep 8, 2023 at 6:36 PM Hayato Kuroda (Fujitsu) wrote: > > > 2. Why get_old_cluster_logical_slot_infos() need to use > > pg_malloc_array whereas for similar stuff get_rel_infos() use > > pg_malloc()? > > They did a same thing. I used pg_malloc_array() macro to keep the code > within 80 col

Re: Correct the documentation for work_mem

2023-09-08 Thread Imseih (AWS), Sami
> This looks mostly fine to me modulo "sort or hash". I do see many > instances of "and/or" in the docs. Maybe that would work better. "sort or hash operations at the same time" is clear explanation IMO. This latest version of the patch looks good to me. Regards, Sami

Re: Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases

2023-09-08 Thread Masahiko Sawada
On Thu, Sep 7, 2023 at 10:22 PM Masahiko Sawada wrote: > > On Tue, Sep 5, 2023 at 11:32 AM Zhijie Hou (Fujitsu) > wrote: > > > > On Monday, September 4, 2023 10:42 PM Masahiko Sawada > > wrote: > > > > Hi, > > > > > On Mon, Sep 4, 2023 at 9:38 PM Zhijie Hou (Fujitsu) > > > > > > wrote: > > >

Re: [PATCH] Add inline comments to the pg_hba_file_rules view

2023-09-08 Thread David Zhang
This is a very useful feature. I applied the patch to the master branch, and both make check and make check-world passed without any issues. Just one comment here, based on the example below, host db jim 127.0.0.1/32 md5 # #foo# ... it returns the following pg_hba_file_rules records: pos

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Álvaro Hernández
On 7/9/23 21:51, Gabriele Bartolini wrote: Hi everyone, I would like to propose a patch that allows administrators to disable `ALTER SYSTEM` via either a runt-time option to pass to the Postgres server process at startup (e.g. `--disable-alter-system=true`, false by default) or a new GUC (o

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Magnus Hagander
On Fri, Sep 8, 2023 at 5:31 PM Tom Lane wrote: > > Alvaro Herrera writes: > > I don't understand Tom's resistance to this request. > > It's false security. If you think you are going to prevent a superuser > from messing with the system's configuration, you are going to need a > lot more restric

Re: Row pattern recognition

2023-09-08 Thread Vik Fearing
On 9/8/23 21:27, Jacob Champion wrote: On 9/7/23 20:54, Tatsuo Ishii wrote: But it's easy to come up with a pattern where that's the wrong order, like PATTERN ( A+ (B|A)+ ) Now "aaa" will be considered before "aab", which isn't correct. Can you explain a little bit more? I think 'aaa'

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Gabriele Bartolini
Hi Tom and Alvaro, On Fri, 8 Sept 2023 at 17:31, Tom Lane wrote: > Alvaro Herrera writes: > > I don't understand Tom's resistance to this request. > > It's false security. If you think you are going to prevent a superuser > from messing with the system's configuration, you are going to need a

Re: Avoid a possible null pointer (src/backend/utils/adt/pg_locale.c)

2023-09-08 Thread Jeff Davis
On Fri, 2023-09-08 at 15:24 +0900, Michael Paquier wrote: > Looking closer, there is much more inconsistency in this file > depending on the routine called.  How about something like the v2 > attached instead to provide more context in the error message about > the function called?  Let's say, when

Re: lockup in parallel hash join on dikkop (freebsd 14.0-current)

2023-09-08 Thread Thomas Munro
On Sat, Sep 9, 2023 at 7:00 AM Alexander Lakhin wrote: > It takes less than 10 minutes on average for me. I checked > REL_12_STABLE, REL_13_STABLE, and REL_14_STABLE (with HAVE_KQUEUE undefined > forcefully) — they all are affected. > I could not reproduce the lockup on my Ubuntu box (with HAVE_SY

Re: Row pattern recognition

2023-09-08 Thread Jacob Champion
On 9/7/23 20:54, Tatsuo Ishii wrote: >> DEFINE >> A AS PREV(CLASSIFIER()) IS DISTINCT FROM 'A', >> ... > > But: > > UP AS price > PREV(price) > > also depends on previous row, no? PREV(CLASSIFIER()) depends not on the value of the previous row but the state of the match so far.

Re: proposal: psql: show current user in prompt

2023-09-08 Thread Pavel Stehule
Hi Another thing that should be described there is that this falls > outside of the transaction flow, i.e. it's changes are not reverted on > ROLLBACK. But that leaves an important consideration: What happens > when an error occurs on the server during handling of this message > (e.g. the GUC does

Re: proposal: psql: show current user in prompt

2023-09-08 Thread Pavel Stehule
út 5. 9. 2023 v 13:29 odesílatel Jelte Fennema napsal: > On Tue, 5 Sept 2023 at 05:50, Pavel Stehule > wrote: > > > I prefer to introduce a new function - it is ten lines of code. The form > is not important - it can be a full number or minor number. It doesn't > matter I think. But my opinion i

Re: lockup in parallel hash join on dikkop (freebsd 14.0-current)

2023-09-08 Thread Alexander Lakhin
Hello, 03.09.2023 00:00, Alexander Lakhin wrote: I'll try to test this guess on the target machine... I got access to dikkop thanks to Tomas Vondra, and started reproducing the issue. It was rather difficult to catch the lockup as Tomas and Tom noticed before. I tried to use stress-ng to affe

Re: Document that server will start even if it's unable to open some TCP/IP ports

2023-09-08 Thread Nathan Bossart
On Fri, Sep 08, 2023 at 10:52:10AM -0400, Bruce Momjian wrote: > On Thu, Sep 7, 2023 at 09:21:07PM -0700, Nathan Bossart wrote: >> On Thu, Sep 07, 2023 at 07:13:44PM -0400, Bruce Momjian wrote: >> > On Thu, Sep 7, 2023 at 02:54:13PM -0700, Nathan Bossart wrote: >> >> IMO the phrase "open a port"

Re: Adding a pg_get_owned_sequence function?

2023-09-08 Thread Nathan Bossart
On Fri, Sep 08, 2023 at 10:56:15AM -0400, Stephen Frost wrote: > If we're going to actually mark it deprecated then it should be, at > least, a yearly discussion about removing it. I'm generally more in > favor of either just keeping it, or just removing it, though. We've had > very little succes

Re: SQL:2011 application time

2023-09-08 Thread Paul A Jungwirth
On Fri, Sep 8, 2023 at 2:35 AM jian he wrote: > > hi. > the following script makes the server crash (Segmentation fault). > [snip] > > ALTER TABLE temporal_fk_rng2rng > ADD CONSTRAINT temporal_fk_rng2rng_fk > FOREIGN KEY (parent_id, PERIOD valid_at) > REFERENCES temporal_rng > on update se

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Tom Lane
Alvaro Herrera writes: > I don't understand Tom's resistance to this request. It's false security. If you think you are going to prevent a superuser from messing with the system's configuration, you are going to need a lot more restrictions than this, and we'll be forever getting security report

Re: Eliminate redundant tuple visibility check in vacuum

2023-09-08 Thread Robert Haas
On Thu, Sep 7, 2023 at 6:23 PM Melanie Plageman wrote: > I mostly wanted to remove the NULL checks because I found them > distracting (so, a stylistic complaint). However, upon further > reflection, I actually think it is better if heap_page_prune_opt() > passes NULL. heap_page_prune() has no erro

Re: Adding a pg_get_owned_sequence function?

2023-09-08 Thread Stephen Frost
Greetings, * Nathan Bossart (nathandboss...@gmail.com) wrote: > On Fri, Sep 01, 2023 at 01:31:43PM -0400, Tom Lane wrote: > > Nathan Bossart writes: > >> I wonder if it'd be possible to just remove pg_get_serial_sequence(). > > > > A quick search at http://codesearch.debian.net/ finds uses of it

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Alvaro Herrera
On 2023-Sep-08, Gabriele Bartolini wrote: > That is the point I highlighted in the initial post in the thread. We could > make it readonly, but the returned error is misleading and definitely poor > UX: > > ``` > postgres=# ALTER SYSTEM SET wal_level TO minimal; > ERROR: could not open file "pos

Re: Document that server will start even if it's unable to open some TCP/IP ports

2023-09-08 Thread Bruce Momjian
On Thu, Sep 7, 2023 at 09:21:07PM -0700, Nathan Bossart wrote: > On Thu, Sep 07, 2023 at 07:13:44PM -0400, Bruce Momjian wrote: > > On Thu, Sep 7, 2023 at 02:54:13PM -0700, Nathan Bossart wrote: > >> IMO the phrase "open a port" is kind of nonstandard. I think we should say > >> something along

FDW pushdown of non-collated functions

2023-09-08 Thread Jean-Christophe Arnu
Dear hackers, I recently found a weird behaviour involving FDW (postgres_fdw) and planning. Here’s a simplified use-case: Given a remote table (say on server2) with the following definition: CREATE TABLE t1( ts timestamp without time zone, x bigint, x2 text ); --Then populate t1 table:IN

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Gabriele Bartolini
Hi Isaac, On Fri, 8 Sept 2023 at 16:11, Isaac Morland wrote: > Alternate idea, not sure how good this is: Use existing OS security > features (regular permissions, or more modern features such as the > immutable attribute) to mark the postgresql.auto.conf file as not being > writeable. Then any

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Isaac Morland
On Fri, 8 Sept 2023 at 10:03, Gabriele Bartolini < gabriele.bartol...@enterprisedb.com> wrote: > ALTER SYSTEM is already heavily restricted. > > > Could you please help me better understand what you mean here? > > >> I don't think we need random kluges added to the permissions system. > > > If yo

Re: [RFC] Add jit deform_counter

2023-09-08 Thread Dmitry Dolgov
> On Fri, Sep 08, 2023 at 03:34:42PM +0200, Daniel Gustafsson wrote: > > On 5 Sep 2023, at 16:37, Daniel Gustafsson wrote: > > > I've gone over this version of the patch and I think it's ready to go in. > > I'm > > marking this Ready for Committer and will go ahead with it shortly barring > > a

Re: [RFC] Add jit deform_counter

2023-09-08 Thread Daniel Gustafsson
> On 5 Sep 2023, at 16:37, Daniel Gustafsson wrote: > I've gone over this version of the patch and I think it's ready to go in. I'm > marking this Ready for Committer and will go ahead with it shortly barring any > objections. Pushed, after another round of review with some minor fixes. -- Dan

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

2023-09-08 Thread Hayato Kuroda (Fujitsu)
Dear Amit, > On Fri, Sep 8, 2023 at 2:12 PM Zhijie Hou (Fujitsu) > wrote: > > > > 2. > > > > + if (nslots_on_new) > > + { > > + if (nslots_on_new == 1) > > + pg_fatal("New cluster must not have logical > replication slots but found a slot."); > > +

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

2023-09-08 Thread Hayato Kuroda (Fujitsu)
Dear Amit, Thank you for reviewing! > Few comments: > = > 1. > > + All slots on the old cluster must be usable, i.e., there are no slots > + whose > +linkend="view-pg-replication-slots">pg_replication_slots. > wal_status > + is lost. > + > > Shall we

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

2023-09-08 Thread Hayato Kuroda (Fujitsu)
Dear Hou, Thank you for reviewing! PSA new version! PSA new version. > Here are some comments: > > 1. > > bool reap_child(bool wait_for_child); > + > +XLogRecPtr strtoLSN(const char *str, bool *have_error); > > This function has be removed. Removed. > 2. > > + if (nslots_on_n

Re: SLRUs in the main buffer pool - Page Header definitions

2023-09-08 Thread Stephen Frost
Greetings, * Robert Haas (robertmh...@gmail.com) wrote: > On Thu, Aug 24, 2023 at 3:28 PM Stephen Frost wrote: > > Agreed that we'd certainly want to make sure it's all correct and to do > > performance testing but in terms of how many buffers... isn't much of > > the point of this that we have d

Re: Using non-grouping-keys at HAVING clause

2023-09-08 Thread Kohei KaiGai
2023年9月8日(金) 19:07 Vik Fearing : > > On 9/8/23 09:42, Kohei KaiGai wrote: > > Hello, > > > > I got a trouble report here: > > https://github.com/heterodb/pg-strom/issues/636 > > > > It says that PG-Strom raised an error when the HAVING clause used > > non-grouping-keys, > > even though the vanilla

Re: Possibility to disable `ALTER SYSTEM`

2023-09-08 Thread Gabriele Bartolini
Hi Tom, On Thu, 7 Sept 2023 at 22:27, Tom Lane wrote: > Gabriele Bartolini writes: > > I would like to propose a patch that allows administrators to disable > > `ALTER SYSTEM` via either a runt-time option to pass to the Postgres > server > > process at startup (e.g. `--disable-alter-system=tru

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

2023-09-08 Thread Amit Kapila
On Fri, Sep 8, 2023 at 2:12 PM Zhijie Hou (Fujitsu) wrote: > > 2. > > + if (nslots_on_new) > + { > + if (nslots_on_new == 1) > + pg_fatal("New cluster must not have logical > replication slots but found a slot."); > + else > +

RE: Synchronizing slots from primary to standby

2023-09-08 Thread Hayato Kuroda (Fujitsu)
Dear Shveta, I resumed to check the thread. Here are my high-level comments. Sorry if you have been already discussed. 01. General I think the documentation can be added, not only GUCs. How about adding examples for combinations of physical and logical replications? You can say that both of phy

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

2023-09-08 Thread Amit Kapila
On Thu, Sep 7, 2023 at 5:54 PM Hayato Kuroda (Fujitsu) wrote: > > Thank you for reviewing! PSA new version. > Few comments: = 1. + All slots on the old cluster must be usable, i.e., there are no slots + whose + pg_replication_slots.wal_status + is lost. +

Re: Using non-grouping-keys at HAVING clause

2023-09-08 Thread Vik Fearing
On 9/8/23 09:42, Kohei KaiGai wrote: Hello, I got a trouble report here: https://github.com/heterodb/pg-strom/issues/636 It says that PG-Strom raised an error when the HAVING clause used non-grouping-keys, even though the vanilla PostgreSQL successfully processed the query. SELECT MAX(c0) FROM

Re: Support prepared statement invalidation when result types change

2023-09-08 Thread Jelte Fennema
Another similar issue was reported on the PgBouncer prepared statement PR[1]. It's related to an issue that was already reported on the mailinglist[2]. It turns out that invalidation of the argument types is also important in some cases. The newly added 3rd patch in this series addresses that issu

Reuse child_relids in try_partitionwise_join was Re: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)

2023-09-08 Thread Ashutosh Bapat
On Fri, Jul 28, 2023 at 3:16 PM Ashutosh Bapat wrote: > > Hi Tom, Richard, > > On Mon, Jul 24, 2023 at 8:17 AM Richard Guo wrote: > > > > Thanks for pushing it! > > With this fix, I saw a noticeable increase in the memory consumption > of planner. I was running experiments mentioned in [1] The re

Re: Add resource intensiveness as a reason to not running tests by default

2023-09-08 Thread Daniel Gustafsson
> On 7 Sep 2023, at 13:24, Daniel Gustafsson wrote: > >> On 7 Sep 2023, at 13:09, Nazir Bilal Yavuz wrote: > >> With f47ed79cc8, the test suite doesn't run 'wal_consistency_checking' >> as default because it is resource intensive; but regress docs doesn't >> state resource intensiveness as a re

Re: SQL:2011 application time

2023-09-08 Thread jian he
hi. the following script makes the server crash (Segmentation fault). create schema test; set search_path to test; DROP TABLE IF EXISTS temporal_rng; CREATE TABLE temporal_rng (id int4range, valid_at daterange); ALTER TABLE temporal_rng ADD CONSTRAINT temporal_rng_pk PRIMARY KEY (id, valid_at WIT

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

2023-09-08 Thread Zhijie Hou (Fujitsu)
On Thursday, September 7, 2023 8:24 PM Kuroda, Hayato/黒田 隼人 wrote: > > Dear Peter, > > Thank you for reviewing! PSA new version. Thanks for updating the patches ! Here are some comments: 1. bool reap_child(bool wait_for_child); + +XLogRecPtr strtoLSN(const char *str, bool *ha

Re: Build the docs if there are changes in docs and don't run other tasks if the changes are only in docs

2023-09-08 Thread Daniel Gustafsson
> On 7 Sep 2023, at 18:06, Nazir Bilal Yavuz wrote: > if the changes are only in the docs, don't run > all tasks except building the docs task; this could help to save more > CI times. A related idea for docs in order to save CI time: if the changes are only in internal docs, ie README files, th

RE: pg_ctl start may return 0 even if the postmaster has been already started on Windows

2023-09-08 Thread Hayato Kuroda (Fujitsu)
Dear Hoiguchi-san, Thank you for making the patch! > It doesn't seem to work as expected. We still lose the relationship > between the PID file and the launched postmaster. Yes, I did not expect that the relationship can be kept. Conceptually +1 for your approach. > > Ditching cmd.exe seems lik

Re: CHECK Constraint Deferrable

2023-09-08 Thread Dilip Kumar
On Thu, Sep 7, 2023 at 1:25 PM Himanshu Upadhyaya wrote: > > Attached is v2 of the patch, rebased against the latest HEAD. I have done some initial reviews, and here are my comments. More detailed review later. Meanwhile, you can work on these comments and fix all the cosmetics especially 80 ch

Re: Impact of checkpointer during pg_upgrade

2023-09-08 Thread Amit Kapila
On Fri, Sep 8, 2023 at 10:10 AM Michael Paquier wrote: > > On Fri, Sep 08, 2023 at 09:14:59AM +0530, Amit Kapila wrote: > > On Fri, Sep 8, 2023 at 9:00 AM Zhijie Hou (Fujitsu) > > wrote: > >>> I > >>> mean that doing the latter is benefitial for the sake of any patch > >>> committed and > >>> a

Using non-grouping-keys at HAVING clause

2023-09-08 Thread Kohei KaiGai
Hello, I got a trouble report here: https://github.com/heterodb/pg-strom/issues/636 It says that PG-Strom raised an error when the HAVING clause used non-grouping-keys, even though the vanilla PostgreSQL successfully processed the query. SELECT MAX(c0) FROM t0 GROUP BY t0.c1 HAVING t0.c0

Re: Oversight in reparameterize_path_by_child leading to executor crash

2023-09-08 Thread Ashutosh Bapat
On Thu, Aug 24, 2023 at 8:17 AM Richard Guo wrote: > > > On Thu, Aug 24, 2023 at 1:44 AM Tom Lane wrote: >> >> Richard Guo writes: >> > If we go with the "tablesample scans can't be reparameterized" approach >> > in the back branches, I'm a little concerned that what if we find more >> > cases i

Re: Eager page freeze criteria clarification

2023-09-08 Thread Andres Freund
Hi, On 2023-09-07 22:29:04 -0700, Peter Geoghegan wrote: > On Thu, Sep 7, 2023 at 9:45 PM Andres Freund wrote: > > I.e. setting an, otherwise unmodified, page all-visible won't trigger an FPI > > if checksums are disabled, but will FPI with checksums enabled. I think > > that's > > a substantial

Re: WL_SOCKET_ACCEPT fairness on Windows

2023-09-08 Thread Thomas Munro
I committed this for 17. It would be good to come up with something fundamentally better than this, to get rid of that 64 event limit nonsense, but I don't see it happening in the 17 cycle, and prefer the semantics with this commit in the meantime.