1

In Cubrid Database Server there is a possibility to store the 'object instance' reference of newly inserted record into a local variable for referencing later in another statement, such as below:

create class atype (code integer, description varchar);
insert into atype (code,description) values (1,'Valid') into :valid_value;

create class tvalue (ttype atype, dvalue varchar);
insert into tvalue (ttype,dvalue) values (:valid_value, '1' ) into :a1 ;

Is this possible in PostgreSQL from within the same session? If so, is there a limit for the number of variables that are available?

S-Man
  • 22,521
  • 7
  • 40
  • 63
mmmmmm
  • 980
  • 1
  • 14
  • 16
  • 1
    Isn't this an answer to your question https://stackoverflow.com/questions/2944297/postgresql-function-for-last-inserted-id – Jonny Jul 17 '19 at 10:41
  • close and related, but not quite the same. The :valid_value in my example is like a reference to the inserted "row", not an id. It is used when inserting in the tvalue table a previously created instance/row of "atype". – mmmmmm Jul 25 '19 at 06:28

0 Answers0