New answers tagged plpgsql
Quick and dirty If it's ok to raise an exception, simply cast to regclass: SELECT 'foo'::regclass If 'foo' is found, you get back the oid, output as text representation, so that's just the table name, escaped if necessary. Else you get an error message complaining about the invalid cast. This has two major shortcomings: The search includes implicit ...
You can convert the config value to an array and replace the $user with the current user name. The array can then be used in the where condition: where n.nspname = any(string_to_array(replace(current_setting('search_path'), '$user', current_user), ','))
Is the context a big overhead? Can I use it for realtime data mapping (let's say 1000 queries/s)) Performance depends on hardware and complexity of your functions. I created an appliance that ran on a small 12-core server and a FusionIO-card (total costs euro 10000) and did about 2500 transactions per second with 20 concurrent users. Each transaction ...
Either way, that's totally possible, given that all your parameters are of the same data type. EXECUTE ... USING happily takes an array, which is treated as a single argument. Access elements with array subscripts. create or replace function test_function(_filter1 text = null , _filter2 text = null ...
Top 50 recent answers are included