[Gambas-user] Postgresql date question

Rolf Schmidt rolf.frogs at ...221...
Sun Jul 20 10:27:12 CEST 2008


Hi Richard

> Hi to postgres users of gambas.
>
> I'm passing some information to postges, which gets the data from date type
>
> eg date1 as date
>      data2 as date
>
> (N the postgres database the default on the date field is null)
>
> my problem is that postgres baulks when I"ve not put a date into one of the
> gambas date variables with the message:
>
> "invalid syntax for type date '00:00:00'"
>
> my sql is far more complex but reduced to the date part reads something
> like this
>
> insert into mytable (date1, date2) values
>
> ('01/01/2008','00:00:00')
>
> I wondered if anyone could volunteer a solution

You can use an insert trigger, which checks, if date to be insertet is invalid 
and set a wanted default i.e. 1.1.1970 or what ever you like. So you will get 
always a valid date or you even can insert NULL if you insist on an empty 
date.

HTH Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20080720/2a423fd5/attachment.sig>


More information about the User mailing list