PostgreSQL CHECK Constraint

2021-10-03 Thread Shaozhong SHI
Has anyone got experience with data quality checking, validation and reporting within PostgreSQL? How best to use PostgreSQL CHECK Constraint for data quality checking, validation and reporting? Can we report on errors in a detailed and specific way? For instance, can we produce report on specif

PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread FOUTE K . Jaurès
Hello, I want to order tables based on the foreign key so that I can delete tables one by one without facing "ERROR: update or delete on table "table" violates foreign key constraint. DETAIL: Key is still referenced from table" Any help is appreciated. Thank you in advance. Best regards Jaurès F

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread Karsten Hilbert
Am Sun, Oct 03, 2021 at 08:48:13AM +0100 schrieb FOUTE K. Jaurès: > I want to order tables based on the foreign key so that I can delete tables > one by one without facing "ERROR: update or delete on table "table" > violates foreign key constraint. DETAIL: Key is still referenced from table" drop

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread Thomas Kellerer
FOUTE K. Jaurès schrieb am 03.10.2021 um 09:48: I want to order tables based on the foreign key so that I can delete tables one by one without facing "ERROR: update or delete on table "table" violates foreign key constraint. DETAIL: Key is still referenced from table" You can create the foreign

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread Andreas Joseph Krogh
På søndag 03. oktober 2021 kl. 10:49:49, skrev Thomas Kellerer mailto:sham...@gmx.net>>: FOUTE K. Jaurès schrieb am 03.10.2021 um 09:48: > I want to order tables based on the foreign key so that I can delete > tables one by one without facing "ERROR: update or delete on table > "table" violate

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Christian Ramseyer
On 03.10.21 09:31, Shaozhong SHI wrote: > > Has anyone got experience with data quality checking, validation and > reporting within PostgreSQL? > > How best to use PostgreSQL CHECK Constraint for data quality checking, > validation and reporting?   > > Can we report on errors in a detailed an

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread FOUTE K . Jaurès
Thanks for your input but I want to make a delete with where clause On Sun, 3 Oct 2021, 10:26 Andreas Joseph Krogh, wrote: > På søndag 03. oktober 2021 kl. 10:49:49, skrev Thomas Kellerer < > sham...@gmx.net>: > > FOUTE K. Jaurès schrieb am 03.10.2021 um 09:48: > > I want to order tables based o

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread Adrian Klaver
On 10/3/21 7:40 AM, FOUTE K. Jaurès wrote: Thanks for your input but I want to make a delete with where clause Then Thomas Kellerer's suggestion of having "ON DELETE CASCADE" on the FK would seem to be what you need. If not then you will need to provide more information about what you are try

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread FOUTE K . Jaurès
I need to delete data from about 100 table in the production system for a specific client without stopping application. On Sun, 3 Oct 2021, 17:19 Adrian Klaver, wrote: > On 10/3/21 7:40 AM, FOUTE K. Jaurès wrote: > > Thanks for your input but I want to make a delete with where clause > > Then Th

pg_dump save command in output

2021-10-03 Thread Joao Miguel Ferreira
Hello all, is there a way to ask pg_dump to save a comment in the output file with the full command it is executing ? thank you Joao

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread Adrian Klaver
On 10/3/21 9:24 AM, FOUTE K. Jaurès wrote: Please don't top post, inline/bottom posting is the preferred style on this list. I need to delete data from about 100 table in the production system for a specific client without stopping application. Honestly that is not that much more informativ

Re: pg_dump save command in output

2021-10-03 Thread Adrian Klaver
On 10/3/21 9:56 AM, Joao Miguel Ferreira wrote: Hello all, is there a way to ask pg_dump to save a comment in the output file with the full command it is executing ? No. What information is the comment trying to convey? Are you dumping in plain or custom format? thank you Joao -- Adr

Re: pg_dump save command in output

2021-10-03 Thread Joao Miguel Ferreira
On Sun, Oct 3, 2021 at 6:03 PM Adrian Klaver wrote: > On 10/3/21 9:56 AM, Joao Miguel Ferreira wrote: > > Hello all, > > > > is there a way to ask pg_dump to save a comment in the output file with > > the full command it is executing ? > > No. > > What information is the comment trying to convey?

Re: pg_dump save command in output

2021-10-03 Thread Karsten Hilbert
Am Sun, Oct 03, 2021 at 06:15:54PM +0100 schrieb Joao Miguel Ferreira: > I just wanted to save the command inside the SQL file to be able to > "remember" it later. ideally I would open the file on some text editor and > see the original pg_dump command on the few first lines, as a comment > > -- o

Re: pg_dump save command in output

2021-10-03 Thread Adrian Klaver
On 10/3/21 10:15 AM, Joao Miguel Ferreira wrote: I just wanted to save the command inside the SQL file to be able to "remember" it later. ideally I would open the file on some text editor and see the original pg_dump command on the few first lines, as a comment -- original command was: psq

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Shaozhong SHI
Hi, Christian, That is interesting. Can errors be captured and saved as data with scripting? Regards, David On Sunday, 3 October 2021, Christian Ramseyer wrote: > > > On 03.10.21 09:31, Shaozhong SHI wrote: > > > > Has anyone got experience with data quality checking, validation and > > reporti

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Karsten Hilbert
Am Sun, Oct 03, 2021 at 07:16:32PM +0100 schrieb Shaozhong SHI: > That is interesting. Can errors be captured and saved as data with > scripting? Depends on what the script does. If the script runs (or is written in) Python the canonical PG driver (psycopg2/3) will give you such data. Karsten

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Shaozhong SHI
Hi, Kirsten, That sounds brilliant. Are there any examples on the web these days? Regards, David On Sunday, 3 October 2021, Karsten Hilbert wrote: > Am Sun, Oct 03, 2021 at 07:16:32PM +0100 schrieb Shaozhong SHI: > > > That is interesting. Can errors be captured and saved as data with > > scrip

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Christian Ramseyer
> The reported error looks like this: > > postgres@dellstore ERROR: new row for relation "test_customers" > violates check constraint "check_age" .. > > This errors appears in the serverlog which has many format and > forwarding options, you can read about them here: On 03.10.

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Shaozhong SHI
Hi, Christian, Brilliant! Some years ago, I did something similar and saved problematic ones for data collector. Now, I am reviewing to see whether there be any elegant way to automate reporting and giving feedback. Regards, David On Sunday, 3 October 2021, Christian Ramseyer wrote: > > The

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Karsten Hilbert
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- Karsten Sure, they are just a search engine's use away. > Are there any examples on the web these days? > That sounds brilliant. :Am Sun, Oct 03, 2021 at 07:44:41PM +0100 schrieb Shaozhong SHI

Splitting libpq build

2021-10-03 Thread Igor Korot
Hi, ALL, I wonder who ade the decision not to provide an independent build of the client library of PostgreSQL? And what was the reason behind it? Its very annoying to build the whole server, just to create a client library to connect to a remote DB. And then kill the build after the install as us

Re: Splitting libpq build

2021-10-03 Thread Tom Lane
Igor Korot writes: > I wonder who ade the decision not to provide an independent build > of the client library of PostgreSQL? And what was the reason behind it? It wasn't worth the maintenance trouble. It still isn't. On any remotely-modern machine, a build of the whole tree is only going to ta

Re: Splitting libpq build

2021-10-03 Thread Igor Korot
Hi Tom, On Sun, Oct 3, 2021 at 3:11 PM Tom Lane wrote: > > Igor Korot writes: > > I wonder who ade the decision not to provide an independent build > > of the client library of PostgreSQL? And what was the reason behind it? > > It wasn't worth the maintenance trouble. It still isn't. On any >

Re: Splitting libpq build

2021-10-03 Thread Adrian Klaver
On 10/3/21 1:20 PM, Igor Korot wrote: Hi Tom, On Sun, Oct 3, 2021 at 3:11 PM Tom Lane wrote: Igor Korot writes: I wonder who ade the decision not to provide an independent build of the client library of PostgreSQL? And what was the reason behind it? But building the whole tree is just th

Re: Splitting libpq build

2021-10-03 Thread Tom Lane
Igor Korot writes: > On Sun, Oct 3, 2021 at 3:11 PM Tom Lane wrote: >> Having said that, it does work on non-Windows machines to do >> ./configure ... >> cd src/interfaces/libpq >> make -s install > Well, asking people to download the whole source tree just to build > client library 1000 times a

Re: Splitting libpq build

2021-10-03 Thread Igor Korot
Hi, Adrian, On Sun, Oct 3, 2021 at 3:28 PM Adrian Klaver wrote: > > On 10/3/21 1:20 PM, Igor Korot wrote: > > Hi Tom, > > > > On Sun, Oct 3, 2021 at 3:11 PM Tom Lane wrote: > >> > >> Igor Korot writes: > >>> I wonder who ade the decision not to provide an independent build > >>> of the client l

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread David G. Johnston
On Sun, Oct 3, 2021, 00:48 FOUTE K. Jaurès wrote: > Hello, > > I want to order tables based on the foreign key so that I can delete > tables one by one without facing "ERROR: update or delete on table > "table" violates foreign key constraint. DETAIL: Key is still referenced > from table" > As o

Re: Check constraint failure messages

2021-10-03 Thread zim
An error message that includes the table name and column name would also be helpful for non-bulk inserts: a single insert where multiple columns of a table have the same domain type. The problem gets worse when there are inserts into multiple tables that have the same domain types (multiple sql

Re: Check constraint failure messages

2021-10-03 Thread David G. Johnston
On Sun, Oct 3, 2021, 14:39 zim wrote: > An error message that includes the table name and column name would also > be helpful for non-bulk inserts: > This is not limited to domain types and comes up fairly often. In general there is agreement that the current behavior is not great but implement

Re: Splitting libpq build

2021-10-03 Thread Tom Lane
Igor Korot writes: > Imagine you are a developer/maintainer of sme software. This software needs to > connect to different DBMSes perform soe operations and then disconnect. > It is very easy to say that I have SQLite as a submodule in my Git tree, > I have mysql-connector as a submodule, but I ca

Re: Splitting libpq build

2021-10-03 Thread Igor Korot
Hi, Tom, On Sun, Oct 3, 2021 at 5:27 PM Tom Lane wrote: > > Igor Korot writes: > > Imagine you are a developer/maintainer of sme software. This software needs > > to > > connect to different DBMSes perform soe operations and then disconnect. > > It is very easy to say that I have SQLite as a su