Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aW5UJ-0000I3-16 for pgsql-admin@arkaria.postgresql.org; Wed, 17 Feb 2016 17:02:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aW5UI-0000If-7Y for pgsql-admin@arkaria.postgresql.org; Wed, 17 Feb 2016 17:02:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aW5Sc-0006qi-C5 for pgsql-admin@postgresql.org; Wed, 17 Feb 2016 17:00:18 +0000 Received: from outbound.afilias.info ([66.199.183.4]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aW5SY-0006fl-7P for pgsql-admin@postgresql.org; Wed, 17 Feb 2016 17:00:17 +0000 Received: from ms5.on1.afilias-ops.info ([10.109.8.9] helo=smtp.afilias.info) by outbound.afilias.info with esmtp (Exim 4.72) (envelope-from ) id 1aW5SU-0003Op-4D for pgsql-admin@postgresql.org; Wed, 17 Feb 2016 17:00:10 +0000 Received: from mail-io0-f171.google.com ([209.85.223.171]) by smtp.afilias.info with esmtps (TLSv1:RC4-SHA:128) (Exim 4.72) (envelope-from ) id 1aW5SU-00032M-3u for pgsql-admin@postgresql.org; Wed, 17 Feb 2016 17:00:10 +0000 Received: by mail-io0-f171.google.com with SMTP id l127so43312966iof.3 for ; Wed, 17 Feb 2016 09:00:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=NyQDa3kmKgtki8UYZeR3lcNj0DSjrOKknEMffNUzW5c=; b=SrEInH+twuT+g3w9wRX94ZNFR0VJETlaio29niKESMR2xPIeWreb6mWBp+D6QyvqBm thUEtgDlQOl6ebOYDwfScn6vDlniFCYBBIRnzIYOLNkOR/TmEuarcHt+IvAU4AO45Jzp m8nF20f4W6DtW+4iOAU40uFu0y+402v7KLrnD0vjYBbmbgMvLOcyUCER+PFdOVIjb1mP BjYBGq1BA1dTaYOYHT4uNg9ji2mCK12RannGR0mg/XJf8n0ZR5rh7nrY+KU3I3xGMgVw lAJlWxo7s9zXKSfqdUzRw+cr3/925PC/j1nzstuofz/CIOKlon9RjCWWbXfJkF4StNNO Sgvw== X-Gm-Message-State: AG10YOTeEeawZFjJj8Q3WuHf2ijZbsgrISUOYidkBKfE3lwqjsvciHMYaX78VsYsdjMjtR60AY6OXcDFFr0fuDIxBe6L4a6Eiiv7f85iCOibRlCtG37ReKVjtjf1+Bs9GvbVxwaFX5JBTQlyL/c= X-Received: by 10.107.170.140 with SMTP id g12mr5176195ioj.44.1455728404856; Wed, 17 Feb 2016 09:00:04 -0800 (PST) X-Received: by 10.107.170.140 with SMTP id g12mr5176179ioj.44.1455728404707; Wed, 17 Feb 2016 09:00:04 -0800 (PST) Received: from [192.168.1.126] (192-0-198-71.cpe.teksavvy.com. [192.0.198.71]) by smtp.gmail.com with ESMTPSA id l6sm8324381igv.10.2016.02.17.09.00.03 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Feb 2016 09:00:04 -0800 (PST) Subject: Re: Extracting data into .csv format To: pgsql-admin@postgresql.org References: <2BC18916DE4BF141AC1EFC55CE2CAE7D1B8DAE47@NAEANRFKXM01V.nadsusea.nads.navy.mil> From: Ziggy Skalski Message-ID: <56C4A710.6050309@afilias.info> Date: Wed, 17 Feb 2016 12:00:00 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <2BC18916DE4BF141AC1EFC55CE2CAE7D1B8DAE47@NAEANRFKXM01V.nadsusea.nads.navy.mil> Content-Type: multipart/alternative; boundary="------------060605010108040508050304" X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------060605010108040508050304 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 2016-02-17 11:49 AM, Ferrell, Denise D CTR NSWCDD, H11 wrote: > Using PostgreSQL 9.3 on Linux > > I'm trying to extract data into a comma delimited format and not having much success...seems to act totally different from Oracle. Does anyone have any suggestions? > > Thank you in advance. > Denise Have you tried something like i.e.: psql -c "COPY ( QUERY ) TO STDOUT WITH CSV HEADER " > CSV_FILE.csv Should do the trick (assuming it's basic output you're after). Regards, Ziggy --------------060605010108040508050304 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
On 2016-02-17 11:49 AM, Ferrell, Denise D CTR NSWCDD, H11 wrote:
Using PostgreSQL 9.3 on Linux 

I'm trying to extract data into a comma delimited format and not having much success...seems to act totally different from Oracle.  Does anyone have any suggestions?

Thank you in advance.
Denise
Have you tried something like i.e.:

psql -c "COPY ( QUERY ) TO STDOUT WITH CSV HEADER " > CSV_FILE.csv

Should do the trick (assuming it's basic output you're after).

Regards,

Ziggy

--------------060605010108040508050304--