Question : PostgreSQL documents it’s Set Returning Functions with C extensions like this, C-language functions have two options for returning […]
Tag: set-returning-functions
Filling in missing dates in record set from generate_series()
Question : Consider: with days as (select day::date from generate_series(date ‘2013-01-01’, date ‘2013-01-01’ + 365, interval ‘1 day’ day) day […]
Call function where argument is a (sub)select statement
Question : My function takes an int4 as argument and returns a table: SELECT * FROM test_function(545421); — works fine […]
jsonb_each_text(jsonb) returns jsonb, not text
Question : According to docs , jsonb_each_text(jsonb) returns setof key text, value text but if you pg_typeof(value) on result it […]
PostgreSQL: Is it possible to get a different function result type (i.e. TABLE) in stored function based on input?
Question : The question is as follow, I wanted to get some flexibility in my example function, so based on […]
Extract and combine multiple values from a jsonb column
Question : I am looking to extract multiple values from a jsonb column in Postgres, and am running into an […]
T-SQL Daylight Saving lookup table – poorly performing table-valued function
Question : I’ve created a “Daylight Savings” lookup calendar table for the GMT region. The function I’m using to query […]
Efficiency of Scalar UDF vs TVF
Question : I am trying to optimize the rollup code for my company and ran into a very peculiar issue. […]
How do I optimize my transaction level running balances cartesian join?
Question : This is a continuation of an question found here: Generate multiple running totals with GROUP BY day This […]
T-SQL Daylight Saving lookup table – poorly performing table-valued function
Question : I’ve created a “Daylight Savings” lookup calendar table for the GMT region. The function I’m using to query […]