Skip to content

Commit f0b9bac

Browse files
committed
use quote_ident() on schema in get_schema_qualified_name(), fix typos found by codespell
1 parent 2775b5a commit f0b9bac

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ EXPLAIN SELECT * FROM items WHERE id = 1234;
192192
-> Index Scan using items_34_pkey on items_34 (cost=0.28..8.29 rows=0 width=0)
193193
Index Cond: (id = 1234)
194194
```
195-
Note that pg_pathman exludes parent table from the query plan. To access parent table use ONLY modifier:
195+
Note that pg_pathman excludes parent table from the query plan. To access parent table use ONLY modifier:
196196
```
197197
EXPLAIN SELECT * FROM ONLY items;
198198
QUERY PLAN

init.sql

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ CREATE OR REPLACE FUNCTION @extschema@.get_schema_qualified_name(
259259
RETURNS TEXT AS
260260
$$
261261
BEGIN
262-
RETURN relnamespace::regnamespace || delimiter || quote_ident(relname || suffix) FROM pg_class WHERE oid = cls::oid;
262+
RETURN (SELECT quote_ident(relnamespace::regnamespace::text) ||
263+
delimiter ||
264+
quote_ident(relname || suffix)
265+
FROM pg_class
266+
WHERE oid = cls::oid);
263267
END
264268
$$
265269
LANGUAGE plpgsql;
@@ -271,23 +275,23 @@ CREATE OR REPLACE FUNCTION @extschema@.validate_relations_equality(relation1 OID
271275
RETURNS BOOLEAN AS
272276
$$
273277
DECLARE
274-
rec RECORD;
278+
rec RECORD;
275279
BEGIN
276-
FOR rec IN (
277-
WITH
278-
a1 AS (select * from pg_attribute where attrelid = relation1 and attnum > 0),
279-
a2 AS (select * from pg_attribute where attrelid = relation2 and attnum > 0)
280-
SELECT a1.attname name1, a2.attname name2, a1.atttypid type1, a2.atttypid type2
281-
FROM a1
282-
FULL JOIN a2 ON a1.attnum = a2.attnum
283-
)
284-
LOOP
285-
IF rec.name1 IS NULL OR rec.name2 IS NULL OR rec.name1 != rec.name2 THEN
286-
RETURN False;
287-
END IF;
288-
END LOOP;
289-
290-
RETURN True;
280+
FOR rec IN (
281+
WITH
282+
a1 AS (select * from pg_attribute where attrelid = relation1 and attnum > 0),
283+
a2 AS (select * from pg_attribute where attrelid = relation2 and attnum > 0)
284+
SELECT a1.attname name1, a2.attname name2, a1.atttypid type1, a2.atttypid type2
285+
FROM a1
286+
FULL JOIN a2 ON a1.attnum = a2.attnum
287+
)
288+
LOOP
289+
IF rec.name1 IS NULL OR rec.name2 IS NULL OR rec.name1 != rec.name2 THEN
290+
RETURN False;
291+
END IF;
292+
END LOOP;
293+
294+
RETURN True;
291295
END
292296
$$
293297
LANGUAGE plpgsql;

range.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ LANGUAGE plpgsql;
619619
* partition will be destroyed.
620620
*
621621
* Notes: dummy field is used to pass the element type to the function
622-
* (it is neccessary because of pseudo-types used in function)
622+
* (it is necessary because of pseudo-types used in function)
623623
*/
624624
CREATE OR REPLACE FUNCTION @extschema@.merge_range_partitions_internal(
625625
p_parent_relid OID

0 commit comments

Comments
 (0)