Tagged Questions
0
votes
1answer
79 views
How to use array variable in query in PostgreSQL
Create table t1 ( xcheck varchar[], name text );
CREATE OR REPLACE FUNCTION fn_acgroup(xch varchar[])
RETURNS record AS
DECLARE xrc as record;
execute 'select name from t1 where xcheck @> ...
0
votes
1answer
325 views
Save output from multiple SQL SELECT commands to a file
Within a Postgres function I would like to run a number of SQL SELECT commands and append the output to the same variable. After all the SELECT commands have run this output should be written to a ...
1
vote
2answers
324 views
Running a CTE query in a loop using PL/pgSQL
I'm trying to execute query that is repeatedly called in a loop using plpgsql -the loop iterates over another table (named coordinates) that contains top left and bottom right latitude/longitude ...
5
votes
2answers
370 views
PostgreSQL procedural languages - differences between PL/pgSQL and SQL
Can anybody please summarize the differences between:
http://www.postgresql.org/docs/9.1/static/xfunc-sql.html
and
http://www.postgresql.org/docs/9.1/static/plpgsql.html
?
Main points:
...
8
votes
2answers
161 views
Postgres query plan of a UDF invocation written in pgpsql
It's possible when using the pgadmin or plsql to get a hold of a query plan for a sql statement executed via a UDF (using EXPLAIN). So, how do I get a hold of the query plan for a particular ...
0
votes
1answer
220 views
PL/pgSQL function + client-side lo_import
I have a problem with importing documents into PostgreSQL. I have a plpgsql function, which simplified could look like this:
create function add_file(flag integer, sth varchar) returns void as
begin
...
2
votes
2answers
690 views
Dynamic access to record column in plpgsql function
How can I address a column from a record in a plpgsql function dynamically?
In the following snippet I have access to a variable entity.colname that contains the column that should be checked in the ...
10
votes
1answer
560 views
Generate an exception with a Context
When PostgreSQL throws an exception, there is a line "CONTEXT" like:
ERROR: INSERT has more target COLUMNS than expressions
LINE 3: ...
...