SQL: INSERT INTO tab1 (pkey,name) VALUES (100,'aaaa') | 4gl source : pgs-serial.4gl line=16 | ../ODI_common.h:00816(3) : adaptStatement: stmt type = 2 | ../ODI_common.h:00821(3) : adaptStatement: ifxemul = 1 | pgs.c:00869(3) : Find serial info: [select ns.nspname||'.'||substring(pg_get_expr(a.adbin,0) from 'nextval.''([^'']*)') seqname , c.attname from pg_class p join pg_attrdef a on (p.oid=a.adrelid) join pg_attribute c on (p.oid=c.attrelid and a.adnum=c.attnum) join pg_namespace ns on (p.relnamespace=ns.oid) where upper(p.relname)=upper('tab1') and pg_get_expr(a.adbin,0) like 'nextval%' and (ns.nspname=current_schema() or ns.oid=pg_my_temp_schema())] | pgs.c:01853(3) : Prefetch rows = 0 | pgs.c:01755(3) : Nat stmt1 = insert into tab1 (pkey,name) VALUES (100,'aaaa') returning tab1.pkey, (select case when tab1.pkey>=(select last_value from public.tab1_pkey_seq) then setval('public.tab1_pkey_seq',tab1.pkey,true) else 0 end) | sqlcode : 0 | sqlerrd3 : 1 | curr driver : ident='dbmpgs' | curr connection : ident='test1@localhost:5436+driver='dbmpgs',resource='test1'' (dbspec=[test1@localhost:5436+driver='dbmpgs',resource='test1']) | Timestamp : 2022-07-05 14:53:07.01594 | Execution time : 0 00:00:00.00650
CREATE TABLE testtable ( idno INTEGER NOT NULL, col01 VARCHAR(50) NOT NULL, col02 VARCHAR(50) NOT NULL);ALTER TABLE testtable ADD CONSTRAINT pk_testtable PRIMARY KEY(idno);CREATE SEQUENCE sq_testtable;ALTER TABLE testtable ALTER COLUMN idno SET DEFAULT NEXTVAL('sq_testtable'); MAIN DEFINE rec RECORD pkey INT, col01 VARCHAR(50), col02 VARCHAR(50) END RECORD CONNECT TO "test1@localhost:5436+driver='dbmpgs',resource='test1'" USER "pgsuser" USING "fourjs" DELETE FROM testtable INSERT INTO testtable VALUES (1000,'aaa','bbb') --DISPLAY sqlca.sqlerrd[2] INSERT INTO testtable (col01,col02) VALUES ('aaa','bbb') --DISPLAY sqlca.sqlerrd[2] DECLARE c1 CURSOR FOR SELECT * FROM testtable FOREACH c1 INTO rec.* DISPLAY rec.* END FOREACH END MAIN sf@toro:~/genero/devel/fgl/tests$ fglcomp -M pgs-serial.4gl && fglrun pgs-serial.42m 1000aaabbb 1003aaabbb