Thread: Bad timestamp external representation
Hello everybody I meet the "bad timestamp external representation" error, and I don't know how to solve it. I tried, of course, to look for documentation myself, but I feel lost with this... any help will be greatly appreciated. I first met the problem with a view: create view allprod as ( SELECT equip,produit,nserie,exserie,ech FROM package union SELECT id,produit,nserie,exserie,ech FROM equip union SELECT equip_id,'',produit,'','' FROM cles ) The view is created succesfully, but if I try a "select * from allprod", I have the timestamp error. "ech" is the timestamp field, it can be null in some rows. If I use it in only one of the unions (instead of 2), the same problem occur. Of course, if I create the view without the "ech" field, I can select or do what I want without trouble. I also found this: on a normal table with a timestamp field (called, say, "tstamp"), I will get the error too with a query like "select * from my_table where tstamp=''", and no error with "...where tstamp is null". Well, it may be easy for advanced user, but not for me ! I use postgresql 7.1.3 on a Debian 2.2r3 system, with a "fr_FR" locale. Thanks in advance Francois Thomas
You might try using NULL instead of '' when selecting from cles. I don't know if that is what the problem is, but I do know that the timestamp type does not like ''. Jason --- Francois Thomas <FrancoisT@alsdesign.fr> wrote: > > Hello everybody > > I meet the "bad timestamp external representation" > error, and I don't know > how to solve it. I tried, of course, to look for > documentation myself, but I > feel lost with this... any help will be greatly > appreciated. > I first met the problem with a view: > > create view allprod as > ( > SELECT equip,produit,nserie,exserie,ech FROM package > > union > SELECT id,produit,nserie,exserie,ech FROM equip > union > SELECT equip_id,'',produit,'','' FROM cles > ) > The view is created succesfully, but if I try a > "select * from allprod", I > have the timestamp error. > "ech" is the timestamp field, it can be null in some > rows. If I use it in > only one of the unions (instead of 2), the same > problem occur. Of course, if > I create the view without the "ech" field, I can > select or do what I want > without trouble. > I also found this: on a normal table with a > timestamp field (called, say, > "tstamp"), I will get the error too with a query > like "select * from > my_table where tstamp=''", and no error with > "...where tstamp is null". > Well, it may be easy for advanced user, but not for > me ! > I use postgresql 7.1.3 on a Debian 2.2r3 system, > with a "fr_FR" locale. > Thanks in advance > > Francois Thomas > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the > unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Saluton, On Wed, Aug 22, 2001 at 10:16:28AM +0200, Francois Thomas wrote: > > Hello everybody > > I meet the "bad timestamp external representation" error, and I don't know ... > SELECT equip,produit,nserie,exserie,ech FROM package > union > SELECT id,produit,nserie,exserie,ech FROM equip > union > SELECT equip_id,'',produit,'','' FROM cles ^^ This looks to me that you are trying to use '' as a timestamp. Instead, you should provide a meaningful timestamp - probably NULL ("don't know"). Albert.
> > I meet the "bad timestamp external representation" error, > and I don't know > ... > > SELECT equip,produit,nserie,exserie,ech FROM package > > union > > SELECT id,produit,nserie,exserie,ech FROM equip > > union > > SELECT equip_id,'',produit,'','' FROM cles > ^^ > > This looks to me that you are trying to use '' as a > timestamp. Instead, you should provide a meaningful timestamp - > probably NULL ("don't know"). > > Albert. Many thanks to all the persons who helped me with this issue ! The view is now working perfectly... Salutations from France François Thomas