Dmitry Koterov dmitry at koterov.ru
Thu Jul 12 10:19:58 PDT 2007
Attention! Note that this fix must be applied NOT for slonik only, BUT for
slon too on EACH machine!
This is because slon uses the same parser as slonik and starts an endless
cycle trying to run the command which patched slonik successfully processed.

On 7/12/07, Dmitry Koterov <dmitry at koterov.ru> wrote:
>
> The quick & dirty fix for the first one is:
>
> slony1-1.2.9\src\parsestatements\scanner.c
>
> if (state =3D=3D Q_NORMAL_STATE) {
>     state =3D Q_HOPE_TO_DASH;
>     break;
> }
>
> replace to
>
> if (state =3D=3D Q_NORMAL_STATE && extended_statement[cpos+1] =3D=3D '-')=
 {
>     state =3D Q_HOPE_TO_DASH;
>     break;
> }
>
>
> On 7/12/07, Dmitry Koterov <dmitry at koterov.ru> wrote:
> >
> > Hello.
> >
> > Here is the third bug I found in slonik with SQL parsing. Try to feed
> > the following to slonik:
> >
> > CREATE INDEX aaa ON public.bbb USING btree ((-ccc), ddd);
> > hjkhjkhjkjhk;
> >
> > You will see:
> >
> > DDL script consisting of 0 SQL statements
> > Submit DDL Event to subscribers...
> > DDL on origin - PGRES_TUPLES_OK
> >
> > If you replace "-ccc" with "ccc", all works fine: "2 SQL statements".
> >
> >
> >
> > The second bug:
> >
> > CREATE RULE "position_get_last_id_on_insert"
> > AS ON INSERT TO "public"."position" DO (SELECT
> > currval('position_position_id_seq'::regclass) AS id;);
> >
> > Incorrectly splitted by "id;".
> >
> >
> >
> > And the first bug:
> >
> > DDL Statement 2: (299,471) [
> > CREATE UNIQUE INDEX "i_dictionary_uni_abbr" ON "static"."dictionary"
> >   USING btree ((substring(dic_russian, E'^([^(]*[^( ]) *\\('::text)))
> >   WHERE (dic_category_id =3D 26);
> > ]
> > DDL Statement failed - PGRES_FATAL_ERROR
> >
> > You see, it generates an error. Here is a portion of postgres logs:
> >
> > 2007-06-28 18:56:55 GMT 87.250.244.99(55965)ERROR:  invalid regular
> > expression: parentheses () not balanced
> > 2007-06-28 18:56:55 GMT 87.250.244.99(55965)STATEMENT:
> >         CREATE UNIQUE INDEX "i_dictionary_uni_abbr" ON
> > "static"."dictionary"
> >           USING btree ((substring(dic_russian, E'^([^(]*[^( ])
> > *\('::text)))
> >           WHERE (dic_category_id =3D 26);
> >
> > Note the \\( part above: it is sent to the server as \(.
> > Seems slonik replaces \\ by \ before sending it to postgres?
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20070712/=
b8f47423/attachment-0001.htm


More information about the Slony1-general mailing list