Skip to content Skip to sidebar Skip to footer
Showing posts with the label Plpgsql

Postgres Function Returning One Record While I Have Many Records?

I have many records which my simple query returning but when i use function it just gives me first … Read more Postgres Function Returning One Record While I Have Many Records?

How To Return Temp Table From Postgres Function?

I have below query running fine independently, but showing many issues inside a postgres function C… Read more How To Return Temp Table From Postgres Function?

How To Save A Data With Comma In Character Varying That Passes Through A Trigger?

I have a field of type character varying but I get an error when trying to save a data that contain… Read more How To Save A Data With Comma In Character Varying That Passes Through A Trigger?

Array Not Being Returned By Select Query Inside Plpgsql Test Case

SELECT query I am using: SELECT ARRAY[table_name,pg_size_pretty(table_size)] FROM ( SELECT … Read more Array Not Being Returned By Select Query Inside Plpgsql Test Case

Sql To Merge Rows

Update How I can select the rows from a table that when ordered the first element matches some row… Read more Sql To Merge Rows

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, … Read more What Is The Difference Between Prepared Statements And Sql Or Pl/pgsql Functions, In Terms Of Their Purpose?

How To Pass A Record As Parameter For Pl/pgsql Function?

I keep looking for this answer online but I cannot find it. I am trying to pass one record over a P… Read more How To Pass A Record As Parameter For Pl/pgsql Function?

Iterating On Each Element From An Array Of Arrays On Postgresql

I have a VARCHAR of numbers inside my stored procedure, these numbers are organized as arrays, I wi… Read more Iterating On Each Element From An Array Of Arrays On Postgresql

Update A Table With A Trigger After Update

I have two tables batch (batch_id,start_date,end_date,batch_strength,is_locked) sem (user_id,is_a… Read more Update A Table With A Trigger After Update

Plpgsql Function That Returns Multiple Columns Gets Called Multiple Times

I'm running PostgreSQL 9.2.1 and have a plpgsql function that returns 3 columns. It's calle… Read more Plpgsql Function That Returns Multiple Columns Gets Called Multiple Times

Postgresql Performance Of Ad-hoc Sql Vs Functions

Is there any difference? I know SQL queries are having their execution plans cached just as good as… Read more Postgresql Performance Of Ad-hoc Sql Vs Functions

Passing A Record As Function Argument Pl/pgsql

First I am really new to pl/pgsql. Need it for a project. I am stuck with this (simplified) problem… Read more Passing A Record As Function Argument Pl/pgsql

Elegant Way Of Handling Postgresql Exceptions?

In PostgreSQL, I would like to create a safe-wrapping mechanism which returns empty result if an ex… Read more Elegant Way Of Handling Postgresql Exceptions?

Syntax Error In Dynamic Sql In Pl/pgsql Function

I am using pl/pgsql in PostgreSQL 10, to create complex queries. I am testing a query with a couple… Read more Syntax Error In Dynamic Sql In Pl/pgsql Function

If-statement With String Containing The Condition

This question is about Postgresql 8.3. I've got a table with a field containing conditions like… Read more If-statement With String Containing The Condition

Postgresql Functions

These are the type definitions provided to me create type IR as (pattern_number integer, uoc_number… Read more Postgresql Functions

Splitting Comma Separated String In Pl/pgsql Function

I am trying to write a function that takes an ID as an input and update some fields on that given I… Read more Splitting Comma Separated String In Pl/pgsql Function

Count Rows Affected By Delete

I use this code to verify the DELETE sentence, but I am sure you know a better way: CREATE OR REPLA… Read more Count Rows Affected By Delete

Race Condition Between Select And Insert For Multiple Columns

Note: This is a question which is a follow up of this solution. You need to read the link to get co… Read more Race Condition Between Select And Insert For Multiple Columns

Pass Array Of Tags To A Plpgsql Function And Use It In Where Condition

I'd like to create a function that returns items based on their tags. However, I do not know ho… Read more Pass Array Of Tags To A Plpgsql Function And Use It In Where Condition