Oleg Bartunov <oleg@sai.msu.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-051 | 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