pgpool2.git / summary / log / commit / refs
commit 4174e3400bd93c7db0c017da549086e817822cb1
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Tue Aug 17 05:17:13 2010 +0000
Do not rewrite statement which accesses columns having now() etc. as
the default value but the data type are not timestamp etc.
Otherwise we have an error in DMLS. See:
Subject: [Pgpool-general] function epoch seems to be causing error
To: pgpool-general@pgfoundry.org
Date: Mon, 16 Aug 2010 21:48:31 +0000 (UTC)
For more details.
pool_timestamp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pool_timestamp.c b/pool_timestamp.c
index 24c2a6eed..0294b903d 100644
--- a/pool_timestamp.c
+++ b/pool_timestamp.c
@@ -109,7 +109,13 @@ ts_unregister_func(void *data)
static TSRel*
relcache_lookup(TSRewriteContext *ctx)
{
-#define ATTRDEFQUERY "SELECT attname, coalesce(d.adsrc = 'now()' OR d.adsrc LIKE '%%''now''::text%%', false)" \
+#define ATTRDEFQUERY "SELECT attname, coalesce((d.adsrc = '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 = '%s'::regclass::oid" \
[parent: e53c0f89c906]