pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDEFAULT TEXT 'now' in create table
2+ messages / 2 participants
[nested] [flat]
* DEFAULT TEXT 'now' in create table
@ 1999-02-12 16:20 Roberto Joao Lopes Garcia <roberto@mha.com.br>
0 siblings, 1 reply; 2+ messages in thread
From: Roberto Joao Lopes Garcia @ 1999-02-12 16:20 UTC (permalink / raw)
To: pgsql-sql
Hi
I´m making tests on datetime fields and try to use DEFAULT TEXT 'now' but
it end up always with the same time.
Is it OK? I do not think so! Perhaps I made some mistakes or do not
understood the manuals.
PostgreSQL 6.4.0 - Sparc Solaris 2.5 - front end psql
test=>
test=>
test=>
test=> CREATE SEQUENCE seq_conex\g
CREATE
test=>
CREATE TABLE conex (
id int4 PRIMARY KEY DEFAULT NEXTVAL('seq_conex'),
hora time DEFAULT TEXT 'now',
ms int4 ,
dt datetime DEFAULT
TEXT 'now'
)\g
test-> test-> test-> test-> test-> NOTICE: CREATE
TABLE/PRIMARY KEY will create implicit index conex_pkey for table
conex
CREATE
test=> insert into conex (ms) values (100000) \g
INSERT
6113923 1
test=> select * from conex\g
id|hora | ms|dt
--+--------+------+--------------------------
1|13:58:39|100000|12/02/1999 13:58:39.00 EDT
(1 row)
--
-- After +- 2 minutes ...
--
test=> insert into conex (ms) values (140110) \g
INSERT 6113924 1
test=>
select * from conex\g
id|hora | ms|dt
--+--------+------+--------------------------
1|13:58:39|100000|12/02/1999 13:58:39.00 EDT
2|13:58:39|140110|12/02/1999
13:58:39.00 EDT ==> I think should be 14:01:10.00
(2 rows)
test=>
Thank You!
Roberto
------------------------------------------------------------------
Eng. Roberto João Lopes Garcia E-mail: roberto@mha.com.br
F. 55 11 848 9906 FAX 55 11 848 9955
MHA Engenharia Ltda
E-mail: mha@mha.com.br WWW: http://www.mha.com.br
Av Maria Coelho Aguiar, 215 Bloco D 2 Andar
Centro Empresarial de Sao Paulo
Sao Paulo - BRASIL - 05805 000
-------------------------------------------------------------------
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] DEFAULT TEXT 'now' in create table
@ 1999-02-15 11:12 Remigiusz Sokolowski <rems@gdansk.sprint.pl>
parent: Roberto Joao Lopes Garcia <roberto@mha.com.br>
0 siblings, 0 replies; 2+ messages in thread
From: Remigiusz Sokolowski @ 1999-02-15 11:12 UTC (permalink / raw)
To: Roberto Joao Lopes Garcia <roberto@mha.com.br>; +Cc: pgsql-sql
>
> I´m making tests on datetime fields and try to use DEFAULT TEXT 'now' but
> it end up always with the same time.
>
> Is it OK? I do not think so! Perhaps I made some mistakes or do not
> understood the manuals.
>
> PostgreSQL 6.4.0 - Sparc Solaris 2.5 - front end psql
> hora time DEFAULT TEXT 'now',
Hi!
Instead of 'now' use now() this will always insert actual time - I have
teh same problem :-)
Rem
-------------------------------------------------------------------*------------
Remigiusz Sokolowski e-mail: rems@gdansk.sprint.pl * *
-----------------------------------------------------------------*****----------
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-02-15 11:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-12 16:20 DEFAULT TEXT 'now' in create table Roberto Joao Lopes Garcia <roberto@mha.com.br>
1999-02-15 11:12 ` Remigiusz Sokolowski <rems@gdansk.sprint.pl>
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