On Friday 11 January 2008 11:45:38 am Adrian Klaver wrote:
> I tested the latest and greatest version of the sequence query:
>
> SELECT substring((SELECT substring(pg_get_expr(d.adbin, d.adrelid)
> for 128) FROM pg_attrdef d
>  WHERE d.adrelid = a.attrelid
>  AND d.adnum = a.attnum
>  AND a.atthasdef
>  ) FROM 'nextval[^'']*''([^'']*)')
>  FROM pg_attribute a
>  LEFT JOIN pg_class c ON c.oid = a.attrelid
>  LEFT JOIN pg_attrdef d ON d.adrelid = a.attrelid AND d.adnum =
>  a.attnum AND a.atthasdef
>  LEFT JOIN pg_namespace n ON c.relnamespace = n.oid
>  WHERE (c.relname = 'mytest') AND a.attname = 'pkid'
>  and n.nspname='public'
>  AND NOT a.attisdropped
>  AND a.attnum > 0
>  AND pg_get_expr(d.adbin, d.adrelid) LIKE 'nextval%'
>
> It works on 7.4.19, 8.0.14, 8.2.3 and 8.3beta3.
> --
> Adrian Klaver
> [EMAIL PROTECTED]

That's good news.  

The last issue is the 'nextval' string.  

I think it is possible to create a sequence function that does not 
use 'nextval'.  But will that function work with 'currval'?  I doubt it.  So 
in your mind is it safe to assume that 'nextval' is a requirement for the 
field? 

BTW I have no idea how to create a sequence that did not need 'nextval'. 



-- 
John Fabiani


_______________________________________________
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