Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
2k views

Array of template type in PL/pgSQL function using %TYPE

I have a PostgreSQL database and a PL/pgSQL function that currently has arguments with copied types (for example IN arg_1 table_1.column_1%TYPE). I want to update it so one of those arguments is ...
Felipe Ruiz's user avatar
1 vote
1 answer
196 views

What does exec(text) do?

I just found the following function in two RDS PostgreSQL 9.3 DBs: -- -- Name: exec(text); Type: FUNCTION; Schema: public; Owner: adam -- CREATE FUNCTION exec(text) RETURNS text LANGUAGE plpgsql ...
Adam Matan's user avatar
  • 12.1k
2 votes
1 answer
2k views

Prevent postgres function of running more than 1 instance at the same time

DBMS: Postgres 9.3.4 OS: Debian 7 I have a plpgsql function that will be put in crontab to run every 15 minutes. The function should finish in about 8 minutes, but just in case it takes more than 15 ...
Ivan De Sousa Paz's user avatar
0 votes
1 answer
172 views

Postgresql Function Trying to Insert into 1 row instead of 2

Postgresql 9.3, Mac OS X 10.6.7 I created this function and I would like to insert both results into the same row. Obviously the way I have it inserts into 2 rows. First, here is the Table T1: ...
Jim Miller's user avatar
13 votes
2 answers
45k views

Return a record with PL/pgSQL function - to speed up the query

I have a non-forking game daemon written in Perl, which uses async queries to write player stats into a PostgreSQL 9 database. But when I need to read something from database (like if a player is ...
Alexander Farber's user avatar
6 votes
2 answers
3k views

Is this temp table behaviour documented?

Query Language (SQL) and PL/pgSQL functions treat temp tables differently: begin; create table foo(id) as values (1); select * from foo; /* id ---- 1 */ savepoint s; create function f() returns ...
Jack Douglas's user avatar
  • 40.5k