On Thursday 10 January 2008 4:08 pm, johnf wrote:
> On Thursday 10 January 2008 01:14:38 pm Adrian Klaver wrote:
> >
> > Works here. The only comment is that use of E' limits it to 8.1+.
> > Thanks for working on this.
> > --
> > Adrian Klaver
> > [EMAIL PROTECTED]
>
> Oh I did not realize the I lost compatibility - that's not good. At the
> moment we still support 7.4. That's because 7.4 is still very popular.
>
>
> BTW I forgot schema checks - so here is the new select:
>
> 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 E'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%'
You can use the old escape scheme with the new versions. The only problem is
that it emits warnings by default. You can stop the warnings by setting
escape_string_warning =off in postgresql.conf . Something else to keep in
mind, the double cast (nextval(('plant1_p_item_no_seq'::text)::regclass)) for
the sequence name is 8.1+. Prior to that is was-
nextval('plant1_p_item_no_seq'::text).
--
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]