Top "Plpgsql" questions

PL/pgSQL is the default procedural language for PostgreSQL.

Pass a SELECT result as an argument to postgreSQL function

I have a table "UserState" with following fields: id, userid, ctime, state, endtime. I have a simple query: SELECT userid …

postgresql plpgsql
Executing queries dynamically in PL/pgSQL

I have found solutions (I think) to the problem I'm about to ask for on Oracle and SQL Server, but …

postgresql aggregate-functions plpgsql dynamic-sql dynamic-queries
Postgresql Create Trigger Before Deleting A Row

so i have these two tables: -- Table user columns: id,name,surname, password,token,earnedmoney -- Table addlisting columns: …

postgresql triggers plpgsql stored-functions
array_length() of an empty array returning NULL

I'm developing some stored proceduces in PL/pgSQL and some of them are giving me some problems. The sprocs I'm …

arrays postgresql plpgsql
PostgreSQL functions returning void

Functions written in PL/pgSQL or SQL can be defined as RETURNS void. I recently stumbled upon an odd difference …

postgresql stored-procedures null plpgsql void
How to use variable as table name in plpgsql

I'm new to plpgsql. I'm trying to run a simple query in plpgsql using a variable as table name in …

postgresql plpgsql dynamic-sql
Unnest array by one level

I want to take an array of n dimensions and return set containing rows of arrays of n-1 dimensions. For …

arrays postgresql plpgsql
Catch all error psql function exception

I am writing an function with exception catching and ignoring. I want to catch all the exceptions and just ignore …

exception-handling plpgsql psql
Good resources for learning PL/pgSQL?

I've been looking around the net trying to find good resources for learning PostgreSQL's procedural programming language, PL/pgSQL. So …

sql postgresql plpgsql
What is the difference between prepared statements and SQL or PL/pgSQL functions, in terms of their purpose?

In PostgreSQL, what is the difference between a prepared statement and a SQL or PL/pgSQL function, in terms of …

sql postgresql prepared-statement plpgsql sql-function