On Wednesday 09 January 2008 8:50 pm, johnf wrote:
> On Wednesday 09 January 2008 01:45:26 pm Adrian Klaver wrote:
> > I am trying to work through my own problems with new(). In doing so I ran
> > into a problem with the Postgres driver not  finding the sequence on my
> > table. The details are below. I pulled the query from getLastInsertID and
> > ran with the result shown below, no relname.  Below that is the schema
> > for the table and below that a query against pg_class that shows that the
> > sequence does exist.
> >
<snip>
> >
> > Thanks,
> > --
> > Adrian Klaver
>
> The problem is your data type - it is not a 'serial'. I have been
> researching but have not come up with a "select" to cover using other data
> types.  If you find anything let me know.
The key seems to be using the pg_attrdef table. It holds the default values 
for table columns. Use the oid of the table to find pg_attrdef.adrelid and 
the pg_attribute.attnum to find pg_attrdef.adnum. pg_attrdef.adbin contains a 
binary representation of the default value for the column. This can be made 
readable using system function pg_get_expr(expr_text, relation_oid) where 
relation_oid is the table oid. I haven't worked out a complete solution yet 
as it involves parsing out the sequence name. 

Hope this helps,
-- 
Adrian Klaver
[EMAIL PROTECTED]


_______________________________________________
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/dabo-users/[EMAIL PROTECTED]

Reply via email to