Rules
am 15.06.2010 08:09:11 von Ricardo Bayley--001636c5bf51a697e804890b718d
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi Fellows,
I have a table with 55 columns or so, plus one extra column of datatype
geometry, I am using PostGIS.
I intend to split my table into 3 tables. So each may have 25 to 30 columns
each.
I've created a View which relates all 3 tables with their pk and fk
accordingly. This VIEW has a RULE .....
*ON INSERT TO public.mytable DO INSTEAD*
I listed 3 ACTIONS in order to insert data into all 3 different tables.
I am having trouble getting the main table´s primary key value. I use =
the
currval('mytable_sequence_id')
It works fine only if I do not insert multiple records at once. If I do
insert multiple records, the currval gets the last value and not each
inserted value. Hence, all my records in my 2 related tables have foreign
key =3D to the last primary key.
I guess I am doing something wrong, either I am missing something or my
approach is incorrect.
Do you know how should I accomplish this ? Any ideas ?
Thanks in advanced.
Ricardo
--001636c5bf51a697e804890b718d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi Fellows,
ne extra column of datatype geometry, I am using PostGIS.
d to split my table into 3 tables. So each may have 25 to 30 columns each.<=
/div>
s with their pk and fk accordingly. This VIEW has a RULE .....Â
div>
e DO INSTEADÂ
..
s primary key value. I use the currval('mytable_sequence_id')
It works fine only if I do not insert multiple records at once. If I do ins=
ert multiple records, the currval gets the last value and not each inserted=
value. Hence, all my records in my 2 related tables have foreign key =3D t=
o the last primary key.
something or my approach is incorrect.
w how should I accomplish this ? Any ideas ?
rdo
--001636c5bf51a697e804890b718d--