Hi,
I am having a problem trying to figure out.
I have two tables behind a view and am trying to figure out how to create
the correct insert rule so that inserting into the view is redirected to
the two tables. I thought I had is solved using a stored procedure, but
doing an insert into view
Sorry, in my haste to get the example out, a couple of typo's where in the
sql.
Correct sql:
BEGIN;
CREATE TABLE table1 (
table1_id SERIAL PRIMARY KEY,
table1_field1 TEXT
);
CREATE TABLE table2 (
table1_id INTEGER NOT NULL PRIMARY KEY REFERENCES table1(table1_id) ON
DELETE CASCADE,
Chris Hoover-2 wrote
Sorry, in my haste to get the example out, a couple of typo's where in the
sql.
Next time, don't quote the entire original wrong query...
Anyway, you probably want to create a trigger on your view and do the
inserts inside the trigger function.
User created CREATE RULE is
David G Johnston wrote
Chris Hoover-2 wrote
Sorry, in my haste to get the example out, a couple of typo's where in
the
sql.
Next time, don't quote the entire original wrong query...
Anyway, you probably want to create a trigger on your view and do the
inserts inside the trigger
On Tue, 2014-12-23 at 15:00 -0500, Chris Hoover wrote:
Sorry, in my haste to get the example out, a couple of typo's where in
the sql.
Correct sql:
BEGIN;
CREATE TABLE table1 (
table1_id SERIAL PRIMARY KEY,
table1_field1 TEXT
);
CREATE TABLE table2 (
table1_id
On Tue, Dec 23, 2014 at 6:40 PM, rob stone-2 [via PostgreSQL]
ml-node+s1045698n583190...@n5.nabble.com wrote:
Rather strange to have two tables sharing the same primary key value.
One would have thought it was a one-to-many relationship between table1
and table2.
​while not particularly
Chris Hoover wrote: Correct sql:
BEGIN;
CREATE TABLE table1 (
table1_id SERIAL PRIMARY KEY,
table1_field1 TEXT
);
CREATE TABLE table2 (
table1_id INTEGER NOT NULL PRIMARY KEY REFERENCES table1(table1_id)
ON DELETE CASCADE,
table2_field1 TEXT
);
CREATE VIEW orig_table AS