dbTalk Databases Forums  

[BUGS] Regex bug

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Regex bug in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Fetter
 
Posts: n/a

Default [BUGS] Regex bug - 08-06-2004 , 12:25 PM






Kind people,

Here's a symptom as reported by John Hansen aka applejack:

SELECT 'r'||'\000\125'||'hello' ~ '^.hello' AS "OMG";
OMG
-----
t
(1 row)

I have produced this behavior in 7.4.3 and CVS tip.

This should be false, shouldn't it?

Cheers,
D
--
David Fetter david (AT) fetter (DOT) org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Regex bug - 08-06-2004 , 12:56 PM






David Fetter <david (AT) fetter (DOT) org> writes:
Quote:
Here's a symptom as reported by John Hansen aka applejack:

SELECT 'r'||'\000\125'||'hello' ~ '^.hello' AS "OMG";
This is not a regex bug: it has to do with the fact that we don't
support embedded nulls in text values. This may enlighten you
a bit as to what's happening:

regression=# select length ('\000\125');
length
--------
0
(1 row)


regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Regex bug - 08-06-2004 , 12:58 PM



David Fetter <david (AT) fetter (DOT) org> writes:
Quote:
On Fri, Aug 06, 2004 at 01:32:32PM -0400, Tom Lane wrote:
regression=# select length ('\000\125');
length
--------
0
(1 row)

Ah, right. John was testing his unicode patch, so there must be some
magick underneath that distinguishes characters from bytes

Cheers,
D (feeling a little sheepish. again.)
It occurs to me that a case could be made for having text_in throw an
error if it sees '\000'. I cannot really see that there's any benefit
to the current behavior of (effectively) silently truncating the string.

Comments?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #4  
Old   
David Fetter
 
Posts: n/a

Default Re: [BUGS] Regex bug - 08-06-2004 , 01:10 PM



On Fri, Aug 06, 2004 at 01:32:32PM -0400, Tom Lane wrote:
Quote:
David Fetter <david (AT) fetter (DOT) org> writes:
Here's a symptom as reported by John Hansen aka applejack:

SELECT 'r'||'\000\125'||'hello' ~ '^.hello' AS "OMG";

This is not a regex bug: it has to do with the fact that we don't
support embedded nulls in text values. This may enlighten you
a bit as to what's happening:

regression=# select length ('\000\125');
length
--------
0
(1 row)
Ah, right. John was testing his unicode patch, so there must be some
magick underneath that distinguishes characters from bytes

Cheers,
D (feeling a little sheepish. again.)
--
David Fetter david (AT) fetter (DOT) org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.