Problem with COPY and DateStyle

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Problem with COPY and DateStyle
Date: 2004-04-15 04:43:08
Message-ID: 200404150443.i3F4h8w13188@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just found out that datestyle affects the output of COPY, and hence
pg_dump:

test=> create table test(x date);
CREATE
test=> insert into test values ('2001-07-31');
INSERT 17239 1
test=> set datestyle to 'postgres, dmy';
SET
test=> copy test to '/tmp/x';
COPY
test=> \!cat /tmp/x
31-07-2001
test=> set datestyle to 'postgres, mdy';
SET
test=> copy test to '/tmp/x';
COPY
test=> \!cat /tmp/x
07-31-2001

Should we set the datestyle at the top of pg_dump files like we do with
encoding and other settings? Seems we should.

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-04-15 04:54:34 Re: Problem with COPY and DateStyle
Previous Message Robert Treat 2004-04-15 02:46:21 Re: pgmex, a MATLAB interface for PostgreSQL