| From: | Michael Fuhr <mike(at)fuhr(dot)org> | 
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | \copy (query) delimiter syntax error | 
| Date: | 2007-02-03 09:18:05 | 
| Message-ID: | 20070203091805.GA59938@winnie.fuhr.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers pgsql-patches | 
psql's \copy (query) with a delimiter yields a syntax error:
  test=> \copy foo to foo.txt delimiter '|'
  (works)
  test=> \copy (select * from foo) to foo.txt
  (works)
  test=> \copy (select * from foo) to foo.txt delimiter '|'
  ERROR:  syntax error at or near "USING"
  LINE 1: COPY ( select * from foo ) TO STDOUT USING DELIMITERS '|'
The problem is that \copy sends USING DELIMITERS for backward
compatibility (comment on line 502 of src/bin/psql/copy.c) but that
COPY (query) doesn't support USING DELIMITERS:
  CopyStmt:   COPY opt_binary qualified_name opt_column_list opt_oids
              copy_from copy_file_name copy_delimiter opt_with copy_opt_list
              ...
              | COPY select_with_parens TO copy_file_name opt_with
                copy_opt_list
  copy_delimiter:
              /* USING DELIMITERS kept for backward compatibility. 2002-06-15 */
             opt_using DELIMITERS Sconst
What should be fixed -- COPY or \copy?  Does psql's \copy still
need backward compatibility to unsupported pre-7.3?
-- 
Michael Fuhr
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2007-02-03 09:57:46 | Re: Referential Integrity and SHARE locks | 
| Previous Message | Kate F | 2007-02-03 04:28:48 | Re: snprintf() | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2007-02-03 15:57:39 | Re: [pgsql-patches] Recalculating OldestXmin in a long-running vacuum | 
| Previous Message | Jeremy Drake | 2007-02-03 03:01:33 | Re: [HACKERS] writing new regexp functions |