Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7760d6b30d | ||
|
|
4515c8547e | ||
|
|
2766bbc83a | ||
|
|
c4980a90f9 | ||
|
|
61d2024eb5 | ||
|
|
af142306aa | ||
|
|
7437a9686b | ||
|
|
82f90e618c | ||
|
|
55a77b0ef0 | ||
|
|
2e68626165 | ||
|
|
06b7eb8504 | ||
|
|
ccbabaa3b4 |
5
Makefile
5
Makefile
@@ -1,7 +1,7 @@
|
||||
# cartodb/Makefile
|
||||
|
||||
EXTENSION = cartodb
|
||||
EXTVERSION = 0.22.1
|
||||
EXTVERSION = 0.23.1
|
||||
|
||||
SED = sed
|
||||
AWK = awk
|
||||
@@ -87,6 +87,9 @@ UPGRADABLE = \
|
||||
0.21.0 \
|
||||
0.22.0 \
|
||||
0.22.1 \
|
||||
0.22.2 \
|
||||
0.23.0 \
|
||||
0.23.1 \
|
||||
$(EXTVERSION)dev \
|
||||
$(EXTVERSION)next \
|
||||
$(END)
|
||||
|
||||
9
NEWS.md
9
NEWS.md
@@ -1,3 +1,12 @@
|
||||
0.23.1 (2018-07-19)
|
||||
* Fix `CDB_EstimateRowCount` parallelizability #333
|
||||
|
||||
0.23.0 (2018-07-03)
|
||||
* Add a new helper function `_CDB_Table_Exists(table_name_with_optional_schema TEXT)` #332
|
||||
|
||||
0.22.2 (2018-05-29)
|
||||
* Fix: Fix hyphenates usernames in 0.22.1 fix (#331)
|
||||
|
||||
0.22.1 (2018-05-29)
|
||||
* Fix: Correctly grant permission to all sequences related with table (#330)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ BEGIN
|
||||
EXECUTE Format('ANALYZE %s;', reloid);
|
||||
END IF;
|
||||
END
|
||||
$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL RESTRICTED SECURITY DEFINER;
|
||||
$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL UNSAFE SECURITY DEFINER;
|
||||
|
||||
-- Return a row count estimate of the result of a query using statistics
|
||||
CREATE OR REPLACE FUNCTION CDB_EstimateRowCount(query text)
|
||||
@@ -28,4 +28,4 @@ BEGIN
|
||||
EXECUTE 'EXPLAIN (FORMAT JSON) ' || query INTO STRICT plan;
|
||||
RETURN plan->0->'Plan'->'Plan Rows';
|
||||
END
|
||||
$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL RESTRICTED;
|
||||
$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL UNSAFE;
|
||||
|
||||
@@ -158,3 +158,20 @@ BEGIN
|
||||
RETURN left(string, (i - 1));
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql' IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
|
||||
-- Checks if a given text representing a qualified or unqualified table name (relation)
|
||||
-- actually exists in the database. It is meant to be used as a guard for other function/queries.
|
||||
CREATE OR REPLACE FUNCTION cartodb._CDB_Table_Exists(table_name_with_optional_schema TEXT)
|
||||
RETURNS bool
|
||||
AS $$
|
||||
DECLARE
|
||||
table_exists bool := false;
|
||||
BEGIN
|
||||
table_exists := EXISTS(SELECT * FROM pg_class WHERE table_name_with_optional_schema::regclass::oid = oid AND relkind = 'r');
|
||||
RETURN table_exists;
|
||||
EXCEPTION
|
||||
WHEN invalid_schema_name OR undefined_table THEN
|
||||
RETURN false;
|
||||
END;
|
||||
$$ LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;
|
||||
|
||||
@@ -110,7 +110,7 @@ FUNCTION cartodb._CDB_Organization_Get_Table_Sequences(from_schema text, table_n
|
||||
AS $$
|
||||
BEGIN
|
||||
RETURN QUERY EXECUTE 'SELECT
|
||||
n.nspname || ''.'' || c.relname
|
||||
quote_ident(n.nspname) || ''.'' || quote_ident(c.relname)
|
||||
FROM
|
||||
pg_depend d
|
||||
JOIN pg_class c ON d.objid = c.oid
|
||||
|
||||
@@ -126,3 +126,13 @@ SELECT * FROM cartodb._CDB_Octet_Truncate('piraña', 6);
|
||||
|
||||
-- Test _CDB_Octet_Truncate UTF8 case
|
||||
SELECT * FROM cartodb._CDB_Octet_Truncate('piraña', 7);
|
||||
|
||||
-- Test _CDB_Table_Exists
|
||||
CREATE TABLE public.this_table_exists();
|
||||
SELECT cartodb._CDB_Table_Exists('this_table_does_not_exist');
|
||||
SELECT cartodb._CDB_Table_Exists('this_schema_does_not_exist.this_table_does_not_exist');
|
||||
SELECT cartodb._CDB_Table_Exists('this_table_exists');
|
||||
SELECT cartodb._CDB_Table_Exists('public.this_table_exists');
|
||||
SELECT cartodb._CDB_Table_Exists('raster_overviews'); -- view created by postgis
|
||||
SELECT cartodb._CDB_Table_Exists('public.raster_overviews');
|
||||
DROP TABLE public.this_table_exists
|
||||
|
||||
@@ -57,3 +57,11 @@ DROP TABLE
|
||||
pira
|
||||
pirañ
|
||||
piraña
|
||||
CREATE TABLE
|
||||
f
|
||||
f
|
||||
t
|
||||
t
|
||||
f
|
||||
f
|
||||
DROP TABLE
|
||||
|
||||
Reference in New Issue
Block a user