Re: [PATCH v1] pg_ls_tmpdir to show directories

2019-12-27 Thread Fabien COELHO
Hello Justin, Why not simply showing the files underneath their directories? /path/to/tmp/file1 /path/to/tmp/subdir1/file2 In which case probably showing the directory itself is not useful, and the is_dir column could be dropped? The names are expected to look like this: $ sudo find

PostgreSQL 12.1 patch for "private_modify" table creation option for data validation reinforcement

2019-12-27 Thread Abdul Yadi AH-2
As I have published on https://abdulyadi.wordpress.com/2019/12/26/reinforce-data-validation-prevent-direct-table-modification/, the patch is to have "private_modify" option in table creation. For example: CREATE TABLE mytable (id integer) WITH (private_modify=true); Having the option set, even

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread John Naylor
On Fri, Dec 27, 2019 at 9:16 PM David Fetter wrote: > On Fri, Dec 27, 2019 at 07:02:02PM -0500, John Naylor wrote: > > The lookup table case is less clear. Removing the shift results in > > assembly that looks more like the C code and is slower for me. The > > standard lookup table code uses some

Re: Allow WHEN in INSTEAD OF triggers

2019-12-27 Thread Tom Lane
David Fetter writes: > While noodling around with an upcoming patch to remove user-modifiable > RULEs, I noticed that WHEN conditions were disallowed from INSTEAD OF > triggers for no discernible reason. This patch removes that > restriction. This seems like a remarkably bad idea. The point of

Re: Allow WHEN in INSTEAD OF triggers

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-28, David Fetter wrote: > While noodling around with an upcoming patch to remove user-modifiable > RULEs, I noticed that WHEN conditions were disallowed from INSTEAD OF > triggers for no discernible reason. This patch removes that > restriction. If you want to remove the restriction,

Allow WHEN in INSTEAD OF triggers

2019-12-27 Thread David Fetter
Folks, While noodling around with an upcoming patch to remove user-modifiable RULEs, I noticed that WHEN conditions were disallowed from INSTEAD OF triggers for no discernible reason. This patch removes that restriction. I noticed that columns were also disallowed in INSTEAD OF triggers, but

Re: Server crash with Master-Slave configuration.

2019-12-27 Thread Robert Haas
On Wed, Dec 25, 2019 at 1:29 AM Prabhat Sahu wrote: > Thanks Michael for pointing it out, I have re-tested the scenario > with "--tablespace-mapping=OLDDIR=NEWDIR" option of pg_basebackup, and now > its working fine. > But I think, instead of the crash, a proper error message would be > better.

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread David Fetter
On Fri, Dec 27, 2019 at 07:02:02PM -0500, John Naylor wrote: > On Fri, Dec 27, 2019 at 11:05 AM Tom Lane wrote: > > > > John Naylor writes: > > > On Fri, Dec 27, 2019 at 9:54 AM Tom Lane wrote: > > >> ... but couldn't the > > >> right shift be elided in favor of changing the constant we > > >>

Re: Duplicate Workers entries in some EXPLAIN plans

2019-12-27 Thread Maciek Sakrejda
Done! Thanks!

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread John Naylor
On Fri, Dec 27, 2019 at 11:05 AM Tom Lane wrote: > > John Naylor writes: > > On Fri, Dec 27, 2019 at 9:54 AM Tom Lane wrote: > >> ... but couldn't the > >> right shift be elided in favor of changing the constant we > >> subtract clz's result from? Shifting off those bits separately > >> made

Re: Implementing Incremental View Maintenance

2019-12-27 Thread legrand legrand
Hello, Thank you for this patch. I have tried to use an other patch with yours: "Planning counters in pg_stat_statements (using pgss_store)" https://www.postgresql.org/message-id/CAOBaU_Y12bn0tOdN9RMBZn29bfYYH11b2CwKO1RO7dX9fQ3aZA%40mail.gmail.com setting

Re: Memory-Bounded Hash Aggregation

2019-12-27 Thread Jeff Davis
On Sat, 2019-12-14 at 18:32 +0100, Tomas Vondra wrote: > So I think we're not costing the batching properly / at all. Hi, I've attached a new patch that adds some basic costing for disk during hashagg. The accuracy is unfortunately not great, especially at smaller work_mem sizes and smaller

Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes

2019-12-27 Thread Tom Lane
Alvaro Herrera writes: > One minor thing I noticed is that if I enter > \copy t from '/tmp/t' > and I have files /tmp/t and /tmp/tst then it removes the ending quote. Yeah, that bothered me too. [ pokes at it for a bit... ] The quote_file_name function isn't passed enough info to handle this

Re: weird libpq GSSAPI comment

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-27, Stephen Frost wrote: > Maybe part of the confusion here is that there's two different things- a > credential cache, and then a credential *handle*. Calling > gss_acquire_cred() will, if a credential *cache* exists, return to us a > credential *handle* (in the form of conn->gcred)

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Stephen Frost
Greetings, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > * Tom Lane (t...@sss.pgh.pa.us) wrote: > >> Still, I take your point that "peer" does risk letting in a set of > >> connections wider than what the DBA was thinking about. Enlarging > >> on my other response that what

Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-27, Tom Lane wrote: > I wrote: > > [ psql-filename-completion-fixes-2.patch ] > > The cfbot noted this was broken by the removal of pg_config.h.win32, > so here's a new version rebased over that. No changes other than > adjusting the MSVC autoconf-substitute code. Works well for

Re: [PATCH v1] pg_ls_tmpdir to show directories

2019-12-27 Thread Justin Pryzby
On Fri, Dec 27, 2019 at 06:50:24PM +0100, Fabien COELHO wrote: > >On Fri, Dec 27, 2019 at 05:22:47PM +0100, Fabien COELHO wrote: > >>The implementation simply extends an existing functions with a boolean to > >>allow for sub-directories. However, the function does not seem to show > >>subdir

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Stephen Frost
Greetings, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > * Tom Lane (t...@sss.pgh.pa.us) wrote: > >> But ... if "peer" auth allowed all the cases Peter wants to allow, > >> we'd not be having this discussion in the first place, would we? > > > I'm still not entirely

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> Still, I take your point that "peer" does risk letting in a set of >> connections wider than what the DBA was thinking about. Enlarging >> on my other response that what we want is an auth option not a whole >> new auth type,

Re: weird libpq GSSAPI comment

2019-12-27 Thread Stephen Frost
Greetings, (I've added Robbie to this thread, so he can correct me if/when I go wrong in my descriptions regarding the depths of GSSAPI ;) * Alvaro Herrera (alvhe...@2ndquadrant.com) wrote: > I found this comment in fe-connect.c: > > /* > * If GSSAPI is enabled

Re: xact_start for walsender & logical decoding not updated

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-13, Kyotaro Horiguchi wrote: > At Fri, 13 Dec 2019 13:05:41 +0800, Craig Ringer > wrote in > > On Wed, 11 Dec 2019 at 02:08, Alvaro Herrera > > wrote: > > > > > On 2019-Dec-10, Tomas Vondra wrote: > > > > > > > On Tue, Dec 10, 2019 at 09:42:17AM +0900, Kyotaro Horiguchi wrote: >

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> But ... if "peer" auth allowed all the cases Peter wants to allow, >> we'd not be having this discussion in the first place, would we? > I'm still not entirely convinced it doesn't, but that's also because I > keep thinking we're

Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes

2019-12-27 Thread Tom Lane
I wrote: > [ psql-filename-completion-fixes-2.patch ] The cfbot noted this was broken by the removal of pg_config.h.win32, so here's a new version rebased over that. No changes other than adjusting the MSVC autoconf-substitute code. regards, tom lane diff --git

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Stephen Frost
Greetings, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Peter Eisentraut writes: > > Well, if this is the pg_hba.conf setup and I am considering the > > authentication method when creating new users, then my only safe option > > is to not create any new users. Because which OS users exist is not

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Stephen Frost
Greetings, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > Why not have a special user that can be used for Type: local pg_hba.conf > > lines? So you'd have: > > local all localowner peer > > That way you're: > > a) only keeping the types we have today > > b) using peer auth,

Re: Improvement to psql's connection defaults

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-16, Daniel Gustafsson wrote: > On 16 Dec 2019, at 15:47, Alvaro Herrera wrote: > > > Please, where did you find this "form"? > > It seems to be from the wiki: > > https://wiki.postgresql.org/wiki/Submitting_a_Patch#Patch_submission OK, I made a few edits there and in other

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Tom Lane
Peter Eisentraut writes: > Well, if this is the pg_hba.conf setup and I am considering the > authentication method when creating new users, then my only safe option > is to not create any new users. Because which OS users exist is not > controlled by the DBA. If the OS admin and the DBA are

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Tom Lane
Stephen Frost writes: > Why not have a special user that can be used for Type: local pg_hba.conf > lines? So you'd have: > local all localowner peer > That way you're: > a) only keeping the types we have today > b) using peer auth, which is what this actually is > c) NOT using 'trust', which we

Re: [PATCH v1] pg_ls_tmpdir to show directories

2019-12-27 Thread Fabien COELHO
Re-added -hackers. Indeed, I left it out by accident. I tried to bounce the original mail but it did not work. Thanks for reviewing. On Fri, Dec 27, 2019 at 05:22:47PM +0100, Fabien COELHO wrote: The implementation simply extends an existing functions with a boolean to allow for

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Stephen Frost
Greetings, * Peter Eisentraut (peter.eisentr...@2ndquadrant.com) wrote: > On 2019-12-18 16:24, Stephen Frost wrote: > >Which represents pretty much exactly what you're going for here, doesn't > >it..? > > This is similar but not exactly the same thing: (1) It doesn't work if the > OS user name

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Stephen Frost
Greetings, * Peter Eisentraut (peter.eisentr...@2ndquadrant.com) wrote: > On 2019-12-18 15:09, Robert Haas wrote: > >I feel like this is taking a policy decision that properly belongs in > >pg_hba.conf and making it into a GUC. If you're introducing a GUC > >because it's not possible to configure

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Peter Eisentraut
On 2019-12-18 16:24, Stephen Frost wrote: As for the question about how to set up pg_hba.conf so that just the DB owner can log in via peer, the Debian/Ubuntu packages are deployed, by default, with an explicit message and entry: # DO NOT DISABLE! # If you change this first entry you will need

Re: Allow cluster owner to bypass authentication

2019-12-27 Thread Peter Eisentraut
On 2019-12-18 15:09, Robert Haas wrote: I feel like this is taking a policy decision that properly belongs in pg_hba.conf and making it into a GUC. If you're introducing a GUC because it's not possible to configure the behavior that you want in pg_hba.conf, then I think the solution to that is

aggregate crash

2019-12-27 Thread Teodor Sigaev
Hi! Found crash on production instance, assert-enabled build crashes in pfree() call, with default config. v11, v12 and head are affected, but, seems, you need to be a bit lucky. The bug is comparing old and new aggregate pass-by-ref values only by pointer value itself, despite on null

Re: [PATCH v1] pg_ls_tmpdir to show directories

2019-12-27 Thread Justin Pryzby
Re-added -hackers. Thanks for reviewing. On Fri, Dec 27, 2019 at 05:22:47PM +0100, Fabien COELHO wrote: > The implementation simply extends an existing functions with a boolean to > allow for sub-directories. However, the function does not seem to show > subdir contents recursively. Should it be

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread Tom Lane
Alvaro Herrera writes: > On 2019-Dec-27, Tom Lane wrote: >> ... Perhaps what we really ought to be working on is >> finding MSVC equivalents for __builtin_clz and friends. > Apparently clz() can be written using _BitScanReverse(), per > https://stackoverflow.com/a/20468180 >

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread David Fetter
On Fri, Dec 27, 2019 at 01:29:47PM -0300, Alvaro Herrera wrote: > On 2019-Dec-27, Tom Lane wrote: > > > This kind of leads me to wonder if we don't need to expend more > > effort on the non-CLZ version of pg_leftmost_one_pos32; it seems > > like it shouldn't be losing this badly to the

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-27, Tom Lane wrote: > This kind of leads me to wonder if we don't need to expend more > effort on the non-CLZ version of pg_leftmost_one_pos32; it seems > like it shouldn't be losing this badly to the only-slightly- > improved logic that's currently in AllocSetFreeIndex. On the >

Remove libpq.rc, use win32ver.rc for libpq

2019-12-27 Thread Peter Eisentraut
I was wondering why we have a separate libpq.rc for libpq and use win32ver.rc for all other components. I suspect this is also a leftover from the now-removed client-only Windows build. With a bit of tweaking we can use win32ver.rc for libpq as well and remove a bit of duplicative code. I

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread Tom Lane
John Naylor writes: > On Fri, Dec 27, 2019 at 9:54 AM Tom Lane wrote: >> ... but couldn't the >> right shift be elided in favor of changing the constant we >> subtract clz's result from? Shifting off those bits separately >> made sense in the old implementation, but assuming that CLZ is >> more

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread John Naylor
On Fri, Dec 27, 2019 at 9:54 AM Tom Lane wrote: > > Anyway, getting back to the presented patch, I find myself a bit > dissatisfied with it because it seems like it's leaving something > on the table. Specifically, looking at the generated assembly > code on a couple of architectures, the setup

Re: Reorderbuffer crash during recovery

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-27, vignesh C wrote: > I felt amit solution also solves the problem. Attached patch has the > fix based on the solution proposed. > Thoughts? This seems a sensible fix to me, though I didn't try to reproduce the failure. > @@ -2472,6 +2457,7 @@

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread Tom Lane
Alvaro Herrera writes: > On 2019-Dec-26, John Naylor wrote: >> In commit ab5b4e2f9ed, we optimized AllocSetFreeIndex() using a lookup >> table. At the time, using CLZ was rejected because compiler/platform >> support was not widespread enough to justify it. For other reasons, we >> recently added

Re: use CLZ instruction in AllocSetFreeIndex()

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-26, John Naylor wrote: > In commit ab5b4e2f9ed, we optimized AllocSetFreeIndex() using a lookup > table. At the time, using CLZ was rejected because compiler/platform > support was not widespread enough to justify it. For other reasons, we > recently added bitutils.h which uses

Re: Libpq support to connect to standby server as priority

2019-12-27 Thread Alvaro Herrera
On 2019-Dec-27, tsunakawa.ta...@fujitsu.com wrote: > From: Alvaro Herrera > > I'm not sure I understand why we end up with "prefer-read" in addition > > to "prefer-standby" (and similar seeming redundancy between "primary" > > and "read-write"). Do we really need more than one way to identify >

Re: Calling PLpgSQL function with composite type fails with an error: "ERROR: could not open relation with OID ..."

2019-12-27 Thread Ashutosh Sharma
On Fri, Dec 27, 2019 at 9:20 AM Tom Lane wrote: > > Ashutosh Sharma writes: > > Okay. Thanks for that fix. You've basically forced > > revalidate_rectypeid() to update the PLpgSQL_rec's rectypeid > > irrespective of typcache entry requires re-validation or not. > > Right. The assignment is

Re: doc: vacuum full, fillfactor, and "extra space"

2019-12-27 Thread Fabien COELHO
Hello Justin, I started writing this patch to avoid the possibly-misleading phrase: "with no extra space" (since it's expected to typically take ~2x space, or 1x "extra" space). But the original phrase "with no extra space" seems to be wrong anyway, since it actually follows fillfactor, so

Re: Expose lock group leader pid in pg_stat_activity

2019-12-27 Thread Julien Rouhaud
On Fri, Dec 27, 2019 at 10:01 AM Sergei Kornilov wrote: > > Hello > > > As I understand it, lock group is some infrastructure that is used by > > parallel queries, but could be used for something else too. So if > > more documentation is needed, we should say something like "For now, > > only

Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema

2019-12-27 Thread Michael Paquier
On Fri, Dec 27, 2019 at 12:33:03AM +0530, Mahendra Singh wrote: > On Thu, 26 Dec 2019 at 23:21, Tom Lane wrote: >> No, we can't, because the particular temp namespace used by a given >> session isn't stable. And I'd prefer keep the name of the namespace in the error message, because the

Re: Expose lock group leader pid in pg_stat_activity

2019-12-27 Thread Sergei Kornilov
Hello > As I understand it, lock group is some infrastructure that is used by > parallel queries, but could be used for something else too. So if > more documentation is needed, we should say something like "For now, > only parallel queries can have a lock group" or something like that. If

RE: problem with read-only user

2019-12-27 Thread ROS Didier
Hi Tom Thanks for your answer. Actually, you're right, the tables, the sequences are created by the user kidsdpn03 and another read-only role (kidsdpn03_ro) must interrogate these objects. So every time the kidsdpn03 role creates a new table, the kidsdpn03_ro role will

Re: Reorderbuffer crash during recovery

2019-12-27 Thread vignesh C
On Tue, Dec 17, 2019 at 2:32 PM Amit Kapila wrote: > > On Wed, Dec 11, 2019 at 11:13 AM vignesh C wrote: > > > > > > It sets the final_lsn here so that it can iterate from the start_lsn > > to final_lsn and cleanup the serialized files in > > ReorderBufferRestoreCleanup function. One solution We