From: | "codeWarrior" <gpatnude(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Insert a default timestamp when nothing given |
Date: | 2006-01-19 15:53:51 |
Message-ID: | dqocld$1gk0$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Change your table definition and specify a defeault value for your timestamp
column.... this way -- when nothing is given on insert --> it will
populate...
CREATE TABLE test (
id serial not null primary key,
defaultdate timestamp not null default now()
);
"" Martin Pohl"" <Nilpherd(at)gmx(dot)net> wrote in message
news:31905(dot)1137671744(at)www74(dot)gmx(dot)net(dot)(dot)(dot)
>
> Hi,
>
> I have to port an application from MS SQL7 to Postgresql (7.4).
>
> When I have a column with a datetime on MS SQL7 the following is possible:
> INSERT INTO mytable (mydate) values ('');
>
> In this case MSSQL will insert '01.01.1900' as the date.
>
> When I do the same on Postgresql it says:
> "invalid input syntax for type timestamp with time zone: ''".
>
> Unfortunately the application I have to port often uses '' as a date.
>
> My question:
> Is there any way to have MSSQLs behavior in PostgreSQL?
>
> Thanks for answers
>
> --
> Telefonieren Sie schon oder sparen Sie noch?
> NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2006-01-19 16:00:57 | Re: Execution of stored procedures |
Previous Message | Axel Straschil | 2006-01-19 15:30:05 | PostgreSQL - a ORDBMS? |