On Tuesday 02 March 2010 09:59:30 am Ed Leafe wrote:
> Dabo handles views just fine. Dabo was not designed to be able to update a
> table/view that lacks a PK.
Even with a PK, the way the dbPostgres->getLastInsertID() works does not
find the field associated with the PK. Which makes sense - sort of.
But you work with Postgres daily - is there a way to determine the primary PK
in a view? I think it might be possible to determine that a field is a
serial data type - but to know it's a PK is another story. But of course the
developer does in fact know which field is the primary field by reading the
code. I also wonder if there where a way to define the Dabo DataSource to
set the sequence name to allow the curval() to work.
But I did find the following (from a kind soul on the sql list):
>CREATE RULE my_view_insert AS ON INSERT TO my_view DO INSTEAD
>INSERT INTO my_data (id,somevalue) VALUES (COALSECE(NEW.id,
>nextval('my_data_id_seq'::text)),NEW.somevalue);
>The real kicker is the COALSECE(NEW.id, nextval('my_data_id_seq'::text)) bit.
>It says that if an id is explicitly set then use that otherwise use the next
>value in the sequence. Neat, huh?"
Which would allow me to insert the PK inadvance but required that I change the
view. But that change I think should be allowed since it really did not
change anything but instead allowed me to provide the PK or not.
Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]