Re: PLPGSQL - store fetched records in array of record
On Wed, Jul 2, 2025 at 8:21 AM Durumdara wrote: > Hello! > > I have to store some fetched records into two lists (arrays) to work with > them. > There's almost certainly a way to do what you need done without using arrays. Might require a bit of rethinking, though. -- Death to , and butter sauce. Don't boil me, I'm still alive. lobster!
Re: Simulate a PITR in postgresql 16
I don't know exactly what I did wrong but redoing what I described in the email worked perfectly! Thanks everyone! Enviado do Gmail para celular Em seg., 30 de jun. de 2025 às 15:35, Franklin Anderson de Oliveira Souza < frankli...@gmail.com> escreveu: > I'm trying to simulate a PITR in postgresql 16 with the following steps: > > directorys: > /data/primary > /data/base > /data/wals > /data/csv > > 1- Create cluster to primary postgresql: > /usr/pgsql-16/bin/initd -D /data/primary > > 2- Start Cluster ( port) > /usr/pgsql-16/bin/pg_ctl -D /data/primary start > > 3- Create Database, table, user and slot: > create database "Foo"; > \c Foo; > create table public.acme(hash text); > create role "UserReplication" with login password '123' replication; > select pg_create_physical_replication_slot('slot_wals'); > > 4- Start pg_receivewal: > /usr/pgsql-16/bin/pg_receivewal --host=localhost --port= > --username=UserReplication --slot=slot_wals --verbose --no-loop > --directory=/data/wals > > 5- Load file csv on primary server > \COPY public.acme(hash) FROM '/data/csv/file_21444.csv' WITH (FORMAT csv); > > example of file contents: > $ head -n 10 /data/csv/file_21444.csv > hash > 0b035a242b54076056a59 > 4be85c5bcc5fe22191933 > bb5632427c397b421b928 > 6ad913964b556d93379d7 > 99a072b776804e115bb2e > 199834e3fe2d244e09543 > ba296a09a91423401c901 > 9657bfcae2e017e9d6f42 > 0e2d4b2594006930da843 > > At this point wals were created in the /data/wals directory by > pg_receivewal due to the applied load of item 5 on the primary server. > > 6- Create pg_basebackup > pg_basebackup -U UserReplication -h localhost -p -P -v > --wal-method=stream --checkpoint=fast -D /data/base/ > > 7- New load file csv on primary server > \COPY public.acme(hash) FROM '/data/csv/file_38629.csv' WITH (FORMAT csv); > > more wals were created by pg_receivewal with new data load. > > Now I will start the cluster generated by pg_basebackup with the > restore_command parameter > configured to feed on the wals logs generated from the last data load, > thus leaving it updated with the same data as the primary: > > 8- Restore Command Parameter > restore_command = 'cp /data/wals/%f %p' # command to use to restore an > archived WAL file > > and > > touch /data/base/recovery.signal > > 9- Start Cluster ( port) > /usr/pgsql-16/bin/pg_ctl -D /data/base start > > but when I see the logs I have a surprise > > - > LOG: starting PostgreSQL 16.3 on x86_64-pc-linux-gnu, compiled by gcc > (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22), 64-bit > LOG: listening on IPv6 address "::1", port > LOG: listening on IPv4 address "127.0.0.1", port > LOG: listening on Unix socket "/run/postgresql/.s.PGSQL." > LOG: listening on Unix socket "/tmp/.s.PGSQL." > LOG: database system was shut down at 2025-06-30 12:15:28 -04 > cp: cannot stat '/dados/temp/wals/0002.history': No such file or > directory > - > > > The restore_command requires the .history file but it does not exist > in any of the clusters in this simple test, which is wrong in this > example ? Tanks > > -- > foobar >
Re: PLPGSQL - store fetched records in array of record
Sorry. I forgot to mention that I have two arrays (records). One for the modifiable elements, and one for the checkable elements. If there is a conflict between the actual mod. item and one of the checkable items, the checkable item will move to the end of the modification list. And the actual mod. item starting time could be changed in this process. First I imagined a temporary table, but I felt this has too much overhead against an "in memory" array. UPDATE, INSERT, DELETE and reopen after each modification. Ron Johnson ezt írta (időpont: 2025. júl. 2., Sze, 15:29): > On Wed, Jul 2, 2025 at 8:21 AM Durumdara wrote: > >> Hello! >> >> I have to store some fetched records into two lists (arrays) to work with >> them. >> > > There's almost certainly a way to do what you need done without using > arrays. Might require a bit of rethinking, though. > > -- > Death to , and butter sauce. > Don't boil me, I'm still alive. > lobster! >
Re: PLPGSQL - store fetched records in array of record
On 7/2/25 07:26, Durumdara wrote: Sorry. I forgot to mention that I have two arrays (records). One for the modifiable elements, and one for the checkable elements. If there is a conflict between the actual mod. item and one of the checkable items, the checkable item will move to the end of the modification list. And the actual mod. item starting time could be changed in this process. First I imagined a temporary table, but I felt this has too much overhead against an "in memory" array. UPDATE, INSERT, DELETE and reopen after each modification. Assuming it is installed and you have the necessary permissions there is plpython3u. As it is Python it is looser on types. As example: CREATE OR REPLACE FUNCTION public.python_test() RETURNS void LANGUAGE plpython3u AS $function$ rec_list = [] for row in plpy.cursor("select category_fk, cell_per from cell_per where cell_per > 1"): rec_list.append({"cat": row["category_fk"], "cp": row["cell_per"]}) plpy.notice(rec_list) $function$ ; select * from python_test(); NOTICE: [{'cat': 'HERB 3.5', 'cp': 18}, {'cat': 'H PREM 3.5', 'cp': 18}, {'cat': 'HERB 2.5', 'cp': 32}, {'cat': 'H PREM 2.5', 'cp': 32}, {'cat': 'GER SC 3.5', 'cp': 18}, {'cat': 'SUCCULENTS', 'cp': 18}] python_test - (1 row) Ron Johnson mailto:ronljohnso...@gmail.com>> ezt írta (időpont: 2025. júl. 2., Sze, 15:29): On Wed, Jul 2, 2025 at 8:21 AM Durumdara mailto:durumd...@gmail.com>> wrote: Hello! I have to store some fetched records into two lists (arrays) to work with them. There's almost certainly a way to do what you need done without using arrays. Might require a bit of rethinking, though. -- Death to , and butter sauce. Don't boil me, I'm still alive. lobster! -- Adrian Klaver adrian.kla...@aklaver.com
Re: Postgresql support for Windows Server 2025
On 7/2/25 07:42, Gaurav Aradhya wrote: Greetings, Can you please let me know when Postgresql 17.x shall be supported for Windows Server 2025? Greatly appreciated your feedback. The Windows packaging is done by EDB, someone from there will need to see this and respond or you could contact them directly. In the meantime you could install it on Windows 2025 and let us know if it worked. Thanks Gaurav -- Adrian Klaver adrian.kla...@aklaver.com
PLPGSQL - store fetched records in array of record
Hello! I have to store some fetched records into two lists (arrays) to work with them. I can use the RECORD type in a FOR SELECT loop to get one row data. declare f record; begin for f in select title, length But if I tried to define an "array of record", I got an error message. declare R_A record[]; < some error So I can't store the fetched data into an array simply. Ok, I found a solution when I define a TYPE, and I use this: declare f TMy_Record; R_A TMy_Record[]; Then I can work with the data. But this means a dependency, so I can't change the TYPE without pre-dropping the stored procedure (and without recreating after). Is there any way to avoid this? To use a "simple untyped record" in an array without "dependencies"? Thank you for the answer! Best regards dd
Re: Postgresql support for Windows Server 2025
On Wed, 2025-07-02 at 20:12 +0530, Gaurav Aradhya wrote: > Can you please let me know when Postgresql 17.x shall be supported for > Windows Server 2025? Greatly appreciated your feedback. If you want to know if it is working, the best answer is "as soon as someone donates a Windows 2025 buildfarm member". For now, trying it and seeing if it works for you is your best bet. If you run into trouble, people will try to help, but if code changes are required, that's going to be difficult until some hackers start using that version. Yours, Laurenz Albe
Re: PLPGSQL - store fetched records in array of record
On Wednesday, July 2, 2025, Durumdara wrote: > > > Is there any way to avoid this? To use a "simple untyped record" in an > array without "dependencies"? > Use jsonb David J.
Postgresql support for Windows Server 2025
Greetings, Can you please let me know when Postgresql 17.x shall be supported for Windows Server 2025? Greatly appreciated your feedback. Thanks Gaurav
Re: Postgresql support for Windows Server 2025
On Wednesday, July 2, 2025, Gaurav Aradhya wrote: > > Can you please let me know when Postgresql 17.x shall be supported for > Windows Server 2025? Greatly appreciated your feedback. > Impossible to guess when someone may choose to set up a build farm member running that OS. David J.