Skip to content

Commit 951cde1

Browse files
committed
restrict partitioning of temporary tables
1 parent 46115f9 commit 951cde1

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

hash.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ BEGIN
6969
PERFORM @extschema@.partition_data(parent_relid);
7070

7171
RETURN partitions_count;
72+
73+
EXCEPTION WHEN others THEN
74+
RAISE EXCEPTION '%', SQLERRM;
7275
END
7376
$$ LANGUAGE plpgsql
7477
SET client_min_messages = WARNING;

init.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,18 @@ $$
8888
DECLARE
8989
v_rec RECORD;
9090
is_referenced BOOLEAN;
91+
rel_persistence CHAR;
9192

9293
BEGIN
94+
/* Ignore temporary tables */
95+
SELECT relpersistence FROM pg_catalog.pg_class
96+
WHERE oid = p_relation INTO rel_persistence;
97+
98+
IF rel_persistence = 't'::CHAR THEN
99+
RAISE EXCEPTION 'Temporary table "%" cannot be partitioned',
100+
quote_ident(p_relation::TEXT);
101+
END IF;
102+
93103
IF EXISTS (SELECT * FROM @extschema@.pathman_config
94104
WHERE partrel = p_relation) THEN
95105
RAISE EXCEPTION 'Relation "%" has already been partitioned', p_relation;

range.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ BEGIN
875875
WHERE oid = p_partition INTO rel_persistence;
876876

877877
IF rel_persistence = 't'::CHAR THEN
878-
RAISE EXCEPTION 'Temporary table \"%\" cannot be used as a partition',
878+
RAISE EXCEPTION 'Temporary table "%" cannot be used as a partition',
879879
quote_ident(p_partition::TEXT);
880880
END IF;
881881

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy