pg_query 4.2.1 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +6 -8
- data/Rakefile +5 -6
- data/ext/pg_query/extconf.rb +14 -4
- data/ext/pg_query/include/pg_query.h +27 -3
- data/ext/pg_query/include/pg_query_enum_defs.c +311 -149
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +545 -489
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +5092 -4432
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +385 -343
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +1294 -1161
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +137 -123
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +1657 -1496
- data/ext/pg_query/include/{access → postgres/access}/amapi.h +3 -1
- data/ext/pg_query/include/{access → postgres/access}/attmap.h +5 -3
- data/ext/pg_query/include/{access → postgres/access}/attnum.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/clog.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/commit_ts.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/detoast.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/genam.h +7 -5
- data/ext/pg_query/include/{access → postgres/access}/gin.h +16 -3
- data/ext/pg_query/include/{access → postgres/access}/htup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/htup_details.h +6 -2
- data/ext/pg_query/include/{access → postgres/access}/itup.h +61 -58
- data/ext/pg_query/include/{access → postgres/access}/parallel.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/printtup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relation.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relscan.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/rmgrlist.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/sdir.h +12 -3
- data/ext/pg_query/include/{access → postgres/access}/skey.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/stratnum.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/sysattr.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/table.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/tableam.h +68 -45
- data/ext/pg_query/include/{access → postgres/access}/toast_compression.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/transam.h +1 -1
- data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
- data/ext/pg_query/include/{access → postgres/access}/tupconvert.h +5 -2
- data/ext/pg_query/include/{access → postgres/access}/tupdesc.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/tupmacs.h +58 -98
- data/ext/pg_query/include/{access → postgres/access}/twophase.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/xact.h +25 -18
- data/ext/pg_query/include/{access → postgres/access}/xlog.h +15 -16
- data/ext/pg_query/include/{access → postgres/access}/xlog_internal.h +100 -62
- data/ext/pg_query/include/postgres/access/xlogbackup.h +41 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogdefs.h +6 -25
- data/ext/pg_query/include/{access → postgres/access}/xlogprefetcher.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/xlogreader.h +7 -6
- data/ext/pg_query/include/{access → postgres/access}/xlogrecord.h +17 -5
- data/ext/pg_query/include/{access → postgres/access}/xlogrecovery.h +4 -3
- data/ext/pg_query/include/postgres/archive/archive_module.h +59 -0
- data/ext/pg_query/include/{c.h → postgres/c.h} +144 -156
- data/ext/pg_query/include/{catalog → postgres/catalog}/catalog.h +4 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/catversion.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/dependency.h +5 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/genbki.h +7 -6
- data/ext/pg_query/include/{catalog → postgres/catalog}/index.h +4 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/indexing.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/namespace.h +2 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaccess.h +10 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaddress.h +3 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute.h +19 -17
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute_d.h +19 -19
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation_d.h +4 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint.h +2 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_control.h +9 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion.h +2 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion_d.h +1 -1
- data/ext/pg_query/include/postgres/catalog/pg_database.h +124 -0
- data/ext/pg_query/include/postgres/catalog/pg_database_d.h +52 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily.h +3 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily_d.h +4 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication.h +2 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type_d.h +1 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/storage.h +6 -6
- data/ext/pg_query/include/{commands → postgres/commands}/async.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/dbcommands.h +2 -1
- data/ext/pg_query/include/{commands → postgres/commands}/defrem.h +2 -1
- data/ext/pg_query/include/{commands → postgres/commands}/event_trigger.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/explain.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/prepare.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/tablespace.h +4 -4
- data/ext/pg_query/include/{commands → postgres/commands}/trigger.h +15 -14
- data/ext/pg_query/include/{commands → postgres/commands}/user.h +9 -3
- data/ext/pg_query/include/{commands → postgres/commands}/vacuum.h +60 -14
- data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
- data/ext/pg_query/include/{common → postgres/common}/file_perm.h +1 -1
- data/ext/pg_query/include/{common → postgres/common}/hashfn.h +1 -1
- data/ext/pg_query/include/postgres/common/int.h +437 -0
- data/ext/pg_query/include/{common → postgres/common}/keywords.h +1 -1
- data/ext/pg_query/include/{common → postgres/common}/kwlookup.h +2 -2
- data/ext/pg_query/include/{common → postgres/common}/pg_prng.h +3 -2
- data/ext/pg_query/include/{common → postgres/common}/relpath.h +20 -13
- data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
- data/ext/pg_query/include/postgres/common/sha2.h +32 -0
- data/ext/pg_query/include/{common → postgres/common}/string.h +5 -3
- data/ext/pg_query/include/{common → postgres/common}/unicode_east_asian_fw_table.h +10 -10
- data/ext/pg_query/include/{common/unicode_combining_table.h → postgres/common/unicode_nonspacing_table.h} +31 -13
- data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5013 -0
- data/ext/pg_query/include/postgres/copyfuncs.switch.c +938 -0
- data/ext/pg_query/include/{datatype → postgres/datatype}/timestamp.h +11 -4
- data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3097 -0
- data/ext/pg_query/include/postgres/equalfuncs.switch.c +785 -0
- data/ext/pg_query/include/{executor → postgres/executor}/execdesc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/executor.h +34 -17
- data/ext/pg_query/include/{executor → postgres/executor}/functions.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/instrument.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/spi.h +2 -2
- data/ext/pg_query/include/{executor → postgres/executor}/tablefunc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/tuptable.h +18 -11
- data/ext/pg_query/include/{fmgr.h → postgres/fmgr.h} +21 -2
- data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
- data/ext/pg_query/include/{funcapi.h → postgres/funcapi.h} +12 -12
- data/ext/pg_query/include/postgres/gram.h +1127 -0
- data/ext/pg_query/include/{parser → postgres}/gramparse.h +4 -4
- data/ext/pg_query/include/{jit → postgres/jit}/jit.h +2 -2
- data/ext/pg_query/include/postgres/kwlist_d.h +1119 -0
- data/ext/pg_query/include/{lib → postgres/lib}/dshash.h +4 -1
- data/ext/pg_query/include/{lib → postgres/lib}/ilist.h +435 -22
- data/ext/pg_query/include/{lib → postgres/lib}/pairingheap.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/simplehash.h +9 -9
- data/ext/pg_query/include/{lib → postgres/lib}/sort_template.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/stringinfo.h +3 -3
- data/ext/pg_query/include/{libpq → postgres/libpq}/auth.h +8 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/crypt.h +1 -1
- data/ext/pg_query/include/{libpq → postgres/libpq}/hba.h +24 -17
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq-be.h +36 -25
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq.h +1 -1
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqcomm.h +10 -41
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqformat.h +2 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqsignal.h +22 -10
- data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
- data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
- data/ext/pg_query/include/{mb → postgres/mb}/pg_wchar.h +35 -18
- data/ext/pg_query/include/{mb → postgres/mb}/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/{miscadmin.h → postgres/miscadmin.h} +27 -15
- data/ext/pg_query/include/{nodes → postgres/nodes}/bitmapset.h +11 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/execnodes.h +83 -30
- data/ext/pg_query/include/{nodes → postgres/nodes}/extensible.h +5 -3
- data/ext/pg_query/include/{nodes → postgres/nodes}/lockoptions.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/makefuncs.h +14 -2
- data/ext/pg_query/include/{nodes → postgres/nodes}/memnodes.h +7 -4
- data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodeFuncs.h +89 -29
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodes.h +96 -511
- data/ext/pg_query/include/postgres/nodes/nodetags.h +471 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/params.h +3 -3
- data/ext/pg_query/include/{nodes → postgres/nodes}/parsenodes.h +377 -139
- data/ext/pg_query/include/{nodes → postgres/nodes}/pathnodes.h +1090 -440
- data/ext/pg_query/include/{nodes → postgres/nodes}/pg_list.h +30 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/plannodes.h +367 -124
- data/ext/pg_query/include/{nodes → postgres/nodes}/primnodes.h +670 -222
- data/ext/pg_query/include/{nodes → postgres/nodes}/print.h +1 -1
- data/ext/pg_query/include/{utils → postgres/nodes}/queryjumble.h +5 -7
- data/ext/pg_query/include/postgres/nodes/replnodes.h +111 -0
- data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/tidbitmap.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/value.h +12 -2
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/cost.h +6 -4
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo_gene.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/optimizer.h +8 -8
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/paths.h +16 -7
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/planmain.h +3 -6
- data/ext/pg_query/include/{parser → postgres/parser}/analyze.h +4 -3
- data/ext/pg_query/include/{parser → postgres/parser}/kwlist.h +12 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_agg.h +4 -2
- data/ext/pg_query/include/{parser → postgres/parser}/parse_coerce.h +3 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_expr.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_func.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_node.h +22 -4
- data/ext/pg_query/include/{parser → postgres/parser}/parse_oper.h +3 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_relation.h +8 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_type.h +4 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parser.h +4 -4
- data/ext/pg_query/include/{parser → postgres/parser}/parsetree.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/scanner.h +2 -2
- data/ext/pg_query/include/{parser → postgres/parser}/scansup.h +1 -1
- data/ext/pg_query/include/{partitioning → postgres/partitioning}/partdefs.h +1 -1
- data/ext/pg_query/include/{pg_config.h → postgres/pg_config.h} +158 -218
- data/ext/pg_query/include/{pg_config_manual.h → postgres/pg_config_manual.h} +8 -46
- data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
- data/ext/pg_query/include/{pg_getopt.h → postgres/pg_getopt.h} +1 -1
- data/ext/pg_query/include/{pg_trace.h → postgres/pg_trace.h} +1 -1
- data/ext/pg_query/include/{pgstat.h → postgres/pgstat.h} +173 -94
- data/ext/pg_query/include/{pgtime.h → postgres/pgtime.h} +3 -3
- data/ext/pg_query/include/{pl_gram.h → postgres/pl_gram.h} +66 -64
- data/ext/pg_query/include/{pl_reserved_kwlist.h → postgres/pl_reserved_kwlist.h} +1 -1
- data/ext/pg_query/include/{pl_reserved_kwlist_d.h → postgres/pl_reserved_kwlist_d.h} +1 -1
- data/ext/pg_query/include/{pl_unreserved_kwlist.h → postgres/pl_unreserved_kwlist.h} +2 -1
- data/ext/pg_query/include/{pl_unreserved_kwlist_d.h → postgres/pl_unreserved_kwlist_d.h} +48 -46
- data/ext/pg_query/include/{plpgsql.h → postgres/plpgsql.h} +28 -33
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-arm.h +3 -3
- data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-ppc.h +21 -21
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-x86.h +2 -2
- data/ext/pg_query/include/{port → postgres/port}/atomics/fallback.h +3 -3
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic-gcc.h +1 -1
- data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +101 -0
- data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +106 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/atomics.h +2 -7
- data/ext/pg_query/include/{port → postgres/port}/pg_bitutils.h +62 -25
- data/ext/pg_query/include/{port → postgres/port}/pg_bswap.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/pg_crc32c.h +1 -1
- data/ext/pg_query/include/postgres/port/simd.h +375 -0
- data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
- data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/socket.h +26 -0
- data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
- data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
- data/ext/pg_query/include/postgres/port/win32.h +59 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
- data/ext/pg_query/include/postgres/port/win32_port.h +594 -0
- data/ext/pg_query/include/{port.h → postgres/port.h} +42 -75
- data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
- data/ext/pg_query/include/postgres/postgres.h +579 -0
- data/ext/pg_query/include/{postgres_ext.h → postgres/postgres_ext.h} +0 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/autovacuum.h +1 -4
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker_internals.h +1 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgwriter.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/interrupt.h +1 -1
- data/ext/pg_query/include/postgres/postmaster/pgarch.h +36 -0
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/postmaster.h +6 -3
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/startup.h +3 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/syslogger.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/walwriter.h +3 -1
- data/ext/pg_query/include/{regex → postgres/regex}/regex.h +9 -6
- data/ext/pg_query/include/{replication → postgres/replication}/logicallauncher.h +6 -1
- data/ext/pg_query/include/{replication → postgres/replication}/logicalproto.h +30 -10
- data/ext/pg_query/include/postgres/replication/logicalworker.h +32 -0
- data/ext/pg_query/include/{replication → postgres/replication}/origin.h +4 -4
- data/ext/pg_query/include/{replication → postgres/replication}/reorderbuffer.h +113 -45
- data/ext/pg_query/include/{replication → postgres/replication}/slot.h +25 -6
- data/ext/pg_query/include/{replication → postgres/replication}/syncrep.h +2 -8
- data/ext/pg_query/include/{replication → postgres/replication}/walreceiver.h +15 -9
- data/ext/pg_query/include/{replication → postgres/replication}/walsender.h +13 -13
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/prs2lock.h +1 -1
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteHandler.h +1 -4
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteManip.h +11 -2
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteSupport.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/backendid.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/block.h +24 -31
- data/ext/pg_query/include/{storage → postgres/storage}/buf.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/bufmgr.h +183 -87
- data/ext/pg_query/include/{storage → postgres/storage}/bufpage.h +146 -93
- data/ext/pg_query/include/{storage → postgres/storage}/condition_variable.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/dsm.h +3 -6
- data/ext/pg_query/include/{storage → postgres/storage}/dsm_impl.h +4 -1
- data/ext/pg_query/include/{storage → postgres/storage}/fd.h +24 -20
- data/ext/pg_query/include/{storage → postgres/storage}/fileset.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/ipc.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/item.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemid.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemptr.h +94 -57
- data/ext/pg_query/include/{storage → postgres/storage}/large_object.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/latch.h +9 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lmgr.h +6 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lock.h +21 -13
- data/ext/pg_query/include/{storage → postgres/storage}/lockdefs.h +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/lwlock.h +16 -2
- data/ext/pg_query/include/{storage → postgres/storage}/off.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_sema.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_shmem.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pmsignal.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/predicate.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/proc.h +22 -17
- data/ext/pg_query/include/{storage → postgres/storage}/procarray.h +3 -2
- data/ext/pg_query/include/{storage → postgres/storage}/proclist_types.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/procsignal.h +3 -1
- data/ext/pg_query/include/postgres/storage/relfilelocator.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/s_lock.h +66 -309
- data/ext/pg_query/include/{storage → postgres/storage}/sharedfileset.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shm_mq.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shm_toc.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shmem.h +1 -23
- data/ext/pg_query/include/{storage → postgres/storage}/sinval.h +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/sinvaladt.h +4 -2
- data/ext/pg_query/include/{storage → postgres/storage}/smgr.h +12 -10
- data/ext/pg_query/include/{storage → postgres/storage}/spin.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/standby.h +9 -8
- data/ext/pg_query/include/{storage → postgres/storage}/standbydefs.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/sync.h +3 -3
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtag.h +7 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtaglist.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/deparse_utility.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/dest.h +1 -3
- data/ext/pg_query/include/{tcop → postgres/tcop}/fastpath.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/pquery.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/tcopprot.h +3 -6
- data/ext/pg_query/include/{tcop → postgres/tcop}/utility.h +1 -1
- data/ext/pg_query/include/{tsearch → postgres/tsearch}/ts_cache.h +2 -4
- data/ext/pg_query/include/{utils → postgres/utils}/acl.h +26 -81
- data/ext/pg_query/include/{utils → postgres/utils}/aclchk_internal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/array.h +19 -1
- data/ext/pg_query/include/{utils → postgres/utils}/backend_progress.h +2 -1
- data/ext/pg_query/include/{utils → postgres/utils}/backend_status.h +24 -3
- data/ext/pg_query/include/{utils → postgres/utils}/builtins.h +15 -6
- data/ext/pg_query/include/{utils → postgres/utils}/bytea.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/catcache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/date.h +37 -9
- data/ext/pg_query/include/{utils → postgres/utils}/datetime.h +41 -21
- data/ext/pg_query/include/{utils → postgres/utils}/datum.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/dsa.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/elog.h +104 -29
- data/ext/pg_query/include/{utils → postgres/utils}/expandeddatum.h +14 -3
- data/ext/pg_query/include/{utils → postgres/utils}/expandedrecord.h +14 -4
- data/ext/pg_query/include/{utils → postgres/utils}/float.h +7 -6
- data/ext/pg_query/include/{utils → postgres/utils}/fmgroids.h +54 -1
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrprotos.h +45 -3
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrtab.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/guc.h +59 -86
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +163 -0
- data/ext/pg_query/include/{utils → postgres/utils}/guc_tables.h +49 -3
- data/ext/pg_query/include/{utils → postgres/utils}/hsearch.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/inval.h +3 -3
- data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
- data/ext/pg_query/include/{utils → postgres/utils}/lsyscache.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memdebug.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memutils.h +7 -51
- data/ext/pg_query/include/postgres/utils/memutils_internal.h +136 -0
- data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +237 -0
- data/ext/pg_query/include/{utils → postgres/utils}/numeric.h +20 -5
- data/ext/pg_query/include/{utils → postgres/utils}/palloc.h +9 -2
- data/ext/pg_query/include/{utils → postgres/utils}/partcache.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/pg_locale.h +22 -14
- data/ext/pg_query/include/{utils → postgres/utils}/pgstat_internal.h +37 -7
- data/ext/pg_query/include/{utils → postgres/utils}/plancache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/portal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/probes.h +6 -6
- data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
- data/ext/pg_query/include/{utils → postgres/utils}/queryenvironment.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/regproc.h +3 -3
- data/ext/pg_query/include/{utils → postgres/utils}/rel.h +60 -43
- data/ext/pg_query/include/{utils → postgres/utils}/relcache.h +13 -8
- data/ext/pg_query/include/{utils → postgres/utils}/reltrigger.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/resowner.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/ruleutils.h +6 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/snapmgr.h +4 -2
- data/ext/pg_query/include/{utils → postgres/utils}/snapshot.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sortsupport.h +2 -2
- data/ext/pg_query/include/{utils → postgres/utils}/syscache.h +4 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timeout.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timestamp.h +41 -11
- data/ext/pg_query/include/{utils → postgres/utils}/tuplesort.h +189 -35
- data/ext/pg_query/include/{utils → postgres/utils}/tuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/typcache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/varlena.h +13 -1
- data/ext/pg_query/include/{utils → postgres/utils}/wait_event.h +9 -4
- data/ext/pg_query/include/{utils → postgres/utils}/xml.h +15 -5
- data/ext/pg_query/include/{postgres.h → postgres/varatt.h} +7 -457
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +6186 -5585
- data/ext/pg_query/include/protobuf/pg_query.pb.h +112443 -91222
- data/ext/pg_query/pg_query.c +10 -1
- data/ext/pg_query/pg_query.pb-c.c +19755 -17757
- data/ext/pg_query/pg_query_deparse.c +1 -10635
- data/ext/pg_query/pg_query_fingerprint.c +12 -8
- data/ext/pg_query/pg_query_fingerprint.h +1 -1
- data/ext/pg_query/pg_query_internal.h +1 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +1 -0
- data/ext/pg_query/pg_query_normalize.c +1 -1
- data/ext/pg_query/pg_query_outfuncs_json.c +6 -0
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +3 -2
- data/ext/pg_query/pg_query_parse.c +47 -5
- data/ext/pg_query/pg_query_parse_plpgsql.c +7 -5
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +1 -0
- data/ext/pg_query/pg_query_ruby.c +5 -0
- data/ext/pg_query/pg_query_ruby_freebsd.sym +2 -0
- data/ext/pg_query/pg_query_scan.c +1 -1
- data/ext/pg_query/pg_query_split.c +3 -3
- data/ext/pg_query/postgres_deparse.c +11067 -0
- data/ext/pg_query/postgres_deparse.h +9 -0
- data/ext/pg_query/src_backend_catalog_namespace.c +7 -2
- data/ext/pg_query/src_backend_catalog_pg_proc.c +1 -1
- data/ext/pg_query/src_backend_commands_define.c +1 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +11 -70
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +96 -6202
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +95 -4068
- data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
- data/ext/pg_query/src_backend_nodes_list.c +14 -2
- data/ext/pg_query/src_backend_nodes_makefuncs.c +95 -1
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +283 -132
- data/ext/pg_query/src_backend_nodes_nodes.c +38 -0
- data/ext/pg_query/src_backend_nodes_value.c +1 -1
- data/ext/pg_query/src_backend_parser_gram.c +33208 -31806
- data/ext/pg_query/src_backend_parser_parser.c +28 -2
- data/ext/pg_query/src_backend_parser_scan.c +4318 -3329
- data/ext/pg_query/src_backend_parser_scansup.c +1 -1
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +1 -1
- data/ext/pg_query/src_backend_tcop_postgres.c +66 -87
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_datum.c +5 -7
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +79 -5
- data/ext/pg_query/src_backend_utils_error_assert.c +4 -7
- data/ext/pg_query/src_backend_utils_error_elog.c +371 -249
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +33 -1
- data/ext/pg_query/src_backend_utils_init_globals.c +6 -3
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +21 -67
- data/ext/pg_query/src_backend_utils_misc_guc_tables.c +492 -0
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +163 -0
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +449 -312
- data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +398 -49
- data/ext/pg_query/src_backend_utils_mmgr_slab.c +1021 -0
- data/ext/pg_query/src_common_encnames.c +4 -1
- data/ext/pg_query/src_common_hashfn.c +1 -1
- data/ext/pg_query/src_common_keywords.c +1 -1
- data/ext/pg_query/src_common_kwlist_d.h +534 -510
- data/ext/pg_query/src_common_kwlookup.c +1 -1
- data/ext/pg_query/src_common_psprintf.c +1 -1
- data/ext/pg_query/src_common_stringinfo.c +4 -4
- data/ext/pg_query/src_common_wchar.c +9 -8
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +661 -694
- data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +48 -46
- data/ext/pg_query/src_port_pg_bitutils.c +79 -5
- data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
- data/ext/pg_query/src_port_snprintf.c +6 -10
- data/ext/pg_query/src_port_strerror.c +1 -1
- data/ext/pg_query/src_port_strlcpy.c +79 -0
- data/lib/pg_query/fingerprint.rb +2 -3
- data/lib/pg_query/node.rb +16 -11
- data/lib/pg_query/parse.rb +1 -1
- data/lib/pg_query/pg_query_pb.rb +166 -3191
- data/lib/pg_query/treewalker.rb +23 -5
- data/lib/pg_query/version.rb +1 -1
- metadata +432 -380
- data/ext/pg_query/guc-file.c +0 -0
- data/ext/pg_query/include/catalog/pg_parameter_acl.h +0 -60
- data/ext/pg_query/include/catalog/pg_parameter_acl_d.h +0 -34
- data/ext/pg_query/include/commands/variable.h +0 -38
- data/ext/pg_query/include/common/ip.h +0 -31
- data/ext/pg_query/include/getaddrinfo.h +0 -162
- data/ext/pg_query/include/kwlist_d.h +0 -1095
- data/ext/pg_query/include/parser/gram.h +0 -1101
- data/ext/pg_query/include/pg_config_os.h +0 -8
- data/ext/pg_query/include/portability/instr_time.h +0 -256
- data/ext/pg_query/include/postmaster/auxprocess.h +0 -20
- data/ext/pg_query/include/postmaster/fork_process.h +0 -17
- data/ext/pg_query/include/postmaster/pgarch.h +0 -73
- data/ext/pg_query/include/replication/logicalworker.h +0 -19
- data/ext/pg_query/include/storage/relfilenode.h +0 -99
- data/ext/pg_query/include/utils/dynahash.h +0 -20
- data/ext/pg_query/include/utils/pg_lsn.h +0 -29
- data/ext/pg_query/include/utils/pidfile.h +0 -56
- data/ext/pg_query/include/utils/ps_status.h +0 -25
- data/ext/pg_query/include/utils/rls.h +0 -50
- data/ext/pg_query/include/utils/tzparser.h +0 -39
- data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2201
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -371
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1116
- data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1993
- data/ext/pg_query/src_common_pg_prng.c +0 -152
- data/ext/pg_query/src_common_string.c +0 -92
- data/ext/pg_query/src_port_pgsleep.c +0 -69
- data/ext/pg_query/src_port_strnlen.c +0 -39
- /data/ext/pg_query/include/{access → postgres/access}/rmgr.h +0 -0
- /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
- /data/ext/pg_query/include/{plerrcodes.h → postgres/plerrcodes.h} +0 -0
- /data/ext/pg_query/include/{storage → postgres/storage}/lwlocknames.h +0 -0
- /data/ext/pg_query/include/{utils → postgres/utils}/errcodes.h +0 -0
@@ -4,7 +4,6 @@
|
|
4
4
|
* - errstart
|
5
5
|
* - PG_exception_stack
|
6
6
|
* - write_stderr
|
7
|
-
* - err_gettext
|
8
7
|
* - in_error_recursion_trouble
|
9
8
|
* - error_context_stack
|
10
9
|
* - errordata_stack_depth
|
@@ -13,6 +12,8 @@
|
|
13
12
|
* - is_log_level_output
|
14
13
|
* - should_output_to_client
|
15
14
|
* - recursion_depth
|
15
|
+
* - get_error_stack_entry
|
16
|
+
* - set_stack_entry_domain
|
16
17
|
* - errmsg_internal
|
17
18
|
* - errcode
|
18
19
|
* - errmsg
|
@@ -25,9 +26,15 @@
|
|
25
26
|
* - emit_log_hook
|
26
27
|
* - send_message_to_server_log
|
27
28
|
* - send_message_to_frontend
|
29
|
+
* - pgwin32_dispatch_queued_signals
|
30
|
+
* - set_stack_entry_location
|
28
31
|
* - matches_backtrace_functions
|
32
|
+
* - backtrace_symbol_list
|
29
33
|
* - set_backtrace
|
34
|
+
* - FreeErrorDataContents
|
30
35
|
* - geterrcode
|
36
|
+
* - errsave_start
|
37
|
+
* - errsave_finish
|
31
38
|
* - errhint
|
32
39
|
* - errposition
|
33
40
|
* - internalerrposition
|
@@ -38,6 +45,9 @@
|
|
38
45
|
* - errcontext_msg
|
39
46
|
* - CopyErrorData
|
40
47
|
* - FlushErrorState
|
48
|
+
* - pg_signal_queue
|
49
|
+
* - pg_signal_mask
|
50
|
+
* - pgwin32_dispatch_queued_signals
|
41
51
|
*--------------------------------------------------------------------
|
42
52
|
*/
|
43
53
|
|
@@ -86,7 +96,7 @@
|
|
86
96
|
* overflow.)
|
87
97
|
*
|
88
98
|
*
|
89
|
-
* Portions Copyright (c) 1996-
|
99
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
90
100
|
* Portions Copyright (c) 1994, Regents of the University of California
|
91
101
|
*
|
92
102
|
*
|
@@ -114,6 +124,7 @@
|
|
114
124
|
#include "libpq/libpq.h"
|
115
125
|
#include "libpq/pqformat.h"
|
116
126
|
#include "mb/pg_wchar.h"
|
127
|
+
#include "nodes/miscnodes.h"
|
117
128
|
#include "miscadmin.h"
|
118
129
|
#include "pgstat.h"
|
119
130
|
#include "postmaster/bgworker.h"
|
@@ -122,9 +133,10 @@
|
|
122
133
|
#include "storage/ipc.h"
|
123
134
|
#include "storage/proc.h"
|
124
135
|
#include "tcop/tcopprot.h"
|
125
|
-
#include "utils/
|
136
|
+
#include "utils/guc_hooks.h"
|
126
137
|
#include "utils/memutils.h"
|
127
138
|
#include "utils/ps_status.h"
|
139
|
+
#include "utils/varlena.h"
|
128
140
|
|
129
141
|
|
130
142
|
/* In this module, access gettext() via err_gettext() */
|
@@ -159,6 +171,10 @@ __thread emit_log_hook_type emit_log_hook = NULL;
|
|
159
171
|
|
160
172
|
|
161
173
|
|
174
|
+
/* Processed form of backtrace_symbols GUC */
|
175
|
+
static __thread char *backtrace_symbol_list;
|
176
|
+
|
177
|
+
|
162
178
|
#ifdef HAVE_SYSLOG
|
163
179
|
|
164
180
|
/*
|
@@ -221,10 +237,17 @@ static __thread int recursion_depth = 0;
|
|
221
237
|
|
222
238
|
|
223
239
|
static const char *err_gettext(const char *str) pg_attribute_format_arg(1);
|
240
|
+
static ErrorData *get_error_stack_entry(void);
|
241
|
+
static void set_stack_entry_domain(ErrorData *edata, const char *domain);
|
242
|
+
static void set_stack_entry_location(ErrorData *edata,
|
243
|
+
const char *filename, int lineno,
|
244
|
+
const char *funcname);
|
245
|
+
static bool matches_backtrace_functions(const char *funcname);
|
224
246
|
static pg_noinline void set_backtrace(ErrorData *edata, int num_skip);
|
225
247
|
static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str);
|
248
|
+
static void FreeErrorDataContents(ErrorData *edata);
|
226
249
|
static void write_console(const char *line, int len);
|
227
|
-
static const char *process_log_prefix_padding(const char *p, int *
|
250
|
+
static const char *process_log_prefix_padding(const char *p, int *ppadding);
|
228
251
|
static void log_line_prefix(StringInfo buf, ErrorData *edata);
|
229
252
|
static void send_message_to_server_log(ErrorData *edata);
|
230
253
|
static void send_message_to_frontend(ErrorData *edata);
|
@@ -282,24 +305,8 @@ should_output_to_server(int elevel)
|
|
282
305
|
/*
|
283
306
|
* should_output_to_client --- should message of given elevel go to the client?
|
284
307
|
*/
|
285
|
-
static inline bool
|
286
|
-
|
287
|
-
{
|
288
|
-
if (whereToSendOutput == DestRemote && elevel != LOG_SERVER_ONLY)
|
289
|
-
{
|
290
|
-
/*
|
291
|
-
* client_min_messages is honored only after we complete the
|
292
|
-
* authentication handshake. This is required both for security
|
293
|
-
* reasons and because many clients can't handle NOTICE messages
|
294
|
-
* during authentication.
|
295
|
-
*/
|
296
|
-
if (ClientAuthInProgress)
|
297
|
-
return (elevel >= ERROR);
|
298
|
-
else
|
299
|
-
return (elevel >= client_min_messages || elevel == INFO);
|
300
|
-
}
|
301
|
-
return false;
|
302
|
-
}
|
308
|
+
static inline bool should_output_to_client(int elevel) { return false; }
|
309
|
+
|
303
310
|
|
304
311
|
|
305
312
|
/*
|
@@ -332,18 +339,9 @@ in_error_recursion_trouble(void)
|
|
332
339
|
* message, since there's a significant probability that that's exactly
|
333
340
|
* what's causing the recursion.
|
334
341
|
*/
|
335
|
-
static inline const char *
|
336
|
-
err_gettext(const char *str)
|
337
|
-
{
|
338
342
|
#ifdef ENABLE_NLS
|
339
|
-
if (in_error_recursion_trouble())
|
340
|
-
return str;
|
341
|
-
else
|
342
|
-
return gettext(str);
|
343
343
|
#else
|
344
|
-
return str;
|
345
344
|
#endif
|
346
|
-
}
|
347
345
|
|
348
346
|
/*
|
349
347
|
* errstart_cold
|
@@ -468,27 +466,13 @@ errstart(int elevel, const char *domain)
|
|
468
466
|
debug_query_string = NULL;
|
469
467
|
}
|
470
468
|
}
|
471
|
-
if (++errordata_stack_depth >= ERRORDATA_STACK_SIZE)
|
472
|
-
{
|
473
|
-
/*
|
474
|
-
* Wups, stack not big enough. We treat this as a PANIC condition
|
475
|
-
* because it suggests an infinite loop of errors during error
|
476
|
-
* recovery.
|
477
|
-
*/
|
478
|
-
errordata_stack_depth = -1; /* make room on stack */
|
479
|
-
ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded")));
|
480
|
-
}
|
481
469
|
|
482
470
|
/* Initialize data for this error frame */
|
483
|
-
edata =
|
484
|
-
MemSet(edata, 0, sizeof(ErrorData));
|
471
|
+
edata = get_error_stack_entry();
|
485
472
|
edata->elevel = elevel;
|
486
473
|
edata->output_to_server = output_to_server;
|
487
474
|
edata->output_to_client = output_to_client;
|
488
|
-
|
489
|
-
edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
|
490
|
-
/* initialize context_domain the same way (see set_errcontext_domain()) */
|
491
|
-
edata->context_domain = edata->domain;
|
475
|
+
set_stack_entry_domain(edata, domain);
|
492
476
|
/* Select default errcode based on elevel */
|
493
477
|
if (elevel >= ERROR)
|
494
478
|
edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
|
@@ -496,8 +480,6 @@ errstart(int elevel, const char *domain)
|
|
496
480
|
edata->sqlerrcode = ERRCODE_WARNING;
|
497
481
|
else
|
498
482
|
edata->sqlerrcode = ERRCODE_SUCCESSFUL_COMPLETION;
|
499
|
-
/* errno is saved here so that error parameter eval can't change it */
|
500
|
-
edata->saved_errno = errno;
|
501
483
|
|
502
484
|
/*
|
503
485
|
* Any allocations for this error state level should go into ErrorContext
|
@@ -508,32 +490,6 @@ errstart(int elevel, const char *domain)
|
|
508
490
|
return true;
|
509
491
|
}
|
510
492
|
|
511
|
-
/*
|
512
|
-
* Checks whether the given funcname matches backtrace_functions; see
|
513
|
-
* check_backtrace_functions.
|
514
|
-
*/
|
515
|
-
static bool
|
516
|
-
matches_backtrace_functions(const char *funcname)
|
517
|
-
{
|
518
|
-
char *p;
|
519
|
-
|
520
|
-
if (!backtrace_symbol_list || funcname == NULL || funcname[0] == '\0')
|
521
|
-
return false;
|
522
|
-
|
523
|
-
p = backtrace_symbol_list;
|
524
|
-
for (;;)
|
525
|
-
{
|
526
|
-
if (*p == '\0') /* end of backtrace_symbol_list */
|
527
|
-
break;
|
528
|
-
|
529
|
-
if (strcmp(funcname, p) == 0)
|
530
|
-
return true;
|
531
|
-
p += strlen(p) + 1;
|
532
|
-
}
|
533
|
-
|
534
|
-
return false;
|
535
|
-
}
|
536
|
-
|
537
493
|
/*
|
538
494
|
* errfinish --- end an error-reporting cycle
|
539
495
|
*
|
@@ -554,23 +510,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
554
510
|
CHECK_STACK_DEPTH();
|
555
511
|
|
556
512
|
/* Save the last few bits of error state into the stack entry */
|
557
|
-
|
558
|
-
{
|
559
|
-
const char *slash;
|
560
|
-
|
561
|
-
/* keep only base name, useful especially for vpath builds */
|
562
|
-
slash = strrchr(filename, '/');
|
563
|
-
if (slash)
|
564
|
-
filename = slash + 1;
|
565
|
-
/* Some Windows compilers use backslashes in __FILE__ strings */
|
566
|
-
slash = strrchr(filename, '\\');
|
567
|
-
if (slash)
|
568
|
-
filename = slash + 1;
|
569
|
-
}
|
570
|
-
|
571
|
-
edata->filename = filename;
|
572
|
-
edata->lineno = lineno;
|
573
|
-
edata->funcname = funcname;
|
513
|
+
set_stack_entry_location(edata, filename, lineno, funcname);
|
574
514
|
|
575
515
|
elevel = edata->elevel;
|
576
516
|
|
@@ -580,6 +520,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
580
520
|
*/
|
581
521
|
oldcontext = MemoryContextSwitchTo(ErrorContext);
|
582
522
|
|
523
|
+
/* Collect backtrace, if enabled and we didn't already */
|
583
524
|
if (!edata->backtrace &&
|
584
525
|
edata->funcname &&
|
585
526
|
backtrace_functions &&
|
@@ -630,31 +571,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
630
571
|
EmitErrorReport();
|
631
572
|
|
632
573
|
/* Now free up subsidiary data attached to stack entry, and release it */
|
633
|
-
|
634
|
-
pfree(edata->message);
|
635
|
-
if (edata->detail)
|
636
|
-
pfree(edata->detail);
|
637
|
-
if (edata->detail_log)
|
638
|
-
pfree(edata->detail_log);
|
639
|
-
if (edata->hint)
|
640
|
-
pfree(edata->hint);
|
641
|
-
if (edata->context)
|
642
|
-
pfree(edata->context);
|
643
|
-
if (edata->backtrace)
|
644
|
-
pfree(edata->backtrace);
|
645
|
-
if (edata->schema_name)
|
646
|
-
pfree(edata->schema_name);
|
647
|
-
if (edata->table_name)
|
648
|
-
pfree(edata->table_name);
|
649
|
-
if (edata->column_name)
|
650
|
-
pfree(edata->column_name);
|
651
|
-
if (edata->datatype_name)
|
652
|
-
pfree(edata->datatype_name);
|
653
|
-
if (edata->constraint_name)
|
654
|
-
pfree(edata->constraint_name);
|
655
|
-
if (edata->internalquery)
|
656
|
-
pfree(edata->internalquery);
|
657
|
-
|
574
|
+
FreeErrorDataContents(edata);
|
658
575
|
errordata_stack_depth--;
|
659
576
|
|
660
577
|
/* Exit error-handling context */
|
@@ -681,8 +598,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
681
598
|
* Any other code you might be tempted to add here should probably be
|
682
599
|
* in an on_proc_exit or on_shmem_exit callback instead.
|
683
600
|
*/
|
684
|
-
fflush(
|
685
|
-
fflush(stderr);
|
601
|
+
fflush(NULL);
|
686
602
|
|
687
603
|
/*
|
688
604
|
* Let the cumulative stats system know. Only mark the session as
|
@@ -708,8 +624,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
708
624
|
* XXX: what if we are *in* the postmaster? abort() won't kill our
|
709
625
|
* children...
|
710
626
|
*/
|
711
|
-
fflush(
|
712
|
-
fflush(stderr);
|
627
|
+
fflush(NULL);
|
713
628
|
abort();
|
714
629
|
}
|
715
630
|
|
@@ -722,6 +637,242 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
722
637
|
}
|
723
638
|
|
724
639
|
|
640
|
+
/*
|
641
|
+
* errsave_start --- begin a "soft" error-reporting cycle
|
642
|
+
*
|
643
|
+
* If "context" isn't an ErrorSaveContext node, this behaves as
|
644
|
+
* errstart(ERROR, domain), and the errsave() macro ends up acting
|
645
|
+
* exactly like ereport(ERROR, ...).
|
646
|
+
*
|
647
|
+
* If "context" is an ErrorSaveContext node, but the node creator only wants
|
648
|
+
* notification of the fact of a soft error without any details, we just set
|
649
|
+
* the error_occurred flag in the ErrorSaveContext node and return false,
|
650
|
+
* which will cause us to skip the remaining error processing steps.
|
651
|
+
*
|
652
|
+
* Otherwise, create and initialize error stack entry and return true.
|
653
|
+
* Subsequently, errmsg() and perhaps other routines will be called to further
|
654
|
+
* populate the stack entry. Finally, errsave_finish() will be called to
|
655
|
+
* tidy up.
|
656
|
+
*/
|
657
|
+
bool
|
658
|
+
errsave_start(struct Node *context, const char *domain)
|
659
|
+
{
|
660
|
+
ErrorSaveContext *escontext;
|
661
|
+
ErrorData *edata;
|
662
|
+
|
663
|
+
/*
|
664
|
+
* Do we have a context for soft error reporting? If not, just punt to
|
665
|
+
* errstart().
|
666
|
+
*/
|
667
|
+
if (context == NULL || !IsA(context, ErrorSaveContext))
|
668
|
+
return errstart(ERROR, domain);
|
669
|
+
|
670
|
+
/* Report that a soft error was detected */
|
671
|
+
escontext = (ErrorSaveContext *) context;
|
672
|
+
escontext->error_occurred = true;
|
673
|
+
|
674
|
+
/* Nothing else to do if caller wants no further details */
|
675
|
+
if (!escontext->details_wanted)
|
676
|
+
return false;
|
677
|
+
|
678
|
+
/*
|
679
|
+
* Okay, crank up a stack entry to store the info in.
|
680
|
+
*/
|
681
|
+
|
682
|
+
recursion_depth++;
|
683
|
+
|
684
|
+
/* Initialize data for this error frame */
|
685
|
+
edata = get_error_stack_entry();
|
686
|
+
edata->elevel = LOG; /* signal all is well to errsave_finish */
|
687
|
+
set_stack_entry_domain(edata, domain);
|
688
|
+
/* Select default errcode based on the assumed elevel of ERROR */
|
689
|
+
edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
|
690
|
+
|
691
|
+
/*
|
692
|
+
* Any allocations for this error state level should go into the caller's
|
693
|
+
* context. We don't need to pollute ErrorContext, or even require it to
|
694
|
+
* exist, in this code path.
|
695
|
+
*/
|
696
|
+
edata->assoc_context = CurrentMemoryContext;
|
697
|
+
|
698
|
+
recursion_depth--;
|
699
|
+
return true;
|
700
|
+
}
|
701
|
+
|
702
|
+
/*
|
703
|
+
* errsave_finish --- end a "soft" error-reporting cycle
|
704
|
+
*
|
705
|
+
* If errsave_start() decided this was a regular error, behave as
|
706
|
+
* errfinish(). Otherwise, package up the error details and save
|
707
|
+
* them in the ErrorSaveContext node.
|
708
|
+
*/
|
709
|
+
void
|
710
|
+
errsave_finish(struct Node *context, const char *filename, int lineno,
|
711
|
+
const char *funcname)
|
712
|
+
{
|
713
|
+
ErrorSaveContext *escontext = (ErrorSaveContext *) context;
|
714
|
+
ErrorData *edata = &errordata[errordata_stack_depth];
|
715
|
+
|
716
|
+
/* verify stack depth before accessing *edata */
|
717
|
+
CHECK_STACK_DEPTH();
|
718
|
+
|
719
|
+
/*
|
720
|
+
* If errsave_start punted to errstart, then elevel will be ERROR or
|
721
|
+
* perhaps even PANIC. Punt likewise to errfinish.
|
722
|
+
*/
|
723
|
+
if (edata->elevel >= ERROR)
|
724
|
+
{
|
725
|
+
errfinish(filename, lineno, funcname);
|
726
|
+
pg_unreachable();
|
727
|
+
}
|
728
|
+
|
729
|
+
/*
|
730
|
+
* Else, we should package up the stack entry contents and deliver them to
|
731
|
+
* the caller.
|
732
|
+
*/
|
733
|
+
recursion_depth++;
|
734
|
+
|
735
|
+
/* Save the last few bits of error state into the stack entry */
|
736
|
+
set_stack_entry_location(edata, filename, lineno, funcname);
|
737
|
+
|
738
|
+
/* Replace the LOG value that errsave_start inserted */
|
739
|
+
edata->elevel = ERROR;
|
740
|
+
|
741
|
+
/*
|
742
|
+
* We skip calling backtrace and context functions, which are more likely
|
743
|
+
* to cause trouble than provide useful context; they might act on the
|
744
|
+
* assumption that a transaction abort is about to occur.
|
745
|
+
*/
|
746
|
+
|
747
|
+
/*
|
748
|
+
* Make a copy of the error info for the caller. All the subsidiary
|
749
|
+
* strings are already in the caller's context, so it's sufficient to
|
750
|
+
* flat-copy the stack entry.
|
751
|
+
*/
|
752
|
+
escontext->error_data = palloc_object(ErrorData);
|
753
|
+
memcpy(escontext->error_data, edata, sizeof(ErrorData));
|
754
|
+
|
755
|
+
/* Exit error-handling context */
|
756
|
+
errordata_stack_depth--;
|
757
|
+
recursion_depth--;
|
758
|
+
}
|
759
|
+
|
760
|
+
|
761
|
+
/*
|
762
|
+
* get_error_stack_entry --- allocate and initialize a new stack entry
|
763
|
+
*
|
764
|
+
* The entry should be freed, when we're done with it, by calling
|
765
|
+
* FreeErrorDataContents() and then decrementing errordata_stack_depth.
|
766
|
+
*
|
767
|
+
* Returning the entry's address is just a notational convenience,
|
768
|
+
* since it had better be errordata[errordata_stack_depth].
|
769
|
+
*
|
770
|
+
* Although the error stack is not large, we don't expect to run out of space.
|
771
|
+
* Using more than one entry implies a new error report during error recovery,
|
772
|
+
* which is possible but already suggests we're in trouble. If we exhaust the
|
773
|
+
* stack, almost certainly we are in an infinite loop of errors during error
|
774
|
+
* recovery, so we give up and PANIC.
|
775
|
+
*
|
776
|
+
* (Note that this is distinct from the recursion_depth checks, which
|
777
|
+
* guard against recursion while handling a single stack entry.)
|
778
|
+
*/
|
779
|
+
static ErrorData *
|
780
|
+
get_error_stack_entry(void)
|
781
|
+
{
|
782
|
+
ErrorData *edata;
|
783
|
+
|
784
|
+
/* Allocate error frame */
|
785
|
+
errordata_stack_depth++;
|
786
|
+
if (unlikely(errordata_stack_depth >= ERRORDATA_STACK_SIZE))
|
787
|
+
{
|
788
|
+
/* Wups, stack not big enough */
|
789
|
+
errordata_stack_depth = -1; /* make room on stack */
|
790
|
+
ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded")));
|
791
|
+
}
|
792
|
+
|
793
|
+
/* Initialize error frame to all zeroes/NULLs */
|
794
|
+
edata = &errordata[errordata_stack_depth];
|
795
|
+
memset(edata, 0, sizeof(ErrorData));
|
796
|
+
|
797
|
+
/* Save errno immediately to ensure error parameter eval can't change it */
|
798
|
+
edata->saved_errno = errno;
|
799
|
+
|
800
|
+
return edata;
|
801
|
+
}
|
802
|
+
|
803
|
+
/*
|
804
|
+
* set_stack_entry_domain --- fill in the internationalization domain
|
805
|
+
*/
|
806
|
+
static void
|
807
|
+
set_stack_entry_domain(ErrorData *edata, const char *domain)
|
808
|
+
{
|
809
|
+
/* the default text domain is the backend's */
|
810
|
+
edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
|
811
|
+
/* initialize context_domain the same way (see set_errcontext_domain()) */
|
812
|
+
edata->context_domain = edata->domain;
|
813
|
+
}
|
814
|
+
|
815
|
+
/*
|
816
|
+
* set_stack_entry_location --- fill in code-location details
|
817
|
+
*
|
818
|
+
* Store the values of __FILE__, __LINE__, and __func__ from the call site.
|
819
|
+
* We make an effort to normalize __FILE__, since compilers are inconsistent
|
820
|
+
* about how much of the path they'll include, and we'd prefer that the
|
821
|
+
* behavior not depend on that (especially, that it not vary with build path).
|
822
|
+
*/
|
823
|
+
static void
|
824
|
+
set_stack_entry_location(ErrorData *edata,
|
825
|
+
const char *filename, int lineno,
|
826
|
+
const char *funcname)
|
827
|
+
{
|
828
|
+
if (filename)
|
829
|
+
{
|
830
|
+
const char *slash;
|
831
|
+
|
832
|
+
/* keep only base name, useful especially for vpath builds */
|
833
|
+
slash = strrchr(filename, '/');
|
834
|
+
if (slash)
|
835
|
+
filename = slash + 1;
|
836
|
+
/* Some Windows compilers use backslashes in __FILE__ strings */
|
837
|
+
slash = strrchr(filename, '\\');
|
838
|
+
if (slash)
|
839
|
+
filename = slash + 1;
|
840
|
+
}
|
841
|
+
|
842
|
+
edata->filename = filename;
|
843
|
+
edata->lineno = lineno;
|
844
|
+
edata->funcname = funcname;
|
845
|
+
}
|
846
|
+
|
847
|
+
/*
|
848
|
+
* matches_backtrace_functions --- checks whether the given funcname matches
|
849
|
+
* backtrace_functions
|
850
|
+
*
|
851
|
+
* See check_backtrace_functions.
|
852
|
+
*/
|
853
|
+
static bool
|
854
|
+
matches_backtrace_functions(const char *funcname)
|
855
|
+
{
|
856
|
+
const char *p;
|
857
|
+
|
858
|
+
if (!backtrace_symbol_list || funcname == NULL || funcname[0] == '\0')
|
859
|
+
return false;
|
860
|
+
|
861
|
+
p = backtrace_symbol_list;
|
862
|
+
for (;;)
|
863
|
+
{
|
864
|
+
if (*p == '\0') /* end of backtrace_symbol_list */
|
865
|
+
break;
|
866
|
+
|
867
|
+
if (strcmp(funcname, p) == 0)
|
868
|
+
return true;
|
869
|
+
p += strlen(p) + 1;
|
870
|
+
}
|
871
|
+
|
872
|
+
return false;
|
873
|
+
}
|
874
|
+
|
875
|
+
|
725
876
|
/*
|
726
877
|
* errcode --- add SQLSTATE error code to the current error
|
727
878
|
*
|
@@ -1391,6 +1542,40 @@ CopyErrorData(void)
|
|
1391
1542
|
*/
|
1392
1543
|
|
1393
1544
|
|
1545
|
+
/*
|
1546
|
+
* FreeErrorDataContents --- free the subsidiary data of an ErrorData.
|
1547
|
+
*
|
1548
|
+
* This can be used on either an error stack entry or a copied ErrorData.
|
1549
|
+
*/
|
1550
|
+
static void
|
1551
|
+
FreeErrorDataContents(ErrorData *edata)
|
1552
|
+
{
|
1553
|
+
if (edata->message)
|
1554
|
+
pfree(edata->message);
|
1555
|
+
if (edata->detail)
|
1556
|
+
pfree(edata->detail);
|
1557
|
+
if (edata->detail_log)
|
1558
|
+
pfree(edata->detail_log);
|
1559
|
+
if (edata->hint)
|
1560
|
+
pfree(edata->hint);
|
1561
|
+
if (edata->context)
|
1562
|
+
pfree(edata->context);
|
1563
|
+
if (edata->backtrace)
|
1564
|
+
pfree(edata->backtrace);
|
1565
|
+
if (edata->schema_name)
|
1566
|
+
pfree(edata->schema_name);
|
1567
|
+
if (edata->table_name)
|
1568
|
+
pfree(edata->table_name);
|
1569
|
+
if (edata->column_name)
|
1570
|
+
pfree(edata->column_name);
|
1571
|
+
if (edata->datatype_name)
|
1572
|
+
pfree(edata->datatype_name);
|
1573
|
+
if (edata->constraint_name)
|
1574
|
+
pfree(edata->constraint_name);
|
1575
|
+
if (edata->internalquery)
|
1576
|
+
pfree(edata->internalquery);
|
1577
|
+
}
|
1578
|
+
|
1394
1579
|
/*
|
1395
1580
|
* FlushErrorState --- flush the error state after error recovery
|
1396
1581
|
*
|
@@ -1479,8 +1664,7 @@ pg_re_throw(void)
|
|
1479
1664
|
}
|
1480
1665
|
|
1481
1666
|
/* Doesn't return ... */
|
1482
|
-
ExceptionalCondition("pg_re_throw tried to return",
|
1483
|
-
__FILE__, __LINE__);
|
1667
|
+
ExceptionalCondition("pg_re_throw tried to return", __FILE__, __LINE__);
|
1484
1668
|
}
|
1485
1669
|
|
1486
1670
|
|
@@ -1504,13 +1688,49 @@ pg_re_throw(void)
|
|
1504
1688
|
|
1505
1689
|
|
1506
1690
|
|
1691
|
+
/*
|
1692
|
+
* GUC check_hook for backtrace_functions
|
1693
|
+
*
|
1694
|
+
* We split the input string, where commas separate function names
|
1695
|
+
* and certain whitespace chars are ignored, into a \0-separated (and
|
1696
|
+
* \0\0-terminated) list of function names. This formulation allows
|
1697
|
+
* easy scanning when an error is thrown while avoiding the use of
|
1698
|
+
* non-reentrant strtok(), as well as keeping the output data in a
|
1699
|
+
* single palloc() chunk.
|
1700
|
+
*/
|
1701
|
+
|
1702
|
+
|
1703
|
+
/*
|
1704
|
+
* GUC assign_hook for backtrace_functions
|
1705
|
+
*/
|
1706
|
+
|
1707
|
+
|
1708
|
+
/*
|
1709
|
+
* GUC check_hook for log_destination
|
1710
|
+
*/
|
1507
1711
|
#ifdef HAVE_SYSLOG
|
1712
|
+
#endif
|
1713
|
+
#ifdef WIN32
|
1714
|
+
#endif
|
1508
1715
|
|
1509
1716
|
/*
|
1510
|
-
*
|
1717
|
+
* GUC assign_hook for log_destination
|
1511
1718
|
*/
|
1512
1719
|
|
1513
1720
|
|
1721
|
+
/*
|
1722
|
+
* GUC assign_hook for syslog_ident
|
1723
|
+
*/
|
1724
|
+
#ifdef HAVE_SYSLOG
|
1725
|
+
#endif
|
1726
|
+
|
1727
|
+
/*
|
1728
|
+
* GUC assign_hook for syslog_facility
|
1729
|
+
*/
|
1730
|
+
#ifdef HAVE_SYSLOG
|
1731
|
+
#endif
|
1732
|
+
|
1733
|
+
#ifdef HAVE_SYSLOG
|
1514
1734
|
|
1515
1735
|
/*
|
1516
1736
|
* Write a message line to syslog
|
@@ -1524,108 +1744,12 @@ pg_re_throw(void)
|
|
1524
1744
|
* interfaces (e.g. CreateFileA()) expect string arguments in this encoding.
|
1525
1745
|
* Every process in a given system will find the same value at all times.
|
1526
1746
|
*/
|
1527
|
-
static int
|
1528
|
-
GetACPEncoding(void)
|
1529
|
-
{
|
1530
|
-
static int encoding = -2;
|
1531
|
-
|
1532
|
-
if (encoding == -2)
|
1533
|
-
encoding = pg_codepage_to_encoding(GetACP());
|
1534
1747
|
|
1535
|
-
return encoding;
|
1536
|
-
}
|
1537
1748
|
|
1538
1749
|
/*
|
1539
1750
|
* Write a message line to the windows event log
|
1540
1751
|
*/
|
1541
|
-
static void
|
1542
|
-
write_eventlog(int level, const char *line, int len)
|
1543
|
-
{
|
1544
|
-
WCHAR *utf16;
|
1545
|
-
int eventlevel = EVENTLOG_ERROR_TYPE;
|
1546
|
-
static HANDLE evtHandle = INVALID_HANDLE_VALUE;
|
1547
1752
|
|
1548
|
-
if (evtHandle == INVALID_HANDLE_VALUE)
|
1549
|
-
{
|
1550
|
-
evtHandle = RegisterEventSource(NULL,
|
1551
|
-
event_source ? event_source : DEFAULT_EVENT_SOURCE);
|
1552
|
-
if (evtHandle == NULL)
|
1553
|
-
{
|
1554
|
-
evtHandle = INVALID_HANDLE_VALUE;
|
1555
|
-
return;
|
1556
|
-
}
|
1557
|
-
}
|
1558
|
-
|
1559
|
-
switch (level)
|
1560
|
-
{
|
1561
|
-
case DEBUG5:
|
1562
|
-
case DEBUG4:
|
1563
|
-
case DEBUG3:
|
1564
|
-
case DEBUG2:
|
1565
|
-
case DEBUG1:
|
1566
|
-
case LOG:
|
1567
|
-
case LOG_SERVER_ONLY:
|
1568
|
-
case INFO:
|
1569
|
-
case NOTICE:
|
1570
|
-
eventlevel = EVENTLOG_INFORMATION_TYPE;
|
1571
|
-
break;
|
1572
|
-
case WARNING:
|
1573
|
-
case WARNING_CLIENT_ONLY:
|
1574
|
-
eventlevel = EVENTLOG_WARNING_TYPE;
|
1575
|
-
break;
|
1576
|
-
case ERROR:
|
1577
|
-
case FATAL:
|
1578
|
-
case PANIC:
|
1579
|
-
default:
|
1580
|
-
eventlevel = EVENTLOG_ERROR_TYPE;
|
1581
|
-
break;
|
1582
|
-
}
|
1583
|
-
|
1584
|
-
/*
|
1585
|
-
* If message character encoding matches the encoding expected by
|
1586
|
-
* ReportEventA(), call it to avoid the hazards of conversion. Otherwise,
|
1587
|
-
* try to convert the message to UTF16 and write it with ReportEventW().
|
1588
|
-
* Fall back on ReportEventA() if conversion failed.
|
1589
|
-
*
|
1590
|
-
* Since we palloc the structure required for conversion, also fall
|
1591
|
-
* through to writing unconverted if we have not yet set up
|
1592
|
-
* CurrentMemoryContext.
|
1593
|
-
*
|
1594
|
-
* Also verify that we are not on our way into error recursion trouble due
|
1595
|
-
* to error messages thrown deep inside pgwin32_message_to_UTF16().
|
1596
|
-
*/
|
1597
|
-
if (!in_error_recursion_trouble() &&
|
1598
|
-
CurrentMemoryContext != NULL &&
|
1599
|
-
GetMessageEncoding() != GetACPEncoding())
|
1600
|
-
{
|
1601
|
-
utf16 = pgwin32_message_to_UTF16(line, len, NULL);
|
1602
|
-
if (utf16)
|
1603
|
-
{
|
1604
|
-
ReportEventW(evtHandle,
|
1605
|
-
eventlevel,
|
1606
|
-
0,
|
1607
|
-
0, /* All events are Id 0 */
|
1608
|
-
NULL,
|
1609
|
-
1,
|
1610
|
-
0,
|
1611
|
-
(LPCWSTR *) &utf16,
|
1612
|
-
NULL);
|
1613
|
-
/* XXX Try ReportEventA() when ReportEventW() fails? */
|
1614
|
-
|
1615
|
-
pfree(utf16);
|
1616
|
-
return;
|
1617
|
-
}
|
1618
|
-
}
|
1619
|
-
ReportEventA(evtHandle,
|
1620
|
-
eventlevel,
|
1621
|
-
0,
|
1622
|
-
0, /* All events are Id 0 */
|
1623
|
-
NULL,
|
1624
|
-
1,
|
1625
|
-
0,
|
1626
|
-
&line,
|
1627
|
-
NULL);
|
1628
|
-
}
|
1629
1753
|
#endif /* WIN32 */
|
1630
1754
|
|
1631
1755
|
#ifdef WIN32
|
@@ -1677,7 +1801,12 @@ write_eventlog(int level, const char *line, int len)
|
|
1677
1801
|
|
1678
1802
|
|
1679
1803
|
/*
|
1680
|
-
* Format
|
1804
|
+
* Format log status information using Log_line_prefix.
|
1805
|
+
*/
|
1806
|
+
|
1807
|
+
|
1808
|
+
/*
|
1809
|
+
* Format log status info; append to the provided buffer.
|
1681
1810
|
*/
|
1682
1811
|
|
1683
1812
|
|
@@ -1765,44 +1894,30 @@ static void send_message_to_frontend(ErrorData *edata) {}
|
|
1765
1894
|
* not available). Used before ereport/elog can be used
|
1766
1895
|
* safely (memory context, GUC load etc)
|
1767
1896
|
*/
|
1897
|
+
|
1768
1898
|
void
|
1769
1899
|
write_stderr(const char *fmt,...)
|
1770
1900
|
{
|
1771
|
-
va_list
|
1772
|
-
|
1773
|
-
#ifdef WIN32
|
1774
|
-
char errbuf[2048]; /* Arbitrary size? */
|
1775
|
-
#endif
|
1776
|
-
|
1777
|
-
fmt = _(fmt);
|
1778
|
-
|
1901
|
+
va_list ap;
|
1779
1902
|
va_start(ap, fmt);
|
1780
|
-
#ifndef WIN32
|
1781
|
-
/* On Unix, we just fprintf to stderr */
|
1782
1903
|
vfprintf(stderr, fmt, ap);
|
1783
1904
|
fflush(stderr);
|
1784
|
-
#else
|
1785
|
-
vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
1786
|
-
|
1787
|
-
/*
|
1788
|
-
* On Win32, we print to stderr if running on a console, or write to
|
1789
|
-
* eventlog if running as a service
|
1790
|
-
*/
|
1791
|
-
if (pgwin32_is_service()) /* Running as a service */
|
1792
|
-
{
|
1793
|
-
write_eventlog(ERROR, errbuf, strlen(errbuf));
|
1794
|
-
}
|
1795
|
-
else
|
1796
|
-
{
|
1797
|
-
/* Not running as service, write to stderr */
|
1798
|
-
write_console(errbuf, strlen(errbuf));
|
1799
|
-
fflush(stderr);
|
1800
|
-
}
|
1801
|
-
#endif
|
1802
1905
|
va_end(ap);
|
1803
1906
|
}
|
1804
1907
|
|
1805
1908
|
|
1909
|
+
|
1910
|
+
|
1911
|
+
/*
|
1912
|
+
* Write a message to STDERR using only async-signal-safe functions. This can
|
1913
|
+
* be used to safely emit a message from a signal handler.
|
1914
|
+
*
|
1915
|
+
* TODO: It is likely possible to safely do a limited amount of string
|
1916
|
+
* interpolation (e.g., %s and %d), but that is not presently supported.
|
1917
|
+
*/
|
1918
|
+
|
1919
|
+
|
1920
|
+
|
1806
1921
|
/*
|
1807
1922
|
* Adjust the level of a recovery-related message per trace_recovery_messages.
|
1808
1923
|
*
|
@@ -1819,3 +1934,10 @@ write_stderr(const char *fmt,...)
|
|
1819
1934
|
* hard-to-explain kluge.
|
1820
1935
|
*/
|
1821
1936
|
|
1937
|
+
#ifdef WIN32
|
1938
|
+
__thread volatile int pg_signal_queue;
|
1939
|
+
|
1940
|
+
__thread int pg_signal_mask;
|
1941
|
+
|
1942
|
+
void pgwin32_dispatch_queued_signals(void) {}
|
1943
|
+
#endif
|