laurenz / oracle_fdw

PostgreSQL Foreign Data Wrapper for Oracle
http://laurenz.github.io/oracle_fdw/
Other
496 stars 156 forks source link

Support generated column when UPDATE #596

Closed realasgard closed 1 year ago

realasgard commented 1 year ago

Hi. I'm posting on behalf of jopoly as a co-worker according to the company's policy. This fixes https://github.com/laurenz/oracle_fdw/issues/568 Solves the problem of generated columns like below.

CREATE FOREIGN TABLE tbl1 (
  c1 int,
  c2 character(10),
  c3 character(10)
) SERVER oracle_srv (table 'TBL1');

INSERT INTO tbl1 (c1, c2) VALUES (1, 'aaa') RETURNING c1, c2;
 c1 |  c2 
----+-----
  1 | aaa 
(1 row)

-- RETURNING the whole row
INSERT INTO tbl1 (c1, c2) VALUES (1, 'aaa') RETURNING tb1;
   tb1
---------
(1, aaa,)
(1 row)
laurenz commented 1 year ago

Thanks, I figured it out.

I rearranged the code to make it more readable, and I didn't cater for old minor releases. As mentioned, there is not really a good way to do that.

I also used a simpler regression test.

Thanks for the patch!