On 12/20/06, Daniel McBrearty <[EMAIL PROTECTED]> wrote:
Is there a way to get the id of the object being created in the
statement doing the creation? I don't even know if the db (postgresql)
can do that ... ?


AFAIK, postgres doesn't support doing this easily for an autogenerated
SERIAL column.

This type of statement does work however:

insert into whatever values (nextval('public.tree_nodeid_seq'::text),
currval('public.tree_nodeid_seq'::text), .....);

Of course, if you really are making a tree or graph, and
self-reference is just a way to say "root-level node", I'd say just
make it nullable and treat nulls as root-level nodes and have an
easier life.

-- Brandon

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to