postgresql - Postgres how can I get column inside a quote -


first , foremost using postgres version 9.4 . trying create partial index on query

select distinct on(city,state)city,state,zip zips city ilike  '%' , state ilike '%' limit 10 

my issue not know how put columns inside quotes '%' partial index looks this

 select distinct on(city,state)city,state,zip zips city ilike      '{city}%' , state ilike '{state}%' limit 10 

what correct method put columns inside single quote mark ? have been looking on place. right partial index looks this

create index "location_search"    on zips (city asc nulls last, state asc nulls last)    city ilike 'city%' , state ilike 'state%'; 

which not helping because postgres treating 'city%' , state ilike 'state%' variables , not columns. have search-box users type in city , state fields want optimize. appreciated ...

try this

 column_name column_name||'%' 

see link


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -