Re: function currtid2() in SQL and ESQL/C to get the new CTID of a row

2022-06-22 Thread Matthias Apitz
El día miércoles, junio 22, 2022 a las 08:39:31 +0200, Matthias Apitz escribió: > > EXEC SQL SELECT currtid2(:table ::text, :oldCTID ::tid) INTO :newCTID; > > > > ... > > Hello Tom, > > We came accross cases where the above SELECT returns as :newCTID the > same as the :oldCTID. The :oldCTID was

Re: function currtid2() in SQL and ESQL/C to get the new CTID of a row

2022-06-21 Thread Matthias Apitz
El día Wednesday, June 01, 2022 a las 09:46:17AM -0400, Tom Lane escribió: > ... > > > Is this function currtid2() not meant to be used in ESQL/C? Or did we > > something wrong in ESQL/C? > > This is not about currtid2, this is a fundamental misunderstanding > of how ECPG works. You can only in

Re: function currtid2() in SQL and ESQL/C to get the new CTID of a row

2022-06-01 Thread Tom Lane
Matthias Apitz writes: > So far so good, but we do need this in ESQL/C. There the code looks as: > EXEC SQL BEGIN DECLARE SECTION; > charstmt[255]; > static char newCTID[80]; > EXEC SQL END DECLARE SECTION; > memset(stmt, 0, sizeof(stmt)); > sprin

function currtid2() in SQL and ESQL/C to get the new CTID of a row

2022-06-01 Thread Matthias Apitz
While looking for a way to get the new CTID of an UPDATEd row, I came accros this function currtid2() which works fine on SQL with a 14.1 server: https://www.postgresql.org/message-id/Pine.BSO.4.44.0206031939050.21627-10%40kitten.greentechnologist.org testdb=# SELECT ctid, * FROM dbctest WH