Created
January 26, 2015 17:17
-
-
Save avances123/e9725ef640f99a7aa47c to your computer and use it in GitHub Desktop.
returning problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE pis1 | |
( | |
x serial NOT NULL, | |
y integer, | |
CONSTRAINT pk_lineas PRIMARY KEY (x) | |
); | |
CREATE TABLE pis2 | |
( | |
id serial, | |
x integer, | |
y integer, | |
CONSTRAINT pk_lineas PRIMARY KEY (id), | |
CONSTRAINT lineas_id_pred_pasado_fkey FOREIGN KEY (x) | |
REFERENCES pis1 (x) MATCH SIMPLE | |
ON UPDATE CASCADE ON DELETE CASCADE | |
); | |
INSERT INTO pis2 (x) SELECT pis1.x FROM pis1 JOIN generate_series(1,3) as kk ON pis1.y = kk RETURNING id,kk; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment