A question about the psql \copy command
Through the work on the patch [1]/messages/by-id/002e01cdff64$a53663b0$efa32b10$@kapila@huaw ei.com, I had a question about the psql \copy
command. We are permitted 1) but not permitted 2):
1) \copy foo from stdin ;
2) \copy foo from stdin;
Is this intentional? I think it would be better to allow for 2). Attached is a
patch.
Thanks,
Best regards,
Etsuro Fujita
[1]: /messages/by-id/002e01cdff64$a53663b0$efa32b10$@kapila@huaw ei.com
/messages/by-id/002e01cdff64$a53663b0$efa32b10$@kapila@huaw
ei.com
Attachments:
psql_copy.patchapplication/octet-stream; name=psql_copy.patchDownload
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index a31d789..4ba385c 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -191,7 +191,7 @@ parse_slash_copy(const char *args)
else
goto error;
- token = strtokx(NULL, whitespace, NULL, "'",
+ token = strtokx(NULL, whitespace, ";", "'",
0, false, true, pset.encoding);
if (!token)
goto error;
On Thu, Feb 7, 2013 at 7:45 AM, Etsuro Fujita
<fujita.etsuro@lab.ntt.co.jp> wrote:
Through the work on the patch [1], I had a question about the psql \copy
command. We are permitted 1) but not permitted 2):
1) \copy foo from stdin ;
2) \copy foo from stdin;
Is this intentional? I think it would be better to allow for 2). Attached is a
patch.
Sounds reasonable to me.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thursday, February 07, 2013 6:15 PM Etsuro Fujita wrote:
Through the work on the patch [1], I had a question about the psql
\copy command. We are permitted 1) but not permitted 2):
1) \copy foo from stdin ;
2) \copy foo from stdin;
Is this intentional? I think it would be better to allow for 2).
Attached is a patch.
Verified that attached patch resolves the problem mentioned by you.
Ran the regression to ensure that it should not break any existing syntax.
Although this is minor bug, but IMO it will improve consistency among \
commands, because other works fine with ";"
With Regards,
Amit Kapila.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Feb 7, 2013 at 09:45:17PM +0900, Etsuro Fujita wrote:
Through the work on the patch [1], I had a question about the psql \copy
command. We are permitted 1) but not permitted 2):
1) \copy foo from stdin ;
2) \copy foo from stdin;
Is this intentional? I think it would be better to allow for 2). Attached is a
patch.
Modified, attached patch applied. Thanks.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
Attachments:
copy.difftext/x-diff; charset=us-asciiDownload
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
new file mode 100644
index c1e7cfe..13123d6
*** a/src/bin/psql/copy.c
--- b/src/bin/psql/copy.c
*************** parse_slash_copy(const char *args)
*** 196,202 ****
goto error;
/* { 'filename' | PROGRAM 'command' | STDIN | STDOUT | PSTDIN | PSTDOUT } */
! token = strtokx(NULL, whitespace, NULL, "'",
0, false, false, pset.encoding);
if (!token)
goto error;
--- 196,202 ----
goto error;
/* { 'filename' | PROGRAM 'command' | STDIN | STDOUT | PSTDIN | PSTDOUT } */
! token = strtokx(NULL, whitespace, ";", "'",
0, false, false, pset.encoding);
if (!token)
goto error;
*************** parse_slash_copy(const char *args)
*** 205,211 ****
{
int toklen;
! token = strtokx(NULL, whitespace, NULL, "'",
0, false, false, pset.encoding);
if (!token)
goto error;
--- 205,211 ----
{
int toklen;
! token = strtokx(NULL, whitespace, ";", "'",
0, false, false, pset.encoding);
if (!token)
goto error;