From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Insert a default timestamp when nothing given |
Date: | 2006-01-19 12:40:10 |
Message-ID: | 20060119124010.GH22896@webserv.wug-glas.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
am 19.01.2006, um 12:55:44 +0100 mailte Martin Pohl folgendes:
>
> 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 ('');
wrong date!
>
> 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?
You can write a function with exception handling.
Simple example: http://www.varlena.com/varlena/GeneralBits/,
02-Jan-2006, 'Insert or Update with Exception Handling'
Or, you can alter table and add a default date, but you can't insert a
wrong date.
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
From | Date | Subject | |
---|---|---|---|
Next Message | Sean Davis | 2006-01-19 12:45:28 | Re: Normalized storage to denormalized report |
Previous Message | Michael Glaesemann | 2006-01-19 12:23:58 | Re: Normalized storage to denormalized report |