Re: Updating PK and all FKs to it in CTE

2021-07-29 Thread Tom Kazimiers
On Thu, Jul 29, 2021 at 10:51:09AM -0400, Tom Lane wrote: I tried to reproduce your problem and failed; the attached script acts as I'd expect. So there must be some moving part you've not mentioned. Can yo create a similar self-contained example that fails? Thanks very much for trying this.

Updating PK and all FKs to it in CTE

2021-07-29 Thread Tom Kazimiers
Hi all, I am on Postgres 13 and have a problem with updates in a CTE. While certainly not generally recommended, I need to update the primary key in a table that is referenced by a few other tables. The table definition is attached to the end of this email [2]. I'd like to avoid dropping and recr

Re: Unexpected behavior with transition tables in update statement trigger

2018-02-27 Thread Tom Kazimiers
On Wed, Feb 28, 2018 at 10:27:23AM +1300, Thomas Munro wrote: Tom K, if you need a workaround before 10.4 comes out in May[1], you could try selecting the whole transition table into a CTE up front. Something like WITH my_copy AS (SELECT * FROM new_table) SELECT * FROM my_copy UNION ALL SELECT *

Re: Unexpected behavior with transition tables in update statement trigger

2018-02-27 Thread Tom Kazimiers
On Tue, Feb 27, 2018 at 03:58:14PM -0500, Tom Lane wrote: Thomas Munro writes: Here's a new version with tuplestore_select_read_pointer() added in another place where it was lacking, and commit message. Moving to -hackers, where patches go. Pushed, along with a regression test based on your

Re: Unexpected behavior with transition tables in update statement trigger

2018-02-26 Thread Tom Kazimiers
Hi Thomas, On Mon, Feb 26, 2018 at 11:15:44PM +1300, Thomas Munro wrote: On Sat, Feb 24, 2018 at 4:47 PM, Tom Kazimiers wrote: Thanks for the reproducer. Yeah, that seems to be a bug. nodeNamedTuplestorescan.c allocates a new read pointer for each separate scan of the named tuplestore, but it

Unexpected behavior with transition tables in update statement trigger

2018-02-23 Thread Tom Kazimiers
Hi all, I am on Postgres 10.2 and try to get a statement level trigger to work that is executed after UPDATE statements on a particular table. This trigger references both the old and new transition table and for some reason I am unable to reference each transition table multiple times in a C

Get IEEE754 bytes of real and double types for msgpack encoding

2018-01-12 Thread Tom Kazimiers
Hi, I am currently investigating whether I could have Postgres return its results in the msgpack [1] format and it seems someone already did most of the work: Patrik Simek came up with encoder and decoder functions [2]. Unfortunately it is lacking support for numbers in real and double format