Top "Plpgsql" questions

PL/pgSQL is the default procedural language for PostgreSQL.

PostgreSQL function returning multiple result sets

Is it possible to return multiple result sets from a Postgres function, like in MSSQL: CREATE PROCEDURE test AS SELECT * …

postgresql plpgsql
Return SETOF rows from PostgreSQL function

I have a situation where I want to return the join between two views. and that's a lot of columns. …

postgresql plpgsql dynamic-sql postgresql-9.2
Check if sequence exists in Postgres (plpgsql)

I'm trying to test, within a stored procedure, whether a sequence already exists. IF EXISTS SEQUENCE seq_name RAISE EXCEPTION …

postgresql stored-procedures plpgsql
Optional argument in PL/pgSQL function

I am trying to write a PL/pgSQL function with optional arguments. It performs a query based on a filtered …

postgresql stored-procedures parameters parameter-passing plpgsql
EXECUTE...INTO...USING statement in PL/pgSQL can't execute into a record?

I'm attempting to write an area of a function in PL/pgSQL that loops through an hstore and sets a …

postgresql record plpgsql dynamic-sql composite
PostgreSQL Update trigger

I have a table: CREATE TABLE annotations ( gid serial NOT NULL, annotation character varying(250), the_geom geometry, "rotationAngle" character varying(3) …

sql postgresql plpgsql triggers
Dynamic SQL (EXECUTE) as condition for IF statement

I want to execute a dynamic SQL statement, with its returned value being the conditional for an IF statement: IF …

postgresql dynamic-sql plpgsql
Dynamically generate columns for crosstab in PostgreSQL

I am trying to create crosstab queries in PostgreSQL such that it automatically generates the crosstab columns instead of hardcoding …

postgresql plpgsql dynamic-sql postgresql-9.1 crosstab
Elegant way of handling PostgreSQL exceptions?

In PostgreSQL, I would like to create a safe-wrapping mechanism which returns empty result if an exception occurs. Consider the …

sql postgresql exception-handling plpgsql dynamic-sql
Using temp table in PL/pgSQL procedure for cleaning tables

I'm trying to delete all data related to a user id from a game database. There is a table holding …

postgresql plpgsql select-into