![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table with one column as follows: =# \d+ procedures Table "public.procedures" Column | Type | Modifiers | Storage | Description -------------------+-------------------+-----------+----------+------------- runway | character varying | | extended | Now: SELECT airport,ident,runway FROM procedures WHERE runway = 35; ERROR: operator does not exist: character varying = integer LINE 1: ...LECT airport,ident,runway FROM procedures WHERE runway = 35; ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. I tried WHERE runway = '35'; WHERE runway = "35"; WHERE runway LIKE '35'; WHERE runway LIKE '%35%'; WHERE runway LIKE '35%'; Last one works but why? and what is it all about? |
|
How does one make a sure-fire workaround to this problem? |
#3
| |||
| |||
|
|
How about a real solution: storing numeric values in numeric types? |
#4
| |||
| |||
|
|
SELECT airport,ident,runway FROM procedures WHERE runway = 35; ERROR: operator does not exist: character varying = integer LINE 1: ...LECT airport,ident,runway FROM procedures WHERE runway = 35; ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. I tried WHERE runway = '35'; WHERE runway = "35"; WHERE runway LIKE '35'; WHERE runway LIKE '%35%'; WHERE runway LIKE '35%'; Last one works but why? and what is it all about? How does one make a sure-fire workaround to this problem? /Bjarne |
#5
| |||
| |||
|
|
mgogala=# select runway from procedures where runway::int=10; |
#6
| |||
| |||
|
|
So thats how it is used! Thanks a lot. / Bjarne |
![]() |
| Thread Tools | |
| Display Modes | |
| |