Обсуждение: function text_ge(text, text), how to use on version 7.2

Поиск
Список
Период
Сортировка

function text_ge(text, text), how to use on version 7.2

От
juerg.rietmann@pup.ch
Дата:
Hello there

I use the function text_ge(text, text) under version 7.03 and it was just
fine. After upgrading to version 7.2 this function doesn't work anymore.

this statement shows all the records even if the greatest year is 2002 in
ul_datum :
select * from userlog where text_ge(ul_datum, '01.01.2004')

Thanks in advance ... Juerg Rietmann



__________________________________________________

PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland

internet          :  www.pup.ch
phone       : +4141 790 4040
fax         : +4141 790 2545
mobile            : +4179 211 0315
__________________________________________________




Re: function text_ge(text, text), how to use on version 7.2

От
Achilleus Mantzios
Дата:
On Tue, 18 Jun 2002 juerg.rietmann@pup.ch wrote:

> Hello there
> 
> I use the function text_ge(text, text) under version 7.03 and it was just
> fine. After upgrading to version 7.2 this function doesn't work anymore.

It is quite possible that text_ge uses local encodings.
However I think it is working fine, but it is unwise to use strings
for dates representation.

You could use timestamps with resolution to milisecond
(which means storing actual UNIX dates), or dates.

What you do with text_ge is a lexicographical comparison of the two texts.
Hence, this method will produce different results for different encodings,
and thus it is not portable.

i'd say convert the 'DD-MM-YYYY' ul_datum fields with the correct SQL 
dates, or timestamps, and then use normal date comparison <,>,=.

> 
> this statement shows all the records even if the greatest year is 2002 in
> ul_datum :
> select * from userlog where text_ge(ul_datum, '01.01.2004')
> 
> Thanks in advance ... Juerg Rietmann
> 
> 
> 
> __________________________________________________
> 
> PFISTER + PARTNER, SYSTEM - ENGINEERING AG
> Juerg Rietmann
> Grundstrasse 22a
> 6343 Rotkreuz
> Switzerland
> 
> internet          :  www.pup.ch
> phone       : +4141 790 4040
> fax         : +4141 790 2545
> mobile            : +4179 211 0315
> __________________________________________________
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com       mantzios@softlab.ece.ntua.gr