leonbloy@sinectis.com.ar wrote:
> [postgres@ren postgres]$ echo "select * from serv2;" | psql test1
> fecha1 | fecha2
> ------------+------------
> 13-01-2000 | 30-09-2000
> (1 row)
> ?????? What's happening here ???
I can't duplicate:
test=# SET datestyle=postgres;
SET VARIABLE
test=# create table serv2 (fecha1 date, fecha2 date);
CREATE
test=# insert into serv2 values ('13-01-2000','01-10-2000');
INSERT 407754 1
test=# select * from serv2;
fecha1 | fecha2
------------+------------
01-13-2000 | 01-10-2000
(1 row)
test=#
System is RedHat 6.2 with the PostgreSQL 7.0.2-2 RPMset loaded. Hmmm,
but 13-01-2000 got flipped to 01-13-2000, and 01-10-2000 didn't flip...
Now that is strange.
Let's try something...
test=# delete from serv2;
DELETE 1
test=# insert into serv2 values ('10-01-2000','01-10-2000');
INSERT 407765 1
test=# select * from serv2;
fecha1 | fecha2
------------+------------
10-01-2000 | 01-10-2000
(1 row)
Nope, still right.
Hmmm, if I insert '30-09-2000', I get:
test=# select * from serv2;
fecha1 | fecha2
------------+------------
01-13-2000 | 09-30-2000
(1 row)
Now, this is with DATESTYLE set within the psql session using 'set
datestyle' -- let's try the PGDATESTYLE variable...
[lowen@utility www]$ export PGDATESTYLE=Postgres
[lowen@utility www]$ psql -c "delete from serv2" test
DELETE 1
[lowen@utility www]$ psql -c "insert into serv2 values
('13-01-2000','01-10-2000')" test
INSERT 407808 1
[lowen@utility www]$ psql -c "select * from serv2" test
fecha1 | fecha2
------------+------------
01-13-2000 | 01-10-2000
(1 row)
[lowen@utility www]$
Still the same results as earlier.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11