Fix inconsistency of sequence values in replication mode
authorYugo Nagata <nagata@sraoss.co.jp>
Wed, 19 Aug 2015 07:13:00 +0000 (16:13 +0900)
committerYugo Nagata <nagata@sraoss.co.jp>
Wed, 19 Aug 2015 07:38:32 +0000 (16:38 +0900)
commit43ff7d3de9db4c8a1143258f4ffff98682dab560
treeef2b80c9eedd438a5c116393572366a7107d46b4
parentdfb0c92d54f4e0d18cc7774aed2ac9c8a0661fc3
Fix inconsistency of sequence values in replication mode

Due to the following commit, table names were always quoted
in queries to check needs for insert lock, whether this is
view, wheter this has default value of timestamp etc. However,
when schema name was provided, table name was quoted wrongly as
like "public.tbl" instead of "public"."tbl". So, pool_regclass
and to_regclass couldn't find right talbe oid and insert lock
was never executed. This caused inconsistency between DB nodes.

In previous codes, quotation marks "" are once remove from
table name returnd by nodeToString, and re-quoted in issued
query. Instead, fixed codes don't remove and use directy in
pgpool_regclass or to_regclass. make_table_from_rangevar()
are also fixed to return table name including quotation marks.
However, when neither pgool_regclass or to_regclass is available,
quotation marks and schema name are removed from table name,
because pg_class.relname is used in this case.

In addition, fix to use to_regclass in insert lock functions
if available.
src/include/protocol/protocol_defs.h
src/include/utils/pool_relcache.h
src/protocol/pool_process_query.c
src/rewrite/pool_timestamp.c
src/utils/pool_relcache.c
src/utils/pool_select_walker.c