Re: pgcrypto - real life examples to encrypt / decrypt

2021-08-03 Thread Vikas Sharma
Thanks Adrian, I will check them out. Regards Vikas S On Mon, 2 Aug 2021 at 22:22, Adrian Klaver wrote: > On 8/2/21 2:14 PM, Vikas Sharma wrote: > > Dear Experts, > > > > Could you please share some real life examples of using pgcrypto in > > production? > > > > I am planning to use it in our

Re: pgcrypto - real life examples to encrypt / decrypt

2021-08-03 Thread Luca Ferrari
On Mon, Aug 2, 2021 at 11:14 PM Vikas Sharma wrote: > > Dear Experts, > > Could you please share some real life examples of using pgcrypto in > production? > > I am planning to use it in our environment and wondering what could be the > best practice for its use. It is not clear what you are go

Re: Unexpected block ID found when reading data

2021-08-03 Thread Luca Ferrari
On Tue, Aug 3, 2021 at 4:49 AM Gilar Ginanjar wrote: > pgrestore command: > pg_restore -U myuser -j8 -d mydb dbdump.backup > As a desparate approach I would try to use options -L and -l to extract objects from the backup and restore a small subset of them, in order to find out where the error is.

Re: pgcrypto - real life examples to encrypt / decrypt

2021-08-03 Thread Vikas Sharma
Thank you Luca, For now I have seen the below: pgp_pub_encrypt -- using public gpg key pgp_pub_decrypt -- using secret gpg key Select crypt('test', gen_salt('md5')); Select PGP_SYM_DECRYPT(PGP_SYM_ENCRYPT('Some data','Secret password','compress-algo=1, cipher-algo=aes256'),'Secret password');

Re: Unexpected block ID found when reading data

2021-08-03 Thread Gilar Ginanjar
Hi, Luca Thanks for the response. I’ve tried with option -L and -l before. The schema is fine, but sadly when i try to restore only data on the tables i need, it comes up with the error. Is there any small chance I can view/save/restore my data? I desperately need it. Many thanks. > On 3 Au

Re: Unexpected block ID found when reading data

2021-08-03 Thread Luca Ferrari
On Tue, Aug 3, 2021 at 1:16 PM Gilar Ginanjar wrote: > Is there any small chance I can view/save/restore my data? I desperately need > it. > I guess there is not much left to do. I will try doing a pg_restore -t one table at a time to limit the damage, assuming that --section=data is not working

Re: pgcrypto - real life examples to encrypt / decrypt

2021-08-03 Thread Luca Ferrari
On Tue, Aug 3, 2021 at 1:03 PM Vikas Sharma wrote: > My question is, can I use the gpg public/secret key instead of the 'Secret > password' in above PGP_Sym_encrypt/decrypt? I can create a wrapper function > to read the public/secret keys to hide it from appearing as clear text. I think you ar

Re: Postgres 9.6 to 12.7 pg_upgrade error - terminating connection due to administrator command

2021-08-03 Thread Luca Ferrari
On Mon, Aug 2, 2021 at 10:31 PM Dhanush D wrote: > > Sharing more context on this: if I run > > /usr/pgsql-9.6/bin/pg_dump -d -t public.auth_permission; > > I see multiple "CREATE SEQUENCE public.auth_permission_id_seq" commands. > This seems unusual. > Seems there is either a problem on the c

Re: Unexpected block ID found when reading data

2021-08-03 Thread Vijaykumar Jain
On Tue, 3 Aug 2021 at 08:19, Gilar Ginanjar wrote: > Hi, Adrian > > Thanks in advance. > > pdgump command: > pg_dump -U myuser -Fc -Z3 -d mydb > dbdump.backup > > I'm not sure which pg_dump version did i use before, but I used psql 12.5 > to dump and the db version is postgresql 9.6. > > pgrestor

Re: pgcrypto - real life examples to encrypt / decrypt

2021-08-03 Thread Joe Conway
On 8/3/21 8:43 AM, Luca Ferrari wrote: On Tue, Aug 3, 2021 at 1:03 PM Vikas Sharma wrote: My question is, can I use the gpg public/secret key instead of the 'Secret password' in above PGP_Sym_encrypt/decrypt? I can create a wrapper function to read the public/secret keys to hide it from appe

Re: pgcrypto - real life examples to encrypt / decrypt

2021-08-03 Thread Vikas Sharma
Thanks you Guys, These are very helpful pointers. I will go away and see how much depth I do need. Regards Vikas S. On Tue, 3 Aug 2021 at 14:36, Joe Conway wrote: > On 8/3/21 8:43 AM, Luca Ferrari wrote: > > On Tue, Aug 3, 2021 at 1:03 PM Vikas Sharma wrote: > >> My question is, can I use the

Re: Unexpected block ID found when reading data

2021-08-03 Thread Tom Lane
Vijaykumar Jain writes: > On Tue, 3 Aug 2021 at 08:19, Gilar Ginanjar > wrote: >> I'm not sure which pg_dump version did i use before, but I used psql 12.5 >> to dump and the db version is postgresql 9.6. >> >> pgrestore command: >> pg_restore -U myuser -j8 -d mydb dbdump.backup >> >> I’ve trie

Re: Unexpected block ID found when reading data

2021-08-03 Thread Gilar Ginanjar
I’m not sure which patch version i used to dump, but i was using postgre 12.5 for pg_dump back then. I’m running pg_restore -f dbdump.backup right now, I think it will take some times because it has a large size (around 9 GB). There are no issues yet. Thanks for advice. > On 3 Aug 2021, at 20

Re: Unexpected block ID found when reading data

2021-08-03 Thread Gilar Ginanjar
Yes, i’ve found at some forums (DBeaver) that it is a bug on pg_restore. Hopefully so, so that I have hope to restore my data later. This is the output for "pg_restore —version”: pg_restore (PostgreSQL) 12.7 And this are some "pg_restore -l -v dbdump.backup” output: ; dbname: mydb ;

Re: Unexpected block ID found when reading data

2021-08-03 Thread Adrian Klaver
On 8/3/21 8:20 AM, Gilar Ginanjar wrote: Yes, i’ve found at some forums (DBeaver) that it is a bug on pg_restore. The specific bug being? Hopefully so, so that I have hope to restore my data later. This is the output for "pg_restore —version”: pg_restore (PostgreSQL) 12.7 And this are so

Re: Unexpected block ID found when reading data

2021-08-03 Thread Tom Lane
Gilar Ginanjar writes: > This is the output for "pg_restore —version”: > pg_restore (PostgreSQL) 12.7 Hmph. That's current, so it has the bug fixes that I thought might be related. Either you've hit a previously-unknown bug, or the file actually is corrupt :-(. Have you tried running the rest

Re: Obsolete or dead serverconnections after reboot

2021-08-03 Thread Peter J. Holzer
On 2021-07-26 09:31:03 +0200, WR wrote: > Now on my Laptops the shutdown of the postgres-service works too. > > I had to switch off the "Schnellstart" (in english something like "fast > start" or "fast boot"), which can be found under Settings > System > Energy > Options > Behavior when pushing th

Re: pg_restore (fromuser -> touser)

2021-08-03 Thread Peter J. Holzer
On 2021-07-27 09:43:45 +0800, Ben Madin wrote: > Hi - we have had to do such operations quite commonly, if you want to automate > / stream such a change I would suggest that you look into sed. Off the top of > my head, consider something like this: > > pg_dump --format=p --schema=schema_a original