[Pgcluster-general] bug in replicate.c
Vladimir Klejch
klejch+pgcluster at netbox.cz
Fri May 19 16:01:30 UTC 2006
Hi
I found a bug in src/backend/libpq/replicate.c, which causes not
replication of "CREATE FUNCTION .." using "dollar quoting" syntax.
>From PG8.1 doc:
http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-DOLLAR-QUOTING
------------------------
A dollar-quoted string constant consists of a dollar sign ($), an optional
"tag" of zero or more characters, another dollar sign, an arbitrary
sequence of characters that makes up the string content, a dollar sign,
the same tag that began this dollar quote, and a dollar sign.
-----------------------
pg_dump uses automaticaly quoting with "$_$" for functions with arguments
like $1,$2,... in function body and PgCluster parses only for "isalnum",
when searches end of quoting string.
Like:
=======================
CREATE FUNCTION fce(integer) RETURNS integer
AS $_$
BEGIN
INSERT INTO tab (x) VALUES ($1);
RETURN 10;
END;
$_$
LANGUAGE plpgsql;
======================
Patch for using "_" in quoting tag is attached.
###############################################################################
--- replicate.c.old 2006-05-19 17:40:17.000000000 +0200
+++ replicate.c 2006-05-17 00:39:02.000000000 +0200
@@ -2210,7 +2210,7 @@
p++;
while (( *p != '\n') && (*p != '\0'))
{
- if (isalnum(*p) == 0)
+ if ((isalnum(*p) == 0) && (*p != '_') )
{
if (*p == '$')
{
###############################################################################
Kleo
--
Vladimír 'Kleo' Klejch
More information about the Pgcluster-general
mailing list