Re: [GENERAL] timestamps

From: tolik(at)icomm(dot)ru (Anatoly K(dot) Lasareff)
To: strawman(at)plexi(dot)com
Cc: General Postgres List <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] timestamps
Date: 1999-02-24 08:50:16
Message-ID: 87n224xk1j.fsf@tolikus.hq.aaanet.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "s" == strawman <strawman(at)plexi(dot)com> writes:

s> I'm trying to create a column that defaults to the current time and date. I
s> tried the SQLServer like syntax below but potgresql choked:

s> CREATE TABLE clicks (
s> avo_userid varchar (10) NOT NULL ,
s> link_id int NOT NULL ,
s> the_time timestamp NOT NULL CONSTRAINT df_now DEFAULT (timestamp('now'))
s> );
s> NOTICE: there is more than one function named "timestamp"
s> NOTICE: that satisfies the given argument types. you will have to
s> NOTICE: retype your query using explicit typecasts.
s> ERROR: function timestamp(unknown) does not exist

s> Is "timestamp" not both a type and a function? How can I look it
up?

There are data type named 'timestamp' and more than one function for
converting 'timestamp' -> other data type. B.e.

timestamp(data)
timestamp(datetime)
... etc

All of them have the same name - 'timestamp', but different type of
argument(s).

In your case parser dont know - what type of argument you use. You
must 'retype your query using explicit typecasts':

the_time timestamp NOT NULL CONSTRAINT df_now DEFAULT (timestamp('now'::datetime))

s> And one more question: How does one construct a foreign key relationship in
s> postgres?

In 6.4 there are no really 'primary ney - foreign key' constraint. If
you wont have this feature you must use 'refint' from postgres
contribs.

--
Anatoly K. Lasareff Email: tolik(at)icomm(dot)ru
Senior programmer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gilles Darold 1999-02-24 08:52:55 ISP with PostgreSQL
Previous Message Adam Haberlach 1999-02-24 06:23:05 Indexing of text fields