Skip to main content
1 vote
1 answer
68 views

I have the following procedure written in redshift, which uses 2 for loops to get country code first and then years as per the country codes. --Procedure : sp_for_loop_test create or replace procedure ...
MAK's user avatar
  • 7,355
1 vote
1 answer
84 views

I have couple temporal tables in my db. CREATE TABLE temporal ( version_id SERIAL PRIMARY KEY, some_id TEXT, some_data TEXT, valid_from TIMESTAMP NOT NULL DEFAULT ...
zaplec's user avatar
  • 1,879
3 votes
1 answer
186 views

I have changed STABLE to IMMUTABLE and expecting it to work faster, but it works more slower. Did I miss something? IMMUTABLE function: test=> \sf+ rls_guard CREATE OR REPLACE FUNCTION ...
Eugen Konkov's user avatar
  • 26.1k
3 votes
1 answer
121 views

I'm using 17.0.6 version (and 13 yet, in another test) of ODBC driver against a PostGreSQL 17 database, I got an unexplicable error when, from a PowerBuilder 12 application using the ODBC, I call a ...
Andrea Ricci's user avatar
3 votes
1 answer
146 views

I have two tables in Postgres with a parent/child relationship: CREATE TABLE table_a ( id SERIAL PRIMARY KEY, type TEXT NOT NULL, rundate DATE NOT NULL ); CREATE TABLE table_b ( id ...
AcrKnight's user avatar
  • 496
3 votes
3 answers
120 views

I would like to use a script variable to set the data type, so that I can generate a few functions with different types, like so: \set bucket_data_type DATE Then run a script to generate this function:...
aidanmo's user avatar
  • 33
2 votes
1 answer
76 views

I understand that I can't error-handle pg_terminate_backend in PL/pgSQL. But I am surprised that I can't error-handle pg_cancel_backend. Below is one attempt that does not work, but I also tried ...
Peter's user avatar
  • 1,416
0 votes
1 answer
58 views

I'm trying to create a new function in Supabase. I'm literally using the example code in the docs: create function hello_world() returns text language plpgsql security definer set search_path = '' as $...
samplecode3300's user avatar
3 votes
1 answer
118 views

In PostgreSQL, I know that an EXCEPTION block starts a subtransaction within the current transaction. However, I'm not sure when this subtransaction is released. For example: CREATE PROCEDURE ...
Tri Pham's user avatar
0 votes
0 answers
95 views

I want to schedule some database maintenance that consists of deleting old data followed by VACUUM: CREATE EXTENSION IF NOT EXISTS pg_cron; SELECT cron.schedule('cleanup', '* * * * *', ' CALL ...
Liero's user avatar
  • 27.8k
1 vote
1 answer
80 views

I have a table which stores attribute value data, the majority of which are numbers but occasionally strings. When the values are numbers, we are interested in a delta. The following PostgreSQL ...
Adam's user avatar
  • 1,206
0 votes
0 answers
45 views

I have a block of code in PL/pgSQL that includes this line to update a table... UPDATE myTable SET processedT = true, messType = 12 WHERE messId = new.messID; The table myTable is actually a ...
ConanTheGerbil's user avatar
0 votes
1 answer
52 views

CREATE FUNCTION create_user_if_not_exists(_name text, _pass text) RETURNS void AS $func$ DECLARE _dbname TEXT := concat(_name, '_db'); BEGIN IF EXISTS (SELECT FROM pg_catalog.pg_roles WHERE ...
zar3bski's user avatar
  • 3,221
2 votes
1 answer
50 views

I wanted to analyze and compare following queries: SELECT from mytable WHERE mytable.TimeStamp < NOW() - MAKE_INTERVAL(DAYS => 1); and same query, but replace Now() with a variable. DO $$ ...
Liero's user avatar
  • 27.8k
1 vote
1 answer
96 views

I'm deleting data and I want to minimize time when rows or table is locked. Goal is to increase throughput of other queries. Let's say inserting into temp table takes 10 seconds and delete statement ...
Liero's user avatar
  • 27.8k

15 30 50 per page
1
2 3 4 5
297