@fabrika/platform-node 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/pg-catalog-names.ts +251 -208
- package/src/postgres-test-provisioner.ts +92 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/platform-node",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"test": "bun test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@fabrika/platform": "
|
|
40
|
+
"@fabrika/platform": "0.4.7"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/pg-catalog-names.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
// @generated from PostgreSQL 17 (`pg_proc` in `pg_catalog`, `pg_get_keywords()`) by
|
|
2
|
-
// `src/__tests__/helpers/generate-pg-catalog-names.ts
|
|
3
|
-
//
|
|
1
|
+
// @generated from PostgreSQL 17 and 18 (`pg_proc` in `pg_catalog`, `pg_get_keywords()`) by
|
|
2
|
+
// `src/__tests__/helpers/generate-pg-catalog-names.ts`, which says how to regenerate it; `pg-catalog-names.test.ts` checks
|
|
3
|
+
// the test server against it. Each set is the union over the supported majors, so a name one of them adds is refused on all.
|
|
4
|
+
|
|
5
|
+
function names(text: string): ReadonlySet<string> {
|
|
6
|
+
return new Set(text.split(/\s+/).filter((name) => name !== ''))
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** The Postgres major versions the sets below are generated from. */
|
|
10
|
+
export const PG_CATALOG_MAJORS: readonly number[] = [17, 18]
|
|
4
11
|
|
|
5
12
|
/** Every function name in `pg_catalog`: an application function may not take one, or a call could resolve to the built-in. */
|
|
6
|
-
export const PG_CATALOG_FUNCTIONS: ReadonlySet<string> =
|
|
7
|
-
`
|
|
13
|
+
export const PG_CATALOG_FUNCTIONS: ReadonlySet<string> = names(`
|
|
8
14
|
RI_FKey_cascade_del RI_FKey_cascade_upd RI_FKey_check_ins RI_FKey_check_upd RI_FKey_noaction_del RI_FKey_noaction_upd RI_FKey_restrict_del
|
|
9
15
|
RI_FKey_restrict_upd RI_FKey_setdefault_del RI_FKey_setdefault_upd RI_FKey_setnull_del RI_FKey_setnull_upd abbrev abs aclcontains acldefault
|
|
10
16
|
aclexplode aclinsert aclitemeq aclitemin aclitemout aclremove acos acosd acosh age amvalidate any_in any_out any_value any_value_transfn
|
|
@@ -13,12 +19,13 @@ anycompatiblearray_recv anycompatiblearray_send anycompatiblemultirange_in anyco
|
|
|
13
19
|
anycompatiblenonarray_out anycompatiblerange_in anycompatiblerange_out anyelement_in anyelement_out anyenum_in anyenum_out anymultirange_in
|
|
14
20
|
anymultirange_out anynonarray_in anynonarray_out anyrange_in anyrange_out anytextcat area areajoinsel areasel array_agg
|
|
15
21
|
array_agg_array_combine array_agg_array_deserialize array_agg_array_finalfn array_agg_array_serialize array_agg_array_transfn
|
|
16
|
-
array_agg_combine array_agg_deserialize array_agg_finalfn array_agg_serialize array_agg_transfn array_append array_cat
|
|
17
|
-
array_fill array_ge array_gt array_in array_larger array_le array_length array_lower array_lt array_ndims array_ne
|
|
18
|
-
array_positions array_prepend array_recv array_remove array_replace
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
array_agg_combine array_agg_deserialize array_agg_finalfn array_agg_serialize array_agg_transfn array_append array_append_support array_cat
|
|
23
|
+
array_dims array_eq array_fill array_ge array_gt array_in array_larger array_le array_length array_lower array_lt array_ndims array_ne
|
|
24
|
+
array_out array_position array_positions array_prepend array_prepend_support array_recv array_remove array_replace array_reverse
|
|
25
|
+
array_sample array_send array_shuffle array_smaller array_sort array_subscript_handler array_subscript_handler_support array_to_json
|
|
26
|
+
array_to_string array_to_tsvector array_typanalyze array_unnest_support array_upper arraycontained arraycontains arraycontjoinsel
|
|
27
|
+
arraycontsel arrayoverlap ascii asin asind asinh atan atan2 atan2d atand atanh avg bernoulli big5_to_euc_tw big5_to_mic big5_to_utf8
|
|
28
|
+
binary_upgrade_add_sub_rel_state binary_upgrade_create_empty_extension binary_upgrade_logical_slot_has_caught_up
|
|
22
29
|
binary_upgrade_replorigin_advance binary_upgrade_set_missing_value binary_upgrade_set_next_array_pg_type_oid
|
|
23
30
|
binary_upgrade_set_next_heap_pg_class_oid binary_upgrade_set_next_heap_relfilenode binary_upgrade_set_next_index_pg_class_oid
|
|
24
31
|
binary_upgrade_set_next_index_relfilenode binary_upgrade_set_next_multirange_array_pg_type_oid
|
|
@@ -42,26 +49,28 @@ brin_minmax_multi_distance_macaddr8 brin_minmax_multi_distance_numeric brin_minm
|
|
|
42
49
|
brin_minmax_multi_distance_time brin_minmax_multi_distance_timestamp brin_minmax_multi_distance_timetz brin_minmax_multi_distance_uuid
|
|
43
50
|
brin_minmax_multi_opcinfo brin_minmax_multi_options brin_minmax_multi_summary_in brin_minmax_multi_summary_out
|
|
44
51
|
brin_minmax_multi_summary_recv brin_minmax_multi_summary_send brin_minmax_multi_union brin_minmax_opcinfo brin_minmax_union
|
|
45
|
-
brin_summarize_new_values brin_summarize_range brinhandler broadcast btarraycmp btboolcmp btbpchar_pattern_cmp
|
|
46
|
-
btcharcmp btequalimage btfloat48cmp btfloat4cmp btfloat4sortsupport btfloat84cmp btfloat8cmp
|
|
47
|
-
btint28cmp btint2cmp btint2sortsupport btint42cmp btint48cmp btint4cmp
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
brin_summarize_new_values brin_summarize_range brinhandler broadcast btarraycmp btboolcmp btboolskipsupport btbpchar_pattern_cmp
|
|
53
|
+
btbpchar_pattern_sortsupport btcharcmp btcharskipsupport btequalimage btfloat48cmp btfloat4cmp btfloat4sortsupport btfloat84cmp btfloat8cmp
|
|
54
|
+
btfloat8sortsupport bthandler btint24cmp btint28cmp btint2cmp btint2skipsupport btint2sortsupport btint42cmp btint48cmp btint4cmp
|
|
55
|
+
btint4skipsupport btint4sortsupport btint82cmp btint84cmp btint8cmp btint8skipsupport btint8sortsupport btnamecmp btnamesortsupport
|
|
56
|
+
btnametextcmp btoidcmp btoidskipsupport btoidsortsupport btoidvectorcmp btrecordcmp btrecordimagecmp btrim bttext_pattern_cmp
|
|
57
|
+
bttext_pattern_sortsupport bttextcmp bttextnamecmp bttextsortsupport bttidcmp btvarstrequalimage bytea bytea_larger bytea_smaller
|
|
58
|
+
bytea_sortsupport bytea_string_agg_finalfn bytea_string_agg_transfn byteacat byteacmp byteaeq byteage byteagt byteain byteale bytealike
|
|
59
|
+
bytealt byteane byteanlike byteaout bytearecv byteasend cardinality casefold cash_cmp cash_div_cash cash_div_flt4 cash_div_flt8
|
|
60
|
+
cash_div_int2 cash_div_int4 cash_div_int8 cash_eq cash_ge cash_gt cash_in cash_le cash_lt cash_mi cash_mul_flt4 cash_mul_flt8 cash_mul_int2
|
|
61
|
+
cash_mul_int4 cash_mul_int8 cash_ne cash_out cash_pl cash_recv cash_send cash_words cashlarger cashsmaller cbrt ceil ceiling center char
|
|
62
|
+
char_length character_length chareq charge chargt charin charle charlt charne charout charrecv charsend chr cideq cidin cidout cidr cidr_in
|
|
63
|
+
cidr_out cidr_recv cidr_send cidrecv cidsend circle circle_above circle_add_pt circle_below circle_center circle_contain circle_contain_pt
|
|
64
|
+
circle_contained circle_distance circle_div_pt circle_eq circle_ge circle_gt circle_in circle_le circle_left circle_lt circle_mul_pt
|
|
65
|
+
circle_ne circle_out circle_overabove circle_overbelow circle_overlap circle_overleft circle_overright circle_recv circle_right circle_same
|
|
66
|
+
circle_send circle_sub_pt clock_timestamp close_ls close_lseg close_pb close_pl close_ps close_sb col_description concat concat_ws
|
|
67
|
+
contjoinsel contsel convert convert_from convert_to corr cos cosd cosh cot cotd count covar_pop covar_samp crc32 crc32c cstring_in
|
|
68
|
+
cstring_out cstring_recv cstring_send cume_dist cume_dist_final current_database current_query current_schema current_schemas
|
|
69
|
+
current_setting current_user currtid2 currval cursor_to_xml cursor_to_xmlschema database_to_xml database_to_xml_and_xmlschema
|
|
70
|
+
database_to_xmlschema date date_add date_bin date_cmp date_cmp_timestamp date_cmp_timestamptz date_eq date_eq_timestamp date_eq_timestamptz
|
|
71
|
+
date_ge date_ge_timestamp date_ge_timestamptz date_gt date_gt_timestamp date_gt_timestamptz date_in date_larger date_le date_le_timestamp
|
|
72
|
+
date_le_timestamptz date_lt date_lt_timestamp date_lt_timestamptz date_mi date_mi_interval date_mii date_ne date_ne_timestamp
|
|
73
|
+
date_ne_timestamptz date_out date_part date_pl_interval date_pli date_recv date_send date_skipsupport date_smaller date_sortsupport
|
|
65
74
|
date_subtract date_trunc datemultirange daterange daterange_canonical daterange_subdiff datetime_pl datetimetz_pl dcbrt decode degrees
|
|
66
75
|
dense_rank dense_rank_final dexp diagonal diameter dispell_init dispell_lexize dist_bp dist_bs dist_cpoint dist_cpoly dist_lp dist_ls
|
|
67
76
|
dist_pathp dist_pb dist_pc dist_pl dist_polyc dist_polyp dist_ppath dist_ppoly dist_ps dist_sb dist_sl dist_sp div dlog1 dlog10 domain_in
|
|
@@ -78,24 +87,26 @@ float8_regr_accum float8_regr_avgx float8_regr_avgy float8_regr_combine float8_r
|
|
|
78
87
|
float8_regr_sxx float8_regr_sxy float8_regr_syy float8_stddev_pop float8_stddev_samp float8_var_pop float8_var_samp float8abs float8div
|
|
79
88
|
float8eq float8ge float8gt float8in float8larger float8le float8lt float8mi float8mul float8ne float8out float8pl float8recv float8send
|
|
80
89
|
float8smaller float8um float8up floor flt4_mul_cash flt8_mul_cash fmgr_c_validator fmgr_internal_validator fmgr_sql_validator format
|
|
81
|
-
format_type gb18030_to_utf8 gbk_to_utf8 gcd gen_random_uuid generate_series generate_series_int4_support generate_series_int8_support
|
|
82
|
-
generate_subscripts get_bit get_byte get_current_ts_config
|
|
83
|
-
gin_cmp_tslexeme gin_compare_jsonb gin_consistent_jsonb
|
|
84
|
-
gin_extract_jsonb_query gin_extract_jsonb_query_path gin_extract_tsquery
|
|
85
|
-
gin_triconsistent_jsonb_path gin_tsquery_consistent gin_tsquery_triconsistent
|
|
86
|
-
ginhandler ginqueryarrayextract gist_box_consistent gist_box_distance
|
|
87
|
-
gist_circle_compress gist_circle_consistent gist_circle_distance
|
|
88
|
-
gist_point_fetch gist_point_sortsupport gist_poly_compress
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
format_type gamma gb18030_to_utf8 gbk_to_utf8 gcd gen_random_uuid generate_series generate_series_int4_support generate_series_int8_support
|
|
91
|
+
generate_series_numeric_support generate_series_timestamp_support generate_subscripts get_bit get_byte get_current_ts_config
|
|
92
|
+
getdatabaseencoding getpgusername gin_clean_pending_list gin_cmp_prefix gin_cmp_tslexeme gin_compare_jsonb gin_consistent_jsonb
|
|
93
|
+
gin_consistent_jsonb_path gin_extract_jsonb gin_extract_jsonb_path gin_extract_jsonb_query gin_extract_jsonb_query_path gin_extract_tsquery
|
|
94
|
+
gin_extract_tsvector gin_triconsistent_jsonb gin_triconsistent_jsonb_path gin_tsquery_consistent gin_tsquery_triconsistent
|
|
95
|
+
ginarrayconsistent ginarrayextract ginarraytriconsistent ginhandler ginqueryarrayextract gist_box_consistent gist_box_distance
|
|
96
|
+
gist_box_penalty gist_box_picksplit gist_box_same gist_box_union gist_circle_compress gist_circle_consistent gist_circle_distance
|
|
97
|
+
gist_point_compress gist_point_consistent gist_point_distance gist_point_fetch gist_point_sortsupport gist_poly_compress
|
|
98
|
+
gist_poly_consistent gist_poly_distance gist_translate_cmptype_common gisthandler gtsquery_compress gtsquery_consistent gtsquery_penalty
|
|
99
|
+
gtsquery_picksplit gtsquery_same gtsquery_union gtsvector_compress gtsvector_consistent gtsvector_decompress gtsvector_options
|
|
100
|
+
gtsvector_penalty gtsvector_picksplit gtsvector_same gtsvector_union gtsvectorin gtsvectorout has_any_column_privilege has_column_privilege
|
|
101
|
+
has_database_privilege has_foreign_data_wrapper_privilege has_function_privilege has_language_privilege has_largeobject_privilege
|
|
102
|
+
has_parameter_privilege has_schema_privilege has_sequence_privilege has_server_privilege has_table_privilege has_tablespace_privilege
|
|
103
|
+
has_type_privilege hash_aclitem hash_aclitem_extended hash_array hash_array_extended hash_multirange hash_multirange_extended hash_numeric
|
|
104
|
+
hash_numeric_extended hash_range hash_range_extended hash_record hash_record_extended hashbool hashboolextended hashbpchar
|
|
105
|
+
hashbpcharextended hashbytea hashbyteaextended hashchar hashcharextended hashcid hashcidextended hashdate hashdateextended hashenum
|
|
106
|
+
hashenumextended hashfloat4 hashfloat4extended hashfloat8 hashfloat8extended hashhandler hashinet hashinetextended hashint2 hashint2extended
|
|
107
|
+
hashint4 hashint4extended hashint8 hashint8extended hashmacaddr hashmacaddr8 hashmacaddr8extended hashmacaddrextended hashname
|
|
108
|
+
hashnameextended hashoid hashoidextended hashoidvector hashoidvectorextended hashtext hashtextextended hashtid hashtidextended hashvarlena
|
|
109
|
+
hashvarlenaextended hashxid hashxid8 hashxid8extended hashxidextended heap_tableam_handler height host hostmask iclikejoinsel iclikesel
|
|
99
110
|
icnlikejoinsel icnlikesel icregexeqjoinsel icregexeqsel icregexnejoinsel icregexnesel icu_unicode_version in_range index_am_handler_in
|
|
100
111
|
index_am_handler_out inet_client_addr inet_client_port inet_gist_compress inet_gist_consistent inet_gist_fetch inet_gist_penalty
|
|
101
112
|
inet_gist_picksplit inet_gist_same inet_gist_union inet_in inet_merge inet_out inet_recv inet_same_family inet_send inet_server_addr
|
|
@@ -138,27 +149,27 @@ jsonb_populate_record_valid jsonb_populate_recordset jsonb_pretty jsonb_recv jso
|
|
|
138
149
|
jsonb_subscript_handler jsonb_to_record jsonb_to_recordset jsonb_to_tsvector jsonb_typeof jsonpath_in jsonpath_out jsonpath_recv
|
|
139
150
|
jsonpath_send justify_days justify_hours justify_interval koi8r_to_iso koi8r_to_mic koi8r_to_utf8 koi8r_to_win1251 koi8r_to_win866
|
|
140
151
|
koi8u_to_utf8 lag language_handler_in language_handler_out last_value lastval latin1_to_mic latin2_to_mic latin2_to_win1250 latin3_to_mic
|
|
141
|
-
latin4_to_mic lcm lead left length like like_escape likejoinsel likesel line line_distance line_eq line_horizontal line_in
|
|
142
|
-
line_intersect line_out line_parallel line_perp line_recv line_send line_vertical ln lo_close lo_creat lo_create lo_export
|
|
143
|
-
lo_get lo_import lo_lseek lo_lseek64 lo_open lo_put lo_tell lo_tell64 lo_truncate lo_truncate64 lo_unlink log log10 loread
|
|
144
|
-
lower_inf lowrite lpad lseg lseg_center lseg_distance lseg_eq lseg_ge lseg_gt lseg_horizontal lseg_in lseg_interpt
|
|
145
|
-
lseg_length lseg_lt lseg_ne lseg_out lseg_parallel lseg_perp lseg_recv lseg_send lseg_vertical ltrim macaddr macaddr8
|
|
146
|
-
macaddr8_cmp macaddr8_eq macaddr8_ge macaddr8_gt macaddr8_in macaddr8_le macaddr8_lt macaddr8_ne macaddr8_not macaddr8_or
|
|
147
|
-
macaddr8_recv macaddr8_send macaddr8_set7bit macaddr_and macaddr_cmp macaddr_eq macaddr_ge macaddr_gt macaddr_in macaddr_le
|
|
148
|
-
macaddr_ne macaddr_not macaddr_or macaddr_out macaddr_recv macaddr_send macaddr_sortsupport make_date make_interval make_time
|
|
149
|
-
make_timestamptz makeaclitem masklen matchingjoinsel matchingsel max md5 mic_to_big5 mic_to_euc_cn mic_to_euc_jp
|
|
150
|
-
mic_to_iso mic_to_koi8r mic_to_latin1 mic_to_latin2 mic_to_latin3 mic_to_latin4 mic_to_sjis mic_to_win1250
|
|
151
|
-
min_scale mod mode mode_final money mul_d_interval multirange multirange_adjacent_multirange
|
|
152
|
-
multirange_after_multirange multirange_after_range multirange_agg_finalfn multirange_agg_transfn
|
|
153
|
-
multirange_before_range multirange_cmp multirange_contained_by_multirange multirange_contained_by_range
|
|
154
|
-
multirange_contains_multirange multirange_contains_range multirange_eq multirange_ge multirange_gist_compress
|
|
155
|
-
multirange_gt multirange_in multirange_intersect multirange_intersect_agg_transfn multirange_le multirange_lt
|
|
156
|
-
multirange_out multirange_overlaps_multirange multirange_overlaps_range multirange_overleft_multirange
|
|
157
|
-
multirange_overright_multirange multirange_overright_range multirange_recv multirange_send multirange_typanalyze
|
|
158
|
-
multirangesel mxid_age name nameconcatoid nameeq nameeqtext namege namegetext namegt namegttext nameiclike nameicnlike
|
|
159
|
-
nameicregexne namein namele nameletext namelike namelt namelttext namene namenetext namenlike nameout namerecv nameregexeq
|
|
160
|
-
namesend neqjoinsel neqsel netmask network network_cmp network_eq network_ge network_gt network_larger network_le network_lt
|
|
161
|
-
network_overlap network_smaller network_sortsupport network_sub network_subeq network_subset_support network_sup network_supeq
|
|
152
|
+
latin4_to_mic lcm lead left length lgamma like like_escape likejoinsel likesel line line_distance line_eq line_horizontal line_in
|
|
153
|
+
line_interpt line_intersect line_out line_parallel line_perp line_recv line_send line_vertical ln lo_close lo_creat lo_create lo_export
|
|
154
|
+
lo_from_bytea lo_get lo_import lo_lseek lo_lseek64 lo_open lo_put lo_tell lo_tell64 lo_truncate lo_truncate64 lo_unlink log log10 loread
|
|
155
|
+
lower lower_inc lower_inf lowrite lpad lseg lseg_center lseg_distance lseg_eq lseg_ge lseg_gt lseg_horizontal lseg_in lseg_interpt
|
|
156
|
+
lseg_intersect lseg_le lseg_length lseg_lt lseg_ne lseg_out lseg_parallel lseg_perp lseg_recv lseg_send lseg_vertical ltrim macaddr macaddr8
|
|
157
|
+
macaddr8_and macaddr8_cmp macaddr8_eq macaddr8_ge macaddr8_gt macaddr8_in macaddr8_le macaddr8_lt macaddr8_ne macaddr8_not macaddr8_or
|
|
158
|
+
macaddr8_out macaddr8_recv macaddr8_send macaddr8_set7bit macaddr_and macaddr_cmp macaddr_eq macaddr_ge macaddr_gt macaddr_in macaddr_le
|
|
159
|
+
macaddr_lt macaddr_ne macaddr_not macaddr_or macaddr_out macaddr_recv macaddr_send macaddr_sortsupport make_date make_interval make_time
|
|
160
|
+
make_timestamp make_timestamptz makeaclitem masklen matchingjoinsel matchingsel max md5 mic_to_big5 mic_to_euc_cn mic_to_euc_jp
|
|
161
|
+
mic_to_euc_kr mic_to_euc_tw mic_to_iso mic_to_koi8r mic_to_latin1 mic_to_latin2 mic_to_latin3 mic_to_latin4 mic_to_sjis mic_to_win1250
|
|
162
|
+
mic_to_win1251 mic_to_win866 min min_scale mod mode mode_final money mul_d_interval multirange multirange_adjacent_multirange
|
|
163
|
+
multirange_adjacent_range multirange_after_multirange multirange_after_range multirange_agg_finalfn multirange_agg_transfn
|
|
164
|
+
multirange_before_multirange multirange_before_range multirange_cmp multirange_contained_by_multirange multirange_contained_by_range
|
|
165
|
+
multirange_contains_elem multirange_contains_multirange multirange_contains_range multirange_eq multirange_ge multirange_gist_compress
|
|
166
|
+
multirange_gist_consistent multirange_gt multirange_in multirange_intersect multirange_intersect_agg_transfn multirange_le multirange_lt
|
|
167
|
+
multirange_minus multirange_ne multirange_out multirange_overlaps_multirange multirange_overlaps_range multirange_overleft_multirange
|
|
168
|
+
multirange_overleft_range multirange_overright_multirange multirange_overright_range multirange_recv multirange_send multirange_typanalyze
|
|
169
|
+
multirange_union multirangesel mxid_age name nameconcatoid nameeq nameeqtext namege namegetext namegt namegttext nameiclike nameicnlike
|
|
170
|
+
nameicregexeq nameicregexne namein namele nameletext namelike namelt namelttext namene namenetext namenlike nameout namerecv nameregexeq
|
|
171
|
+
nameregexne namesend neqjoinsel neqsel netmask network network_cmp network_eq network_ge network_gt network_larger network_le network_lt
|
|
172
|
+
network_ne network_overlap network_smaller network_sortsupport network_sub network_subeq network_subset_support network_sup network_supeq
|
|
162
173
|
networkjoinsel networksel nextval nlikejoinsel nlikesel normalize notlike now npoints nth_value ntile num_nonnulls num_nulls numeric
|
|
163
174
|
numeric_abs numeric_accum numeric_accum_inv numeric_add numeric_avg numeric_avg_accum numeric_avg_combine numeric_avg_deserialize
|
|
164
175
|
numeric_avg_serialize numeric_cmp numeric_combine numeric_deserialize numeric_div numeric_div_trunc numeric_eq numeric_exp numeric_ge
|
|
@@ -176,56 +187,59 @@ percentile_cont_float8_final percentile_cont_float8_multi_final percentile_cont_
|
|
|
176
187
|
percentile_disc percentile_disc_final percentile_disc_multi_final pg_advisory_lock pg_advisory_lock_shared pg_advisory_unlock
|
|
177
188
|
pg_advisory_unlock_all pg_advisory_unlock_shared pg_advisory_xact_lock pg_advisory_xact_lock_shared pg_available_extension_versions
|
|
178
189
|
pg_available_extensions pg_available_wal_summaries pg_backend_pid pg_backup_start pg_backup_stop pg_basetype pg_blocking_pids
|
|
179
|
-
pg_cancel_backend pg_char_to_encoding pg_client_encoding pg_collation_actual_version
|
|
180
|
-
pg_column_compression pg_column_is_updatable pg_column_size pg_column_toast_chunk_id
|
|
181
|
-
pg_control_init pg_control_recovery pg_control_system pg_conversion_is_visible
|
|
182
|
-
pg_copy_physical_replication_slot pg_create_logical_replication_slot pg_create_physical_replication_slot
|
|
183
|
-
pg_current_logfile pg_current_snapshot pg_current_wal_flush_lsn pg_current_wal_insert_lsn pg_current_wal_lsn
|
|
184
|
-
pg_current_xact_id_if_assigned pg_cursor pg_database_collation_actual_version pg_database_size pg_ddl_command_in
|
|
185
|
-
pg_ddl_command_recv pg_ddl_command_send pg_dependencies_in pg_dependencies_out pg_dependencies_recv pg_dependencies_send
|
|
186
|
-
pg_drop_replication_slot pg_encoding_max_length pg_encoding_to_char pg_event_trigger_ddl_commands
|
|
187
|
-
pg_event_trigger_table_rewrite_oid pg_event_trigger_table_rewrite_reason pg_export_snapshot
|
|
188
|
-
pg_extension_update_paths pg_filenode_relation pg_function_is_visible
|
|
189
|
-
pg_get_constraintdef pg_get_expr pg_get_function_arg_default
|
|
190
|
-
pg_get_function_result pg_get_function_sqlbody pg_get_functiondef
|
|
191
|
-
|
|
192
|
-
pg_get_replication_slots pg_get_ruledef
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
pg_cancel_backend pg_char_to_encoding pg_clear_attribute_stats pg_clear_relation_stats pg_client_encoding pg_collation_actual_version
|
|
191
|
+
pg_collation_for pg_collation_is_visible pg_column_compression pg_column_is_updatable pg_column_size pg_column_toast_chunk_id
|
|
192
|
+
pg_conf_load_time pg_config pg_control_checkpoint pg_control_init pg_control_recovery pg_control_system pg_conversion_is_visible
|
|
193
|
+
pg_copy_logical_replication_slot pg_copy_physical_replication_slot pg_create_logical_replication_slot pg_create_physical_replication_slot
|
|
194
|
+
pg_create_restore_point pg_current_logfile pg_current_snapshot pg_current_wal_flush_lsn pg_current_wal_insert_lsn pg_current_wal_lsn
|
|
195
|
+
pg_current_xact_id pg_current_xact_id_if_assigned pg_cursor pg_database_collation_actual_version pg_database_size pg_ddl_command_in
|
|
196
|
+
pg_ddl_command_out pg_ddl_command_recv pg_ddl_command_send pg_dependencies_in pg_dependencies_out pg_dependencies_recv pg_dependencies_send
|
|
197
|
+
pg_describe_object pg_drop_replication_slot pg_encoding_max_length pg_encoding_to_char pg_event_trigger_ddl_commands
|
|
198
|
+
pg_event_trigger_dropped_objects pg_event_trigger_table_rewrite_oid pg_event_trigger_table_rewrite_reason pg_export_snapshot
|
|
199
|
+
pg_extension_config_dump pg_extension_update_paths pg_filenode_relation pg_function_is_visible pg_get_acl pg_get_aios
|
|
200
|
+
pg_get_backend_memory_contexts pg_get_catalog_foreign_keys pg_get_constraintdef pg_get_expr pg_get_function_arg_default
|
|
201
|
+
pg_get_function_arguments pg_get_function_identity_arguments pg_get_function_result pg_get_function_sqlbody pg_get_functiondef
|
|
202
|
+
pg_get_indexdef pg_get_keywords pg_get_loaded_modules pg_get_multixact_members pg_get_object_address pg_get_partition_constraintdef
|
|
203
|
+
pg_get_partkeydef pg_get_publication_tables pg_get_replica_identity_index pg_get_replication_slots pg_get_ruledef pg_get_sequence_data
|
|
204
|
+
pg_get_serial_sequence pg_get_shmem_allocations pg_get_shmem_allocations_numa pg_get_statisticsobjdef pg_get_statisticsobjdef_columns
|
|
205
|
+
pg_get_statisticsobjdef_expressions pg_get_triggerdef pg_get_userbyid pg_get_viewdef pg_get_wait_events pg_get_wal_replay_pause_state
|
|
206
|
+
pg_get_wal_resource_managers pg_get_wal_summarizer_state pg_has_role pg_hba_file_rules pg_ident_file_mappings pg_identify_object
|
|
207
|
+
pg_identify_object_as_address pg_import_system_collations pg_index_column_has_property pg_index_has_property pg_indexam_has_property
|
|
208
|
+
pg_indexam_progress_phasename pg_indexes_size pg_input_error_info pg_input_is_valid pg_is_in_recovery pg_is_other_temp_schema
|
|
209
|
+
pg_is_wal_replay_paused pg_isolation_test_session_is_blocked pg_jit_available pg_last_committed_xact pg_last_wal_receive_lsn
|
|
210
|
+
pg_last_wal_replay_lsn pg_last_xact_replay_timestamp pg_listening_channels pg_lock_status pg_log_backend_memory_contexts
|
|
211
|
+
pg_log_standby_snapshot pg_logical_emit_message pg_logical_slot_get_binary_changes pg_logical_slot_get_changes
|
|
212
|
+
pg_logical_slot_peek_binary_changes pg_logical_slot_peek_changes pg_ls_archive_statusdir pg_ls_dir pg_ls_logdir pg_ls_logicalmapdir
|
|
213
|
+
pg_ls_logicalsnapdir pg_ls_replslotdir pg_ls_summariesdir pg_ls_tmpdir pg_ls_waldir pg_lsn pg_lsn_cmp pg_lsn_eq pg_lsn_ge pg_lsn_gt
|
|
202
214
|
pg_lsn_hash pg_lsn_hash_extended pg_lsn_in pg_lsn_larger pg_lsn_le pg_lsn_lt pg_lsn_mi pg_lsn_mii pg_lsn_ne pg_lsn_out pg_lsn_pli
|
|
203
215
|
pg_lsn_recv pg_lsn_send pg_lsn_smaller pg_mcv_list_in pg_mcv_list_items pg_mcv_list_out pg_mcv_list_recv pg_mcv_list_send pg_my_temp_schema
|
|
204
216
|
pg_ndistinct_in pg_ndistinct_out pg_ndistinct_recv pg_ndistinct_send pg_nextoid pg_node_tree_in pg_node_tree_out pg_node_tree_recv
|
|
205
|
-
pg_node_tree_send pg_notification_queue_usage pg_notify pg_opclass_is_visible pg_operator_is_visible
|
|
206
|
-
pg_options_to_table pg_partition_ancestors pg_partition_root pg_partition_tree pg_postmaster_start_time
|
|
207
|
-
pg_prepared_xact pg_promote pg_read_binary_file pg_read_file pg_relation_filenode pg_relation_filepath
|
|
208
|
-
pg_relation_is_updatable pg_relation_size pg_reload_conf pg_replication_origin_advance
|
|
209
|
-
pg_replication_origin_drop pg_replication_origin_oid pg_replication_origin_progress
|
|
210
|
-
pg_replication_origin_session_progress pg_replication_origin_session_reset
|
|
211
|
-
pg_replication_origin_xact_reset pg_replication_origin_xact_setup pg_replication_slot_advance
|
|
212
|
-
|
|
213
|
-
pg_show_all_settings pg_show_replication_origin_status pg_size_bytes
|
|
214
|
-
pg_snapshot_out pg_snapshot_recv pg_snapshot_send pg_snapshot_xip
|
|
215
|
-
pg_stat_clear_snapshot pg_stat_file pg_stat_force_next_flush pg_stat_get_activity
|
|
216
|
-
pg_stat_get_autoanalyze_count pg_stat_get_autovacuum_count pg_stat_get_backend_activity
|
|
217
|
-
pg_stat_get_backend_client_addr pg_stat_get_backend_client_port pg_stat_get_backend_dbid
|
|
218
|
-
pg_stat_get_backend_start pg_stat_get_backend_subxact
|
|
219
|
-
pg_stat_get_backend_wait_event_type
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
217
|
+
pg_node_tree_send pg_notification_queue_usage pg_notify pg_numa_available pg_opclass_is_visible pg_operator_is_visible
|
|
218
|
+
pg_opfamily_is_visible pg_options_to_table pg_partition_ancestors pg_partition_root pg_partition_tree pg_postmaster_start_time
|
|
219
|
+
pg_prepared_statement pg_prepared_xact pg_promote pg_read_binary_file pg_read_file pg_relation_filenode pg_relation_filepath
|
|
220
|
+
pg_relation_is_publishable pg_relation_is_updatable pg_relation_size pg_reload_conf pg_replication_origin_advance
|
|
221
|
+
pg_replication_origin_create pg_replication_origin_drop pg_replication_origin_oid pg_replication_origin_progress
|
|
222
|
+
pg_replication_origin_session_is_setup pg_replication_origin_session_progress pg_replication_origin_session_reset
|
|
223
|
+
pg_replication_origin_session_setup pg_replication_origin_xact_reset pg_replication_origin_xact_setup pg_replication_slot_advance
|
|
224
|
+
pg_restore_attribute_stats pg_restore_relation_stats pg_rotate_logfile pg_safe_snapshot_blocking_pids pg_sequence_last_value
|
|
225
|
+
pg_sequence_parameters pg_settings_get_flags pg_show_all_file_settings pg_show_all_settings pg_show_replication_origin_status pg_size_bytes
|
|
226
|
+
pg_size_pretty pg_sleep pg_sleep_for pg_sleep_until pg_snapshot_in pg_snapshot_out pg_snapshot_recv pg_snapshot_send pg_snapshot_xip
|
|
227
|
+
pg_snapshot_xmax pg_snapshot_xmin pg_split_walfile_name pg_stat_clear_snapshot pg_stat_file pg_stat_force_next_flush pg_stat_get_activity
|
|
228
|
+
pg_stat_get_analyze_count pg_stat_get_archiver pg_stat_get_autoanalyze_count pg_stat_get_autovacuum_count pg_stat_get_backend_activity
|
|
229
|
+
pg_stat_get_backend_activity_start pg_stat_get_backend_client_addr pg_stat_get_backend_client_port pg_stat_get_backend_dbid
|
|
230
|
+
pg_stat_get_backend_idset pg_stat_get_backend_io pg_stat_get_backend_pid pg_stat_get_backend_start pg_stat_get_backend_subxact
|
|
231
|
+
pg_stat_get_backend_userid pg_stat_get_backend_wait_event pg_stat_get_backend_wait_event_type pg_stat_get_backend_wal
|
|
232
|
+
pg_stat_get_backend_xact_start pg_stat_get_bgwriter_buf_written_clean pg_stat_get_bgwriter_maxwritten_clean
|
|
233
|
+
pg_stat_get_bgwriter_stat_reset_time pg_stat_get_blocks_fetched pg_stat_get_blocks_hit pg_stat_get_buf_alloc
|
|
234
|
+
pg_stat_get_checkpointer_buffers_written pg_stat_get_checkpointer_num_performed pg_stat_get_checkpointer_num_requested
|
|
235
|
+
pg_stat_get_checkpointer_num_timed pg_stat_get_checkpointer_restartpoints_performed pg_stat_get_checkpointer_restartpoints_requested
|
|
236
|
+
pg_stat_get_checkpointer_restartpoints_timed pg_stat_get_checkpointer_slru_written pg_stat_get_checkpointer_stat_reset_time
|
|
237
|
+
pg_stat_get_checkpointer_sync_time pg_stat_get_checkpointer_write_time pg_stat_get_db_active_time pg_stat_get_db_blk_read_time
|
|
238
|
+
pg_stat_get_db_blk_write_time pg_stat_get_db_blocks_fetched pg_stat_get_db_blocks_hit pg_stat_get_db_checksum_failures
|
|
239
|
+
pg_stat_get_db_checksum_last_failure pg_stat_get_db_conflict_all pg_stat_get_db_conflict_bufferpin pg_stat_get_db_conflict_lock
|
|
240
|
+
pg_stat_get_db_conflict_logicalslot pg_stat_get_db_conflict_snapshot pg_stat_get_db_conflict_startup_deadlock
|
|
241
|
+
pg_stat_get_db_conflict_tablespace pg_stat_get_db_deadlocks pg_stat_get_db_idle_in_transaction_time pg_stat_get_db_numbackends
|
|
242
|
+
pg_stat_get_db_parallel_workers_launched pg_stat_get_db_parallel_workers_to_launch pg_stat_get_db_session_time pg_stat_get_db_sessions
|
|
229
243
|
pg_stat_get_db_sessions_abandoned pg_stat_get_db_sessions_fatal pg_stat_get_db_sessions_killed pg_stat_get_db_stat_reset_time
|
|
230
244
|
pg_stat_get_db_temp_bytes pg_stat_get_db_temp_files pg_stat_get_db_tuples_deleted pg_stat_get_db_tuples_fetched
|
|
231
245
|
pg_stat_get_db_tuples_inserted pg_stat_get_db_tuples_returned pg_stat_get_db_tuples_updated pg_stat_get_db_xact_commit
|
|
@@ -233,39 +247,41 @@ pg_stat_get_db_xact_rollback pg_stat_get_dead_tuples pg_stat_get_function_calls
|
|
|
233
247
|
pg_stat_get_function_total_time pg_stat_get_ins_since_vacuum pg_stat_get_io pg_stat_get_last_analyze_time pg_stat_get_last_autoanalyze_time
|
|
234
248
|
pg_stat_get_last_autovacuum_time pg_stat_get_last_vacuum_time pg_stat_get_lastscan pg_stat_get_live_tuples pg_stat_get_mod_since_analyze
|
|
235
249
|
pg_stat_get_numscans pg_stat_get_progress_info pg_stat_get_recovery_prefetch pg_stat_get_replication_slot pg_stat_get_slru
|
|
236
|
-
pg_stat_get_snapshot_timestamp pg_stat_get_subscription pg_stat_get_subscription_stats
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
250
|
+
pg_stat_get_snapshot_timestamp pg_stat_get_subscription pg_stat_get_subscription_stats pg_stat_get_total_analyze_time
|
|
251
|
+
pg_stat_get_total_autoanalyze_time pg_stat_get_total_autovacuum_time pg_stat_get_total_vacuum_time pg_stat_get_tuples_deleted
|
|
252
|
+
pg_stat_get_tuples_fetched pg_stat_get_tuples_hot_updated pg_stat_get_tuples_inserted pg_stat_get_tuples_newpage_updated
|
|
253
|
+
pg_stat_get_tuples_returned pg_stat_get_tuples_updated pg_stat_get_vacuum_count pg_stat_get_wal pg_stat_get_wal_receiver
|
|
254
|
+
pg_stat_get_wal_senders pg_stat_get_xact_blocks_fetched pg_stat_get_xact_blocks_hit pg_stat_get_xact_function_calls
|
|
255
|
+
pg_stat_get_xact_function_self_time pg_stat_get_xact_function_total_time pg_stat_get_xact_numscans pg_stat_get_xact_tuples_deleted
|
|
256
|
+
pg_stat_get_xact_tuples_fetched pg_stat_get_xact_tuples_hot_updated pg_stat_get_xact_tuples_inserted pg_stat_get_xact_tuples_newpage_updated
|
|
257
|
+
pg_stat_get_xact_tuples_returned pg_stat_get_xact_tuples_updated pg_stat_have_stats pg_stat_reset pg_stat_reset_backend_stats
|
|
258
|
+
pg_stat_reset_replication_slot pg_stat_reset_shared pg_stat_reset_single_function_counters pg_stat_reset_single_table_counters
|
|
259
|
+
pg_stat_reset_slru pg_stat_reset_subscription_stats pg_statistics_obj_is_visible pg_stop_making_pinned_objects pg_switch_wal
|
|
260
|
+
pg_sync_replication_slots pg_table_is_visible pg_table_size pg_tablespace_databases pg_tablespace_location pg_tablespace_size
|
|
261
|
+
pg_terminate_backend pg_timezone_abbrevs pg_timezone_abbrevs_abbrevs pg_timezone_abbrevs_zone pg_timezone_names pg_total_relation_size
|
|
262
|
+
pg_trigger_depth pg_try_advisory_lock pg_try_advisory_lock_shared pg_try_advisory_xact_lock pg_try_advisory_xact_lock_shared
|
|
263
|
+
pg_ts_config_is_visible pg_ts_dict_is_visible pg_ts_parser_is_visible pg_ts_template_is_visible pg_type_is_visible pg_typeof
|
|
264
|
+
pg_visible_in_snapshot pg_wal_lsn_diff pg_wal_replay_pause pg_wal_replay_resume pg_wal_summary_contents pg_walfile_name
|
|
265
|
+
pg_walfile_name_offset pg_xact_commit_timestamp pg_xact_commit_timestamp_origin pg_xact_status phraseto_tsquery pi plainto_tsquery
|
|
266
|
+
plpgsql_call_handler plpgsql_inline_handler plpgsql_validator point point_above point_add point_below point_distance point_div point_eq
|
|
267
|
+
point_horiz point_in point_left point_mul point_ne point_out point_recv point_right point_send point_sub point_vert poly_above poly_below
|
|
268
|
+
poly_center poly_contain poly_contain_pt poly_contained poly_distance poly_in poly_left poly_npoints poly_out poly_overabove poly_overbelow
|
|
269
|
+
poly_overlap poly_overleft poly_overright poly_recv poly_right poly_same poly_send polygon popen position positionjoinsel positionsel
|
|
270
|
+
postgresql_fdw_validator pow power prefixjoinsel prefixsel prsd_end prsd_headline prsd_lextype prsd_nexttoken prsd_start pt_contained_circle
|
|
271
|
+
pt_contained_poly query_to_xml query_to_xml_and_xmlschema query_to_xmlschema querytree quote_ident quote_literal quote_nullable radians
|
|
272
|
+
radius random random_normal range_adjacent range_adjacent_multirange range_after range_after_multirange range_agg range_agg_finalfn
|
|
273
|
+
range_agg_transfn range_before range_before_multirange range_cmp range_contained_by range_contained_by_multirange range_contains
|
|
274
|
+
range_contains_elem range_contains_elem_support range_contains_multirange range_eq range_ge range_gist_consistent range_gist_penalty
|
|
275
|
+
range_gist_picksplit range_gist_same range_gist_union range_gt range_in range_intersect range_intersect_agg range_intersect_agg_transfn
|
|
276
|
+
range_le range_lt range_merge range_minus range_ne range_out range_overlaps range_overlaps_multirange range_overleft
|
|
277
|
+
range_overleft_multirange range_overright range_overright_multirange range_recv range_send range_sortsupport range_typanalyze range_union
|
|
278
|
+
rangesel rank rank_final raw_array_subscript_handler record_eq record_ge record_gt record_image_eq record_image_ge record_image_gt
|
|
279
|
+
record_image_le record_image_lt record_image_ne record_in record_larger record_le record_lt record_ne record_out record_recv record_send
|
|
280
|
+
record_smaller regclass regclassin regclassout regclassrecv regclasssend regcollationin regcollationout regcollationrecv regcollationsend
|
|
281
|
+
regconfigin regconfigout regconfigrecv regconfigsend regdictionaryin regdictionaryout regdictionaryrecv regdictionarysend regexeqjoinsel
|
|
282
|
+
regexeqsel regexnejoinsel regexnesel regexp_count regexp_instr regexp_like regexp_match regexp_matches regexp_replace regexp_split_to_array
|
|
283
|
+
regexp_split_to_table regexp_substr regnamespacein regnamespaceout regnamespacerecv regnamespacesend regoperatorin regoperatorout
|
|
284
|
+
regoperatorrecv regoperatorsend regoperin regoperout regoperrecv regopersend regprocedurein regprocedureout regprocedurerecv
|
|
269
285
|
regproceduresend regprocin regprocout regprocrecv regprocsend regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx
|
|
270
286
|
regr_sxy regr_syy regrolein regroleout regrolerecv regrolesend regtypein regtypeout regtyperecv regtypesend repeat replace reverse right
|
|
271
287
|
round row_number row_security_active row_to_json rpad rtrim satisfies_hash_partition scalargejoinsel scalargesel scalargtjoinsel scalargtsel
|
|
@@ -290,43 +306,41 @@ timestamp timestamp_cmp timestamp_cmp_date timestamp_cmp_timestamptz timestamp_e
|
|
|
290
306
|
timestamp_ge_date timestamp_ge_timestamptz timestamp_gt timestamp_gt_date timestamp_gt_timestamptz timestamp_hash timestamp_hash_extended
|
|
291
307
|
timestamp_in timestamp_larger timestamp_le timestamp_le_date timestamp_le_timestamptz timestamp_lt timestamp_lt_date
|
|
292
308
|
timestamp_lt_timestamptz timestamp_mi timestamp_mi_interval timestamp_ne timestamp_ne_date timestamp_ne_timestamptz timestamp_out
|
|
293
|
-
timestamp_pl_interval timestamp_recv timestamp_send timestamp_smaller timestamp_sortsupport timestamp_support
|
|
294
|
-
timestamptypmodout timestamptz timestamptz_cmp timestamptz_cmp_date timestamptz_cmp_timestamp timestamptz_eq
|
|
295
|
-
timestamptz_eq_timestamp timestamptz_ge timestamptz_ge_date timestamptz_ge_timestamp timestamptz_gt timestamptz_gt_date
|
|
296
|
-
timestamptz_gt_timestamp timestamptz_in timestamptz_larger timestamptz_le timestamptz_le_date
|
|
297
|
-
timestamptz_lt_date timestamptz_lt_timestamp timestamptz_mi timestamptz_mi_interval timestamptz_ne
|
|
298
|
-
timestamptz_ne_timestamp timestamptz_out timestamptz_pl_interval timestamptz_recv timestamptz_send timestamptz_smaller
|
|
299
|
-
timestamptztypmodout timetypmodin timetypmodout timetz timetz_cmp timetz_eq timetz_ge timetz_gt timetz_hash
|
|
300
|
-
timetz_larger timetz_le timetz_lt timetz_mi_interval timetz_ne timetz_out timetz_pl_interval timetz_recv
|
|
301
|
-
timetzdate_pl timetztypmodin timetztypmodout timezone to_ascii to_bin to_char to_date to_hex to_json to_jsonb
|
|
302
|
-
to_regcollation to_regnamespace to_regoper to_regoperator to_regproc to_regprocedure to_regrole to_regtype
|
|
303
|
-
to_tsquery to_tsvector transaction_timestamp translate trigger_in trigger_out trim_array trim_scale trunc
|
|
304
|
-
ts_headline ts_lexize ts_match_qv ts_match_tq ts_match_tt ts_match_vq ts_parse ts_rank ts_rank_cd ts_rewrite
|
|
305
|
-
ts_typanalyze tsm_handler_in tsm_handler_out tsmatchjoinsel tsmatchsel tsmultirange tsq_mcontained tsq_mcontains
|
|
306
|
-
tsquery_eq tsquery_ge tsquery_gt tsquery_le tsquery_lt tsquery_ne tsquery_not tsquery_or tsquery_phrase tsqueryin
|
|
307
|
-
tsquerysend tsrange tsrange_subdiff tstzmultirange tstzrange tstzrange_subdiff tsvector_cmp tsvector_concat
|
|
308
|
-
tsvector_gt tsvector_le tsvector_lt tsvector_ne tsvector_to_array tsvector_update_trigger
|
|
309
|
-
tsvectorout tsvectorrecv tsvectorsend txid_current txid_current_if_assigned txid_current_snapshot
|
|
310
|
-
txid_snapshot_recv txid_snapshot_send txid_snapshot_xip txid_snapshot_xmax txid_snapshot_xmin txid_status
|
|
311
|
-
uhc_to_utf8 unicode_assigned unicode_version unique_key_recheck unistr unknownin unknownout unknownrecv unknownsend
|
|
312
|
-
upper_inf utf8_to_big5 utf8_to_euc_cn utf8_to_euc_jis_2004 utf8_to_euc_jp utf8_to_euc_kr utf8_to_euc_tw
|
|
313
|
-
utf8_to_iso8859 utf8_to_iso8859_1 utf8_to_johab utf8_to_koi8r utf8_to_koi8u utf8_to_shift_jis_2004 utf8_to_sjis
|
|
314
|
-
uuid_cmp uuid_eq uuid_extract_timestamp uuid_extract_version uuid_ge uuid_gt uuid_hash uuid_hash_extended uuid_in
|
|
315
|
-
uuid_out uuid_recv uuid_send uuid_sortsupport var_pop var_samp varbit varbit_in
|
|
316
|
-
varbiteq varbitge varbitgt varbitle varbitlt varbitne varbittypmodin
|
|
317
|
-
varcharrecv varcharsend varchartypmodin varchartypmodout variance version
|
|
318
|
-
|
|
319
|
-
win866_to_mic win866_to_win1251 win_to_utf8
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
xpath xpath_exists
|
|
324
|
-
|
|
325
|
-
)
|
|
309
|
+
timestamp_pl_interval timestamp_recv timestamp_send timestamp_skipsupport timestamp_smaller timestamp_sortsupport timestamp_support
|
|
310
|
+
timestamptypmodin timestamptypmodout timestamptz timestamptz_cmp timestamptz_cmp_date timestamptz_cmp_timestamp timestamptz_eq
|
|
311
|
+
timestamptz_eq_date timestamptz_eq_timestamp timestamptz_ge timestamptz_ge_date timestamptz_ge_timestamp timestamptz_gt timestamptz_gt_date
|
|
312
|
+
timestamptz_gt_timestamp timestamptz_hash timestamptz_hash_extended timestamptz_in timestamptz_larger timestamptz_le timestamptz_le_date
|
|
313
|
+
timestamptz_le_timestamp timestamptz_lt timestamptz_lt_date timestamptz_lt_timestamp timestamptz_mi timestamptz_mi_interval timestamptz_ne
|
|
314
|
+
timestamptz_ne_date timestamptz_ne_timestamp timestamptz_out timestamptz_pl_interval timestamptz_recv timestamptz_send timestamptz_smaller
|
|
315
|
+
timestamptztypmodin timestamptztypmodout timetypmodin timetypmodout timetz timetz_cmp timetz_eq timetz_ge timetz_gt timetz_hash
|
|
316
|
+
timetz_hash_extended timetz_in timetz_larger timetz_le timetz_lt timetz_mi_interval timetz_ne timetz_out timetz_pl_interval timetz_recv
|
|
317
|
+
timetz_send timetz_smaller timetzdate_pl timetztypmodin timetztypmodout timezone to_ascii to_bin to_char to_date to_hex to_json to_jsonb
|
|
318
|
+
to_number to_oct to_regclass to_regcollation to_regnamespace to_regoper to_regoperator to_regproc to_regprocedure to_regrole to_regtype
|
|
319
|
+
to_regtypemod to_timestamp to_tsquery to_tsvector transaction_timestamp translate trigger_in trigger_out trim_array trim_scale trunc
|
|
320
|
+
ts_debug ts_delete ts_filter ts_headline ts_lexize ts_match_qv ts_match_tq ts_match_tt ts_match_vq ts_parse ts_rank ts_rank_cd ts_rewrite
|
|
321
|
+
ts_stat ts_token_type ts_typanalyze tsm_handler_in tsm_handler_out tsmatchjoinsel tsmatchsel tsmultirange tsq_mcontained tsq_mcontains
|
|
322
|
+
tsquery_and tsquery_cmp tsquery_eq tsquery_ge tsquery_gt tsquery_le tsquery_lt tsquery_ne tsquery_not tsquery_or tsquery_phrase tsqueryin
|
|
323
|
+
tsqueryout tsqueryrecv tsquerysend tsrange tsrange_subdiff tstzmultirange tstzrange tstzrange_subdiff tsvector_cmp tsvector_concat
|
|
324
|
+
tsvector_eq tsvector_ge tsvector_gt tsvector_le tsvector_lt tsvector_ne tsvector_to_array tsvector_update_trigger
|
|
325
|
+
tsvector_update_trigger_column tsvectorin tsvectorout tsvectorrecv tsvectorsend txid_current txid_current_if_assigned txid_current_snapshot
|
|
326
|
+
txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send txid_snapshot_xip txid_snapshot_xmax txid_snapshot_xmin txid_status
|
|
327
|
+
txid_visible_in_snapshot uhc_to_utf8 unicode_assigned unicode_version unique_key_recheck unistr unknownin unknownout unknownrecv unknownsend
|
|
328
|
+
unnest upper upper_inc upper_inf utf8_to_big5 utf8_to_euc_cn utf8_to_euc_jis_2004 utf8_to_euc_jp utf8_to_euc_kr utf8_to_euc_tw
|
|
329
|
+
utf8_to_gb18030 utf8_to_gbk utf8_to_iso8859 utf8_to_iso8859_1 utf8_to_johab utf8_to_koi8r utf8_to_koi8u utf8_to_shift_jis_2004 utf8_to_sjis
|
|
330
|
+
utf8_to_uhc utf8_to_win uuid_cmp uuid_eq uuid_extract_timestamp uuid_extract_version uuid_ge uuid_gt uuid_hash uuid_hash_extended uuid_in
|
|
331
|
+
uuid_le uuid_lt uuid_ne uuid_out uuid_recv uuid_send uuid_skipsupport uuid_sortsupport uuidv4 uuidv7 var_pop var_samp varbit varbit_in
|
|
332
|
+
varbit_out varbit_recv varbit_send varbit_support varbitcmp varbiteq varbitge varbitgt varbitle varbitlt varbitne varbittypmodin
|
|
333
|
+
varbittypmodout varchar varchar_support varcharin varcharout varcharrecv varcharsend varchartypmodin varchartypmodout variance version
|
|
334
|
+
void_in void_out void_recv void_send websearch_to_tsquery width width_bucket win1250_to_latin2 win1250_to_mic win1251_to_iso
|
|
335
|
+
win1251_to_koi8r win1251_to_mic win1251_to_win866 win866_to_iso win866_to_koi8r win866_to_mic win866_to_win1251 win_to_utf8
|
|
336
|
+
window_cume_dist_support window_dense_rank_support window_ntile_support window_percent_rank_support window_rank_support
|
|
337
|
+
window_row_number_support xid xid8_larger xid8_smaller xid8cmp xid8eq xid8ge xid8gt xid8in xid8le xid8lt xid8ne xid8out xid8recv xid8send
|
|
338
|
+
xideq xideqint4 xidin xidneq xidneqint4 xidout xidrecv xidsend xml xml_in xml_is_well_formed xml_is_well_formed_content
|
|
339
|
+
xml_is_well_formed_document xml_out xml_recv xml_send xmlagg xmlcomment xmlconcat2 xmlexists xmltext xmlvalidate xpath xpath_exists
|
|
340
|
+
`)
|
|
326
341
|
|
|
327
342
|
/** Every SQL keyword, of every category: an application function may not take one (`operator`, `position`). */
|
|
328
|
-
export const SQL_KEYWORDS: ReadonlySet<string> =
|
|
329
|
-
`
|
|
343
|
+
export const SQL_KEYWORDS: ReadonlySet<string> = names(`
|
|
330
344
|
abort absent absolute access action add admin after aggregate all also alter always analyse analyze and any array as asc asensitive
|
|
331
345
|
assertion assignment asymmetric at atomic attach attribute authorization backward before begin between bigint binary bit boolean both
|
|
332
346
|
breadth by cache call called cascade cascaded case cast catalog chain char character characteristics check checkpoint class close cluster
|
|
@@ -334,26 +348,55 @@ coalesce collate collation column columns comment comments commit committed comp
|
|
|
334
348
|
connection constraint constraints content continue conversion copy cost create cross csv cube current current_catalog current_date
|
|
335
349
|
current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare
|
|
336
350
|
default defaults deferrable deferred definer delete delimiter delimiters depends depth desc detach dictionary disable discard distinct do
|
|
337
|
-
document domain double drop each else empty enable encoding encrypted end enum error escape event except exclude excluding
|
|
338
|
-
exists explain expression extension external extract false family fetch filter finalize first float following for force
|
|
339
|
-
forward freeze from full function functions generated global grant granted greatest group grouping groups handler having
|
|
340
|
-
identity if ilike immediate immutable implicit import in include including increment indent index indexes inherit inherits
|
|
341
|
-
inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join json
|
|
342
|
-
json_arrayagg json_exists json_object json_objectagg json_query json_scalar json_serialize json_table json_value keep key keys
|
|
343
|
-
language large last lateral leading leakproof least left level like limit listen load local localtime localtimestamp location lock
|
|
344
|
-
logged mapping match matched materialized maxvalue merge merge_action method minute minvalue mode month move name names national
|
|
345
|
-
nchar nested new next nfc nfd nfkc nfkd no none normalize normalized not nothing notify notnull nowait null nullif nulls numeric
|
|
346
|
-
off offset oids old omit on only operator option options or order ordinality others out outer over overlaps overlay
|
|
347
|
-
parallel parameter parser partial partition passing password path placing plan plans policy position preceding
|
|
348
|
-
preserve primary prior privileges procedural procedure procedures program publication quote quotes range read
|
|
349
|
-
recursive ref references referencing refresh reindex relative release rename repeatable replace replica reset restart
|
|
350
|
-
returning returns revoke right role rollback rollup routine routines row rows rule savepoint scalar schema schemas scroll
|
|
351
|
-
security select sequence sequences serializable server session session_user set setof sets share show similar simple skip
|
|
352
|
-
some source sql stable standalone start statement statistics stdin stdout storage stored strict string strip subscription
|
|
353
|
-
symmetric sysid system system_user table tables tablesample tablespace target temp template temporary text then ties time
|
|
354
|
-
trailing transaction transform treat trigger trim true truncate trusted type types uescape unbounded uncommitted unconditional
|
|
355
|
-
union unique unknown unlisten unlogged until update user using vacuum valid validate validator value values varchar variadic
|
|
356
|
-
version view views volatile when where whitespace window with within without work wrapper write xml xmlattributes
|
|
357
|
-
xmlexists xmlforest xmlnamespaces xmlparse xmlpi xmlroot xmlserialize xmltable year yes zone
|
|
358
|
-
|
|
359
|
-
|
|
351
|
+
document domain double drop each else empty enable encoding encrypted end enforced enum error escape event except exclude excluding
|
|
352
|
+
exclusive execute exists explain expression extension external extract false family fetch filter finalize first float following for force
|
|
353
|
+
foreign format forward freeze from full function functions generated global grant granted greatest group grouping groups handler having
|
|
354
|
+
header hold hour identity if ilike immediate immutable implicit import in include including increment indent index indexes inherit inherits
|
|
355
|
+
initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join json
|
|
356
|
+
json_array json_arrayagg json_exists json_object json_objectagg json_query json_scalar json_serialize json_table json_value keep key keys
|
|
357
|
+
label language large last lateral leading leakproof least left level like limit listen load local localtime localtimestamp location lock
|
|
358
|
+
locked logged mapping match matched materialized maxvalue merge merge_action method minute minvalue mode month move name names national
|
|
359
|
+
natural nchar nested new next nfc nfd nfkc nfkd no none normalize normalized not nothing notify notnull nowait null nullif nulls numeric
|
|
360
|
+
object objects of off offset oids old omit on only operator option options or order ordinality others out outer over overlaps overlay
|
|
361
|
+
overriding owned owner parallel parameter parser partial partition passing password path period placing plan plans policy position preceding
|
|
362
|
+
precision prepare prepared preserve primary prior privileges procedural procedure procedures program publication quote quotes range read
|
|
363
|
+
real reassign recheck recursive ref references referencing refresh reindex relative release rename repeatable replace replica reset restart
|
|
364
|
+
restrict return returning returns revoke right role rollback rollup routine routines row rows rule savepoint scalar schema schemas scroll
|
|
365
|
+
search second security select sequence sequences serializable server session session_user set setof sets share show similar simple skip
|
|
366
|
+
smallint snapshot some source sql stable standalone start statement statistics stdin stdout storage stored strict string strip subscription
|
|
367
|
+
substring support symmetric sysid system system_user table tables tablesample tablespace target temp template temporary text then ties time
|
|
368
|
+
timestamp to trailing transaction transform treat trigger trim true truncate trusted type types uescape unbounded uncommitted unconditional
|
|
369
|
+
unencrypted union unique unknown unlisten unlogged until update user using vacuum valid validate validator value values varchar variadic
|
|
370
|
+
varying verbose version view views virtual volatile when where whitespace window with within without work wrapper write xml xmlattributes
|
|
371
|
+
xmlconcat xmlelement xmlexists xmlforest xmlnamespaces xmlparse xmlpi xmlroot xmlserialize xmltable year yes zone
|
|
372
|
+
`)
|
|
373
|
+
|
|
374
|
+
/** Per major, the names of the sets above that its own catalog lacks. */
|
|
375
|
+
export const PG_CATALOG_ABSENT: ReadonlyMap<number, { functions: ReadonlySet<string>; keywords: ReadonlySet<string> }> = new Map([
|
|
376
|
+
[17, {
|
|
377
|
+
functions: names(`
|
|
378
|
+
array_append_support array_prepend_support array_reverse array_sort array_subscript_handler_support btboolskipsupport btcharskipsupport
|
|
379
|
+
btint2skipsupport btint4skipsupport btint8skipsupport btoidskipsupport bytea bytea_larger bytea_smaller casefold crc32 crc32c
|
|
380
|
+
date_skipsupport gamma generate_series_numeric_support generate_series_timestamp_support gist_translate_cmptype_common
|
|
381
|
+
has_largeobject_privilege hashbool hashboolextended hashbytea hashbyteaextended hashcid hashcidextended hashdate hashdateextended hashxid
|
|
382
|
+
hashxid8 hashxid8extended hashxidextended lgamma pg_clear_attribute_stats pg_clear_relation_stats pg_get_acl pg_get_aios
|
|
383
|
+
pg_get_loaded_modules pg_get_sequence_data pg_get_shmem_allocations_numa pg_ls_summariesdir pg_numa_available pg_restore_attribute_stats
|
|
384
|
+
pg_restore_relation_stats pg_stat_get_backend_io pg_stat_get_backend_wal pg_stat_get_checkpointer_num_performed
|
|
385
|
+
pg_stat_get_checkpointer_slru_written pg_stat_get_db_parallel_workers_launched pg_stat_get_db_parallel_workers_to_launch
|
|
386
|
+
pg_stat_get_total_analyze_time pg_stat_get_total_autoanalyze_time pg_stat_get_total_autovacuum_time pg_stat_get_total_vacuum_time
|
|
387
|
+
pg_stat_reset_backend_stats pg_timezone_abbrevs_abbrevs pg_timezone_abbrevs_zone range_sortsupport record_larger record_smaller
|
|
388
|
+
timestamp_skipsupport timestamptz_hash timestamptz_hash_extended uuid_skipsupport uuidv4 uuidv7
|
|
389
|
+
`),
|
|
390
|
+
keywords: names(`
|
|
391
|
+
enforced objects period virtual
|
|
392
|
+
`),
|
|
393
|
+
}],
|
|
394
|
+
[18, {
|
|
395
|
+
functions: names(`
|
|
396
|
+
pg_timezone_abbrevs
|
|
397
|
+
`),
|
|
398
|
+
keywords: names(`
|
|
399
|
+
recheck
|
|
400
|
+
`),
|
|
401
|
+
}],
|
|
402
|
+
])
|
|
@@ -6,8 +6,13 @@ import { PostgresDatabase } from './sql-postgres'
|
|
|
6
6
|
|
|
7
7
|
/** A provisioning credential that exists for one test run only, and what it created. */
|
|
8
8
|
export interface TestProvisioner {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Connects as `fabrika_tests_<hex>`: CREATEROLE and CREATE on the database, nothing of any application, and a login
|
|
11
|
+
* for `TEST_PROVISIONER_LIFETIME_MINUTES` only.
|
|
12
|
+
*/
|
|
10
13
|
readonly url: string
|
|
14
|
+
/** The provisioners of earlier runs that creating this one dropped. Role names, never a credential. */
|
|
15
|
+
readonly swept: readonly string[]
|
|
11
16
|
/** Drops every role the provisioner created, with everything those roles own, then the provisioner itself. */
|
|
12
17
|
drop(): Promise<void>
|
|
13
18
|
}
|
|
@@ -18,21 +23,52 @@ export interface TestProvisioner {
|
|
|
18
23
|
*/
|
|
19
24
|
export const DATABASE_GRANT_LOCK_KEY: number = createHash('sha256').update('fabrika-db:database-grants', 'utf8').digest().readUIntBE(0, 6) + 1
|
|
20
25
|
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Grants (or revokes) CREATE on `database` to `role`, serialized with every other run that does so on the same server.
|
|
28
|
+
* Verified afterwards: a grantor that neither owns the database, is a superuser nor holds CREATE WITH GRANT OPTION only
|
|
29
|
+
* gets a WARNING, and the statement changes nothing.
|
|
30
|
+
*/
|
|
22
31
|
export async function changeCreateOnDatabase(admin: SqlDatabase, change: 'grant' | 'revoke', role: string, database: string): Promise<void> {
|
|
23
32
|
const statement = change === 'grant'
|
|
24
33
|
? `GRANT CREATE ON DATABASE ${quotedIdentifier(database)} TO ${quotedIdentifier(role)}`
|
|
25
34
|
: `REVOKE CREATE ON DATABASE ${quotedIdentifier(database)} FROM ${quotedIdentifier(role)}`
|
|
26
35
|
await admin.batch([admin.prepare(`SELECT pg_catalog.pg_advisory_xact_lock(${DATABASE_GRANT_LOCK_KEY})`), admin.prepare(statement)])
|
|
36
|
+
const held = await admin.prepare("SELECT pg_catalog.has_database_privilege(?, ?, 'CREATE') AS creates").bind(role, database).first<{
|
|
37
|
+
creates: boolean
|
|
38
|
+
}>()
|
|
39
|
+
if ((held?.creates ?? false) !== (change === 'grant')) {
|
|
40
|
+
throw new PostgresMigrationError(
|
|
41
|
+
`the provisioning credential could not ${change} CREATE on the database ${database} ${
|
|
42
|
+
change === 'grant' ? 'to' : 'from'
|
|
43
|
+
} ${role}: it must own the database, be a superuser, or hold CREATE on it WITH GRANT OPTION`,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
27
46
|
}
|
|
28
47
|
|
|
29
48
|
/** Before Postgres 16, CREATEROLE may grant membership in any role that is not a superuser, `pg_execute_server_program` included. */
|
|
30
49
|
const MINIMUM_SERVER_VERSION = 160000
|
|
31
50
|
|
|
51
|
+
/** A provisioner's name. The sweep selects by it, so a role of another kind never matches. */
|
|
52
|
+
const TEST_PROVISIONER_NAME = /^fabrika_tests_[0-9a-f]{16}$/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* How long a provisioner can log in (`VALID UNTIL`). A run that a kill stopped before `drop()` leaves its provisioner
|
|
56
|
+
* behind, and nobody knows its password; after this time it also cannot log in, and the next run's sweep drops it. A
|
|
57
|
+
* run makes new connections until it ends, so this is far beyond the longest run.
|
|
58
|
+
*/
|
|
59
|
+
export const TEST_PROVISIONER_LIFETIME_MINUTES = 15
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The session-level lock one sweep holds. A run that does not get it skips its sweep: the run that holds it is sweeping
|
|
63
|
+
* the same leftovers, and any role may take any advisory lock, so a run never waits for it.
|
|
64
|
+
*/
|
|
65
|
+
const SWEEP_LOCK_KEY: number = createHash('sha256').update('fabrika-db:test-provisioner-sweep', 'utf8').digest().readUIntBE(0, 6) + 1
|
|
66
|
+
|
|
32
67
|
/**
|
|
33
68
|
* Creates a throwaway provisioning credential for code the platform runs but did not write, such as an application's
|
|
34
69
|
* generated tests: it can create the test kit's role families and schemas, and reaches no application's data, because
|
|
35
70
|
* a CREATEROLE role administers only the roles it created. The provisioning credential itself never leaves this process.
|
|
71
|
+
* First it drops the provisioners earlier runs left behind (`sweepTestProvisioners`).
|
|
36
72
|
*/
|
|
37
73
|
export async function createTestProvisioner(provisioningUrl: string): Promise<TestProvisioner> {
|
|
38
74
|
const { url } = provisioningCredential(provisioningUrl)
|
|
@@ -41,11 +77,14 @@ export async function createTestProvisioner(provisioningUrl: string): Promise<Te
|
|
|
41
77
|
const admin = PostgresDatabase.connect(provisioningUrl, { max: 1 })
|
|
42
78
|
try {
|
|
43
79
|
const self = await admin.prepare(`SELECT rolsuper, rolcreaterole, pg_catalog.current_setting('server_version_num')::int AS version,
|
|
44
|
-
pg_catalog.current_database() AS database
|
|
80
|
+
pg_catalog.current_database() AS database,
|
|
81
|
+
pg_catalog.quote_literal((pg_catalog.now() + interval '${TEST_PROVISIONER_LIFETIME_MINUTES} minutes')::text) AS valid_until
|
|
82
|
+
FROM pg_catalog.pg_roles WHERE rolname = current_user`).first<{
|
|
45
83
|
rolsuper: boolean
|
|
46
84
|
rolcreaterole: boolean
|
|
47
85
|
version: number
|
|
48
86
|
database: string
|
|
87
|
+
valid_until: string
|
|
49
88
|
}>()
|
|
50
89
|
if (self === null || (!self.rolsuper && !self.rolcreaterole)) {
|
|
51
90
|
throw new PostgresMigrationError(
|
|
@@ -57,12 +96,18 @@ export async function createTestProvisioner(provisioningUrl: string): Promise<Te
|
|
|
57
96
|
'the test run needs Postgres 16 or later: before 16, a CREATEROLE role may grant itself any role that is not a superuser',
|
|
58
97
|
)
|
|
59
98
|
}
|
|
60
|
-
|
|
61
|
-
await
|
|
99
|
+
const swept = await sweepTestProvisioners(admin, self.database)
|
|
100
|
+
await admin.prepare(`CREATE ROLE ${name} LOGIN CREATEROLE NOINHERIT PASSWORD '${scramVerifier(password)}' VALID UNTIL ${self.valid_until}`).run()
|
|
101
|
+
try {
|
|
102
|
+
await changeCreateOnDatabase(admin, 'grant', name, self.database)
|
|
103
|
+
} catch (error) {
|
|
104
|
+
await admin.prepare(`DROP ROLE ${name}`).run()
|
|
105
|
+
throw error
|
|
106
|
+
}
|
|
62
107
|
const database = self.database
|
|
63
108
|
url.username = name
|
|
64
109
|
url.password = password
|
|
65
|
-
return { url: url.toString(), drop: () => dropTestProvisioner(provisioningUrl, name, database) }
|
|
110
|
+
return { url: url.toString(), swept, drop: () => dropTestProvisioner(provisioningUrl, name, database) }
|
|
66
111
|
} finally {
|
|
67
112
|
await admin.close()
|
|
68
113
|
}
|
|
@@ -71,15 +116,52 @@ export async function createTestProvisioner(provisioningUrl: string): Promise<Te
|
|
|
71
116
|
async function dropTestProvisioner(provisioningUrl: string, name: string, database: string): Promise<void> {
|
|
72
117
|
const admin = PostgresDatabase.connect(provisioningUrl, { max: 1 })
|
|
73
118
|
try {
|
|
74
|
-
await admin
|
|
75
|
-
await dropCreatedRoles(admin, name)
|
|
76
|
-
await changeCreateOnDatabase(admin, 'revoke', name, database)
|
|
77
|
-
await admin.prepare(`DROP ROLE ${name}`).run()
|
|
119
|
+
await dropProvisioner(admin, name, database)
|
|
78
120
|
} finally {
|
|
79
121
|
await admin.close()
|
|
80
122
|
}
|
|
81
123
|
}
|
|
82
124
|
|
|
125
|
+
/**
|
|
126
|
+
* As the provisioning credential: drops every provisioner an earlier run left behind (a run killed before `drop()`),
|
|
127
|
+
* with everything it administers. A leftover is one past its `VALID UNTIL`, or without one (a release before it), that
|
|
128
|
+
* the credential administers, that holds CREATE on no other database, and that has no session, neither as itself nor as
|
|
129
|
+
* a role it created. A concurrent run's provisioner is still valid; a session keeps one that outlived its validity.
|
|
130
|
+
*/
|
|
131
|
+
async function sweepTestProvisioners(admin: SqlDatabase, database: string): Promise<readonly string[]> {
|
|
132
|
+
const lock = await admin.prepare(`SELECT pg_catalog.pg_try_advisory_lock(${SWEEP_LOCK_KEY}) AS locked`).first<{ locked: boolean }>()
|
|
133
|
+
if (lock?.locked !== true) return []
|
|
134
|
+
try {
|
|
135
|
+
const { results } = await admin.prepare(`SELECT r.rolname AS name FROM pg_catalog.pg_roles r
|
|
136
|
+
WHERE r.rolname ~ ?
|
|
137
|
+
AND (r.rolvaliduntil IS NULL OR r.rolvaliduntil < pg_catalog.now())
|
|
138
|
+
AND pg_catalog.pg_has_role(r.oid, 'MEMBER WITH ADMIN OPTION')
|
|
139
|
+
AND NOT EXISTS (SELECT FROM pg_catalog.pg_database d
|
|
140
|
+
WHERE d.datname <> pg_catalog.current_database() AND pg_catalog.has_database_privilege(r.oid, d.oid, 'CREATE'))
|
|
141
|
+
AND NOT EXISTS (SELECT FROM pg_catalog.pg_stat_activity a
|
|
142
|
+
WHERE a.usesysid = r.oid
|
|
143
|
+
OR a.usesysid IN (SELECT m.roleid FROM pg_catalog.pg_auth_members m WHERE m.member = r.oid AND m.admin_option))
|
|
144
|
+
ORDER BY 1`).bind(TEST_PROVISIONER_NAME.source).all<{ name: string }>()
|
|
145
|
+
const swept: string[] = []
|
|
146
|
+
for (const { name } of results) {
|
|
147
|
+
if (!TEST_PROVISIONER_NAME.test(name)) continue
|
|
148
|
+
await dropProvisioner(admin, name, database)
|
|
149
|
+
swept.push(name)
|
|
150
|
+
}
|
|
151
|
+
return swept
|
|
152
|
+
} finally {
|
|
153
|
+
await admin.prepare(`SELECT pg_catalog.pg_advisory_unlock(${SWEEP_LOCK_KEY})`).run()
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** As the provisioning credential: the provisioner's roles with what they own, its CREATE on `database`, then itself. */
|
|
158
|
+
async function dropProvisioner(admin: SqlDatabase, name: string, database: string): Promise<void> {
|
|
159
|
+
await admin.prepare(`GRANT ${name} TO CURRENT_USER`).run()
|
|
160
|
+
await dropCreatedRoles(admin, name)
|
|
161
|
+
await changeCreateOnDatabase(admin, 'revoke', name, database)
|
|
162
|
+
await admin.prepare(`DROP ROLE ${name}`).run()
|
|
163
|
+
}
|
|
164
|
+
|
|
83
165
|
/** As the provisioner: each role it administers, made its own for a moment so that its objects can be dropped, then dropped. */
|
|
84
166
|
async function dropCreatedRoles(admin: SqlDatabase, name: string): Promise<void> {
|
|
85
167
|
const { results } = await admin.prepare(`SELECT pg_catalog.pg_get_userbyid(m.roleid) AS role FROM pg_catalog.pg_auth_members m
|