Page 1 of 1

[solved]PostgreSQL - ERROR: multiple assignments to same col

Posted: 21.10.2013, 12:02
by fhaut
@EgonHugeist

On Delphi 2009, PostgreSQL 9.3

Code: Select all

2013-10-21 07:50:52 cat: Prepare, proto: postgresql-9, msg: PREPARE 'UPDATE public.s162car SET ins004=?,codemp=?,codfil=?,codcta=?,codcar=?,ins004=?,codemp=?,codfil=?,codcta=?,codcar=?,ins004=? WHERE codemp=? AND codfil=? AND codcta=? AND codcar=?', errcode: 0, error: ERROR: multiple assignments to same column "ins004"
To reproduce:

1 Open a query
2 edit some field and post record
3 edit the same field and post again

in the SQL statement are twice a field updated. "ins004" in the sample.

Call Stack

Code: Select all

21/10/2013 07:44:05 Exceção EZDatabaseError ocorrida em TZAbstractDataset.InternalUpdate na linha 388 no arquivo ZAbstractDataset.pas
Mensage: SQL Error: ERROR:  multiple assignments to same column "ins004"

Stack: 
[007365D6] ZDbcPostgreSqlUtils.CheckPostgreSQLError (Line 720, "ZDbcPostgreSqlUtils.pas")
[00732C66] ZDbcPostgreSqlStatement.TZPostgreSQLCAPIPreparedStatement.ExectuteInternal (Line 803, "ZDbcPostgreSqlStatement.pas")
[0073375B] ZDbcPostgreSqlStatement.TZPostgreSQLCAPIPreparedStatement.Prepare (Line 1022, "ZDbcPostgreSqlStatement.pas")
[00733A27] ZDbcPostgreSqlStatement.TZPostgreSQLCAPIPreparedStatement.ExecuteUpdatePrepared (Line 1072, "ZDbcPostgreSqlStatement.pas")
[006B3D1B] ZDbcGenericResolver.TZGenericCachedResolver.PostUpdates (Line 889, "ZDbcGenericResolver.pas")
[006B5AC8] ZDbcCachedResultSet.TZAbstractCachedResultSet.PostRowUpdates (Line 471, "ZDbcCachedResultSet.pas")
[006B5C66] ZDbcCachedResultSet.TZAbstractCachedResultSet.PostUpdates (Line 578, "ZDbcCachedResultSet.pas")
[006B6C48] ZDbcCachedResultSet.TZAbstractCachedResultSet.UpdateRow (Line 1906, "ZDbcCachedResultSet.pas")
[007AA82B] ZAbstractDataset.TZAbstractDataset.InternalUpdate (Line 386, "ZAbstractDataset.pas")
[007AAB87] ZAbstractDataset.TZAbstractDataset.InternalPost (Line 504, "ZAbstractDataset.pas")
[005D2825] DB.TDataSet.CheckOperation
[005D2354] DB.TDataSet.Post
[005ED58D] DBCtrls.TDBNavigator.BtnClick

Re: PostgreSQL - ERROR: multiple assignments to same column

Posted: 21.10.2013, 14:36
by fhaut
Sorry,

tested again on Revision 2857 (testing-7.2) and there is fixed.

but the log of TZSQLMonitor is without the prepare Statement.

Code: Select all

2013-10-21 11:30:01 cat: Execute prepared, proto: postgresql-8, msg: Statement 238
2013-10-21 11:30:01 cat: Execute prepared, proto: postgresql-8, msg: Statement 239
2013-10-21 11:30:01 cat: Bind prepared, proto: postgresql-8, msg: Statement 240 : 167643992,
2013-10-21 11:30:01 cat: Execute prepared, proto: postgresql-8, msg: Statement 240
2013-10-21 11:30:01 cat: Bind prepared, proto: postgresql-8, msg: Statement 241 : 3,
2013-10-21 11:30:01 cat: Execute prepared, proto: postgresql-8, msg: Statement 241
2013-10-21 11:30:01 cat: Bind prepared, proto: postgresql-8, msg: Statement 242 : 3,
2013-10-21 11:30:01 cat: Execute prepared, proto: postgresql-8, msg: Statement 242
2013-10-21 11:30:01 cat: Bind prepared, proto: postgresql-8, msg: Statement 243 : 4,1,3,
2013-10-21 11:30:01 cat: Execute prepared, proto: postgresql-8, msg: Statement 243

Re: PostgreSQL - ERROR: multiple assignments to same column

Posted: 21.10.2013, 17:30
by EgonHugeist
fhaut,

have my problems to confirm this. Did test the logs of \testing-7.2 and the vals are written like expected.
Did fix a wrong format of the logstrings, but everything seems to be fine R2858:

Code: Select all

2013-10-21 16:38:57 cat: Connect, proto: postgresql-9, msg: CONNECT TO "zeoslib" AS USER "postgres"
2013-10-21 16:38:57 cat: Execute, proto: postgresql-9, msg: select setting from pg_settings where name = 'bytea_output'
2013-10-21 16:38:58 cat: Connect, proto: postgresql-9, msg: CONNECT TO "zeoslib" AS USER "postgres"
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SET CLIENT_ENCODING = WIN1252
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: select setting from pg_settings where name = 'bytea_output'
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SELECT version()
2013-10-21 16:38:58 cat: Execute prepared, proto: postgresql-9, msg: Statement 1
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SELECT n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,pg_get_expr(def.adbin, def.adrelid) as adsrc,dsc.description  FROM pg_catalog.pg_namespace n  JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid)  JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid)  LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)  LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog')  WHERE a.attnum > 0 AND NOT a.attisdropped AND n.nspname = E'public' AND c.relname = E'people' ORDER BY nspname,relname,attnum
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SELECT oid, typname, typbasetype,typtype FROM pg_type WHERE (typtype = 'b' and oid < 10000) OR typtype = 'p' OR typtype = 'e' OR typbasetype<>0 ORDER BY oid
2013-10-21 16:38:58 cat: Execute prepared, proto: postgresql-9, msg: Statement 2
2013-10-21 16:38:58 cat: Execute prepared, proto: postgresql-9, msg: Statement 3
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SELECT version()
2013-10-21 16:38:58 cat: Execute prepared, proto: postgresql-9, msg: Statement 4
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SELECT n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,pg_get_expr(def.adbin, def.adrelid) as adsrc,dsc.description  FROM pg_catalog.pg_namespace n  JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid)  JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid)  LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)  LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog')  WHERE a.attnum > 0 AND NOT a.attisdropped AND n.nspname = E'public' AND c.relname = E'people' ORDER BY nspname,relname,attnum
2013-10-21 16:38:58 cat: Execute, proto: postgresql-9, msg: SELECT oid, typname, typbasetype,typtype FROM pg_type WHERE (typtype = 'b' and oid < 10000) OR typtype = 'p' OR typtype = 'e' OR typbasetype<>0 ORDER BY oid
2013-10-21 16:38:58 cat: Execute prepared, proto: postgresql-9, msg: Statement 5
2013-10-21 16:38:58 cat: Execute prepared, proto: postgresql-9, msg: Statement 6
2013-10-21 16:39:13 cat: Execute, proto: postgresql-9, msg: SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, ct.relname AS TABLE_NAME, a.attname AS COLUMN_NAME, a.attnum AS KEY_SEQ, ci.relname AS PK_NAME FROM pg_catalog.pg_namespace n, pg_catalog.pg_class ct, pg_catalog.pg_class ci, pg_catalog.pg_attribute a, pg_catalog.pg_index i WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid AND a.attrelid=ci.oid AND i.indisprimary AND ct.relname = E'people' AND ct.relnamespace = n.oid AND n.nspname = E'public' ORDER BY table_name, pk_name, key_seq
2013-10-21 16:39:14 cat: Bind prepared, proto: postgresql-9, msg: Statement 7 : 'Kristen Sato2äöäüößßßß',3
2013-10-21 16:39:14 cat: Execute prepared, proto: postgresql-9, msg: Statement 7
2013-10-21 16:39:17 cat: Disconnect, proto: postgresql-9, msg: DISCONNECT FROM "zeoslib"
2013-10-21 16:39:17 cat: Disconnect, proto: postgresql-9, msg: DISCONNECT FROM "zeoslib"
So which branch did you use for?

Btw. i changed the logging a bit. Now i write the original date which we send to the server. See the accendentual characters.

Re: PostgreSQL - ERROR: multiple assignments to same column

Posted: 21.10.2013, 17:40
by fhaut
@EgonHugeist

on branches/testing-7.2 Revision 2858 works fine

problem solved

thank you

Re: [solved]PostgreSQL - ERROR: multiple assignments to same

Posted: 21.10.2013, 17:55
by fhaut
@all

On my tests, branch 7.2, using D2009, PostgreSQL version 8.4, 9.0, 9.1, 9.2 and 9.3 using blobs fields, date, strings, numeric.

Work better and faster in this version.

Someone could use the component TPgEventAlerter ? I tried to use without success, is there any example or some test case?

Re: [solved]PostgreSQL - ERROR: multiple assignments to same

Posted: 21.10.2013, 22:53
by EgonHugeist
:builder: