Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Tom Lane
Bryn Llewellyn writes: > I've seen this pattern in use: > create temp table if not exists pg_temp.flag(val boolean not null) on > commit delete rows; > insert into pg_temp.flag(val) values(true); > But doing a DDL before every use of the session-state representation felt > heavier than ass

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > >> b...@yugabyte.com writes: >> >> get stacked diagnostics msg = message_text; >> if msg != 'relation "pg_temp.flag" does not exist' then > > This is pretty fragile --- eg, it will fall over with translated messages. I > think you could presume that if the error

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Ron
On 10/1/22 15:42, Ron wrote: On 10/1/22 14:54, Christoph Moench-Tegeder wrote: ## Ron (ronljohnso...@gmail.com): The question then is "why am I just now seeing the problem?"  We've been using v12 for two years, and it just happened. The only recent change is that I upgraded it from RDS 12.10

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Ron
On 10/1/22 14:54, Christoph Moench-Tegeder wrote: ## Ron (ronljohnso...@gmail.com): The question then is "why am I just now seeing the problem?"  We've been using v12 for two years, and it just happened. The only recent change is that I upgraded it from RDS 12.10 to 12.11 a couple of weeks ago

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Christoph Moench-Tegeder
## Ron (ronljohnso...@gmail.com): > The question then is "why am I just now seeing the problem?"  We've been > using v12 for two years, and it just happened. > > The only recent change is that I upgraded it from RDS 12.10 to 12.11 a > couple of weeks ago. That's correlation, but no proof for c

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Tom Lane
Bryn Llewellyn writes: > get stacked diagnostics msg = message_text; > if msg != 'relation "pg_temp.flag" does not exist' then This is pretty fragile --- eg, it will fall over with translated messages. I think you could presume that if the error condition name is undefined_table then you kno

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > > Up to now, there's been an intentional policy of not documenting > > « > 20.16. Customized Options > https://www.postgresql.org/docs/14/runtime-config-custom.html > > » > > very prominently[*], becau

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Ron
On 10/1/22 07:21, Christoph Moench-Tegeder wrote: ## Ron (ronljohnso...@gmail.com): Note how quickly it runs the first five times, but takes 780x longer the sixth time I run it.  Exiting psql and entering again causes the same slowness the sixth time it's run. Tanks at the sixth time? That rin

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Ron
On 10/1/22 07:20, Peter J. Holzer wrote: On 2022-10-01 02:22:22 -0500, Ron wrote: I extracted the singleton into a function, and that helped me isolate the problem. I don't know what a singleton select is (duckduckgo tells me it has something to do with DB2 and/or COBOL, or maybe it's a whisky)

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Tom Lane
"Peter J. Holzer" writes: > On 2022-10-01 20:24:21 +0800, Julien Rouhaud wrote: >> This is intentional, and documented at >> https://www.postgresql.org/docs/14/runtime-config-custom.html. > So it's there but hard to find (I did read the table of contents at > https://www.postgresql.org/docs/14/ru

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Peter J. Holzer
On 2022-10-01 20:24:21 +0800, Julien Rouhaud wrote: > On Sat, Oct 01, 2022 at 02:05:53PM +0200, Peter J. Holzer wrote: > > On 2022-09-30 17:59:01 -0700, Bryn Llewellyn wrote: > > > set rls.tenant_id=42; > > > > This works because there is a "." in the name. Without the "." > > PostgreSQL complains:

Re: Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Julien Rouhaud
Hi, On Sat, Oct 01, 2022 at 02:05:53PM +0200, Peter J. Holzer wrote: > On 2022-09-30 17:59:01 -0700, Bryn Llewellyn wrote: > > set rls.tenant_id=42; > > This works because there is a "." in the name. Without the "." > PostgreSQL complains: > > hjp=> set rls_tenant_id=42; > ERROR: unrecognized con

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Christoph Moench-Tegeder
## Ron (ronljohnso...@gmail.com): > Note how quickly it runs the first five times, but takes 780x longer the > sixth time I run it.  Exiting psql and entering again causes the same > slowness the sixth time it's run. Tanks at the sixth time? That rings a bell: "The current rule for this is that

Re: Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Peter J. Holzer
On 2022-10-01 02:22:22 -0500, Ron wrote: > I extracted the singleton into a function, and that helped me isolate the > problem. I don't know what a singleton select is (duckduckgo tells me it has something to do with DB2 and/or COBOL, or maybe it's a whisky), but: > Note how quickly it runs the

Names of run-time configuration parameters (was: Limiting the operations that client-side code can perform upon its database backend's artifacts)

2022-10-01 Thread Peter J. Holzer
On 2022-09-30 17:59:01 -0700, Bryn Llewellyn wrote: > set rls.tenant_id=42; This works because there is a "." in the name. Without the "." PostgreSQL complains: hjp=> set rls_tenant_id=42; ERROR: unrecognized configuration parameter "rls_tenant_id" I think I sort of knew this but had forgotten

Re: Limiting the operations that client-side code can perform upon its database backend's artifacts

2022-10-01 Thread Peter J. Holzer
On 2022-09-30 17:59:01 -0700, Bryn Llewellyn wrote: > hjp-pg...@hjp.at wrote: > b...@yugabyte.com wrote: > Paraphrasing Peter, the design of the application's RDBMS backend has > to implement its own notions of roles and privileges as a new layer on > top of what

Example code Re: Singleton SELECT inside cursor loop

2022-10-01 Thread Ron
I extracted the singleton into a function, and that helped me isolate the problem. Note how quickly it runs the first five times, but takes 780x longer the sixth time I run it.  Exiting psql and entering again causes the same slowness the sixth time it's run. sides=> select strans.TASK001785