[SQL] Text cast problem

2009-04-03 Thread Volkmar Herbst
Dear all- 

I encountered the following problem:

 

select * from parcel where number = '255 ' 

gives me 1 row but 

 

select * from parcel where number = '255 ' ::text

does give me 0 rows. The cast removes the trailing empty character.

 

Why is that? Unfortunately the statements are generated (NPGSQL) and I can’t 
change the way they are generated. What can I do? Any suggestions highly 
welcomed!

 

Volkmar

 



[SQL] strange update behavior

2011-04-13 Thread Volkmar Herbst GCI
 

I did encounter a quite strange behavior during update which I did not
understand:

 

The following query updated table parcelle with only one entry for all rows:

update cadastre.parcelle 

set code_unique = t2.code_unique  from  

cadastre.parcelle t1, cadastre.propriete t2 

where t1.uoid = t2.uoidparcelle;

 

the next update query behaved as expected :

update cadastre.parcelle 

set code_unique = t2.code_unique  from  

cadastre.parcelle t1, cadastre.propriete t2 

where parcelle.uoid = t2.uoidparcelle;

 

Why do i have to reference table parcelle in the where clause?