[Pgpool-general] ERROR: syntax error at or near "-" at character 310

David Andersen david at andersen.gs
Fri Dec 28 12:29:19 UTC 2007


Hi,

I have just gotten Pgpool-II to work and I am now testing its
parallelization capabilities.

I have two nodes with the table egg4 containing the following values:

Node 1:
bench_parallel=# select * from egg4;
 id | agg
----+-----
  1 |  40
  2 |  40
  2 |  50
  1 |  60
(4 rows)

bench_parallel=#

Node 2:
bench_parallel=# select * from egg4;
 id | agg
----+-----
 11 |  60
 11 |  20
 14 |  70
(3 rows)


Running the following query against pgpool-II yields correct results:
bench_parallel=# select id, avg(agg) from egg4 group by id;
 id |         avg
----+---------------------
 11 | 40.0000000000000000
 14 | 70.0000000000000000
  2 | 45.0000000000000000
  1 | 41.6666666666666667
(4 rows)


However, when I try running the following query:
select * from egg4 inner join (select id, avg(agg) as a from egg4 group by
id) AS second on (egg4.id = second.id) where egg4.agg > second.a;

I get:
ERROR:  syntax error at or near "-" at character 310

In the log file of pgpool I can see the following line:
2007-12-28 07:07:55 DEBUG: pid 3238: OneNode_do_command: Query:  SELECT
pool_c$2  AS id,pool_c$3  AS agg,pool_c$4  AS id,pool_c$5  AS a FROM
dblink('host=domU-12-31-38-00-2C-42 dbname=bench_parallel port=9999
user=postgres','SELECT pool_parallel("SELECT egg4.id, egg4.agg FROM egg4
WHERE TRUE")') AS egg4(pool_c$2 integer,pool_c$3 integer) JOIN ( SELECT
pool_g$1 AS pool_c$-1 ,(sum(pool_g$0)/sum(pool_g$0c)) AS pool_c$-1  FROM
dblink('host=domU-12-31-38-00-2C-42 dbname=bench_parallel port=9999
user=postgres','SELECT pool_parallel("SELECT sum(agg),count(agg),id FROM
egg4 GROUP BY id")') AS pool_t$1g (pool_g$0 numeric ,pool_g$0c bigint
,pool_g$1 integer)  GROUP BY pool_g$1) AS second  ON  (
egg4.pool_c$2=second.pool_c$4 ) WHERE  (egg4.pool_c$3>second.pool_c$5 )

Character 310 is probably referring to the alias in this part: "SELECT
pool_g$1 AS pool_c$-1".

I get the an identical error message if I run the following query:
bench_parallel=# SELECT 1 AS pool_c$-1;
ERROR:  syntax error at or near "-" at character 20
LINE 1: SELECT 1 AS pool_c$-1;
                           ^


The whole sequence from the log file is:
2007-12-28 07:07:55 DEBUG: pid 3238: read kind from frontend Q(51)
2007-12-28 07:07:55 LOG:   pid 3238: statement: select * from egg4 inner
join (select id, avg(agg) as a from egg4 group by id) AS second on (egg4.id=
second.id) where egg4.agg > second.a;
2007-12-28 07:07:55 DEBUG: pid 3238: initSelectStmt: ANALYZE now(0)
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_range_info num= 1
current_select=0
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_range_info dist 0
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_join_info dist state=P
egg4
2007-12-28 07:07:55 DEBUG: pid 3238: append_join_table start
2007-12-28 07:07:55 DEBUG: pid 3238: append_join_table no = 0
,col=id,type=integer,table=egg4
2007-12-28 07:07:55 DEBUG: pid 3238: append_join_table no = 1
,col=agg,type=integer,table=egg4
2007-12-28 07:07:55 DEBUG: pid 3238: initSelectStmt: ANALYZE now(1)
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_range_info num= 1
current_select=1
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_range_info dist 1
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_virtual_info dist state=P
egg4
2007-12-28 07:07:55 DEBUG: pid 3238: append_virtual_table select=1,
no=0,col=id,type=integer,table=egg4,state=P,valid=-1
2007-12-28 07:07:55 DEBUG: pid 3238: append_virtual_table select=1,
no=1,col=agg,type=integer,table=egg4,state=P,valid=-1
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 1, col_name=(id)
detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef id
now(1),last(0) part(1) call_part(0)
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 1,
col_name=(agg) detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef agg
now(1),last(0) part(1) call_part(0)
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 1, col_name=(id)
detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef id
now(1),last(0) part(3) call_part(0)
2007-12-28 07:07:55 DEBUG: pid 3238: AnalyzeReturnRecord: current_select=1
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info: base=0
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info:
col=id,type=integer base=1
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info: base=1
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info: col=a,type=text
base=2
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteSelectStmt select_no=1
state=PSPSSSSS
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteTRangeSubSelect: select range
ture 1
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_range_info num= 2
current_select=0
2007-12-28 07:07:55 DEBUG: pid 3238: inside build_range_info select 0, state
= S (8: build_virtual_table join join->colnum=4
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 0,
table_name=(egg4), col_name=(id) detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef id
now(0),last(-1) part(0) call_part(-1)
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 0,
table_name=(second), col_name=(id) detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef id
now(0),last(-1) part(0) call_part(-1)
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 0,
table_name=(egg4), col_name=(agg) detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef agg
now(0),last(-1) part(2) call_part(-1)
2007-12-28 07:07:55 DEBUG: pid 3238: GetInnerRef state = S now select(0),
table_name=(egg4), col_name=(agg) detect
2007-12-28 07:07:55 DEBUG: pid 3238: return state is S
2007-12-28 07:07:55 DEBUG: pid 3238: DetectValidColumn no = 0,
table_name=(second), col_name=(a) detect
2007-12-28 07:07:55 DEBUG: pid 3238: ChangeStatebyColumnRef a
now(0),last(-1) part(2) call_part(-1)
2007-12-28 07:07:55 DEBUG: pid 3238: AnalyzeReturnRecord: current_select=0
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info:
col=id,type=integer
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info:
col=agg,type=integer
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info:
col=id,type=integer
2007-12-28 07:07:55 DEBUG: pid 3238: append_select_def_info: col=a,type=text
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteSelectStmt select_no=0
state=SSSSSSSS
2007-12-28 07:07:55 DEBUG: pid 3238: analyze_debug :select no(0), last
select(-1), last_part(-1), state(S)
2007-12-28 07:07:55 DEBUG: pid 3238: analyze_debug :select no(1), last
select(0), last_part(0), state(S)
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteSelectStmt:START QueryRewrite
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteColumnRef: aggregate no = 1
2007-12-28 07:07:55 DEBUG: pid 3238: _FuncCall: aggregate no = 0
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 1, col_name=(id)
detect
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteColumnRef: aggregate no = 1
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 0,
table_name=(egg4), col_name=(id) detect
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 0,
table_name=(second), col_name=(id) detect
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteList select=0,count=0
2007-12-28 07:07:55 DEBUG: pid 3238: writeRangeHeader select_no=0
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteColumnRef: aggregate no = 1
2007-12-28 07:07:55 DEBUG: pid 3238: AliasToResTargetCondition select no
=1,ret_no = 0,col_no =-1,colname=id
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteList select=1,count=0
2007-12-28 07:07:55 DEBUG: pid 3238: _FuncCall: aggregate no = 0
2007-12-28 07:07:55 DEBUG: pid 3238: AliasToResTargetCondition select no
=1,ret_no = 1,col_no =-1,colname=a
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteList select=1,count=1
2007-12-28 07:07:55 DEBUG: pid 3238: writeSelectHeader select_no=1 state=0
2007-12-28 07:07:55 DEBUG: pid 3238: _rewriteColumnRef: aggregate no = 1
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 0,
table_name=(egg4), col_name=(id) detect
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 0,
table_name=(second), col_name=(id) detect
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 0,
table_name=(egg4), col_name=(agg) detect
2007-12-28 07:07:55 DEBUG: pid 3238: GetPoolColumn no = 0,
table_name=(second), col_name=(a) detect
2007-12-28 07:07:55 DEBUG: pid 3238: OneNode_do_command: Query:  SELECT
pool_c$2  AS id,pool_c$3  AS agg,pool_c$4  AS id,pool_c$5  AS a FROM
dblink('host=domU-12-31-38-00-2C-42 dbname=bench_parallel port=9999
user=postgres','SELECT pool_parallel("SELECT egg4.id, egg4.agg FROM egg4
WHERE TRUE")') AS egg4(pool_c$2 integer,pool_c$3 integer) JOIN ( SELECT
pool_g$1 AS pool_c$-1 ,(sum(pool_g$0)/sum(pool_g$0c)) AS pool_c$-1  FROM
dblink('host=domU-12-31-38-00-2C-42 dbname=bench_parallel port=9999
user=postgres','SELECT pool_parallel("SELECT sum(agg),count(agg),id FROM
egg4 GROUP BY id")') AS pool_t$1g (pool_g$0 numeric ,pool_g$0c bigint
,pool_g$1 integer)  GROUP BY pool_g$1) AS second  ON  (
egg4.pool_c$2=second.pool_c$4 ) WHERE  (egg4.pool_c$3>second.pool_c$5 )
2007-12-28 07:07:55 DEBUG: pid 3238: pool_rewrite_stmt: XXX message_code 7
2007-12-28 07:07:55 DEBUG: pid 3238: pool_rewrite_stmt: XXX rule 705



My pgpool.conf is:
#
# pgpool-II configuration file sample
# $Header: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample,v 1.15 2007/10/31
10:45:52 y-asaba Exp $

# Host name or IP address to listen on: '*' for all, '' for no TCP/IP
# connections
listen_addresses = '*'

# Port number for pgpool
port = 9999

# Port number for pgpool communication manager
pcp_port = 9898

# Unix domain socket path.  (The Debian package defaults to
# /var/run/postgresql.)
socket_dir = '/tmp'

# Unix domain socket path for pgpool communication manager.
# (Debian package defaults to /var/run/postgresql)
pcp_socket_dir = '/tmp'

# Unix domain socket path for the backend. Debian package defaults to
/var/run/postgresql!
backend_socket_dir = '/tmp'

# pgpool communication manager timeout. 0 means no timeout, but strongly not
recommended!
pcp_timeout = 10

# number of pre-forked child process
num_init_children = 32

# Number of connection pools allowed for a child process
max_pool = 4

# If idle for this many seconds, child exits.  0 means no timeout.
child_life_time = 300

# If idle for this many seconds, connection to PostgreSQL closes.
# 0 means no timeout.
connection_life_time = 0

# If child_max_connections connections were received, child exits.
# 0 means no exit.
child_max_connections = 0

# If client_idle_limit is n (n > 0), the client is forced to be
# disconnected whenever after n seconds idle (even inside an explicit
# transactions!)
# 0 means no disconnect.
client_idle_limit = 0

# Maximum time in seconds to complete client authentication.
# 0 means no timeout.
authentication_timeout = 60

# Logging directory
logdir = '/tmp'

# Replication mode
replication_mode = false

# Set this to nonzero (in milliseconds) to detect this situation and
# resolve the deadlock by aborting current session.
replication_timeout = 5000

# Load balancing mode, i.e., all SELECTs except in a transaction block
# are load balanced.  This is ignored if replication_mode is false.
load_balance_mode = true

# if there's a data mismatch between master and secondary
# start degeneration to stop replication mode
replication_stop_on_mismatch = false

# If true, replicate SELECT statement when load balancing is disabled.
# If false, it is only sent to the master node.
replicate_select = false

# Semicolon separated list of queries to be issued at the end of a session
reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'

# If true print timestamp on each log line.
print_timestamp = true

# If true, operate in master/slave mode.
master_slave_mode = false

# If true, cache connection pool.
connection_cache = true

# Health check timeout.  0 means no timeout.
health_check_timeout = 20

# Health check period.  0 means no health check.
health_check_period = 0

# Health check user
health_check_user = 'nobody'

# Execute command by failover.
# special values:  %d = node id
#                  %h = host name
#                  %p = port number
#                  %D = database cluster path
#                  %% = '%' character
#
failover_command = ''

# Execute command by failback.
# special values:  %d = node id
#                  %h = host name
#                  %p = port number
#                  %D = database cluster path
#                  %% = '%' character
#
failback_command = ''

# If true, automatically lock table with INSERT statements to keep SERIAL
# data consistency.  An /*INSERT LOCK*/ comment has the same effect.  A
# /NO INSERT LOCK*/ comment disables the effect.
insert_lock = false

# If true, ignore leading white spaces of each query while pgpool judges
# whether the query is a SELECT so that it can be load balanced.  This
# is useful for certain APIs such as DBI/DBD which is known to adding an
# extra leading white space.
ignore_leading_white_space = true

# If true, print all statements to the log.  Like the log_statement option
# to PostgreSQL, this allows for observing queries without engaging in full
# debugging.
log_statement = true

# If true, incoming connections will be printed to the log.
log_connections = true

# If true, hostname will be shown in ps status. Also shown in
# connection log if log_connections = true.
# Be warned that this feature will add overhead to look up hostname.
log_hostname = false

# if non 0, run in parallel query mode
parallel_mode = true

# if non 0, use query cache
enable_query_cache = false

#set pgpool2 hostname
pgpool2_hostname = ''

# system DB info
system_db_hostname = 'localhost'
system_db_port = 5432
system_db_dbname = 'pgpool'
system_db_schema = 'pgpool_catalog'
system_db_user = 'pgpool'
system_db_password = ''

# backend_hostname, backend_port, backend_weight
# here are examples
backend_hostname0 = 'localhost'
backend_port0 = 5432
backend_weight0 = 1
backend_data_directory0 = '/data'
backend_hostname1 = 'ec2-67-202-24-56.compute-1.amazonaws.com'
backend_port1 = 9999
backend_weight1 = 1
backend_data_directory1 = '/data'

# - HBA -

# If true, use pool_hba.conf for client authentication. In pgpool-II
# 1.1, the default value is false. The default value will be true in
# 1.2.
enable_pool_hba = false

# - online recovery -
# online recovery user
recovery_user = 'nobody'

# online recovery password
recovery_password = ''

# execute a command in first stage.
recovery_1st_stage_command = ''

# execute a command in second stage.
recovery_2nd_stage_command = ''



Thank you in advance!


Regards,

David Andersen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/pgpool-general/attachments/20071228/3c1c326a/attachment-0001.html 


More information about the Pgpool-general mailing list