Re: pg_dump and search_path - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pg_dump and search_path
Date
Msg-id 20150811173120.GB3040@postgresql.org
Whole thread Raw
In response to pg_dump and search_path  ("Steve Thames" <sthames42@gmail.com>)
Responses Re: pg_dump and search_path  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Steve Thames wrote:

>    SELECT a.attnum, n.nspname, c.relname, d.adsrc AS default_value 
>      FROM pg_attribute AS a 
>      JOIN pg_class     AS c ON a.attrelid     = c.oid 
>      JOIN pg_namespace AS n ON c.relnamespace = n.oid 
> LEFT JOIN pg_attrdef   AS d ON d.adrelid      = c.oid AND d.adnum = a.attnum
>     WHERE a.attnum > 0   
>       AND n.nspname = 'testschema'  
>       AND c.relname = 'testtable';

Don't ever rely on adsrc.  It's useless.  Use pg_get_expr(adbin)
instead.  That's safe, for instance, if the sequence gets renamed.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump and search_path
Next
From: Tom Lane
Date:
Subject: Re: pg_dump and search_path