Re: CALL and named parameters

2025-08-08 Thread Dominique Devienne
On Fri, Aug 8, 2025 at 1:33 AM Tom Lane wrote: > Christoph Moench-Tegeder writes: > > ## Dominique Devienne (ddevie...@gmail.com): > >> dd_v185=> call "Epos-DBA".db_grant_connect_to(grantee_role => 'dd_joe'); > >> ERROR: procedure Epos-DBA.d

Re: CALL and named parameters

2025-08-07 Thread Dominique Devienne
On Thu, Aug 7, 2025 at 4:36 PM Tom Lane wrote: > Dominique Devienne writes: > > I was expecting an error telling me the procedure exists, but the > > argument name used in the call didn't. Then it's obvious to me what > > mistake I made. If argument names don&

Re: CALL and named parameters

2025-08-07 Thread Dominique Devienne
On Thu, Aug 7, 2025 at 4:21 PM Tom Lane wrote: > The message presumably was like > > ERROR: procedure ... does not exist > HINT: No procedure matches the given name and argument types. You might need > to add explicit type casts. Hi Tom. Indeed it was. I shared my psql session showing that.

Re: CALL and named parameters

2025-08-07 Thread Dominique Devienne
On Thu, Aug 7, 2025 at 3:30 PM David G. Johnston wrote: > On Thursday, August 7, 2025, Dominique Devienne wrote: >> Can you overload a function solely by changing an argument name? > No, the signature is only the name and input argument types. Thanks for confirming. >> S

Re: CALL and named parameters

2025-08-07 Thread Dominique Devienne
On Wed, Aug 6, 2025 at 8:09 PM Pavel Stehule wrote: > Maybe there is another issue? Indeed. Thanks Pavel, Andrian, Christoph, for demonstrating I was wrong. I misinterpreted the signals I got, and accepted the AI's interpretation on success (after a long day) when the inderlying isse was elsewher

CALL and named parameters

2025-08-06 Thread Dominique Devienne
(sorry, this is a rant...). Was getting an error calling a procedure ERROR: procedure ... does not exist HINT: No procedure matches the given name and argument types. You might need to add explicit type casts. I verify USAGE on the SCHEMA of the proc. OK. I verify EXECUTE on the FUNCTION. OK.

Re: Stored procedures or raw queries

2025-08-06 Thread Dominique Devienne
On Wed, Aug 6, 2025 at 2:04 PM Simon Connah wrote: > My main question is whether I should use stored procedures / functions > or whether I should embed raw SQL queries in my backend? I understand > that procedures are faster as it cuts down on the round trip speed and > the database can optimise i

Re: Notices not printed by PQtrace

2025-08-05 Thread Dominique Devienne
On Tue, Aug 5, 2025 at 3:20 PM Álvaro Herrera wrote: > On 2025-Aug-05, Dominique Devienne wrote: > Yeah, I think that makes sense. Feel free to propose a patch. OK, fair enough. If I ever do (fat chances), I'd add another opt-in flag to make the trace machine readable (see my older t

Notices not printed by PQtrace

2025-08-05 Thread Dominique Devienne
Hi. I'm using PQtrace for client-side tracing with PQtrace, which I thought was showing protocol messages in details. But turns out that RAISE notices from PL/pgSQL are not there. And to think about it, I wonder whether NOTIFY messages are there too. Are these oversights? Any chance this could

Re: SET LOCAL ROLE inside SECURITY INVOKER (LANGUAGE plpgsql) function

2025-07-31 Thread Dominique Devienne
On Thu, Jul 31, 2025 at 4:11 PM Tom Lane wrote: > Dominique Devienne writes: > > On Thu, Jul 31, 2025 at 11:35 AM Guillaume Lelarge > > wrote: > >> It doesn't lie. The role has DELETE privilege. I guess what it lacks is > >> the SELECT privilege. If you

Re: SET LOCAL ROLE inside SECURITY INVOKER (LANGUAGE plpgsql) function

2025-07-31 Thread Dominique Devienne
On Thu, Jul 31, 2025 at 4:13 PM Adrian Klaver wrote: > On 7/31/25 04:37, Dominique Devienne wrote: > So the below from the original post was not correct: > > "My setup ensures that the role I SET LOCAL ROLE to, has (indirectly) > been granted DMLs on that table." Not so.

Re: Yet more ROLE changes in v18 beta1???

2025-07-31 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 4:57 AM Tom Lane wrote: > Dominique Devienne writes: > > Unfortunately, digging into this is not something I can do right away. > > v18 is still a few months out, I do hope I can investigate before that. > > It'd be good if you could prioritize

Re: SET LOCAL ROLE inside SECURITY INVOKER (LANGUAGE plpgsql) function

2025-07-31 Thread Dominique Devienne
On Thu, Jul 31, 2025 at 11:35 AM Guillaume Lelarge wrote: > On 31/07/2025 10:41, Dominique Devienne wrote: > > On Wed, Jul 30, 2025 at 9:42 PM Adrian Klaver > > wrote: > > how can has_table_privilege() "lie" like this? > > It doesn't lie. The role has

Re: SET LOCAL ROLE inside SECURITY INVOKER (LANGUAGE plpgsql) function

2025-07-31 Thread Dominique Devienne
On Wed, Jul 30, 2025 at 9:42 PM Adrian Klaver wrote: > My suspicion is that there is a missing piece in your chain of roles. But my point Adrian is that, in my case, has_table_privilege() returns true (t) yet the delete fails. Contrary to your example above. I can easily accept that the problem l

Re: SET LOCAL ROLE inside SECURITY INVOKER (LANGUAGE plpgsql) function

2025-07-30 Thread Dominique Devienne
On Wed, Jul 30, 2025 at 5:23 PM Adrian Klaver wrote: > On 7/30/25 04:37, Dominique Devienne wrote: > > Are there special consideration I'm unaware of, regarding SET ROLE > > inside routines? > What is the ROLE that defined the function? A 3rd role. But does it matter

SET LOCAL ROLE inside SECURITY INVOKER (LANGUAGE plpgsql) function

2025-07-30 Thread Dominique Devienne
Hi. PostgreSQL v17 here. I'm stumped by something, and would like pointers to sort something out. Inside my function, I do: EXECUTE format('SET LOCAL ROLE %I', schema_owner); raise notice 'CURRENT_USER = %, can DELETE = %', CURRENT_USER, has_table_privilege('SchemaMapping', 'D

Re: Aggregate versions of hashing functions (md5, sha1, etc...)

2025-07-11 Thread Dominique Devienne
On Fri, Jul 11, 2025 at 6:05 PM Florents Tselai wrote: > On Fri, Jul 11, 2025, 18:27 Adrian Klaver wrote: >> [...] create an extension that incorporates the code. > > That's an ideal use case for an extension indeed . Extensions are of no use to me, unfortunately, unless built-in and official. S

Re: Aggregate versions of hashing functions (md5, sha1, etc...)

2025-07-11 Thread Dominique Devienne
On Fri, Jul 11, 2025 at 11:00 AM Dominique Devienne wrote: > The current md5() and pgcrypto.digest() functions roll the x1 > init, xN process, and x1 finish into a single call, processing a > single bytea (or perhaps more intelligently for TOAST'ed values, the > 2K "rows&

Re: Aggregate versions of hashing functions (md5, sha1, etc...)

2025-07-11 Thread Dominique Devienne
On Thu, Jul 10, 2025 at 9:03 PM Merlin Moncure wrote: > On Thu, Jul 10, 2025 at 5:48 AM Dominique Devienne > wrote: >> We store scientific information in PostgreSQL, and some of that is >> bytea and large, thus we must "chunk it" both for performance, and not >&g

Re: Aggregate versions of hashing functions (md5, sha1, etc...)

2025-07-11 Thread Dominique Devienne
On Thu, Jul 10, 2025 at 7:11 PM Ron Johnson wrote: > On Thu, Jul 10, 2025 at 12:26 PM Adrian Klaver > wrote: >> On 7/10/25 04:48, Dominique Devienne wrote: >> > Seems so logical to me, that these hashing functions were available >> > are aggregates, I can'

Re: Aggregate versions of hashing functions (md5, sha1, etc...)

2025-07-11 Thread Dominique Devienne
On Thu, Jul 10, 2025 at 6:25 PM Adrian Klaver wrote: > On 7/10/25 04:48, Dominique Devienne wrote: > > Seems so logical to me, that these hashing functions were available > > are aggregates, I can't be the first one to think of that, can it? > > I've been on this l

Aggregate versions of hashing functions (md5, sha1, etc...)

2025-07-10 Thread Dominique Devienne
We store scientific information in PostgreSQL, and some of that is bytea and large, thus we must "chunk it" both for performance, and not be limited to 1GB (we do exceed that, in rare occasions). Recently I added md5/sha1 hashing support for such values (for various reasons, to track corruptions i

Re: Extension disappearing act

2025-06-20 Thread Dominique Devienne
On Thu, Jun 19, 2025 at 6:35 PM Laurenz Albe wrote: > > On Thu, 2025-06-19 at 15:09 +0200, Dominique Devienne wrote: > > Hi. Little mystery we don't understand. v17. > > We're stumped for now. > > So are we. Why do you keep us guessing instead of posting a repro

Re: Extension disappearing act

2025-06-19 Thread Dominique Devienne
On Thu, Jun 19, 2025 at 4:18 PM Adrian Klaver wrote: > On 6/19/25 06:09, Dominique Devienne wrote: > > Hi. Little mystery we don't understand. v17. > Does 'all' include the public schema? No. We don't touch `public` at all, beside pgcrypto ending up inside it.

Extension disappearing act

2025-06-19 Thread Dominique Devienne
Hi. Little mystery we don't understand. v17. Create new DB, owned by dedicated new ROLE. Create extension (pgcrypto) in our case. Installed in public, owned by DB owner role. Create schemas and populate them inside the DB. This also creates roles associated to those schemas. One of the schema is o

Re: is pg_stat_activity "transactional"? How fast does it update?

2025-06-11 Thread Dominique Devienne
On Tue, Jun 10, 2025 at 5:46 PM Dominique Devienne wrote: > On Tue, Jun 10, 2025 at 4:27 PM Tom Lane wrote: > > PQfinish is asynchronous: [...] > > [...] pg_stat_activity() takes a snapshot of the view's contents > Many thanks Tom. Didn't know either of those fa

Re: is pg_stat_activity "transactional"? How fast does it update?

2025-06-10 Thread Dominique Devienne
On Tue, Jun 10, 2025 at 4:27 PM Tom Lane wrote: > Dominique Devienne writes: > > So when and how fast does pg_stat_activity update, in the face of a > > PQfinish? > > The shared state underlying pg_stat_activity is updated > immediately when something changes. How

is pg_stat_activity "transactional"? How fast does it update?

2025-06-10 Thread Dominique Devienne
Hi. We're getting unit-test failures that look like data-races, which somehow are getting very frequent recently, tripping our CI. Basically we have a `services` table, for service discovery, which records the backend PID of its main DB Connection. Such that we can account for "stale" / "zombie"

Re: Feature request: Settings to disable comments and multiple statements in a connection

2025-06-10 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 1:06 AM Tom Lane wrote: > > Provide a client connection option (and/or implement the backend support) > > to allow only one statement in an execute request > > This exists already; you just have to use the extended query protocol. Hi Tom. Can you be more specific please? I

Re: LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-05 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 5:01 PM Daniel Verite wrote: > Dominique Devienne wrote: > > > locale 'C.UTF-8' or lc_collate 'C.UTF-8' lc_ctype 'C.UTF-8' > > > cannot work on Windows because Windows does not have a locale > > > name

Re: LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-05 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 2:40 PM Daniel Verite wrote: > Dominique Devienne wrote: > > On Linux, no error unlike on Windows (still inconsistent there IMHO), > > but the result is slightly different for datcollate and datctype (C vs > > en_US), > > while the

Re: LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-05 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 1:40 PM Laurenz Albe wrote: > On Thu, 2025-06-05 at 10:53 +0200, Dominique Devienne wrote: > > It clearly says "locale or builtin_locale", emphasis on the OR. > > You are right, and that's how it works on Linux. > BUILTIN_LOCALE is not

Re: LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-05 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 11:07 AM Dominique Devienne wrote: > So... It is possible to have the SAME command on Windows and Linux, > which yields the SAME datcollate and datctype values??? > So far, such a command eludes me, I'm afraid. --DD So I tried to be explicit about lc_collat

Re: LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-05 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 4:52 AM Jeff Davis wrote: > > On Windows, I'm getting > I tried on windows and linux and got the same result. Thanks Jeff, for your informative email. The command work, just like it does on Linux. YET... The results are NOT the same! C:\Users\ddevienne>psql service=my17 ps

Re: LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-05 Thread Dominique Devienne
On Thu, Jun 5, 2025 at 3:01 AM Laurenz Albe wrote: > On Wed, 2025-06-04 at 14:23 +0200, Dominique Devienne wrote: > > The command I'm using (from a libpq trace) is: > > > > create database "dd_v168" encoding 'UTF8' locale 'C.UTF-8' >

Re: Yet more ROLE changes in v18 beta1???

2025-06-04 Thread Dominique Devienne
On Wed, Jun 4, 2025 at 5:34 PM Tom Lane wrote: > Dominique Devienne writes: > > In any case, if anyone else knows about changes in this area, I'm > > interested. > > Digging through the commit log didn't find much, but conceivably > > https://git.post

Re: Yet more ROLE changes in v18 beta1???

2025-06-04 Thread Dominique Devienne
On Wed, Jun 4, 2025 at 5:29 PM Adrian Klaver wrote: > > $ ./myruntests.csh tests_pdgm_schemas -t "..." --pq-version > > Connected to ... (17.4, server 18.0) > > What is '(17.4, server 18.0)' referring to? > > What is the actual test being run below? 17.4 is the client-side version, i.e. the LibPQ

Re: Yet more ROLE changes in v18 beta1???

2025-06-04 Thread Dominique Devienne
On Wed, Jun 4, 2025 at 4:25 PM Robert Haas wrote: > Hi Dominique, Hi Rober, > Thanks for testing. This time, whatever is going wrong here is > probably not my fault, because I don't think I changed anything in > this area for v18. Actually, I'm unaware of anyone else having made > significant ch

Yet more ROLE changes in v18 beta1???

2025-06-04 Thread Dominique Devienne
(Robert, you were kind enough to help me understand the v16 changes, so I'm hoping you might have insight on this too. And this time around, it's not one year too late I hope, since I'm testing betas now. See https://www.postgresql.org/message-id/CA%2BTgmoZMqsg6-6qN_fuMZTGu%3DVdyjv-u9ZgWbEnOTvRE45

Re: pg_constraint catalog changes in v18 beta1???

2025-06-04 Thread Dominique Devienne
On Wed, Jun 4, 2025 at 3:07 PM Dominique Devienne wrote: > Is this change of behavior normal? > ... Was this intentional? Well, apparently it is intentional, I found an entry in the release notes. Case closed I guess. I adapted our introspection. Thanks, --DD >From https://www.postg

pg_constraint catalog changes in v18 beta1???

2025-06-04 Thread Dominique Devienne
Hi. I decided to test our stuff against the v18 beta1. And right off the bat, I'm getting differences when introspecting a schema via the catalogs, which now return NOT NULL constraints for regular columns, which was not the case before, and when the doc seems to say pg_constraint.contype = n is f

LOCALE C.UTF-8 on EDB Windows v17 server

2025-06-04 Thread Dominique Devienne
Hi. For a long time, I was just doing a plain CREATE DATABASE, using whatever local template1 was using. Then when v17 came out, I wanted to force UTF-8 for the encoding, *AND* use the new C.UTF-8 builtin locale, to not depend on libc on Linux. (which forced me to use template0 explicitly). And s

Re: current_role of caller of a DEFINER function

2025-06-03 Thread Dominique Devienne
On Wed, Jun 26, 2024 at 2:25 PM Dominique Devienne wrote: > On Wed, Jun 26, 2024 at 11:08 AM Laurenz Albe > wrote: > > On Wed, 2024-06-26 at 10:35 +0200, Dominique Devienne wrote: > > > So I have two questions: > > > 1) Is there any way to know the current_role of

Re: DROP ROLE as SUPERUSER

2025-04-29 Thread Dominique Devienne
On Fri, Feb 21, 2025 at 3:44 PM Tom Lane wrote: > Dominique Devienne writes: > > On Fri, Feb 21, 2025 at 3:33 PM Tom Lane wrote: > >> REASSIGN OWNED then DROP OWNED is the recommended path. > > > Hi. Am I missing something? foobar does not OWN anything in this case. &

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 3:29 PM Vydehi Ganti wrote: > Can i know if there is any scenario or ref document for the design you > suggested above? Some docs: https://www.postgresql.org/docs/current/ddl-rowsecurity.html https://satoricyber.com/postgres-security/postgres-row-level-security/ Your Ora

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 3:21 PM Vydehi Ganti wrote: > So I don't have a possibility to append where clause dynamically and can only > check the boolean? Indeed. But given that you can run arbitrary SQL inside the function, even dynamic SQL, that ends up pretty much the same. And you have access

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 3:01 PM Vydehi Ganti wrote: > Then it should build up the lPredicate with the filter condition and append > to the query user runs on the Activity table. You're not reading us, and asking us to do the work for you... RLS Predicates don't return strings in PostgreSQL, but

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 2:43 PM Laurenz Albe wrote: > On Fri, 2025-04-25 at 12:38 +0530, Vydehi Ganti wrote: > > We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, > > compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit > > 2.The function would return a charact

Re: Clarification on RLS policy

2025-04-25 Thread Dominique Devienne
On Fri, Apr 25, 2025 at 9:09 AM Vydehi Ganti wrote: > We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu, > compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit > I have a scenario where > 1.I need to enforce RLS policy on a table for Select by calling a Function

Re: Request for official clarification on SQL parameter parsing changes in PostgreSQL 15 and 16

2025-04-17 Thread Dominique Devienne
On Thu, Apr 17, 2025 at 11:13 AM 王 博 wrote: > Hello PostgreSQL Community, > We have encountered unexpected SQL parsing errors during application upgrades > from PostgreSQL 14 to 15 and 16, related to the use of JDBC-style parameter > placeholders (`?`) in our legacy applications. AFAIK, Postgre

Re: Fwd: Identify system databases

2025-04-16 Thread Dominique Devienne
On Wed, Apr 16, 2025 at 4:39 PM Tom Lane wrote: > Laurenz Albe writes: > > On Wed, 2025-04-16 at 10:09 +0200, Dominique Devienne wrote: So in a way, you guys are saying one should never REVOKE CONNECT ON DATABASE FROM PUBLIC? All my DBs are not PUBLIC-accessible. And inside my DBs,

Re: Fwd: Identify system databases

2025-04-16 Thread Dominique Devienne
On Wed, Apr 16, 2025 at 9:32 AM Laurenz Albe wrote: > On Tue, 2025-04-15 at 17:24 -0700, Adrian Klaver wrote: > But then you fortunately cannot drop all databases, because you cannot > drop the database you are connected to. > > Still, a cluster that is missing "postgres" will give beginners troub

CREATE SCHEMA AUTHORIZATION and ALTER SCHEMA OWNER TO

2025-04-14 Thread Dominique Devienne
Hi. I'm on v16+. The DB owner ROLE has CREATEROLE, and obviously CREATE on the DB. So it can both CREATE SCHEMA, and CREATE ROLE. Yet it cannot CREATE SCHEMA AUTHORIZATION, and gets an ERROR: must be able to SET ROLE "..." Yet because this is v16+, thus the DB owner has ADMIN OPTION on the ROLEs

Re: Event-Triggers for DB owners instead of just SUPERUSER

2025-04-14 Thread Dominique Devienne
On Mon, Apr 14, 2025 at 12:09 PM Wolfgang Walther wrote: > > From Dominique Devienne: > > Can't event-triggers also be available to DB owners, instead of just > > SUPERUSER? > > There's a recent -hackers thread exactly about this: > https

Event-Triggers for DB owners instead of just SUPERUSER

2025-04-14 Thread Dominique Devienne
Hi. I'd like to use CREATE EVENT TRIGGER, but they are SUPERUSER only. In the past, CREATE EXTENSION was also SUPERUSER-only, but is now also available to DB owners. Which is great! Can't event-triggers also be available to DB owbers, instead of just SUPERUSER? Having CREATEDB does not imply ha

Re: Interesting case of IMMUTABLE significantly hurting performance

2025-04-11 Thread Dominique Devienne
On Fri, Apr 11, 2025 at 5:52 AM Tom Lane wrote: > Merlin Moncure writes: > > I guess the real problems here are lack of feedback on a number of fronts: > > *) the server knows the function is not immutable but lets you create it > > anyway, even though it can have negative downstream consequences

Re: After upgrading libpq, the same function(PQftype) call returns a different OID

2025-03-20 Thread Dominique Devienne
On Thu, Mar 20, 2025 at 4:43 PM Sebastien Flaesch wrote: > OR ( I guess I start to understand the code... ) it this comment only for: > #define CASHOID MONEYOID > #define LSNOID PG_LSNOID That's what Tom already replied, yes. --DD

Re: psql and regex not like

2025-03-09 Thread Dominique Devienne
On Thu, Mar 6, 2025 at 11:24 AM Ron Johnson wrote: > I already do that. This is part of a long chain of commands so I'm trying to > minimize the length of commands. but given that your regexp patterns are not anchored, they are not equivalent. I think mine is "more correct". > Anyway, it would

Re: psql and regex not like

2025-03-06 Thread Dominique Devienne
On Thu, Mar 6, 2025 at 10:38 AM Ron Johnson wrote: > This statement runs great from the psql prompt. Does exactly what I want. > select datname from pg_database WHERE datname !~ 'template|postgres' ORDER BY > datname; > > But it doesn't work so well from the bash prompt. Not escaping the "!" >

Re: Keep specialized query pairs, or use single more general but more complex one

2025-02-24 Thread Dominique Devienne
On Mon, Feb 24, 2025 at 5:39 PM Greg Sabino Mullane wrote: > On Mon, Feb 24, 2025 at 4:46 AM Dominique Devienne > wrote: > >> But now we have a new requirement, for "fuzzy find". I.e. the client can >> ask for names >> which are not the exact in-DB n

Re: Keep specialized query pairs, or use single more general but more complex one

2025-02-24 Thread Dominique Devienne
On Mon, Feb 24, 2025 at 3:51 PM Rob Sargent wrote: > API: > > * The first type never relies on fuzzy-find. > > Then have that app type use the simple, fast query. > I'm sorry, but that's neither helpful, nor relevant. --DD

Re: COLLATION update in 13.1

2025-02-24 Thread Dominique Devienne
On Mon, Feb 24, 2025 at 12:33 PM Matthias Apitz wrote: > Thanks for your hint, Jeremy. But this does not work either: > > postgres=# SELECT collname, collversion FROM pg_collation where collname = > 'de_DE.utf8'; > collname | collversion > +- > de_DE.utf8 | 2.38 > (1 r

Keep specialized query pairs, or use single more general but more complex one

2025-02-24 Thread Dominique Devienne
Hi, We have a few dozen queries involving grandparent, parent, child table triplets, to implement a pre-existing API on top of PostgreSQL. That API is not SQL-based nor SQL "friendly" either, that's why we detect patterns in the APIs inputs, to use different SQL queries, as (important) optimizatio

Re: #XX000: ERROR: tuple concurrently updated

2025-02-24 Thread Dominique Devienne
On Thu, Feb 20, 2025 at 4:27 PM Tom Lane wrote: > Dominique Devienne writes: > > Error: DDL Error: GRANT USAGE ON SCHEMA "SCH1", "SCH2" TO "SCH2:RO", > > "SCH2:RW", "SCH2:SU": #XX000: ERROR: tuple concurrently updated > > S

Re: DROP ROLE as SUPERUSER

2025-02-21 Thread Dominique Devienne
On Fri, Feb 21, 2025 at 3:45 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Friday, February 21, 2025, Dominique Devienne > wrote: > >> On Fri, Feb 21, 2025 at 3:33 PM Tom Lane wrote: >> >>> Dominique Devienne writes: >>> > The

Re: DROP ROLE as SUPERUSER

2025-02-21 Thread Dominique Devienne
On Fri, Feb 21, 2025 at 3:33 PM Tom Lane wrote: > Dominique Devienne writes: > > The point I'm trying to make, is that "hunting down" grantor(s) to > connect > > to DB(s) to be able to "force drop" a ROLE is a PITA. And I really wish > > t

Re: DROP ROLE as SUPERUSER

2025-02-21 Thread Dominique Devienne
On Thu, Feb 20, 2025 at 5:52 PM Tom Lane wrote: > So grants and revokes are still being done as the object owner by > default. > > Now I'm unclear on exactly what was happening in Dominique's case. > Was the problematic permission granted by somebody other than the > database's owner? > Here's m

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread Dominique Devienne
On Thu, Feb 20, 2025 at 5:05 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Thursday, February 20, 2025, Dominique Devienne > > wrote: > >> Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE silently > >> did nothing, even with

DROP ROLE as SUPERUSER

2025-02-20 Thread Dominique Devienne
Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE silently did nothing, even with CASCADE, when I was running it as SUPERUSER, preventing DROP'ing the ROLE. I had to manually SET ROLE to the GRANTOR, do the REVOKE, which DID something this time, and then I could DROP the role. That's

Re: #XX000: ERROR: tuple concurrently updated

2025-02-20 Thread Dominique Devienne
On Thu, Feb 20, 2025 at 4:27 PM Tom Lane wrote: > Dominique Devienne writes: > > Hi. A tester just tried to restore two custom backups (not official > > PostgreSQL ones) concurrently. > > ... > > The second session completed OK. > > But the first session errors

#XX000: ERROR: tuple concurrently updated

2025-02-20 Thread Dominique Devienne
Hi. A tester just tried to restore two custom backups (not official PostgreSQL ones) concurrently. The restore process creates a new schema, some roles,and does some role-to-role grants, before loading the data. The two restores are independent, i.e. create different non-overlapping schemas. But b

Re: v18 virtual columns

2025-02-20 Thread Dominique Devienne
On Thu, Feb 20, 2025 at 3:31 PM Ron Johnson wrote: > On Thu, Feb 20, 2025 at 8:07 AM Dominique Devienne > wrote: > >> Hi. I've just read >> https://www.dbi-services.com/blog/postgresql-18-virtual-generated-columns/ >> >> and I'm wondering whether t

v18 virtual columns

2025-02-20 Thread Dominique Devienne
Hi. I've just read https://www.dbi-services.com/blog/postgresql-18-virtual-generated-columns/ and I'm wondering whether there will be a way to ALTER existing STORED generated columns, to be virtual? W/o rewriting the whole table that is. Thanks, --DD

Re: Best Approach for Swapping a Table with its Copy

2025-02-13 Thread Dominique Devienne
On Thu, Feb 13, 2025 at 4:09 PM Greg Sabino Mullane wrote: > On Wed, Feb 12, 2025 at 9:02 PM Marcelo Fernandes > wrote: > >> What I am after is the same, but I seek a deeper understanding of what it >> does, and why it does it. For example, it swaps relfilenode. Why? > > > It is surgically repla

Re: Design of a reliable task processing queue

2025-01-21 Thread Dominique Devienne
On Sun, Jan 19, 2025 at 9:23 AM Alex Burkhart wrote: > I'm looking for help to organize locks and transaction for a reliable task > queue. Have a look at https://github.com/tembo-io/pgmq for inspiration maybe. --DD

Re: Postgres do not support tinyint?

2025-01-10 Thread Dominique Devienne
On Fri, Jan 10, 2025 at 10:13 AM Vladlen Popolitov wrote: > If you really need 1-byte integer, you can use "char" type. Cast it > to/from int. See comment at the end of the page > https://www.postgresql.org/docs/17/datatype-character.html Hi. What would be the best online doc to learn about the p

Re: Will PQsetSingleRowMode get me results faster?

2025-01-06 Thread Dominique Devienne
On Mon, Jan 6, 2025 at 12:21 PM Stijn Sanders wrote: > I've been using LibPQ to get data from PostgreSQL instances with great > success. > I'm using PQsendQuery and PQgetResult, but noticed there's also > PQsetSingleRowMode. > The documentation is clearly stating it only benefits a limited set o

Re: Pipeline Mode vs Single Row Mode / Chunked Rows Mode

2025-01-02 Thread Dominique Devienne
On Thu, Dec 19, 2024 at 3:37 PM Daniel Frey wrote: > I'm adding support for Pipeline Mode to my C++ PostgreSQL client library [...] > Anyway, is there some documentation about how these modes interact and how > they can be combined? Or should they never be combined? Hi. Happy New Year. I was int

Re: Customize psql prompt to show current_role

2024-11-27 Thread Dominique Devienne
On Wed, Nov 27, 2024 at 3:14 PM Raphael Salguero Aragón wrote: > Am 23.09.2024 um 17:37 schrieb Dominique Devienne : > > I'd be glad to use Pavel's proposed %N. —DD > I just wanted to add that we are also supporting a larger customer with > exactly the same request. >

Re: Fwd: A million users

2024-11-13 Thread Dominique Devienne
On Wed, Nov 13, 2024 at 11:29 AM Alvaro Herrera wrote: > On 2024-Nov-13, Vijaykumar Jain wrote: > > I tried to grant select permissions to 5000 different roles on one table, > > It failed with row size too big already at 2443. > > But you can grant select to one "reader" role, and grant that one r

Re: About the stability of COPY BINARY data

2024-11-07 Thread Dominique Devienne
On Thu, Nov 7, 2024 at 7:04 PM Adrian Klaver wrote: > On 11/7/24 09:55, Dominique Devienne wrote: > > On Thu, Nov 7, 2024 at 6:39 PM Daniel Verite > > wrote: > >> Dominique Devienne wrote: > >>> Also, does the code for per-type _send() and _recv()

Re: About the stability of COPY BINARY data

2024-11-07 Thread Dominique Devienne
On Thu, Nov 7, 2024 at 6:39 PM Daniel Verite wrote: > Dominique Devienne wrote: > > Also, does the code for per-type _send() and _recv() functions > > really change across versions of PostgreSQL? How common are > > instances of such changes across versions?

Re: About the stability of COPY BINARY data

2024-11-07 Thread Dominique Devienne
On Thu, Nov 7, 2024 at 5:37 PM Adrian Klaver wrote: > > On 11/6/24 08:20, Dominique Devienne wrote: > >>From https://www.postgresql.org/docs/current/sql-copy.html: > > |> binary-format file is less portable across machine architectures > > and PostgreSQL versions

About the stability of COPY BINARY data

2024-11-06 Thread Dominique Devienne
>From https://www.postgresql.org/docs/current/sql-copy.html: |> binary-format file is less portable across machine architectures and PostgreSQL versions In my experience, the binary encoding of binding/resultset/copy is endian neutral (network byte order), so what is the less portable across machi

Re: Switching to NOINHERIT user triggers #XX000 error

2024-11-05 Thread Dominique Devienne
On Tue, Nov 5, 2024 at 7:25 PM Tom Lane wrote: > Dominique Devienne writes: > > On Tue, Nov 5, 2024 at 6:42 PM Tom Lane wrote: > >> This is probably a bug, at least to the extent that we don't like > >> XX000 errors to be easily reachable, so please le

Re: Switching to NOINHERIT user triggers #XX000 error

2024-11-05 Thread Dominique Devienne
On Tue, Nov 5, 2024 at 6:42 PM Tom Lane wrote: > Dominique Devienne writes: > > On v16 and v17 though, it works with INHERIT, but with NOINHERIT, I get: > > GRANT "...:USER" TO "ddevienne" #XX000: ERROR: no possible grantors > > Any clue to what this m

Switching to NOINHERIT user triggers #XX000 error

2024-11-05 Thread Dominique Devienne
Hi. Still working on porting our stuff to v16+, with the ROLE changes. I'm facing a new issue. The same code and unit test works in v14, when the LOGIN user running the test is INHERIT or NOINHERIT. On v16 and v17 though, it works with INHERIT, but with NOINHERIT, I get: GRANT "...:USER" TO "dde

Re: COPY documentation with regard to references constraints

2024-10-31 Thread Dominique Devienne
On Thu, Oct 31, 2024 at 1:04 PM Bruno Wolff III wrote: > I was unable to find any documentation clarifying if using COPY to load a > table with rows referencing others rows in the same table, whether I > had to worry about ordering of the input. > What I found (in 17) is that even if the reference

Re: Regression in Postgres 17?

2024-10-22 Thread Dominique Devienne
On Tue, Oct 22, 2024 at 6:03 PM Achilleas Mantzios wrote: > Στις 22/10/24 18:54, ο/η Colin 't Hart έγραψε: > This works in Postgres 15: > Do this instead : > create function json_test(out value text, out jsonparam jsonb) ... > apparently json is a reserved word (now) and won't be accepted as funct

Re: What are best practices wrt passwords?

2024-10-16 Thread Dominique Devienne
On Wed, Oct 16, 2024 at 2:25 PM wrote: > I'd like to be able to use psql without typing passwords again and > again. I know about `.pgpass` and PGPASSFILE, but I specifically do not > want to use it - I have the password in the `.env` file, and having it > in _two_ places comes with its own set o

Advice on efficiently logging outputs to PostgreSQL

2024-10-15 Thread Dominique Devienne
I have an existing heavy ETL that serially loads tons of data to PostgreSQL. This is done using a CLI tool, processing one project after another. I'd like to parallelize / distribute the work, which I could do from my CLI tool, but 1) that would be confined to a single machine, and 2) we'd like to

Re: Tablespace ACLs

2024-10-10 Thread Dominique Devienne
On Thu, Oct 10, 2024 at 4:19 PM Erik Wienhold wrote: > > > On 2024-10-10 14:35 +0200, Dominique Devienne wrote: > > > > On a related but different matter, is it normal not having access to a > > > > single tablespace makes the whole output disappear? >

Re: Tablespace ACLs

2024-10-10 Thread Dominique Devienne
On Thu, Oct 10, 2024 at 3:40 PM Erik Wienhold wrote: > On 2024-10-10 14:35 +0200, Dominique Devienne wrote: > > Hi. Why isn't the ::regrole::text cast working as usual? > > Aren't the OIDs for grantor and grantee returned by acldefault() valid > > ROLEs? >

Tablespace ACLs

2024-10-10 Thread Dominique Devienne
Hi. Why isn't the ::regrole::text cast working as usual? Aren't the OIDs for grantor and grantee returned by acldefault() valid ROLEs? C:\Users\ddevienne>psql service=... psql (17.0) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: postgresql) Type "help"

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 5:16 PM Adrian Klaver wrote: > On 9/23/24 08:07, Dominique Devienne wrote: > > I often resort to \conninfo, but it's less automatic and > > harder to visually parse (IMHO) compared to a custom ad-hoc prompt. > For me that shows the user that conn

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 4:55 PM Tom Lane wrote: > Laurenz Albe writes: > > To get the current role, psql would have to query the database whenever > > it displays the prompt. That would be rather expensive... > > See previous discussion: > https://www.postgresql.org/message-id/flat/CAFj8pRBFU-Wz

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 3:05 PM Laurenz Albe wrote: > On Mon, 2024-09-23 at 14:59 +0200, Dominique Devienne wrote: > > On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold wrote: > > > You could instead use this: > > > > > > SELECT current_role \gset > >

Re: Customize psql prompt to show current_role

2024-09-23 Thread Dominique Devienne
On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold wrote: > You could instead use this: > > SELECT current_role \gset > \set PROMPT1 '%n@%/ (%:current_role:)=%# ' > > But that won't work with subsequent SET ROLE commands. Bummer... That was kinda the point, that it updates automatically. Then

Re: Why no pg_has_role(..., 'ADMIN')?

2024-09-23 Thread Dominique Devienne
On Fri, Sep 20, 2024 at 8:49 PM Robert Haas wrote: > On Fri, Sep 20, 2024 at 2:34 PM Tom Lane wrote: > > I'm now inclined to add wording within the pg_has_role entry > I don't have an opinion about the details, but +1 for documenting it +1 as well. Especially since I now recall, in hindsight, ab

Re: Why no pg_has_role(..., 'ADMIN')?

2024-09-23 Thread Dominique Devienne
On Fri, Sep 20, 2024 at 6:51 PM Robert Haas wrote: > On Fri, Sep 20, 2024 at 12:37 PM Laurenz Albe > wrote: > > That would be a useful addition, yes. > > I think this already exists. The full list of modes supported by > pg_has_role() is listed in convert_role_priv_string(). You can do > somethi

  1   2   3   4   >