Re: Creating constraint dynamically

2022-09-04 Thread sivapostg...@yahoo.com
Hello, Sorry for delay... I had to go on leave.. Checked, it's our mistake here.   The issue is not what I described, but in the replicated database where the constraint was not updated.  Correcting the constraint there solved this issue.   Sorry for not checking properly before coming here. Hap

Re: Creating constraint dynamically

2022-08-22 Thread jian he
On Mon, Aug 22, 2022 at 12:59 PM sivapostg...@yahoo.com < sivapostg...@yahoo.com> wrote: > Hello, > Using PG 11.4 > > We populate constraint string dynamically and add it to the table with > alter table command. It gets added, but without the required brackets. > What we build is > ALTER TABLE pu

Re: Creating constraint dynamically

2022-08-22 Thread Francisco Olarte
On Mon, 22 Aug 2022 at 09:29, sivapostg...@yahoo.com wrote: > We populate constraint string dynamically and add it to the table with alter > table command. It gets added, but without the required brackets. Brackets are NOT required in your example. You are doing a classic form, OR of ANDs, some

Re: Creating constraint dynamically

2022-08-22 Thread JITEN KUMAR SHAH
On 8/22/22 13:09, Wim Bertels wrote: sivapostg...@yahoo.com schreef op ma 22-08-2022 om 07:29 [+]: ALTER TABLE public.tx_barcode_stock ADD CONSTRAINT "tx_barcode_stock_CK1" CHECK ( (branchcode = '1'::bpchar  and barcodeitem = 'Y'::bpchar and closingstock >= 0::numeric)  Or (branchcode = '

Re: Creating constraint dynamically

2022-08-22 Thread Wim Bertels
sivapostg...@yahoo.com schreef op ma 22-08-2022 om 07:29 [+]: > > ALTER TABLE public.tx_barcode_stock  > ADD CONSTRAINT "tx_barcode_stock_CK1" CHECK  > ( (branchcode = '1'::bpchar  and barcodeitem = 'Y'::bpchar and > closingstock >= 0::numeric)  Or (branchcode = '1' and barcodeitem = > 'N'::bp

Re: Creating constraint dynamically

2022-08-22 Thread sivapostg...@yahoo.com
Hello,Using PG 11.4 We populate constraint string dynamically and add it to the table with alter table command.  It gets added, but without the required brackets.  What we build isALTER TABLE public.tx_barcode_stock ADD CONSTRAINT "tx_barcode_stock_CK1" CHECK ( (branchcode = '1'::bpchar  and bar