Duplicate key error

2024-11-10 Thread yudhi s
We have a merge query as below for a partition table which is range partitioned on a truncated date column 'part_date'. And the only unique key in this table is a composite primary key on (id, part_date). And this merge queries ON condition is based on one of the columns i.e ID which is the leading

Re: Fwd: Fwd: Postgres attach partition: AccessExclusive lock set on different tables depending on how attaching is performed

2024-11-10 Thread Tom Lane
Adrian Klaver writes: > 3) Because of 1 & 2, this needs further analysis by someone or someones > more knowledgeable. This surprised me a bit too, because I thought we took a slightly-less-than-exclusive lock for FK additions or deletions. Tracing through it, I find that CloneFkReferencing opens

Re: Fwd: Fwd: Postgres attach partition: AccessExclusive lock set on different tables depending on how attaching is performed

2024-11-10 Thread Adrian Klaver
On 11/10/24 11:52, user wrote: Thank you for an answer! So reparenting of a constraint required that additional lock. I made some measurements and can see that even that reparenting (and additional lock) is required, the time it takes to make the attach is smaller than when the foreign constrai

Re: Fwd: Fwd: Postgres attach partition: AccessExclusive lock set on different tables depending on how attaching is performed

2024-11-10 Thread user
Thank you for an answer! So reparenting of a constraint required that additional lock. I made some measurements and can see that even that reparenting (and additional lock) is required, the time it takes to make the attach is smaller than when the foreign constraint hasn't been created beforehand.

Re: Fwd: Fwd: Postgres attach partition: AccessExclusive lock set on different tables depending on how attaching is performed

2024-11-10 Thread Adrian Klaver
On 11/10/24 05:18, user wrote: Hello, Sorry for nagging, but I would really like to find some answers. So, to reiterate. Experiment done as follows: "' CREATE TABLE refs (                     id integer primary key,                     did integer                 ); CREATE

RE: Bash function from psql (v14)

2024-11-10 Thread Murthy Nunna
Thanks, Greg. 1. This means what I am trying to do is not meant to work. This won’t work even if I declare the function before calling it in PSQL. I get it. 2. You are correct. Function must be declared before the call. Thanks again.

Re: adsrc

2024-11-10 Thread Greg Sabino Mullane
> > Yes. Looks like the DBD::Pg module is what needs the upgrade. > Specifically, you will need DBD::Pg version 3.9.0 or higher, but I *highly* recommend using the latest release you can (right now, that is 3.18.0) Cheers, Greg

Re: Bash function from psql (v14)

2024-11-10 Thread Greg Sabino Mullane
What problem are you trying to solve? If you tell us that, we can guide you to some better solutions. There are numerous issues here, but the most important are: 1) Calling a shell via \! invokes an entirely new process: there is no link to the parent or grandparent process 2) The run-bash-funct

Fwd: Fwd: Postgres attach partition: AccessExclusive lock set on different tables depending on how attaching is performed

2024-11-10 Thread user
Hello, Sorry for nagging, but I would really like to find some answers. So, to reiterate. Experiment done as follows: "' CREATE TABLE refs ( id integer primary key, did integer ); CREATE TABLE films ( id