Re: ANY_VALUE aggregate

2022-12-06 Thread David G. Johnston
On Mon, Dec 5, 2022 at 10:40 PM Vik Fearing wrote: > On 12/6/22 05:57, David G. Johnston wrote: > > On Mon, Dec 5, 2022 at 9:48 PM Vik Fearing > wrote: > > > >> I can imagine an optimization that would remove an ORDER BY clause > >> because it

Re: [DOCS] Stats views and functions not in order?

2022-12-06 Thread David G. Johnston
On Tue, Dec 6, 2022 at 6:36 PM Peter Smith wrote: > I'd like to "fix" this but IIUC there is no consensus yet about what > order is best for patch 0001, right? > > I'm planning on performing a more thorough review of 0003 and 0004 tomorrow. As for 0001 - go with Peter E.'s suggested ordering.

Re: ANY_VALUE aggregate

2022-12-05 Thread David G. Johnston
On Mon, Dec 5, 2022 at 7:57 AM Vik Fearing wrote: > The SQL:2023 Standard defines a new aggregate named ANY_VALUE. It > returns an implementation-dependent (i.e. non-deterministic) value from > the rows in its group. > > PFA an implementation of this aggregate. > > Can we please add

Re: GROUP BY ALL

2022-12-18 Thread David G. Johnston
On Sunday, December 18, 2022, Tom Lane wrote: > Andrey Borodin writes: > > I saw a thread in a social network[0] about GROUP BY ALL. The idea seems > useful. > > Isn't that just a nonstandard spelling of SELECT DISTINCT? > > What would happen if there are aggregate functions in the tlist? > I'm

Re: Ordering behavior for aggregates

2022-12-13 Thread David G. Johnston
On Tue, Dec 13, 2022 at 9:45 AM Ronan Dunklau wrote: > Le mardi 13 décembre 2022, 16:13:34 CET Tom Lane a écrit : > > Accordingly, I find nothing at all attractive in this proposal. > > I think the main thing it'd accomplish is to drive users back to > > the bad old days of ordering-by-subquery,

Re: plpgsq_plugin's stmt_end() is not called when an error is caught

2022-12-15 Thread David G. Johnston
On Thu, Dec 15, 2022 at 8:49 AM Tom Lane wrote: > Masahiko Sawada writes: > > I don't think we need additional PG_TRY() for that since exec_stmts() > > is already called in PG_TRY() if there is an exception block. I meant > > to call stmt_end() in PG_CATCH() in exec_stmt_block() (i.e. only when

Re: ANY_VALUE aggregate

2022-12-05 Thread David G. Johnston
On Mon, Dec 5, 2022 at 8:46 PM Vik Fearing wrote: > On 12/5/22 18:56, David G. Johnston wrote: > > Also, maybe we should have any_value do something like compute a 50/50 > > chance that any new value seen replaces the existing chosen value, > instead > > of simply retur

Re: ANY_VALUE aggregate

2022-12-05 Thread David G. Johnston
On Mon, Dec 5, 2022 at 9:48 PM Vik Fearing wrote: > On 12/6/22 05:22, David G. Johnston wrote: > > On Mon, Dec 5, 2022 at 8:46 PM Vik Fearing > wrote: > > > >> On 12/5/22 18:56, David G. Johnston wrote: > >>> Also, maybe we should have any_value do some

Re: Error-safe user functions

2022-12-07 Thread David G. Johnston
On Wed, Dec 7, 2022 at 8:23 AM Tom Lane wrote: > Andrew Dunstan writes: > > On 2022-12-07 We 09:20, Tom Lane wrote: > >> Returning to the naming quagmire -- it occurred to me just now that > >> it might be helpful to call this style of error reporting "soft" > >> errors rather than "safe"

Re: Error-safe user functions

2022-12-07 Thread David G. Johnston
On Wed, Dec 7, 2022 at 9:06 AM Tom Lane wrote: > "David G. Johnston" writes: > > Why not do away with two separate functions and define a composite type > > (boolean, text) for is_valid to return? > > I don't see any advantage to that. It would be harder to use

Re: ANY_VALUE aggregate

2022-12-07 Thread David G. Johnston
On Wed, Dec 7, 2022 at 1:58 AM Pantelis Theodosiou wrote: > On Tue, Dec 6, 2022 at 4:57 AM David G. Johnston > wrote: > ... > > > > > > I'm referring to the query: > > > > select any_value(v order by v) from (values (2),(1),(3)) as vals (v); > > //

Re: [PATCH] random_normal function

2022-12-08 Thread David G. Johnston
On Thu, Dec 8, 2022 at 2:53 PM Paul Ramsey wrote: > > random_normal(stddev float8 DEFAULT 1.0, mean float8 DEFAULT 0.0) > Any particular justification for placing stddev before mean? A brief survey seems to indicate other libraries, as well as (at least for me) learned convention, has the mean

Re: Error-safe user functions

2022-12-07 Thread David G. Johnston
On Wed, Dec 7, 2022 at 7:20 AM Tom Lane wrote: > > Returning to the naming quagmire -- it occurred to me just now that > it might be helpful to call this style of error reporting "soft" > errors rather than "safe" errors, which'd provide a nice contrast > with "hard" errors thrown by

Re: Error-safe user functions

2022-12-07 Thread David G. Johnston
On Wed, Dec 7, 2022 at 8:04 AM Andrew Dunstan wrote: > > On 2022-12-07 We 09:20, Tom Lane wrote: > > Andrew Dunstan writes: > >> Perhaps we should add a type in the regress library that will never have > >> a safe input function, so we can test that the mechanism works as > >> expected in that

Re: Document parameter count limit

2022-11-23 Thread David G. Johnston
On Wed, Nov 23, 2022 at 11:47 AM Tom Lane wrote: > Bruce Momjian writes: > > Does this come up enough to document it? I assume the error message the > > user receives is clear. > > Looks like you get > > if (nParams < 0 || nParams > PQ_QUERY_PARAM_MAX_LIMIT) > { >

Re: fixing CREATEROLE

2022-11-23 Thread David G. Johnston
On Wed, Nov 23, 2022 at 2:18 PM Robert Haas wrote: > On Wed, Nov 23, 2022 at 3:59 PM David G. Johnston > wrote: > > I haven't yet formed a complete thought here but is there any reason we > cannot convert the permission-like attributes to predefined roles? > > > >

Re: fixing CREATEROLE

2022-11-23 Thread David G. Johnston
On Wed, Nov 23, 2022 at 1:04 PM Robert Haas wrote: > > I'm not very certain about any of that stuff; I don't have a clear > mental model of how it should work, or even what exact problem we're > trying to solve. To me, the patches that I posted make sense as far as > they go, but I'm not under

Re: fixing CREATEROLE

2022-11-23 Thread David G. Johnston
On Wed, Nov 23, 2022 at 2:01 PM Robert Haas wrote: > In the latter case there are two, one with > > grantor=bootstrap_supeuser/admin_option=true/set_option=false/inherit_option=false > and a second with > grantor=alice/admin_option=false/set_option=true/inherit_option=true. > This, IMO, is

Re: Glossary and initdb definition work for "superuser" and database/cluster

2022-11-18 Thread David G. Johnston
On Fri, Nov 18, 2022 at 4:11 AM Alvaro Herrera wrote: > On 2022-Nov-02, David G. Johnston wrote: > > > Version 2 attached, some significant re-working. Starting to think that > > initdb isn't the place for some of this content - in particular the stuff > > I'm deciding t

Re: Understanding WAL - large amount of activity from removing data

2022-11-20 Thread David G. Johnston
On Sun, Nov 20, 2022 at 6:24 PM Isaac Morland wrote: > What I'm finding is that the UPDATE is taking over an hour for 5000 > records, and tons of WAL is being generated, several files per minute. > Selecting the non-PDF columns from the entire table takes a few > milliseconds, and the only thing

Re: fixing CREATEROLE

2022-11-28 Thread David G. Johnston
On Mon, Nov 28, 2022 at 12:42 PM wrote: > David G. Johnston: > > A quick tally of the thread so far: > > > > No Defaults needed: David J., Mark?, Tom? > > Defaults needed - attached to role directly: Robert > > Defaults needed - defined within Default Privileges

Re: fixing CREATEROLE

2022-11-28 Thread David G. Johnston
On Mon, Nov 28, 2022 at 2:55 PM Robert Haas wrote: > On Mon, Nov 28, 2022 at 4:19 PM David G. Johnston > wrote: > > That's fine, but are you saying this patch is incapable (or simply > undesirable) of having the parts about handling defaults separated out from > the par

Re: fixing CREATEROLE

2022-11-28 Thread David G. Johnston
On Mon, Nov 28, 2022 at 11:57 AM wrote: > Robert Haas: > > I don't know if changing the syntax from A to B is really getting us > > anywhere. I generally agree that the ALTER DEFAULT PRIVILEGES syntax > > looks nicer than the CREATE/ALTER ROLE syntax, but I'm not sure that's > > a sufficient

Re: fixing CREATEROLE

2022-11-28 Thread David G. Johnston
On Mon, Nov 28, 2022 at 1:28 PM Robert Haas wrote: > On Mon, Nov 28, 2022 at 3:02 PM Mark Dilger > wrote: > > You can argue that a grant with INHERIT FALSE, SET FALSE, ADMIN TRUE > still grants membership, and I think formally that's true, but I also > think it's just picking something to

Re: [DOCS] Stats views and functions not in order?

2022-11-25 Thread David G. Johnston
On Fri, Nov 25, 2022 at 5:09 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 23.11.22 09:36, Peter Smith wrote: > > v6-0005-Cleanup-view-name-hyperlinks-for-Tables-28.1-and-.patch > v6-0006-Remove-all-stats-views-from-the-ToC-of-28.2.patch > > I wasn't sure yet whether these

Re: fixing CREATEROLE

2022-11-29 Thread David G. Johnston
On Tue, Nov 29, 2022 at 12:32 AM wrote: > > Is there any other argument to be made against ADP? > These aren't privileges, they are memberships. The pg_default_acl catalog is also per-data while these settings should be present in a catalog which, like pg_authid, is catalog-wide. This latter

Re: [DOCS] Stats views and functions not in order?

2022-11-16 Thread David G. Johnston
On Tue, Nov 15, 2022 at 6:39 PM Peter Smith wrote: > > I was also wondering (but have not yet done) if the content *outside* > the tables should be reordered to match the table 28.1/28.2 order. > > Thoughts? > > I would love to do away with the ToC listing of view names in 28.2 altogether.

Re: [DOCS] Stats views and functions not in order?

2022-11-25 Thread David G. Johnston
On Wed, Nov 23, 2022 at 1:36 AM Peter Smith wrote: > On Thu, Nov 17, 2022 at 8:46 AM David G. Johnston > wrote: > > > Also, make it so each view ends up being its own separate page. > > > > I did not do this. AFAIK those views of chapter 54 get rendered to &g

Re: Allow round() function to accept float and double precision

2022-11-30 Thread David G. Johnston
On Wed, Nov 30, 2022 at 6:45 PM Tom Lane wrote: > David Rowley writes: > > > I'm unsure what the repercussions of the fact that REAL and FLOAT8 are > > not represented as decimals. > > The main thing is that I think the output will still have to be > NUMERIC, or you're going to get complaints

Re: Questions regarding distinct operation implementation

2022-12-01 Thread David G. Johnston
On Thu, Dec 1, 2022 at 2:37 PM David Rowley wrote: > > The question is, what do you want to make work? If you're not worried > about supporting DISTINCT when there is an ORDER BY clause and the > frame options are effectively ROWS BETWEEN UNBOUNDED PRECEDING AND > UNBOUNDED FOLLOWING, then it's

Re: Allow round() function to accept float and double precision

2022-12-01 Thread David G. Johnston
On Thu, Dec 1, 2022 at 2:21 PM David Rowley wrote: > On Fri, 2 Dec 2022 at 09:02, Tom Lane wrote: > > > > David Rowley writes: > > > I don't really agree that it will work fine in all cases though. If > > > the numeric has more than 1000 digits left of the decimal point then > > > the method

Re: pgsql: Revoke PUBLIC CREATE from public schema, now owned by pg_databas

2022-11-30 Thread David G. Johnston
On Wed, Nov 30, 2022 at 3:35 PM Tom Lane wrote: > > BTW, is "create a schema with the same name" sufficient detail? > You have to either make it owned by that user, or explicitly > grant CREATE permission on it. I'm not sure if that detail > belongs here, but it feels like maybe it does. > >

Re: [DOCS] Stats views and functions not in order?

2022-12-01 Thread David G. Johnston
On Thu, Dec 1, 2022 at 2:20 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 29.11.22 08:29, Peter Smith wrote: > > PSA v8* patches. > > > > Here, patches 0001 and 0002 are unchanged, but 0003 has many changes > > per David's suggestion [1] to change all these views to > >

Re: Optimize common expressions in projection evaluation

2022-12-02 Thread David G. Johnston
On Fri, Dec 2, 2022 at 12:52 AM Peifeng Qiu wrote: > Hi hackers. > > When a star(*) expands into multiple fields, our current > implementation is to generate multiple copies of the expression > and do FieldSelects. This is very inefficient because the same > expression get evaluated multiple

Re: pgsql: Prevent instability in contrib/pageinspect's regression test.

2022-11-21 Thread David G. Johnston
On Mon, Nov 21, 2022 at 1:12 PM Tom Lane wrote: > Andres Freund writes: > > On 2022-11-21 12:52:01 -0500, Robert Haas wrote: > >> On Mon, Nov 21, 2022 at 12:35 PM Tom Lane wrote: > >>> Why in the world is get_raw_page() marked as parallel safe? > >>> It clearly isn't, given this restriction. >

Re: How to *really* quit psql?

2022-11-19 Thread David G. Johnston
On Sat, Nov 19, 2022 at 12:59 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Sat, Nov 19, 2022 at 12:49 PM Tom Lane wrote: > >> Greg Stark writes: >> > On Sat, 19 Nov 2022 at 14:10, Tom Lane wrote: >> >> Under what circumstances would

Re: How to *really* quit psql?

2022-11-19 Thread David G. Johnston
On Sat, Nov 19, 2022 at 12:10 PM Tom Lane wrote: > Fabien COELHO writes: > > - when the current script is included from something, > > you quit the current script and proceed after the \i of next -f, BAD > > > Question: is there any way to really abort a psql script from an > included > >

Re: How to *really* quit psql?

2022-11-19 Thread David G. Johnston
On Sat, Nov 19, 2022 at 12:49 PM Tom Lane wrote: > Greg Stark writes: > > On Sat, 19 Nov 2022 at 14:10, Tom Lane wrote: > >> Under what circumstances would it be appropriate for a script to take > >> it on itself to decide that? It has no way of knowing what the next -f > >> option is or what

Re: New docs chapter on Transaction Management and related changes

2022-11-30 Thread David G. Johnston
On Wed, Nov 30, 2022 at 6:52 AM Bruce Momjian wrote: > On Wed, Nov 30, 2022 at 07:33:44AM +0100, Peter Eisentraut wrote: > > On 30.11.22 02:51, Bruce Momjian wrote: > > > Patch applied back to PG 11. Thanks to Simon for getting this > important > > > information in our docs, and for the

Re: Allow round() function to accept float and double precision

2022-12-01 Thread David G. Johnston
On Thu, Dec 1, 2022 at 7:39 AM Tom Lane wrote: > Dean Rasheed writes: > > > The fact that passing a negative scale to round() isn't documented > > does seem like an oversight though... > > Agreed, will do something about that. > > Thanks. I'm a bit surprised you left "Rounds v to s decimal

Re: pgsql: Add new GUC createrole_self_grant.

2023-01-13 Thread David G. Johnston
On Fri, Jan 13, 2023 at 4:46 PM Andres Freund wrote: > > I don't really see what that has to do with the topic at hand, unless you > want > to suggest removing the entire section about how to write secure security > definer functions? > Not remove, but I'm not seeing why the introduction of

Re: pgsql: Add new GUC createrole_self_grant.

2023-01-16 Thread David G. Johnston
On Monday, January 16, 2023, Robert Haas wrote: > > > I don't really think there's too much wrong with what I wrote in the > patch as proposed, and I would like to get it committed and move on > without getting drawn into a wide-ranging discussion of every way in > which we might be able to

Re: pgsql: Add new GUC createrole_self_grant.

2023-01-14 Thread David G. Johnston
On Sat, Jan 14, 2023 at 5:31 PM Robert Haas wrote: > On Fri, Jan 13, 2023 at 8:29 PM David G. Johnston > wrote: > >> The point of the security definer section is to explain how to safely > write > >> security definer functions that you grant to less privileged users

Re: pgsql: Add new GUC createrole_self_grant.

2023-01-14 Thread David G. Johnston
On Sat, Jan 14, 2023 at 6:12 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > While the function owner has their own pg_db_role_setting preference for > this setting, > Should we be pointing out that if the role with CREATEROLE isn't also a LOGIN role then there

Re: [DOCS] Stats views and functions not in order?

2023-01-18 Thread David G. Johnston
On Wed, Jan 18, 2023 at 3:36 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 11.01.23 07:11, Peter Smith wrote: > > v9-0003 --> v10-0001 > > > >> I'm not sure if anything is pending for v9-0003, if there is something > >> pending, please post an updated patch for the same. >

Re: [DOCS] Stats views and functions not in order?

2023-01-18 Thread David G. Johnston
On Wed, Jan 18, 2023 at 8:38 AM Tom Lane wrote: > "David G. Johnston" writes: > > ... I was going for the html effect > > of having these views chunked into their own pages, any other changes > being > > non-detrimental. > > But is that a result

Re: psql: Add role's membership options to the \du+ command

2023-01-24 Thread David G. Johnston
On Mon, Jan 9, 2023 at 9:09 AM Pavel Luzanov wrote: > When you include one role in another, you can specify three options: > ADMIN, INHERIT (added in e3ce2de0) and SET (3d14e171). > > For example. > > CREATE ROLE alice LOGIN; > > GRANT pg_read_all_settings TO alice WITH ADMIN TRUE, INHERIT TRUE,

Re: Making Vars outer-join aware

2023-01-24 Thread David G. Johnston
On Tue, Jan 24, 2023 at 1:25 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Tue, Jan 24, 2023 at 12:31 PM Tom Lane wrote: > >> select ... from t1 left join t2 on (t1.x = t2.y and t1.x = 1); > >> > >> If we turn the generic equivclass.c log

Re: Making Vars outer-join aware

2023-01-24 Thread David G. Johnston
On Tue, Jan 24, 2023 at 12:31 PM Tom Lane wrote: > I wrote: > > Hans Buschmann writes: > >> I just noticed your new efforts in this area. > >> I wanted to recurr to my old thread [1] considering constant > propagation of quals. > >> [1] >

Re: CREATE ROLE bug?

2023-01-25 Thread David G. Johnston
On Wed, Jan 25, 2023 at 7:35 AM Bruce Momjian wrote: > > So, how would someone with CREATEROLE permission add people to their own > role, without superuser permission? Are we adding any security by > preventing this? > > As an encouraged design choice you wouldn't. You'd create a new group and

Re: Set arbitrary GUC options during initdb

2023-01-27 Thread David G. Johnston
On Fri, Jan 27, 2023 at 8:53 AM Tom Lane wrote: > Robert Haas writes: > > The idea is that instead of: > > > replace_token(conflines, "#max_connections = 100", repltok); > > > You'd write something like: > > > replace_guc_value(conflines, "max_connections", repltok); > > > Which would look for

Re: If there are more than two functions in different schemas, the functions have the same name and same arguments, \df[+] only display the function that schema first appeared in the search_path.

2023-01-15 Thread David G. Johnston
On Sunday, January 15, 2023, 金 wrote: > > postgres=# \df fun1 > > List of functions > > Schema | Name | Result data type |Argument data types > | Type > > +--+--+- >

v16 GRANT role TO role needs a multi-option setting capability

2023-01-23 Thread David G. Johnston
Hey, GRANT role_name [, ...] TO role_specification [, ...] [ WITH { ADMIN | INHERIT | SET } { OPTION | TRUE | FALSE } ] [ GRANTED BY role_specification ] It would be really nice to complete this new feature of INHERIT/SET FALSE/TRUE with a multi-specification capability. GRANT role_name

Re: Add connection active, idle time to pg_stat_activity

2022-11-08 Thread David G. Johnston
On Tue, Nov 8, 2022 at 6:56 PM Andres Freund wrote: > > Separately from that, I'm a bit worried about starting to add accumulative > counters to pg_stat_activity. It's already gotten hard to use interactively > due to the number of columns - and why stop with the columns you suggest? > Why > not

Re: Add connection active, idle time to pg_stat_activity

2022-11-08 Thread David G. Johnston
On Tue, Nov 8, 2022 at 7:37 PM Andres Freund wrote: > On 2022-11-08 19:25:27 -0700, David G. Johnston wrote: > > Actually two, because I also suggest that not only is the duration > recorded, > > but a counter be incremented each time a given state becomes the > curre

Re: Document parameter count limit

2022-11-10 Thread David G. Johnston
On Thu, Nov 10, 2022 at 10:58 AM Corey Huinker wrote: > >> +if you are reading this prepatorily, please redesign your >> query to use temporary tables or arrays >> > > I agree with the documentation of this parameter. > I agree with dissuading anyone from attempting to change it > The

Re: psql: Add command to use extended query protocol

2022-11-07 Thread David G. Johnston
On Mon, Nov 7, 2022 at 9:02 PM Pavel Stehule wrote: > > > út 8. 11. 2022 v 3:47 odesílatel Corey Huinker > napsal: > >> On Mon, Nov 7, 2022 at 4:12 PM Tom Lane wrote: >> >>> Corey Huinker writes: >>> > I thought about basically reserving the \$[0-9]+ space as bind >>> variables, >>> > but it

Re: Glossary and initdb definition work for "superuser" and database/cluster

2022-11-02 Thread David G. Johnston
On Tue, Nov 1, 2022 at 6:59 PM David G. Johnston wrote: > > P.S. I'm now looking at the very first paragraph to initdb more closely, > not liking "single server instance" all that much and wondering how to fit > in "cluster user" there - possibly by s

Re: [DOCS] Stats views and functions not in order?

2022-11-09 Thread David G. Johnston
On Mon, Nov 7, 2022 at 5:19 PM Peter Smith wrote: > On Mon, Nov 7, 2022 at 5:50 AM Tom Lane wrote: > > > > Peter Smith writes: > > > Sorry, I forgot the attachments in the previous post. PSA. > > > > I spent a bit of time looking at this. I agree that a lot of the > > current ordering choices

Document parameter count limit

2022-11-09 Thread David G. Johnston
Inspired by a recent posting on Slack... diff --git a/doc/src/sgml/limits.sgml b/doc/src/sgml/limits.sgml index d5b2b627dd..5d68eef093 100644 --- a/doc/src/sgml/limits.sgml +++ b/doc/src/sgml/limits.sgml @@ -97,6 +97,13 @@ 32 can be increased by recompiling PostgreSQL + + +

Re: Add sub-transaction overflow status in pg_stat_activity

2022-11-14 Thread David G. Johnston
On Mon, Nov 14, 2022 at 9:04 AM Robert Haas wrote: > On Mon, Nov 14, 2022 at 10:57 AM Justin Pryzby > wrote: > > > First, we're just talking about an extra couple of columns in > > > pg_stat_activity here, which does not seem like a heavy price to pay. > > > > The most recent patch adds a

Re: Add sub-transaction overflow status in pg_stat_activity

2022-11-14 Thread David G. Johnston
On Mon, Nov 14, 2022 at 9:41 AM Robert Haas wrote: > On Mon, Nov 14, 2022 at 11:35 AM Amit Singh > wrote: > > Making the information available in pg_stat_activity makes it a lot > easier to identify the pid which has caused the subtran overflow. Debugging > through the app code can be an

Re: Add sub-transaction overflow status in pg_stat_activity

2022-11-14 Thread David G. Johnston
On Mon, Nov 14, 2022 at 11:43 AM Robert Haas wrote: > On Mon, Nov 14, 2022 at 12:47 PM Andres Freund wrote: > > I'd go the other way. It's pretty unimportant whether it overflowed, it's > > important how many subtxns there are. The cases where overflowing causes > real > > problems are when

Re: pg_dump versus hash partitioning

2023-02-01 Thread David G. Johnston
On Wed, Feb 1, 2023 at 3:38 PM Tom Lane wrote: > Peter Geoghegan writes: > > You mentioned "minor releases" here. Who said anything about that? > > I did: I'd like to back-patch the fix if possible. I think changing > the default --load-via-partition-root choice could be back-patchable. > > If

Re: NumericShort vs NumericLong format

2023-03-06 Thread David G. Johnston
I'll give this a go as a learning exercise for myself... On Mon, Mar 6, 2023 at 8:47 PM Amin wrote: > > - How can I determine which format will be used for a numeric type? > https://github.com/postgres/postgres/blob/cf96907aadca454c4094819c2ecddee07eafe203/src/backend/utils/adt/numeric.c#L491

Re: Options to rowwise persist result of stable/immutable function with RECORD result

2023-03-22 Thread David G. Johnston
On Tuesday, March 21, 2023, Eske Rahn wrote: > Hi, > > I have noticed a rather odd behaviour that is not strictly a bug, but is > unexpected. > > It is when a immutable (or stable) PG function is returning results in a > record structure a select on these calls the function repeatedly for each >

Re: Options to rowwise persist result of stable/immutable function with RECORD result

2023-03-22 Thread David G. Johnston
On Wed, Mar 22, 2023 at 4:46 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Wed, Mar 22, 2023 at 4:32 PM Eske Rahn wrote: > >> Hi, >> >> Thanks for the quick answer *:-D* >> >> That was a nice sideeffect of lateral. >> >>

Re: Options to rowwise persist result of stable/immutable function with RECORD result

2023-03-22 Thread David G. Johnston
On Wed, Mar 22, 2023 at 4:32 PM Eske Rahn wrote: > Hi, > > Thanks for the quick answer *:-D* > > That was a nice sideeffect of lateral. > > In the example, the calling code also gets simplified: > > WITH x AS ( > SELECT clock_timestamp() rowstart, *, clock_timestamp() rowend FROM ( >

Re: psql: Add role's membership options to the \du+ command

2023-03-07 Thread David G. Johnston
On Tue, Mar 7, 2023 at 2:02 PM David G. Johnston wrote: > > I'll be looking over your v3 patch sometime this week, if not today. > > Moving the goal posts for this meta-command to >= 9.5 seems like it should be done as a separate patch and thread. The documentation pres

Re: psql: Add role's membership options to the \du+ command

2023-03-07 Thread David G. Johnston
On Mon, Mar 6, 2023 at 12:43 AM Pavel Luzanov wrote: > Indeed, adding ADMIN to pg_has_role looks logical. The function will show > whether one role can manage another directly or indirectly (via SET ROLE). > FWIW I've finally gotten to publishing my beta version of the Role Graph for PostgreSQL

Re: Re: Give me more details of some bits in infomask!!

2023-02-26 Thread David G. Johnston
On Sun, Feb 26, 2023 at 8:36 AM jack...@gmail.com wrote: > > CID means "command ID" i.e. sequential ID assigned to commands in a > > single session (for visibility checks, so that a query doesn't see data > > deleted by earlier commands in the same session). See > >

Re: Re: Why the lp_len is 28 not 32?

2023-02-26 Thread David G. Johnston
On Sun, Feb 26, 2023 at 8:11 AM jack...@gmail.com wrote: > > *From:* Tomas Vondra > > > +++ > > 1 | 8160 | 28 | \x0100 > > > > > Pretty sure this is because we align the

Re: What's the prefix?

2023-02-26 Thread David G. Johnston
On Sun, Feb 26, 2023 at 9:16 AM jack...@gmail.com wrote: > use these sqls: > create table t(a text); > insert into t values('a'); > select lp,lp_len,t_data from heap_page_items(get_raw_page('t',0)); > lp | lp_len | t_data > ++ > 1 | 26 | \x0561 > as you can see, the 61

Re: Improving inferred query column names

2023-02-20 Thread David G. Johnston
On Mon, Feb 20, 2023 at 8:08 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 11.02.23 20:24, Andres Freund wrote: > > > > I think on a green field it'd be clearly better to do something like the > > above. What does give me pause is that it seems quite likely to break > >

Re: psql: Add role's membership options to the \du+ command

2023-02-21 Thread David G. Johnston
On Tue, Feb 21, 2023 at 2:14 PM Pavel Luzanov wrote: > On 17.02.2023 19:53, David G. Johnston wrote: > > On Fri, Feb 17, 2023 at 4:02 AM Pavel Luzanov > wrote: > >>List of roles >> Role name |

Re: psql: Add role's membership options to the \du+ command

2023-03-03 Thread David G. Johnston
On Fri, Mar 3, 2023 at 4:01 AM Pavel Luzanov wrote: > Hello, > > On 22.02.2023 00:34, David G. Johnston wrote: > > I didn't even know this function existed. But I see that it was changed in > 3d14e171 with updated documentation: > > https://www.postgresql.org/docs/d

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

2023-03-04 Thread David G. Johnston
On Sat, Mar 4, 2023 at 5:07 PM Tom Lane wrote: > Jeff Davis writes: > > On Sat, 2023-03-04 at 18:04 -0500, Dave Cramer wrote: > >> Most of the clients know how to decode the builtin types. I'm not > >> sure there is a use case for binary encode types that the clients > >> don't have a priori

Re: psql: Add role's membership options to the \du+ command

2023-02-17 Thread David G. Johnston
On Fri, Feb 17, 2023 at 4:02 AM Pavel Luzanov wrote: >List of roles > Role name | Attributes | > Member of > > ---++--- > admin |

Re: SELECT INTO without columns or star

2023-03-31 Thread David G. Johnston
On Fri, Mar 31, 2023 at 8:10 AM Zhang Mingli wrote: > When I exec a sql SELECT INTO without columns or * by mistake, it succeeds: > > Yes, a table may have zero columns by design. David J.

Re: psql: Add role's membership options to the \du+ command

2023-04-03 Thread David G. Johnston
On Wed, Mar 22, 2023 at 11:11 AM Pavel Luzanov wrote: > In the previous version, I didn't notice (unlike cfbot) the compiler > warning. Fixed in version 6. > > I've marked this Ready for Committer. My opinion is that this is a necessary modification due to the already-committed changes to the

Re: psql: Add role's membership options to the \du+ command

2023-04-04 Thread David G. Johnston
On Tue, Apr 4, 2023 at 10:37 AM Tom Lane wrote: > Robert Haas writes: > > On Tue, Apr 4, 2023 at 1:12 PM Tom Lane wrote: > >> I wonder if, while we're here, we should apply the idea of > >> joining-with-newlines-not-commas to the attributes column too. > > > That would make the column

Re: psql: Add role's membership options to the \du+ command

2023-04-05 Thread David G. Johnston
On Wed, Apr 5, 2023 at 6:58 AM Tom Lane wrote: > Pavel Luzanov writes: > > What if this long output will be available only for \du+, and for \du > > just show distinct (without duplicates) > > roles in the current array format? For those, who don't care about these > > new membership options,

Re: psql: Add role's membership options to the \du+ command

2023-04-04 Thread David G. Johnston
On Tue, Apr 4, 2023 at 9:13 AM Tom Lane wrote: > "David G. Johnston" writes: > > I've marked this Ready for Committer. > > Hmm ... not sure I like the proposed output. The 'a', 'i', 's' > annotations are short but they don't have much else to recommend them. > On

Re: psql: Add role's membership options to the \du+ command

2023-02-10 Thread David G. Johnston
On Fri, Feb 10, 2023 at 2:08 PM David Zhang wrote: > > I noticed the document psql-ref.sgml has been updated for both `du+` and > `dg+`, but only `du` and `\du+` are covered in regression test. Is that > because `dg+` is treated exactly the same as `du+` from testing point of > view? > Yes. >

Re: psql: Add role's membership options to the \du+ command

2023-02-15 Thread David G. Johnston
On Wed, Feb 15, 2023 at 2:31 PM David Zhang wrote: > There is a default built-in role `pg_monitor` and the behavior changed > after the patch. If `\dg+` and `\du+` is treated as the same, and `make > check` all pass, then I assume there is no test case to verify the output > of `duS+`. My point

Re: CHECK Constraint Deferrable

2023-07-07 Thread David G. Johnston
On Friday, July 7, 2023, Himanshu Upadhyaya wrote: > I can think of one scenario, as below > > 1) any department should have an employee > 2)any employee should be assigned to a department > so, the employee table has a FK to the department table, and another check > constraint should be added

Re: CommandStatus from insert returning when using a portal.

2023-07-12 Thread David G. Johnston
On Wed, Jul 12, 2023 at 2:59 PM Dave Cramer wrote: > On Wed, 12 Jul 2023 at 17:49, Tom Lane wrote: > >> Dave Cramer writes: >> > Obviously I am biased by the JDBC API which would like to have >> > PreparedStatement.execute() return the number of rows inserted >> > without having to wait to

Re: CommandStatus from insert returning when using a portal.

2023-07-12 Thread David G. Johnston
On Wed, Jul 12, 2023 at 5:57 PM Dave Cramer wrote: > On Wed, 12 Jul 2023 at 20:00, wrote: > >> Dave Cramer writes: >> > Obviously I am biased by the JDBC API which would like to have >> > PreparedStatement.execute() return the number of rows inserted >> > without having to wait to read all of

Re: CommandStatus from insert returning when using a portal.

2023-07-12 Thread David G. Johnston
On Wed, Jul 12, 2023 at 1:03 PM Dave Cramer wrote: > > INSERT INTO test_table (cnt) VALUES (1), (2) RETURNING id > > if a portal is used to get the results then the CommandStatus > IIUC the portal is not optional if you including the RETURNING clause. There is no CommandStatus message in the

Re: CommandStatus from insert returning when using a portal.

2023-07-13 Thread David G. Johnston
On Thursday, July 13, 2023, Dave Cramer wrote: > > Any comment on why the CommandComplete is incorrect ? > It returns INSERT 0 0 if a cursor is used > Looking at DECLARE it is surprising that what you describe is even possible. Can you share a psql reproducer? David J.

Re: psql: Add role's membership options to the \du+ command

2023-07-13 Thread David G. Johnston
On Thu, Jul 13, 2023 at 8:01 AM Tom Lane wrote: > > I plan to replace it to: > > >pg_catalog.concat_ws(', ', > > CASE WHEN pam.admin_option THEN 'ADMIN' END, > > CASE WHEN m.rolinherit THEN 'INHERIT' END, > > 'SET' > >) AS "Options", > > That does not seem right. Is it

Re: CommandStatus from insert returning when using a portal.

2023-07-17 Thread David G. Johnston
On Wed, Jul 12, 2023 at 2:49 PM Tom Lane wrote: > Dave Cramer writes: > > Obviously I am biased by the JDBC API which would like to have > > PreparedStatement.execute() return the number of rows inserted > > without having to wait to read all of the rows returned > > Umm ... you do realize that

Re: Regarding Installation of PostgreSQL

2023-07-18 Thread David G. Johnston
You are still in the wrong place - this is a developers list, which is only slightly less bad than sending it to a security list. We have a "general" list if you really cannot find a better place to send stuff. But in this case your complaint has to do with the pgAdmin program so its support

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Thu, Jul 13, 2023 at 6:07 PM Dave Cramer wrote: > On Thu, 13 Jul 2023 at 10:24, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Thursday, July 13, 2023, Dave Cramer wrote: >> >>> >>> Any comment on why the CommandComplete is incor

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Fri, Jul 14, 2023 at 9:30 AM Dave Cramer wrote: > David, > > I will try to get a tcpdump file. Doing this in libpq seems challenging as > I'm not aware of how to create a portal in psql. > Yeah, apparently psql does something special (like ignoring it...) with its FETCH_COUNT variable (set

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Fri, Jul 14, 2023 at 9:50 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > > Fixing that test in some manner and recompiling psql seems like it should > be the easiest way to produce a core-only test case. > > Apparently not - since it (ExecQueryUsingCu

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Fri, Jul 14, 2023 at 3:12 PM Chapman Flack wrote: > If someone really does want to do a huge INSERT and get the generated > values back in increments, it might be clearer to write an explicit > INSERT RETURNING and issue it with executeQuery, where everything will > work as expected. > > For

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Fri, Jul 14, 2023 at 11:34 AM wrote: > On 2023-07-12 21:30, David G. Johnston wrote: > > Right, and executeUpdate is the wrong API method to use, in the > > PostgreSQL > > world, when executing insert/update/delete with the non-SQL-standard > > returning clause. .

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Fri, Jul 14, 2023 at 12:51 PM Tom Lane wrote: > "David G. Johnston" writes: > > I agree that the documented contract of the insert command tag says it > > reports the size of the entire tuple store maintained by the server > during > > the transaction ins

Re: CommandStatus from insert returning when using a portal.

2023-07-14 Thread David G. Johnston
On Fri, Jul 14, 2023 at 10:39 AM wrote: > On 2023-07-14 12:58, Dave Cramer wrote: > > See attached pcap file > > So if the fetch count is zero and no portal is needed, > or if the fetch count exceeds the row count and the command > completion follows directly with no suspension of the portal,

<    4   5   6   7   8   9   10   11   >