Get cursor name for invalid_cursor_name error

2024-10-07 Thread PetSerAl
How to reliable get cursor name which cause invalid_cursor_name error? postgres=# CREATE FUNCTION value_from_cursor_unsafe(cursor_name text) RETURNS integer postgres-# STRICT LANGUAGE plpgsql postgres-# AS $$ postgres$# DECLARE postgres$# cursor CONSTANT refcursor NOT NULL := cursor_name; po

Re: Postgresql range_agg() Return empty list

2024-07-11 Thread PetSerAl
Your update expression does not handle empty ranges properly, but convert them into complete ranges. https://dbfiddle.uk/Ia6wESpL On Thu, Jul 11, 2024 at 5:55 PM Han Tang wrote: > > Hi > > Hope you are doing well! > > I am using range_agg() function, it works fine with original table value > > Q

Re: pg_dump and not MVCC-safe commands

2024-05-20 Thread PetSerAl
> However, it would be the very same > database state that any other query would see at that time. Other queries can use different techniques to prevent this. For example, lock tables before snapshot, as recommended in documentation. I understand, that pg_dump can not use that, as it need snapshot

Re: pg_dump and not MVCC-safe commands

2024-05-20 Thread PetSerAl
My question: What happens if not MVCC-safe command committed after snapshot but before lock? On Mon, May 20, 2024 at 12:33 PM Guillaume Lelarge wrote: > > Hi, > > Le lun. 20 mai 2024 à 11:27, PetSerAl a écrit : >> >> How pg_dump interact with not MVCC-safe command

pg_dump and not MVCC-safe commands

2024-05-20 Thread PetSerAl
How pg_dump interact with not MVCC-safe commands? As I understand, pg_dump first take snapshot and then lock all tables it intended to dump. What happens if not MVCC-safe command committed after snapshot but before lock? From comment to pg_dump.c I understand that it may fail with 'cache lookup fa

Single-User Mode oid assignment

2024-03-18 Thread PetSerAl
I have following script, which initialize two clusters: echo CREATE ROLE new_user WITH LOGIN;>init_cluster.sql echo CREATE DATABASE new_database WITH OWNER = new_user;>>init_cluster.sql initdb -D case1 -U postgres pg_ctl start -D case1 -w psql "host=localhost dbname=postgres user=postgres"OIDs ass