Re: BUG #4927: psql does "spoil" the query before sending it to server

Поиск
Список
Период
Сортировка
От Euler Taveira de Oliveira
Тема Re: BUG #4927: psql does "spoil" the query before sending it to server
Дата
Msg-id 4A60D5EA.5060308@timbira.com
обсуждение исходный текст
Ответ на BUG #4927: psql does "spoil" the query before sending it to server  ("handling numeric literals with dots in psql \copy command" <filip.rembialkowski@gmail.com>)
Ответы Re: BUG #4927: psql does "spoil" the query before sending it to server  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
handling numeric literals with dots in psql copy command escreveu:
> filip@filip=# \copy ( select 1.23::numeric as num ) to 'out.csv' with csv
> header
> ERROR:  syntax error at or near "."
> LINE 1: COPY ( select 1 . 23::numeric as num ) TO STDOUT CSV HEADER
>                         ^
> \copy: ERROR:  syntax error at or near "."
> LINE 1: COPY ( select 1 . 23::numeric as num ) TO STDOUT CSV HEADER
>                         ^
>
> query inside parentheses is OK.
>
> same bug reproduced in 8.3.7
>
Thanks for your report.

Why are we analysing the query there? One possible fix is to remove the '.' as
delimiter in strtokx(). The trivial patch is attached.


--
  Euler Taveira de Oliveira
  http://www.timbira.com/
Index: copy.c
===================================================================
RCS file: /a/pgsql/dev/anoncvs/pgsql/src/bin/psql/copy.c,v
retrieving revision 1.80
diff -c -r1.80 copy.c
*** copy.c    26 Apr 2009 15:31:50 -0000    1.80
--- copy.c    17 Jul 2009 19:41:58 -0000
***************
*** 146,152 ****

          while (parens > 0)
          {
!             token = strtokx(NULL, whitespace, ".,()", "\"'",
                              nonstd_backslash, true, false, pset.encoding);
              if (!token)
                  goto error;
--- 146,152 ----

          while (parens > 0)
          {
!             token = strtokx(NULL, whitespace, ",()", "\"'",
                              nonstd_backslash, true, false, pset.encoding);
              if (!token)
                  goto error;

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4926: too few pathkeys for mergeclauses
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4927: psql does "spoil" the query before sending it to server