Unix Technical Forum

Where clause...

This is a discussion on Where clause... within the pgsql Novice forums, part of the PostgreSQL category; --> Hello, I have a table which a column "fee_type " declared as char(1) The column can contain 'I' (uppercase ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 11:51 PM
Didier Gasser-Morlay
 
Posts: n/a
Default Where clause...

Hello,

I have a table which a column "fee_type " declared as char(1)

The column can contain 'I' (uppercase i), 'C' or 'R'

When querying with Select * from <table> where fee_type in ('I', 'C')

the query returns nothing.

The query returns the rows I am expecting when doing one of the following:

where fee_type ilike ('I') or fee_type ilike ('C')
or
where fe.fee_type = chr(73) or fee_type = chr(67)
(this proves the value is indeed uppercase)

but nothing is returned either when I try
where fee_type like ('I') or fee_type like ('C')

I thought it would be related to the datatype so I tried casting the
'I' and 'C' to char(1), but I had no luck.

Could you give me a hint ?

thanks
Didier

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 11:51 PM
A. Kretschmer
 
Posts: n/a
Default Re: Where clause...

am Sun, dem 03.02.2008, um 9:26:34 +0100 mailte Didier Gasser-Morlay folgendes:
> Hello,
>
> I have a table which a column "fee_type " declared as char(1)
>
> The column can contain 'I' (uppercase i), 'C' or 'R'
>
> When querying with Select * from <table> where fee_type in ('I', 'C')
>
> the query returns nothing.


Works for me:

test=*# select * from fee;
id | fee_type
----+----------
1 | C
2 | I
3 | c
4 | i
5 | a
(5 rows)

test=*# select * from fee where fee_type in ('C','I');
id | fee_type
----+----------
1 | C
2 | I
(2 rows)


Please show us your table description (\d table like
test=*# \d fee
Table "public.fee"
Column | Type | Modifiers
----------+--------------+-----------
id | integer |
fee_type | character(1) |


and tell us your PG-Version.


Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:23 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com