pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Bug in psql's "-R" option?
3+ messages / 2 participants
[nested] [flat]

* Bug in psql's "-R" option?
@ 2002-11-05 19:07 Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
  2002-11-05 19:20 ` Re: Bug in psql's "-R" option? Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Murthy Kambhampaty @ 2002-11-05 19:07 UTC (permalink / raw)
  To: pgsql-admin

There seems to be a bug in psql's -R option (and the -P recordsep= )
version. I find that whereas the following succeeds:

/usr/local/pgsql/bin/psql -U xxxx -d xxxx -h xxxx \
	-P format=unaligned -P fieldsep='\t' -P tuples_only \
	-c "select * from tab where yoo='hoo'" | /usr/local/pgsql/bin/psql
-U xxxx -d xxxx -h xxxx \
	-c "copy bar from stdin"

adding -R '\n' or -P recordsep='\n' or -P recordsep=newline all give an
error that the last field's data is too long for that field's format.
Presently, this seems a bogus option, since the COPY command cannot handle
any record separator except a newline, but the documentation for the "copy
from" command states that '\n' will be parsed as a newline, so this seems a
bug.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Bug in psql's "-R" option?
  2002-11-05 19:07 Bug in psql's "-R" option? Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
@ 2002-11-05 19:20 ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2002-11-05 19:20 UTC (permalink / raw)
  To: Murthy Kambhampaty <murthy.kambhampaty@goeci.com>; +Cc: pgsql-admin


psql -R controls the record separator for query output, not COPY.

---------------------------------------------------------------------------

Murthy Kambhampaty wrote:
> There seems to be a bug in psql's -R option (and the -P recordsep= )
> version. I find that whereas the following succeeds:
> 
> /usr/local/pgsql/bin/psql -U xxxx -d xxxx -h xxxx \
> 	-P format=unaligned -P fieldsep='\t' -P tuples_only \
> 	-c "select * from tab where yoo='hoo'" | /usr/local/pgsql/bin/psql
> -U xxxx -d xxxx -h xxxx \
> 	-c "copy bar from stdin"
> 
> adding -R '\n' or -P recordsep='\n' or -P recordsep=newline all give an
> error that the last field's data is too long for that field's format.
> Presently, this seems a bogus option, since the COPY command cannot handle
> any record separator except a newline, but the documentation for the "copy
> from" command states that '\n' will be parsed as a newline, so this seems a
> bug.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Bug in psql's "-R" option?
@ 2002-11-05 19:43 Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Murthy Kambhampaty @ 2002-11-05 19:43 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; Murthy Kambhampaty <murthy.kambhampaty@goeci.com>; +Cc: pgsql-admin

OK, sorry for the muddle-headed post (I realized my error as I walked away
from my desk ...).

The bug seems to be in the copy from parsing, which does not follow the
documentation as I related in my original message.

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Tuesday, November 05, 2002 14:21
To: Murthy Kambhampaty
Cc: 'pgsql-admin@postgresql.org'
Subject: Re: [ADMIN] Bug in psql's "-R" option?



psql -R controls the record separator for query output, not COPY.

---------------------------------------------------------------------------

Murthy Kambhampaty wrote:
> There seems to be a bug in psql's -R option (and the -P recordsep= )
> version. I find that whereas the following succeeds:
> 
> /usr/local/pgsql/bin/psql -U xxxx -d xxxx -h xxxx \
> 	-P format=unaligned -P fieldsep='\t' -P tuples_only \
> 	-c "select * from tab where yoo='hoo'" | /usr/local/pgsql/bin/psql
> -U xxxx -d xxxx -h xxxx \
> 	-c "copy bar from stdin"
> 
> adding -R '\n' or -P recordsep='\n' or -P recordsep=newline all give an
> error that the last field's data is too long for that field's format.
> Presently, this seems a bogus option, since the COPY command cannot handle
> any record separator except a newline, but the documentation for the "copy
> from" command states that '\n' will be parsed as a newline, so this seems
a
> bug.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-11-05 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05 19:07 Bug in psql's "-R" option? Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
2002-11-05 19:20 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-11-05 19:43 Re: Bug in psql's "-R" option? Murthy Kambhampaty <murthy.kambhampaty@goeci.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox