From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] 'now' in 7.0 |
Date: | 2000-02-22 22:28:25 |
Message-ID: | 26070.951258505@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> writes:
> create view www_auth as select a.account as user_name, a.password, b.nick as
> group_name from users a, resources b, privilege_user_map c
> where a.auth_id = c.auth_id and b.res_id = c.res_id and
> (a.account_valid_until is null or a.account_valid_until > datetime('now'::text))
> and c.perm_id = 1;
> ERROR: No such function 'datetime' with the specified attributes
Apparently the datetime() function got renamed to timestamp() in the
recent consolidation of date/time types. I'd actually recommend that
you write CURRENT_TIMESTAMP, which is the SQL-approved notation...
> Does the above view will works with now() ?
That should work too.
> Another problem:
> create table tt (i int4, a datetime default 'now');
> doesn't works and I still need
> create table tt (i int4, a datetime default now());
? Works for me:
regression=# create table tt (i int4, a datetime default 'now');
CREATE
regression=# insert into tt values(1);
INSERT 653163 1
regression=# insert into tt values(1);
INSERT 653164 1
regression=# select * from tt;
i | a
---+------------------------
1 | 2000-02-22 17:15:16-05
1 | 2000-02-22 17:15:18-05
(2 rows)
although here also I think now() or CURRENT_TIMESTAMP would be safer
coding.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-02-22 22:38:17 | Re: Splitting distributions (Was: Re: [HACKERS] ECPG / Release) |
Previous Message | Chris Bitmead | 2000-02-22 22:28:14 | Re: [HACKERS] PostgreSQL v7.0 goes Beta ... |