pgpool2.git / summary / log / commit / refs

commit    beb38d3fa357626efc2d1f380a16e8f067c07782
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Sat Mar 21 00:54:08 2015 +0000

    Use to_regclass if available in time stamp rewriting in replication mode.
    
    Newer pgpool-II supposed to use to reg_class, but this was
    accidentally left.


src/rewrite/pool_timestamp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/rewrite/pool_timestamp.c b/src/rewrite/pool_timestamp.c index 849779889..c77654f60 100644 --- a/src/rewrite/pool_timestamp.c +++ b/src/rewrite/pool_timestamp.c @@ -147,9 +147,25 @@ relcache_lookup(TSRewriteContext *ctx) " WHERE c.oid = a.attrelid AND a.attnum >= 1 AND a.attisdropped = 'f' AND c.oid = pgpool_regclass('%s')" \ " ORDER BY a.attnum" +#define ATTRDEFQUERY3 "SELECT attname, d.adsrc, coalesce((d.adsrc LIKE '%%now()%%' OR d.adsrc LIKE '%%''now''::text%%')" \ + " AND (a.atttypid = 'timestamp'::regtype::oid OR" \ + " a.atttypid = 'timestamp with time zone'::regtype::oid OR" \ + " a.atttypid = 'date'::regtype::oid OR" \ + " a.atttypid = 'time'::regtype::oid OR" \ + " a.atttypid = 'time with time zone'::regtype::oid)" \ + " , false)" \ + " FROM pg_catalog.pg_class c, pg_catalog.pg_attribute a " \ + " LEFT JOIN pg_catalog.pg_attrdef d ON (a.attrelid = d.adrelid AND a.attnum = d.adnum)" \ + " WHERE c.oid = a.attrelid AND a.attnum >= 1 AND a.attisdropped = 'f' AND c.oid = to_regclass('%s')" \ + " ORDER BY a.attnum" + char *query; - if (pool_has_pgpool_regclass()) + if (pool_has_to_regclass()) + { + query = ATTRDEFQUERY3; + } + else if (pool_has_pgpool_regclass()) { query = ATTRDEFQUERY2; } [parent: 4b5205d87131]