Table def: CREATE SEQUENCE IF NOT EXISTS lazy_product_stock_id_seq; CREATE TABLE "public"."lazy_product_stock" ( "id" int4 NOT NULL DEFAULT nextval('lazy_pr
In a Postgres 12 database, I have multiple queries (SELECT, UPDATE, ...) in a function that all together take about 20 minutes to complete. I have a check at th
I am trying to import data from a csv into postgres. I have tried the following and got the following errors: Copy TA_Files FROM 'C:\Users\ABla47\Documents\TA
I am trying to write a function (f_all) that basically just calls other "partial" functions (e.g. f_1,f_2,f_3) and merges the results of them into one final JSO
I have a function that uses set_config with is_local = true to set a variable. Now I expected that a select statement using the variable with current_settings w
This script works fine when running on dbeaver, I can work with the new created temp table: SELECT someField INTO TEMP tmp_TableZZ FROM "_fdw
I'm running this code: CREATE OR REPLACE FUNCTION trg_orders_check() RETURNS trigger LANGUAGE plpgsql AS $func$ BEGIN IF NEW.type = 'prescription' AND NEW
How do I declare a variable for used in a PostgreSQL 9.3 query? CREATE or replace FUNCTION public.test() returns int4 AS $BODY$ DECLARE cod_process bi
I would like to select all sequences in the database, get the schema of sequence, dependent table, the schema of a table, dependent column. I've tried the follo
I'm writing a function in PL/pgSQL, and I'm looking for the simplest way to check if a row exists. Right now I'm SELECTing an integer into a boolean, which does
Here's my function declaration and part of the body: CREATE OR REPLACE FUNCTION access_update() RETURNS void AS $$ DECLARE team_ids bigint[]; BEGIN SELECT
Background Users can type in a name and the system should match the text, even if the either the user input or the database field contains accented (UTF-8) cha
I'm building a hierarchical JSON result from several tables. These are just examples but should be sufficient for the purpose of this demonstration to get the i