pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lee Hachadoorian <lee.hachadoorian@gmail.com>
To: PostgreSQL (SQL) <pgsql-sql@postgresql.org>
Subject: COPY without quoting
Date: Thu, 15 Mar 2012 12:16:14 -0400
Message-ID: <4F6215CE.7050207@gmail.com> (raw)

COPY ... TO ... WITH CSV defaults to quoting string fields with embedded 
delimiters, quotes, and newlines. In pgAdmin I can execute to file and 
specify "no quoting" for the output, in which case I get (what I want) a 
file with no quotes, even though there are embedded commas in the 
strings. But I am missing it if the COPY statement has a way to turn 
quotes off. You can turn them *on* with FORCE QUOTE, in which case a 
column will be quoted even if there are no embedded delimiters, etc. I 
tried

COPY ... TO ... WITH CSV QUOTE '';

but got a message that the quote string had to be at least one character.

Any ideas?

Best,
--Lee

-- 
Lee Hachadoorian
PhD, Earth&  Environmental Sciences (Geography)
Research Associate, CUNY Center for Urban Research
http://freecity.commons.gc.cuny.edu




view thread (3+ messages)  latest in thread

Message-ID: <4F6215CE.7050207@gmail.com>
Permalink:  ../4F6215CE.7050207@gmail.com/
Also on:    postgresql.org/message-id/4F6215CE.7050207@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lee.hachadoorian@gmail.com
  Subject: Re: COPY without quoting
  In-Reply-To: <4F6215CE.7050207@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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