Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9888b34

Browse files
committed
Fix more things to be parallel-safe.
Conversion functions were previously marked as parallel-unsafe, since that is the default, but in fact they are safe. Parallel-safe functions defined in pg_proc.h and redefined in system_views.sql were ending up as parallel-unsafe because the redeclarations were not marked PARALLEL SAFE. While editing system_views.sql, mark ts_debug() parallel safe also. Andreas Karlsson
1 parent 8826d85 commit 9888b34

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/backend/catalog/system_views.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ FROM pg_catalog.ts_parse(
890890
) AS tt
891891
WHERE tt.tokid = parse.tokid
892892
$$
893-
LANGUAGE SQL STRICT STABLE;
893+
LANGUAGE SQL STRICT STABLE PARALLEL SAFE;
894894

895895
COMMENT ON FUNCTION ts_debug(regconfig,text) IS
896896
'debug function for text search configuration';
@@ -906,7 +906,7 @@ RETURNS SETOF record AS
906906
$$
907907
SELECT * FROM pg_catalog.ts_debug( pg_catalog.get_current_ts_config(), $1);
908908
$$
909-
LANGUAGE SQL STRICT STABLE;
909+
LANGUAGE SQL STRICT STABLE PARALLEL SAFE;
910910

911911
COMMENT ON FUNCTION ts_debug(text) IS
912912
'debug function for current text search configuration';
@@ -928,12 +928,12 @@ CREATE OR REPLACE FUNCTION
928928
-- legacy definition for compatibility with 9.3
929929
CREATE OR REPLACE FUNCTION
930930
json_populate_record(base anyelement, from_json json, use_json_as_text boolean DEFAULT false)
931-
RETURNS anyelement LANGUAGE internal STABLE AS 'json_populate_record';
931+
RETURNS anyelement LANGUAGE internal STABLE AS 'json_populate_record' PARALLEL SAFE;
932932

933933
-- legacy definition for compatibility with 9.3
934934
CREATE OR REPLACE FUNCTION
935935
json_populate_recordset(base anyelement, from_json json, use_json_as_text boolean DEFAULT false)
936-
RETURNS SETOF anyelement LANGUAGE internal STABLE ROWS 100 AS 'json_populate_recordset';
936+
RETURNS SETOF anyelement LANGUAGE internal STABLE ROWS 100 AS 'json_populate_recordset' PARALLEL SAFE;
937937

938938
CREATE OR REPLACE FUNCTION pg_logical_slot_get_changes(
939939
IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
@@ -981,30 +981,30 @@ CREATE OR REPLACE FUNCTION
981981
secs double precision DEFAULT 0.0)
982982
RETURNS interval
983983
LANGUAGE INTERNAL
984-
STRICT IMMUTABLE
984+
STRICT IMMUTABLE PARALLEL SAFE
985985
AS 'make_interval';
986986

987987
CREATE OR REPLACE FUNCTION
988988
jsonb_set(jsonb_in jsonb, path text[] , replacement jsonb,
989989
create_if_missing boolean DEFAULT true)
990990
RETURNS jsonb
991991
LANGUAGE INTERNAL
992-
STRICT IMMUTABLE
992+
STRICT IMMUTABLE PARALLEL SAFE
993993
AS 'jsonb_set';
994994

995995
CREATE OR REPLACE FUNCTION
996996
parse_ident(str text, strict boolean DEFAULT true)
997997
RETURNS text[]
998998
LANGUAGE INTERNAL
999-
STRICT IMMUTABLE
999+
STRICT IMMUTABLE PARALLEL SAFE
10001000
AS 'parse_ident';
10011001

10021002
CREATE OR REPLACE FUNCTION
10031003
jsonb_insert(jsonb_in jsonb, path text[] , replacement jsonb,
10041004
insert_after boolean DEFAULT false)
10051005
RETURNS jsonb
10061006
LANGUAGE INTERNAL
1007-
STRICT IMMUTABLE
1007+
STRICT IMMUTABLE PARALLEL SAFE
10081008
AS 'jsonb_insert';
10091009

10101010
-- The default permissions for functions mean that anyone can execute them.

src/backend/utils/mb/conversion_procs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ $(SQLSCRIPT): Makefile
173173
func=$$1; shift; \
174174
obj=$$1; shift; \
175175
echo "-- $$se --> $$de"; \
176-
echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '$$"libdir"/$$obj', '$$func' LANGUAGE C STRICT;"; \
176+
echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '$$"libdir"/$$obj', '$$func' LANGUAGE C STRICT PARALLEL SAFE;"; \
177177
echo "COMMENT ON FUNCTION $$func(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) IS 'internal conversion function for $$se to $$de';"; \
178178
echo "DROP CONVERSION pg_catalog.$$name;"; \
179179
echo "CREATE DEFAULT CONVERSION pg_catalog.$$name FOR '$$se' TO '$$de' FROM $$func;"; \

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201605021
56+
#define CATALOG_VERSION_NO 201605031
5757

5858
#endif

0 commit comments

Comments
 (0)