pg_query 2.0.3 → 5.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +165 -0
- data/README.md +67 -29
- data/Rakefile +8 -23
- data/ext/pg_query/extconf.rb +21 -3
- data/ext/pg_query/include/pg_query.h +29 -4
- data/ext/pg_query/include/pg_query_enum_defs.c +551 -272
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +563 -470
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +5403 -3945
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +402 -330
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +1319 -1059
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +141 -118
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +1685 -1379
- data/ext/pg_query/include/{access → postgres/access}/amapi.h +47 -1
- data/ext/pg_query/include/{access → postgres/access}/attmap.h +5 -3
- data/ext/pg_query/include/{access → postgres/access}/attnum.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/clog.h +4 -2
- data/ext/pg_query/include/{access → postgres/access}/commit_ts.h +6 -9
- data/ext/pg_query/include/{access → postgres/access}/detoast.h +1 -11
- data/ext/pg_query/include/{access → postgres/access}/genam.h +21 -16
- data/ext/pg_query/include/{access → postgres/access}/gin.h +17 -4
- data/ext/pg_query/include/{access → postgres/access}/htup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/htup_details.h +80 -88
- data/ext/pg_query/include/{access → postgres/access}/itup.h +61 -52
- 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 +17 -2
- data/ext/pg_query/include/postgres/access/rmgr.h +62 -0
- data/ext/pg_query/include/{access → postgres/access}/rmgrlist.h +24 -24
- 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 +4 -2
- data/ext/pg_query/include/{access → postgres/access}/sysattr.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/table.h +2 -1
- data/ext/pg_query/include/{access → postgres/access}/tableam.h +337 -62
- data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
- data/ext/pg_query/include/{access → postgres/access}/transam.h +123 -13
- 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 +60 -100
- data/ext/pg_query/include/{access → postgres/access}/twophase.h +5 -1
- data/ext/pg_query/include/{access → postgres/access}/xact.h +99 -32
- data/ext/pg_query/include/{access → postgres/access}/xlog.h +69 -165
- data/ext/pg_query/include/{access → postgres/access}/xlog_internal.h +147 -73
- data/ext/pg_query/include/postgres/access/xlogbackup.h +41 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogdefs.h +13 -40
- data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogreader.h +154 -37
- data/ext/pg_query/include/{access → postgres/access}/xlogrecord.h +34 -13
- data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
- data/ext/pg_query/include/postgres/archive/archive_module.h +59 -0
- data/ext/pg_query/include/{c.h → postgres/c.h} +245 -188
- data/ext/pg_query/include/{catalog → postgres/catalog}/catalog.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/catversion.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/dependency.h +14 -19
- data/ext/pg_query/include/postgres/catalog/genbki.h +143 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/index.h +20 -5
- data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/namespace.h +5 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaccess.h +73 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaddress.h +12 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate.h +14 -10
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am.h +4 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute.h +45 -26
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute_d.h +19 -16
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid_d.h +19 -9
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class.h +45 -15
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class_d.h +31 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation.h +35 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation_d.h +21 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint.h +39 -13
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint_d.h +10 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_control.h +13 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion_d.h +4 -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 +11 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger.h +9 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index.h +17 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index_d.h +20 -17
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language.h +10 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator.h +21 -16
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator_d.h +37 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily.h +8 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily_d.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table.h +20 -9
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc.h +20 -11
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc_d.h +10 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication.h +49 -6
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin.h +6 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin_d.h +5 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic.h +19 -12
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext.h +19 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext_d.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger.h +24 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger_d.h +4 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict.h +8 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type.h +56 -24
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type_d.h +70 -31
- data/ext/pg_query/include/{catalog → postgres/catalog}/storage.h +9 -7
- data/ext/pg_query/include/{commands → postgres/commands}/async.h +4 -5
- data/ext/pg_query/include/{commands → postgres/commands}/dbcommands.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/defrem.h +12 -24
- data/ext/pg_query/include/{commands → postgres/commands}/event_trigger.h +2 -2
- 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 +6 -4
- data/ext/pg_query/include/{commands → postgres/commands}/trigger.h +36 -25
- data/ext/pg_query/include/{commands → postgres/commands}/user.h +10 -4
- data/ext/pg_query/include/{commands → postgres/commands}/vacuum.h +140 -47
- data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
- data/ext/pg_query/include/{common → postgres/common}/file_perm.h +4 -4
- 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 +2 -6
- data/ext/pg_query/include/{common → postgres/common}/kwlookup.h +2 -2
- data/ext/pg_query/include/postgres/common/pg_prng.h +61 -0
- data/ext/pg_query/include/{common → postgres/common}/relpath.h +21 -14
- 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/postgres/common/string.h +44 -0
- data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +125 -0
- data/ext/pg_query/include/{common/unicode_combining_table.h → postgres/common/unicode_nonspacing_table.h} +138 -8
- 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 +50 -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 +98 -32
- data/ext/pg_query/include/{executor → postgres/executor}/functions.h +17 -3
- data/ext/pg_query/include/{executor → postgres/executor}/instrument.h +33 -16
- data/ext/pg_query/include/{executor → postgres/executor}/spi.h +42 -4
- 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} +33 -8
- data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
- data/ext/pg_query/include/{funcapi.h → postgres/funcapi.h} +22 -10
- 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 +12 -12
- data/ext/pg_query/include/postgres/kwlist_d.h +1119 -0
- data/ext/pg_query/include/postgres/lib/dshash.h +115 -0
- data/ext/pg_query/include/{lib → postgres/lib}/ilist.h +454 -22
- data/ext/pg_query/include/{lib → postgres/lib}/pairingheap.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/simplehash.h +158 -33
- data/ext/pg_query/include/postgres/lib/sort_template.h +432 -0
- data/ext/pg_query/include/{lib → postgres/lib}/stringinfo.h +3 -3
- data/ext/pg_query/include/{libpq → postgres/libpq}/auth.h +12 -4
- data/ext/pg_query/include/{libpq → postgres/libpq}/crypt.h +5 -4
- data/ext/pg_query/include/{libpq → postgres/libpq}/hba.h +54 -8
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq-be.h +45 -17
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq.h +31 -20
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqcomm.h +26 -71
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqformat.h +2 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqsignal.h +25 -13
- 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 +125 -25
- data/ext/pg_query/include/{mb → postgres/mb}/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/{miscadmin.h → postgres/miscadmin.h} +96 -65
- data/ext/pg_query/include/{nodes → postgres/nodes}/bitmapset.h +11 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/execnodes.h +351 -103
- data/ext/pg_query/include/{nodes → postgres/nodes}/extensible.h +8 -4
- data/ext/pg_query/include/{nodes → postgres/nodes}/lockoptions.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/makefuncs.h +19 -6
- data/ext/pg_query/include/{nodes → postgres/nodes}/memnodes.h +11 -6
- 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 +100 -496
- 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 +678 -207
- data/ext/pg_query/include/{nodes → postgres/nodes}/pathnodes.h +1282 -454
- data/ext/pg_query/include/{nodes → postgres/nodes}/pg_list.h +103 -73
- data/ext/pg_query/include/{nodes → postgres/nodes}/plannodes.h +474 -133
- data/ext/pg_query/include/{nodes → postgres/nodes}/primnodes.h +754 -254
- data/ext/pg_query/include/{nodes → postgres/nodes}/print.h +1 -1
- data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
- 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/postgres/nodes/value.h +90 -0
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/cost.h +14 -5
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo.h +9 -7
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo_gene.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/optimizer.h +31 -28
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/paths.h +29 -12
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/planmain.h +15 -17
- data/ext/pg_query/include/{parser → postgres/parser}/analyze.h +20 -5
- data/ext/pg_query/include/postgres/parser/kwlist.h +498 -0
- data/ext/pg_query/include/{parser → postgres/parser}/parse_agg.h +5 -8
- data/ext/pg_query/include/{parser → postgres/parser}/parse_coerce.h +6 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_expr.h +2 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_func.h +2 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_node.h +41 -11
- data/ext/pg_query/include/{parser → postgres/parser}/parse_oper.h +3 -5
- data/ext/pg_query/include/{parser → postgres/parser}/parse_relation.h +11 -5
- data/ext/pg_query/include/{parser → postgres/parser}/parse_type.h +4 -3
- data/ext/pg_query/include/postgres/parser/parser.h +68 -0
- 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 +2 -5
- data/ext/pg_query/include/{partitioning → postgres/partitioning}/partdefs.h +1 -1
- data/ext/pg_query/include/{pg_config.h → postgres/pg_config.h} +216 -228
- data/ext/pg_query/include/{pg_config_manual.h → postgres/pg_config_manual.h} +80 -58
- data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
- data/ext/pg_query/include/{pg_getopt.h → postgres/pg_getopt.h} +6 -6
- data/ext/pg_query/include/{pg_trace.h → postgres/pg_trace.h} +1 -1
- data/ext/pg_query/include/postgres/pgstat.h +778 -0
- data/ext/pg_query/include/{pgtime.h → postgres/pgtime.h} +16 -6
- data/ext/pg_query/include/{pl_gram.h → postgres/pl_gram.h} +116 -116
- 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} +10 -10
- data/ext/pg_query/include/{pl_unreserved_kwlist.h → postgres/pl_unreserved_kwlist.h} +3 -3
- data/ext/pg_query/include/{pl_unreserved_kwlist_d.h → postgres/pl_unreserved_kwlist_d.h} +60 -60
- data/ext/pg_query/include/{plerrcodes.h → postgres/plerrcodes.h} +9 -1
- data/ext/pg_query/include/{plpgsql.h → postgres/plpgsql.h} +79 -86
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-arm.h +9 -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 +3 -3
- 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 +129 -16
- 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} +107 -111
- 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 +17 -20
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker.h +3 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker_internals.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgwriter.h +6 -6
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/interrupt.h +1 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/pgarch.h +7 -10
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/postmaster.h +21 -17
- data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/syslogger.h +16 -11
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/walwriter.h +5 -3
- data/ext/pg_query/include/{regex → postgres/regex}/regex.h +27 -22
- data/ext/pg_query/include/{replication → postgres/replication}/logicallauncher.h +8 -5
- data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
- data/ext/pg_query/include/postgres/replication/logicalworker.h +32 -0
- data/ext/pg_query/include/{replication → postgres/replication}/origin.h +8 -8
- data/ext/pg_query/include/postgres/replication/reorderbuffer.h +753 -0
- data/ext/pg_query/include/{replication → postgres/replication}/slot.h +42 -12
- data/ext/pg_query/include/{replication → postgres/replication}/syncrep.h +6 -12
- data/ext/pg_query/include/{replication → postgres/replication}/walreceiver.h +158 -20
- data/ext/pg_query/include/{replication → postgres/replication}/walsender.h +20 -20
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/prs2lock.h +1 -1
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteHandler.h +1 -6
- 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 +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/block.h +24 -37
- data/ext/pg_query/include/{storage → postgres/storage}/buf.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/bufmgr.h +196 -95
- data/ext/pg_query/include/{storage → postgres/storage}/bufpage.h +152 -101
- data/ext/pg_query/include/{storage → postgres/storage}/condition_variable.h +14 -3
- data/ext/pg_query/include/{storage → postgres/storage}/dsm.h +6 -6
- data/ext/pg_query/include/{storage → postgres/storage}/dsm_impl.h +6 -2
- data/ext/pg_query/include/{storage → postgres/storage}/fd.h +48 -14
- data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
- data/ext/pg_query/include/{storage → postgres/storage}/ipc.h +5 -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 +96 -57
- data/ext/pg_query/include/{storage → postgres/storage}/large_object.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/latch.h +17 -13
- data/ext/pg_query/include/{storage → postgres/storage}/lmgr.h +7 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lock.h +37 -25
- data/ext/pg_query/include/{storage → postgres/storage}/lockdefs.h +4 -4
- data/ext/pg_query/include/{storage → postgres/storage}/lwlock.h +21 -33
- data/ext/pg_query/include/{storage → postgres/storage}/lwlocknames.h +0 -1
- 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 +9 -7
- data/ext/pg_query/include/{storage → postgres/storage}/pmsignal.h +15 -4
- data/ext/pg_query/include/{storage → postgres/storage}/predicate.h +5 -5
- data/ext/pg_query/include/{storage → postgres/storage}/proc.h +200 -67
- data/ext/pg_query/include/postgres/storage/procarray.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/proclist_types.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/procsignal.h +5 -7
- data/ext/pg_query/include/postgres/storage/relfilelocator.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/s_lock.h +118 -298
- data/ext/pg_query/include/{storage → postgres/storage}/sharedfileset.h +3 -11
- data/ext/pg_query/include/{storage → postgres/storage}/shm_mq.h +5 -4
- 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 +5 -5
- data/ext/pg_query/include/{storage → postgres/storage}/sinvaladt.h +4 -2
- data/ext/pg_query/include/{storage → postgres/storage}/smgr.h +21 -17
- data/ext/pg_query/include/{storage → postgres/storage}/spin.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/standby.h +17 -9
- data/ext/pg_query/include/{storage → postgres/storage}/standbydefs.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/sync.h +9 -5
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtag.h +7 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtaglist.h +3 -2
- 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 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/pquery.h +7 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/tcopprot.h +19 -14
- data/ext/pg_query/include/{tcop → postgres/tcop}/utility.h +7 -3
- data/ext/pg_query/include/{tsearch → postgres/tsearch}/ts_cache.h +3 -5
- data/ext/pg_query/include/{utils → postgres/utils}/acl.h +37 -71
- data/ext/pg_query/include/{utils → postgres/utils}/aclchk_internal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/array.h +26 -2
- data/ext/pg_query/include/postgres/utils/backend_progress.h +45 -0
- data/ext/pg_query/include/postgres/utils/backend_status.h +342 -0
- data/ext/pg_query/include/{utils → postgres/utils}/builtins.h +20 -11
- data/ext/pg_query/include/{utils → postgres/utils}/bytea.h +3 -2
- 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 +48 -27
- data/ext/pg_query/include/{utils → postgres/utils}/datum.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/dsa.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/elog.h +154 -48
- data/ext/pg_query/include/{utils → postgres/utils}/errcodes.h +2 -0
- 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 +13 -12
- data/ext/pg_query/include/{utils → postgres/utils}/fmgroids.h +1353 -696
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrprotos.h +243 -18
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrtab.h +6 -5
- data/ext/pg_query/include/{utils → postgres/utils}/guc.h +120 -121
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +163 -0
- data/ext/pg_query/include/{utils → postgres/utils}/guc_tables.h +71 -21
- data/ext/pg_query/include/{utils → postgres/utils}/hsearch.h +15 -11
- data/ext/pg_query/include/{utils → postgres/utils}/inval.h +7 -3
- data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
- data/ext/pg_query/include/{utils → postgres/utils}/lsyscache.h +16 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memdebug.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memutils.h +14 -53
- 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 +38 -9
- data/ext/pg_query/include/{utils → postgres/utils}/palloc.h +33 -4
- data/ext/pg_query/include/{utils → postgres/utils}/partcache.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/pg_locale.h +37 -21
- data/ext/pg_query/include/postgres/utils/pgstat_internal.h +814 -0
- data/ext/pg_query/include/{utils → postgres/utils}/plancache.h +6 -5
- data/ext/pg_query/include/{utils → postgres/utils}/portal.h +12 -1
- data/ext/pg_query/include/{utils → postgres/utils}/probes.h +59 -59
- 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/postgres/utils/regproc.h +39 -0
- data/ext/pg_query/include/{utils → postgres/utils}/rel.h +129 -61
- data/ext/pg_query/include/{utils → postgres/utils}/relcache.h +21 -14
- 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 +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/snapmgr.h +38 -15
- data/ext/pg_query/include/{utils → postgres/utils}/snapshot.h +14 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sortsupport.h +117 -2
- data/ext/pg_query/include/{utils → postgres/utils}/syscache.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timeout.h +11 -4
- data/ext/pg_query/include/{utils → postgres/utils}/timestamp.h +46 -15
- data/ext/pg_query/include/{utils → postgres/utils}/tuplesort.h +209 -41
- data/ext/pg_query/include/{utils → postgres/utils}/tuplestore.h +2 -2
- data/ext/pg_query/include/{utils → postgres/utils}/typcache.h +24 -17
- data/ext/pg_query/include/{utils → postgres/utils}/varlena.h +17 -3
- data/ext/pg_query/include/postgres/utils/wait_event.h +294 -0
- data/ext/pg_query/include/{utils → postgres/utils}/xml.h +18 -8
- data/ext/pg_query/include/{postgres.h → postgres/varatt.h} +65 -471
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +7494 -6382
- data/ext/pg_query/include/protobuf/pg_query.pb.h +116922 -84792
- data/ext/pg_query/include/protobuf-c/protobuf-c.h +7 -3
- data/ext/pg_query/include/protobuf-c.h +7 -3
- data/ext/pg_query/pg_query.c +10 -1
- data/ext/pg_query/pg_query.pb-c.c +21026 -17002
- data/ext/pg_query/pg_query_deparse.c +1 -9896
- data/ext/pg_query/pg_query_fingerprint.c +162 -50
- data/ext/pg_query/pg_query_fingerprint.h +3 -1
- data/ext/pg_query/pg_query_internal.h +1 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +56 -12
- data/ext/pg_query/pg_query_normalize.c +259 -64
- data/ext/pg_query/pg_query_outfuncs.h +1 -0
- data/ext/pg_query/pg_query_outfuncs_json.c +71 -16
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +73 -12
- data/ext/pg_query/pg_query_parse.c +47 -5
- data/ext/pg_query/pg_query_parse_plpgsql.c +86 -21
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +43 -8
- data/ext/pg_query/pg_query_ruby.c +6 -1
- data/ext/pg_query/pg_query_ruby_freebsd.sym +2 -0
- data/ext/pg_query/pg_query_scan.c +3 -2
- data/ext/pg_query/pg_query_split.c +6 -5
- data/ext/pg_query/postgres_deparse.c +11067 -0
- data/ext/pg_query/postgres_deparse.h +9 -0
- data/ext/pg_query/protobuf-c.c +34 -27
- data/ext/pg_query/src_backend_catalog_namespace.c +27 -10
- data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
- data/ext/pg_query/src_backend_commands_define.c +11 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +13 -70
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +103 -5894
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +102 -3830
- data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
- data/ext/pg_query/src_backend_nodes_list.c +99 -12
- data/ext/pg_query/src_backend_nodes_makefuncs.c +99 -4
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +325 -131
- data/ext/pg_query/src_backend_nodes_nodes.c +38 -0
- data/ext/pg_query/src_backend_nodes_value.c +28 -19
- data/ext/pg_query/src_backend_parser_gram.c +36104 -32074
- data/ext/pg_query/src_backend_parser_parser.c +53 -8
- data/ext/pg_query/src_backend_parser_scan.c +4893 -3701
- data/ext/pg_query/src_backend_parser_scansup.c +4 -28
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
- data/ext/pg_query/src_backend_tcop_postgres.c +133 -105
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
- data/ext/pg_query/src_backend_utils_adt_datum.c +17 -7
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
- data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +187 -19
- data/ext/pg_query/src_backend_utils_error_assert.c +17 -18
- data/ext/pg_query/src_backend_utils_error_elog.c +513 -318
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +44 -17
- data/ext/pg_query/src_backend_utils_init_globals.c +9 -6
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +74 -131
- 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 +453 -314
- data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +549 -76
- 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 +420 -0
- data/ext/pg_query/src_common_keywords.c +15 -2
- data/ext/pg_query/src_common_kwlist_d.h +545 -498
- 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 +717 -113
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +49 -22
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -18
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1136 -1195
- 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 +10 -10
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +60 -60
- data/ext/pg_query/src_port_pg_bitutils.c +103 -40
- data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
- data/ext/pg_query/src_port_qsort.c +12 -224
- data/ext/pg_query/src_port_snprintf.c +51 -29
- data/ext/pg_query/src_port_strerror.c +9 -19
- data/ext/pg_query/src_port_strlcpy.c +79 -0
- data/lib/pg_query/deparse.rb +7 -1
- data/lib/pg_query/filter_columns.rb +7 -5
- data/lib/pg_query/fingerprint.rb +21 -9
- data/lib/pg_query/node.rb +18 -13
- data/lib/pg_query/param_refs.rb +1 -1
- data/lib/pg_query/parse.rb +141 -50
- data/lib/pg_query/pg_query_pb.rb +175 -3031
- data/lib/pg_query/treewalker.rb +26 -2
- data/lib/pg_query/truncate.rb +54 -8
- data/lib/pg_query/version.rb +1 -1
- data/lib/pg_query.rb +0 -1
- metadata +443 -380
- data/ext/pg_query/guc-file.c +0 -0
- data/ext/pg_query/include/access/rmgr.h +0 -35
- data/ext/pg_query/include/access/xloginsert.h +0 -64
- data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
- data/ext/pg_query/include/catalog/genbki.h +0 -64
- data/ext/pg_query/include/catalog/indexing.h +0 -366
- data/ext/pg_query/include/commands/variable.h +0 -38
- data/ext/pg_query/include/common/ip.h +0 -37
- data/ext/pg_query/include/common/string.h +0 -19
- data/ext/pg_query/include/getaddrinfo.h +0 -162
- data/ext/pg_query/include/kwlist_d.h +0 -1072
- data/ext/pg_query/include/nodes/value.h +0 -61
- data/ext/pg_query/include/parser/gram.h +0 -1067
- data/ext/pg_query/include/parser/kwlist.h +0 -477
- data/ext/pg_query/include/parser/parse_clause.h +0 -54
- data/ext/pg_query/include/parser/parse_collate.h +0 -27
- data/ext/pg_query/include/parser/parse_target.h +0 -46
- data/ext/pg_query/include/parser/parser.h +0 -41
- data/ext/pg_query/include/pg_config_os.h +0 -8
- data/ext/pg_query/include/pgstat.h +0 -1487
- data/ext/pg_query/include/portability/instr_time.h +0 -256
- data/ext/pg_query/include/postmaster/fork_process.h +0 -17
- data/ext/pg_query/include/replication/logicalproto.h +0 -110
- data/ext/pg_query/include/replication/logicalworker.h +0 -19
- data/ext/pg_query/include/replication/reorderbuffer.h +0 -467
- data/ext/pg_query/include/storage/relfilenode.h +0 -99
- data/ext/pg_query/include/utils/dynahash.h +0 -19
- 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/regproc.h +0 -28
- 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_libpq_pqcomm.c +0 -651
- data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
- data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2230
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -370
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1086
- data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1831
- data/ext/pg_query/src_common_string.c +0 -86
- data/ext/pg_query/src_port_erand48.c +0 -127
- data/ext/pg_query/src_port_pgsleep.c +0 -69
- data/ext/pg_query/src_port_random.c +0 -31
- data/ext/pg_query/src_port_strnlen.c +0 -39
- data/lib/pg_query/json_field_names.rb +0 -1402
- /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
/*--------------------------------------------------------------------
|
|
2
2
|
* Symbols referenced in this file:
|
|
3
|
+
* - errstart_cold
|
|
3
4
|
* - errstart
|
|
4
5
|
* - PG_exception_stack
|
|
5
6
|
* - write_stderr
|
|
6
|
-
* - err_gettext
|
|
7
7
|
* - in_error_recursion_trouble
|
|
8
8
|
* - error_context_stack
|
|
9
9
|
* - errordata_stack_depth
|
|
10
10
|
* - errordata
|
|
11
|
+
* - should_output_to_server
|
|
11
12
|
* - is_log_level_output
|
|
13
|
+
* - should_output_to_client
|
|
12
14
|
* - recursion_depth
|
|
15
|
+
* - get_error_stack_entry
|
|
16
|
+
* - set_stack_entry_domain
|
|
13
17
|
* - errmsg_internal
|
|
14
18
|
* - errcode
|
|
15
19
|
* - errmsg
|
|
16
20
|
* - errdetail
|
|
21
|
+
* - errhidestmt
|
|
22
|
+
* - errhidecontext
|
|
17
23
|
* - errfinish
|
|
18
24
|
* - pg_re_throw
|
|
19
25
|
* - EmitErrorReport
|
|
20
26
|
* - emit_log_hook
|
|
21
27
|
* - send_message_to_server_log
|
|
22
28
|
* - send_message_to_frontend
|
|
29
|
+
* - pgwin32_dispatch_queued_signals
|
|
30
|
+
* - set_stack_entry_location
|
|
23
31
|
* - matches_backtrace_functions
|
|
32
|
+
* - backtrace_symbol_list
|
|
24
33
|
* - set_backtrace
|
|
34
|
+
* - FreeErrorDataContents
|
|
25
35
|
* - geterrcode
|
|
36
|
+
* - errsave_start
|
|
37
|
+
* - errsave_finish
|
|
26
38
|
* - errhint
|
|
27
39
|
* - errposition
|
|
28
40
|
* - internalerrposition
|
|
@@ -33,6 +45,9 @@
|
|
|
33
45
|
* - errcontext_msg
|
|
34
46
|
* - CopyErrorData
|
|
35
47
|
* - FlushErrorState
|
|
48
|
+
* - pg_signal_queue
|
|
49
|
+
* - pg_signal_mask
|
|
50
|
+
* - pgwin32_dispatch_queued_signals
|
|
36
51
|
*--------------------------------------------------------------------
|
|
37
52
|
*/
|
|
38
53
|
|
|
@@ -81,7 +96,7 @@
|
|
|
81
96
|
* overflow.)
|
|
82
97
|
*
|
|
83
98
|
*
|
|
84
|
-
* Portions Copyright (c) 1996-
|
|
99
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
85
100
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
86
101
|
*
|
|
87
102
|
*
|
|
@@ -109,16 +124,19 @@
|
|
|
109
124
|
#include "libpq/libpq.h"
|
|
110
125
|
#include "libpq/pqformat.h"
|
|
111
126
|
#include "mb/pg_wchar.h"
|
|
127
|
+
#include "nodes/miscnodes.h"
|
|
112
128
|
#include "miscadmin.h"
|
|
129
|
+
#include "pgstat.h"
|
|
113
130
|
#include "postmaster/bgworker.h"
|
|
114
131
|
#include "postmaster/postmaster.h"
|
|
115
132
|
#include "postmaster/syslogger.h"
|
|
116
133
|
#include "storage/ipc.h"
|
|
117
134
|
#include "storage/proc.h"
|
|
118
135
|
#include "tcop/tcopprot.h"
|
|
119
|
-
#include "utils/
|
|
136
|
+
#include "utils/guc_hooks.h"
|
|
120
137
|
#include "utils/memutils.h"
|
|
121
138
|
#include "utils/ps_status.h"
|
|
139
|
+
#include "utils/varlena.h"
|
|
122
140
|
|
|
123
141
|
|
|
124
142
|
/* In this module, access gettext() via err_gettext() */
|
|
@@ -153,6 +171,10 @@ __thread emit_log_hook_type emit_log_hook = NULL;
|
|
|
153
171
|
|
|
154
172
|
|
|
155
173
|
|
|
174
|
+
/* Processed form of backtrace_symbols GUC */
|
|
175
|
+
static __thread char *backtrace_symbol_list;
|
|
176
|
+
|
|
177
|
+
|
|
156
178
|
#ifdef HAVE_SYSLOG
|
|
157
179
|
|
|
158
180
|
/*
|
|
@@ -215,20 +237,87 @@ static __thread int recursion_depth = 0;
|
|
|
215
237
|
|
|
216
238
|
|
|
217
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);
|
|
218
246
|
static pg_noinline void set_backtrace(ErrorData *edata, int num_skip);
|
|
219
247
|
static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str);
|
|
248
|
+
static void FreeErrorDataContents(ErrorData *edata);
|
|
220
249
|
static void write_console(const char *line, int len);
|
|
221
|
-
static
|
|
222
|
-
static void setup_formatted_start_time(void);
|
|
223
|
-
static const char *process_log_prefix_padding(const char *p, int *padding);
|
|
250
|
+
static const char *process_log_prefix_padding(const char *p, int *ppadding);
|
|
224
251
|
static void log_line_prefix(StringInfo buf, ErrorData *edata);
|
|
225
|
-
static void write_csvlog(ErrorData *edata);
|
|
226
252
|
static void send_message_to_server_log(ErrorData *edata);
|
|
227
|
-
static void write_pipe_chunks(char *data, int len, int dest);
|
|
228
253
|
static void send_message_to_frontend(ErrorData *edata);
|
|
229
|
-
static const char *error_severity(int elevel);
|
|
230
254
|
static void append_with_tabs(StringInfo buf, const char *str);
|
|
231
|
-
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
/*
|
|
258
|
+
* is_log_level_output -- is elevel logically >= log_min_level?
|
|
259
|
+
*
|
|
260
|
+
* We use this for tests that should consider LOG to sort out-of-order,
|
|
261
|
+
* between ERROR and FATAL. Generally this is the right thing for testing
|
|
262
|
+
* whether a message should go to the postmaster log, whereas a simple >=
|
|
263
|
+
* test is correct for testing whether the message should go to the client.
|
|
264
|
+
*/
|
|
265
|
+
static inline bool
|
|
266
|
+
is_log_level_output(int elevel, int log_min_level)
|
|
267
|
+
{
|
|
268
|
+
if (elevel == LOG || elevel == LOG_SERVER_ONLY)
|
|
269
|
+
{
|
|
270
|
+
if (log_min_level == LOG || log_min_level <= ERROR)
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
else if (elevel == WARNING_CLIENT_ONLY)
|
|
274
|
+
{
|
|
275
|
+
/* never sent to log, regardless of log_min_level */
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
else if (log_min_level == LOG)
|
|
279
|
+
{
|
|
280
|
+
/* elevel != LOG */
|
|
281
|
+
if (elevel >= FATAL)
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
/* Neither is LOG */
|
|
285
|
+
else if (elevel >= log_min_level)
|
|
286
|
+
return true;
|
|
287
|
+
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/*
|
|
292
|
+
* Policy-setting subroutines. These are fairly simple, but it seems wise
|
|
293
|
+
* to have the code in just one place.
|
|
294
|
+
*/
|
|
295
|
+
|
|
296
|
+
/*
|
|
297
|
+
* should_output_to_server --- should message of given elevel go to the log?
|
|
298
|
+
*/
|
|
299
|
+
static inline bool
|
|
300
|
+
should_output_to_server(int elevel)
|
|
301
|
+
{
|
|
302
|
+
return is_log_level_output(elevel, log_min_messages);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/*
|
|
306
|
+
* should_output_to_client --- should message of given elevel go to the client?
|
|
307
|
+
*/
|
|
308
|
+
static inline bool should_output_to_client(int elevel) { return false; }
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
/*
|
|
313
|
+
* message_level_is_interesting --- would ereport/elog do anything?
|
|
314
|
+
*
|
|
315
|
+
* Returns true if ereport/elog with this elevel will not be a no-op.
|
|
316
|
+
* This is useful to short-circuit any expensive preparatory work that
|
|
317
|
+
* might be needed for a logging message. There is no point in
|
|
318
|
+
* prepending this to a bare ereport/elog call, however.
|
|
319
|
+
*/
|
|
320
|
+
|
|
232
321
|
|
|
233
322
|
|
|
234
323
|
/*
|
|
@@ -250,19 +339,23 @@ in_error_recursion_trouble(void)
|
|
|
250
339
|
* message, since there's a significant probability that that's exactly
|
|
251
340
|
* what's causing the recursion.
|
|
252
341
|
*/
|
|
253
|
-
static inline const char *
|
|
254
|
-
err_gettext(const char *str)
|
|
255
|
-
{
|
|
256
342
|
#ifdef ENABLE_NLS
|
|
257
|
-
if (in_error_recursion_trouble())
|
|
258
|
-
return str;
|
|
259
|
-
else
|
|
260
|
-
return gettext(str);
|
|
261
343
|
#else
|
|
262
|
-
return str;
|
|
263
344
|
#endif
|
|
264
|
-
}
|
|
265
345
|
|
|
346
|
+
/*
|
|
347
|
+
* errstart_cold
|
|
348
|
+
* A simple wrapper around errstart, but hinted to be "cold". Supporting
|
|
349
|
+
* compilers are more likely to move code for branches containing this
|
|
350
|
+
* function into an area away from the calling function's code. This can
|
|
351
|
+
* result in more commonly executed code being more compact and fitting
|
|
352
|
+
* on fewer cache lines.
|
|
353
|
+
*/
|
|
354
|
+
pg_attribute_cold bool
|
|
355
|
+
errstart_cold(int elevel, const char *domain)
|
|
356
|
+
{
|
|
357
|
+
return errstart(elevel, domain);
|
|
358
|
+
}
|
|
266
359
|
|
|
267
360
|
/*
|
|
268
361
|
* errstart --- begin an error-reporting cycle
|
|
@@ -332,27 +425,8 @@ errstart(int elevel, const char *domain)
|
|
|
332
425
|
* warning or less and not enabled for logging, just return false without
|
|
333
426
|
* starting up any error logging machinery.
|
|
334
427
|
*/
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
output_to_server = is_log_level_output(elevel, log_min_messages);
|
|
338
|
-
|
|
339
|
-
/* Determine whether message is enabled for client output */
|
|
340
|
-
if (whereToSendOutput == DestRemote && elevel != LOG_SERVER_ONLY)
|
|
341
|
-
{
|
|
342
|
-
/*
|
|
343
|
-
* client_min_messages is honored only after we complete the
|
|
344
|
-
* authentication handshake. This is required both for security
|
|
345
|
-
* reasons and because many clients can't handle NOTICE messages
|
|
346
|
-
* during authentication.
|
|
347
|
-
*/
|
|
348
|
-
if (ClientAuthInProgress)
|
|
349
|
-
output_to_client = (elevel >= ERROR);
|
|
350
|
-
else
|
|
351
|
-
output_to_client = (elevel >= client_min_messages ||
|
|
352
|
-
elevel == INFO);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/* Skip processing effort if non-error message will not be output */
|
|
428
|
+
output_to_server = should_output_to_server(elevel);
|
|
429
|
+
output_to_client = should_output_to_client(elevel);
|
|
356
430
|
if (elevel < ERROR && !output_to_server && !output_to_client)
|
|
357
431
|
return false;
|
|
358
432
|
|
|
@@ -392,36 +466,20 @@ errstart(int elevel, const char *domain)
|
|
|
392
466
|
debug_query_string = NULL;
|
|
393
467
|
}
|
|
394
468
|
}
|
|
395
|
-
if (++errordata_stack_depth >= ERRORDATA_STACK_SIZE)
|
|
396
|
-
{
|
|
397
|
-
/*
|
|
398
|
-
* Wups, stack not big enough. We treat this as a PANIC condition
|
|
399
|
-
* because it suggests an infinite loop of errors during error
|
|
400
|
-
* recovery.
|
|
401
|
-
*/
|
|
402
|
-
errordata_stack_depth = -1; /* make room on stack */
|
|
403
|
-
ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded")));
|
|
404
|
-
}
|
|
405
469
|
|
|
406
470
|
/* Initialize data for this error frame */
|
|
407
|
-
edata =
|
|
408
|
-
MemSet(edata, 0, sizeof(ErrorData));
|
|
471
|
+
edata = get_error_stack_entry();
|
|
409
472
|
edata->elevel = elevel;
|
|
410
473
|
edata->output_to_server = output_to_server;
|
|
411
474
|
edata->output_to_client = output_to_client;
|
|
412
|
-
|
|
413
|
-
edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
|
|
414
|
-
/* initialize context_domain the same way (see set_errcontext_domain()) */
|
|
415
|
-
edata->context_domain = edata->domain;
|
|
475
|
+
set_stack_entry_domain(edata, domain);
|
|
416
476
|
/* Select default errcode based on elevel */
|
|
417
477
|
if (elevel >= ERROR)
|
|
418
478
|
edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
|
|
419
|
-
else if (elevel
|
|
479
|
+
else if (elevel >= WARNING)
|
|
420
480
|
edata->sqlerrcode = ERRCODE_WARNING;
|
|
421
481
|
else
|
|
422
482
|
edata->sqlerrcode = ERRCODE_SUCCESSFUL_COMPLETION;
|
|
423
|
-
/* errno is saved here so that error parameter eval can't change it */
|
|
424
|
-
edata->saved_errno = errno;
|
|
425
483
|
|
|
426
484
|
/*
|
|
427
485
|
* Any allocations for this error state level should go into ErrorContext
|
|
@@ -432,32 +490,6 @@ errstart(int elevel, const char *domain)
|
|
|
432
490
|
return true;
|
|
433
491
|
}
|
|
434
492
|
|
|
435
|
-
/*
|
|
436
|
-
* Checks whether the given funcname matches backtrace_functions; see
|
|
437
|
-
* check_backtrace_functions.
|
|
438
|
-
*/
|
|
439
|
-
static bool
|
|
440
|
-
matches_backtrace_functions(const char *funcname)
|
|
441
|
-
{
|
|
442
|
-
char *p;
|
|
443
|
-
|
|
444
|
-
if (!backtrace_symbol_list || funcname == NULL || funcname[0] == '\0')
|
|
445
|
-
return false;
|
|
446
|
-
|
|
447
|
-
p = backtrace_symbol_list;
|
|
448
|
-
for (;;)
|
|
449
|
-
{
|
|
450
|
-
if (*p == '\0') /* end of backtrace_symbol_list */
|
|
451
|
-
break;
|
|
452
|
-
|
|
453
|
-
if (strcmp(funcname, p) == 0)
|
|
454
|
-
return true;
|
|
455
|
-
p += strlen(p) + 1;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
493
|
/*
|
|
462
494
|
* errfinish --- end an error-reporting cycle
|
|
463
495
|
*
|
|
@@ -478,19 +510,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
|
478
510
|
CHECK_STACK_DEPTH();
|
|
479
511
|
|
|
480
512
|
/* Save the last few bits of error state into the stack entry */
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
const char *slash;
|
|
484
|
-
|
|
485
|
-
/* keep only base name, useful especially for vpath builds */
|
|
486
|
-
slash = strrchr(filename, '/');
|
|
487
|
-
if (slash)
|
|
488
|
-
filename = slash + 1;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
edata->filename = filename;
|
|
492
|
-
edata->lineno = lineno;
|
|
493
|
-
edata->funcname = funcname;
|
|
513
|
+
set_stack_entry_location(edata, filename, lineno, funcname);
|
|
494
514
|
|
|
495
515
|
elevel = edata->elevel;
|
|
496
516
|
|
|
@@ -500,6 +520,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
|
500
520
|
*/
|
|
501
521
|
oldcontext = MemoryContextSwitchTo(ErrorContext);
|
|
502
522
|
|
|
523
|
+
/* Collect backtrace, if enabled and we didn't already */
|
|
503
524
|
if (!edata->backtrace &&
|
|
504
525
|
edata->funcname &&
|
|
505
526
|
backtrace_functions &&
|
|
@@ -546,45 +567,11 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
|
546
567
|
PG_RE_THROW();
|
|
547
568
|
}
|
|
548
569
|
|
|
549
|
-
/*
|
|
550
|
-
* If we are doing FATAL or PANIC, abort any old-style COPY OUT in
|
|
551
|
-
* progress, so that we can report the message before dying. (Without
|
|
552
|
-
* this, pq_putmessage will refuse to send the message at all, which is
|
|
553
|
-
* what we want for NOTICE messages, but not for fatal exits.) This hack
|
|
554
|
-
* is necessary because of poor design of old-style copy protocol.
|
|
555
|
-
*/
|
|
556
|
-
if (elevel >= FATAL && whereToSendOutput == DestRemote)
|
|
557
|
-
pq_endcopyout(true);
|
|
558
|
-
|
|
559
570
|
/* Emit the message to the right places */
|
|
560
571
|
EmitErrorReport();
|
|
561
572
|
|
|
562
573
|
/* Now free up subsidiary data attached to stack entry, and release it */
|
|
563
|
-
|
|
564
|
-
pfree(edata->message);
|
|
565
|
-
if (edata->detail)
|
|
566
|
-
pfree(edata->detail);
|
|
567
|
-
if (edata->detail_log)
|
|
568
|
-
pfree(edata->detail_log);
|
|
569
|
-
if (edata->hint)
|
|
570
|
-
pfree(edata->hint);
|
|
571
|
-
if (edata->context)
|
|
572
|
-
pfree(edata->context);
|
|
573
|
-
if (edata->backtrace)
|
|
574
|
-
pfree(edata->backtrace);
|
|
575
|
-
if (edata->schema_name)
|
|
576
|
-
pfree(edata->schema_name);
|
|
577
|
-
if (edata->table_name)
|
|
578
|
-
pfree(edata->table_name);
|
|
579
|
-
if (edata->column_name)
|
|
580
|
-
pfree(edata->column_name);
|
|
581
|
-
if (edata->datatype_name)
|
|
582
|
-
pfree(edata->datatype_name);
|
|
583
|
-
if (edata->constraint_name)
|
|
584
|
-
pfree(edata->constraint_name);
|
|
585
|
-
if (edata->internalquery)
|
|
586
|
-
pfree(edata->internalquery);
|
|
587
|
-
|
|
574
|
+
FreeErrorDataContents(edata);
|
|
588
575
|
errordata_stack_depth--;
|
|
589
576
|
|
|
590
577
|
/* Exit error-handling context */
|
|
@@ -611,8 +598,14 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
|
611
598
|
* Any other code you might be tempted to add here should probably be
|
|
612
599
|
* in an on_proc_exit or on_shmem_exit callback instead.
|
|
613
600
|
*/
|
|
614
|
-
fflush(
|
|
615
|
-
|
|
601
|
+
fflush(NULL);
|
|
602
|
+
|
|
603
|
+
/*
|
|
604
|
+
* Let the cumulative stats system know. Only mark the session as
|
|
605
|
+
* terminated by fatal error if there is no other known cause.
|
|
606
|
+
*/
|
|
607
|
+
if (pgStatSessionEndCause == DISCONNECT_NORMAL)
|
|
608
|
+
pgStatSessionEndCause = DISCONNECT_FATAL;
|
|
616
609
|
|
|
617
610
|
/*
|
|
618
611
|
* Do normal process-exit cleanup, then return exit code 1 to indicate
|
|
@@ -631,8 +624,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
|
631
624
|
* XXX: what if we are *in* the postmaster? abort() won't kill our
|
|
632
625
|
* children...
|
|
633
626
|
*/
|
|
634
|
-
fflush(
|
|
635
|
-
fflush(stderr);
|
|
627
|
+
fflush(NULL);
|
|
636
628
|
abort();
|
|
637
629
|
}
|
|
638
630
|
|
|
@@ -645,6 +637,242 @@ errfinish(const char *filename, int lineno, const char *funcname)
|
|
|
645
637
|
}
|
|
646
638
|
|
|
647
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
|
+
|
|
648
876
|
/*
|
|
649
877
|
* errcode --- add SQLSTATE error code to the current error
|
|
650
878
|
*
|
|
@@ -687,8 +915,7 @@ errcode(int sqlerrcode)
|
|
|
687
915
|
* NOTE: the primary error message string should generally include %m
|
|
688
916
|
* when this is used.
|
|
689
917
|
*/
|
|
690
|
-
|
|
691
|
-
#endif
|
|
918
|
+
|
|
692
919
|
|
|
693
920
|
|
|
694
921
|
/*
|
|
@@ -953,6 +1180,13 @@ errhint(const char *fmt,...)
|
|
|
953
1180
|
}
|
|
954
1181
|
|
|
955
1182
|
|
|
1183
|
+
/*
|
|
1184
|
+
* errhint_plural --- add a hint error message text to the current error,
|
|
1185
|
+
* with support for pluralization of the message text
|
|
1186
|
+
*/
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
956
1190
|
/*
|
|
957
1191
|
* errcontext_msg --- add a context error message text to the current error
|
|
958
1192
|
*
|
|
@@ -1006,7 +1240,18 @@ set_errcontext_domain(const char *domain)
|
|
|
1006
1240
|
*
|
|
1007
1241
|
* This should be called if the message text already includes the statement.
|
|
1008
1242
|
*/
|
|
1243
|
+
int
|
|
1244
|
+
errhidestmt(bool hide_stmt)
|
|
1245
|
+
{
|
|
1246
|
+
ErrorData *edata = &errordata[errordata_stack_depth];
|
|
1009
1247
|
|
|
1248
|
+
/* we don't bother incrementing recursion_depth */
|
|
1249
|
+
CHECK_STACK_DEPTH();
|
|
1250
|
+
|
|
1251
|
+
edata->hide_stmt = hide_stmt;
|
|
1252
|
+
|
|
1253
|
+
return 0; /* return value does not matter */
|
|
1254
|
+
}
|
|
1010
1255
|
|
|
1011
1256
|
/*
|
|
1012
1257
|
* errhidecontext --- optionally suppress CONTEXT: field of log entry
|
|
@@ -1014,17 +1259,18 @@ set_errcontext_domain(const char *domain)
|
|
|
1014
1259
|
* This should only be used for verbose debugging messages where the repeated
|
|
1015
1260
|
* inclusion of context would bloat the log volume too much.
|
|
1016
1261
|
*/
|
|
1262
|
+
int
|
|
1263
|
+
errhidecontext(bool hide_ctx)
|
|
1264
|
+
{
|
|
1265
|
+
ErrorData *edata = &errordata[errordata_stack_depth];
|
|
1017
1266
|
|
|
1267
|
+
/* we don't bother incrementing recursion_depth */
|
|
1268
|
+
CHECK_STACK_DEPTH();
|
|
1018
1269
|
|
|
1270
|
+
edata->hide_ctx = hide_ctx;
|
|
1019
1271
|
|
|
1020
|
-
/*
|
|
1021
|
-
|
|
1022
|
-
*
|
|
1023
|
-
* This is used when backwards compatibility demands that the function
|
|
1024
|
-
* name appear in messages sent to old-protocol clients. Note that the
|
|
1025
|
-
* passed string is expected to be a non-freeable constant string.
|
|
1026
|
-
*/
|
|
1027
|
-
|
|
1272
|
+
return 0; /* return value does not matter */
|
|
1273
|
+
}
|
|
1028
1274
|
|
|
1029
1275
|
/*
|
|
1030
1276
|
* errposition --- add cursor position to the current error
|
|
@@ -1296,6 +1542,40 @@ CopyErrorData(void)
|
|
|
1296
1542
|
*/
|
|
1297
1543
|
|
|
1298
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
|
+
|
|
1299
1579
|
/*
|
|
1300
1580
|
* FlushErrorState --- flush the error state after error recovery
|
|
1301
1581
|
*
|
|
@@ -1368,16 +1648,10 @@ pg_re_throw(void)
|
|
|
1368
1648
|
|
|
1369
1649
|
/*
|
|
1370
1650
|
* At least in principle, the increase in severity could have changed
|
|
1371
|
-
* where-to-output decisions, so recalculate.
|
|
1372
|
-
* sync with errstart(), which see for comments.
|
|
1651
|
+
* where-to-output decisions, so recalculate.
|
|
1373
1652
|
*/
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
log_min_messages);
|
|
1377
|
-
else
|
|
1378
|
-
edata->output_to_server = (FATAL >= log_min_messages);
|
|
1379
|
-
if (whereToSendOutput == DestRemote)
|
|
1380
|
-
edata->output_to_client = true;
|
|
1653
|
+
edata->output_to_server = should_output_to_server(FATAL);
|
|
1654
|
+
edata->output_to_client = should_output_to_client(FATAL);
|
|
1381
1655
|
|
|
1382
1656
|
/*
|
|
1383
1657
|
* We can use errfinish() for the rest, but we don't want it to call
|
|
@@ -1390,8 +1664,7 @@ pg_re_throw(void)
|
|
|
1390
1664
|
}
|
|
1391
1665
|
|
|
1392
1666
|
/* Doesn't return ... */
|
|
1393
|
-
ExceptionalCondition("pg_re_throw tried to return",
|
|
1394
|
-
__FILE__, __LINE__);
|
|
1667
|
+
ExceptionalCondition("pg_re_throw tried to return", __FILE__, __LINE__);
|
|
1395
1668
|
}
|
|
1396
1669
|
|
|
1397
1670
|
|
|
@@ -1415,13 +1688,49 @@ pg_re_throw(void)
|
|
|
1415
1688
|
|
|
1416
1689
|
|
|
1417
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
|
+
*/
|
|
1418
1711
|
#ifdef HAVE_SYSLOG
|
|
1712
|
+
#endif
|
|
1713
|
+
#ifdef WIN32
|
|
1714
|
+
#endif
|
|
1419
1715
|
|
|
1420
1716
|
/*
|
|
1421
|
-
*
|
|
1717
|
+
* GUC assign_hook for log_destination
|
|
1422
1718
|
*/
|
|
1423
1719
|
|
|
1424
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
|
|
1425
1734
|
|
|
1426
1735
|
/*
|
|
1427
1736
|
* Write a message line to syslog
|
|
@@ -1435,107 +1744,12 @@ pg_re_throw(void)
|
|
|
1435
1744
|
* interfaces (e.g. CreateFileA()) expect string arguments in this encoding.
|
|
1436
1745
|
* Every process in a given system will find the same value at all times.
|
|
1437
1746
|
*/
|
|
1438
|
-
static int
|
|
1439
|
-
GetACPEncoding(void)
|
|
1440
|
-
{
|
|
1441
|
-
static int encoding = -2;
|
|
1442
|
-
|
|
1443
|
-
if (encoding == -2)
|
|
1444
|
-
encoding = pg_codepage_to_encoding(GetACP());
|
|
1445
1747
|
|
|
1446
|
-
return encoding;
|
|
1447
|
-
}
|
|
1448
1748
|
|
|
1449
1749
|
/*
|
|
1450
1750
|
* Write a message line to the windows event log
|
|
1451
1751
|
*/
|
|
1452
|
-
static void
|
|
1453
|
-
write_eventlog(int level, const char *line, int len)
|
|
1454
|
-
{
|
|
1455
|
-
WCHAR *utf16;
|
|
1456
|
-
int eventlevel = EVENTLOG_ERROR_TYPE;
|
|
1457
|
-
static HANDLE evtHandle = INVALID_HANDLE_VALUE;
|
|
1458
|
-
|
|
1459
|
-
if (evtHandle == INVALID_HANDLE_VALUE)
|
|
1460
|
-
{
|
|
1461
|
-
evtHandle = RegisterEventSource(NULL,
|
|
1462
|
-
event_source ? event_source : DEFAULT_EVENT_SOURCE);
|
|
1463
|
-
if (evtHandle == NULL)
|
|
1464
|
-
{
|
|
1465
|
-
evtHandle = INVALID_HANDLE_VALUE;
|
|
1466
|
-
return;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
1752
|
|
|
1470
|
-
switch (level)
|
|
1471
|
-
{
|
|
1472
|
-
case DEBUG5:
|
|
1473
|
-
case DEBUG4:
|
|
1474
|
-
case DEBUG3:
|
|
1475
|
-
case DEBUG2:
|
|
1476
|
-
case DEBUG1:
|
|
1477
|
-
case LOG:
|
|
1478
|
-
case LOG_SERVER_ONLY:
|
|
1479
|
-
case INFO:
|
|
1480
|
-
case NOTICE:
|
|
1481
|
-
eventlevel = EVENTLOG_INFORMATION_TYPE;
|
|
1482
|
-
break;
|
|
1483
|
-
case WARNING:
|
|
1484
|
-
eventlevel = EVENTLOG_WARNING_TYPE;
|
|
1485
|
-
break;
|
|
1486
|
-
case ERROR:
|
|
1487
|
-
case FATAL:
|
|
1488
|
-
case PANIC:
|
|
1489
|
-
default:
|
|
1490
|
-
eventlevel = EVENTLOG_ERROR_TYPE;
|
|
1491
|
-
break;
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
/*
|
|
1495
|
-
* If message character encoding matches the encoding expected by
|
|
1496
|
-
* ReportEventA(), call it to avoid the hazards of conversion. Otherwise,
|
|
1497
|
-
* try to convert the message to UTF16 and write it with ReportEventW().
|
|
1498
|
-
* Fall back on ReportEventA() if conversion failed.
|
|
1499
|
-
*
|
|
1500
|
-
* Since we palloc the structure required for conversion, also fall
|
|
1501
|
-
* through to writing unconverted if we have not yet set up
|
|
1502
|
-
* CurrentMemoryContext.
|
|
1503
|
-
*
|
|
1504
|
-
* Also verify that we are not on our way into error recursion trouble due
|
|
1505
|
-
* to error messages thrown deep inside pgwin32_message_to_UTF16().
|
|
1506
|
-
*/
|
|
1507
|
-
if (!in_error_recursion_trouble() &&
|
|
1508
|
-
CurrentMemoryContext != NULL &&
|
|
1509
|
-
GetMessageEncoding() != GetACPEncoding())
|
|
1510
|
-
{
|
|
1511
|
-
utf16 = pgwin32_message_to_UTF16(line, len, NULL);
|
|
1512
|
-
if (utf16)
|
|
1513
|
-
{
|
|
1514
|
-
ReportEventW(evtHandle,
|
|
1515
|
-
eventlevel,
|
|
1516
|
-
0,
|
|
1517
|
-
0, /* All events are Id 0 */
|
|
1518
|
-
NULL,
|
|
1519
|
-
1,
|
|
1520
|
-
0,
|
|
1521
|
-
(LPCWSTR *) &utf16,
|
|
1522
|
-
NULL);
|
|
1523
|
-
/* XXX Try ReportEventA() when ReportEventW() fails? */
|
|
1524
|
-
|
|
1525
|
-
pfree(utf16);
|
|
1526
|
-
return;
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
ReportEventA(evtHandle,
|
|
1530
|
-
eventlevel,
|
|
1531
|
-
0,
|
|
1532
|
-
0, /* All events are Id 0 */
|
|
1533
|
-
NULL,
|
|
1534
|
-
1,
|
|
1535
|
-
0,
|
|
1536
|
-
&line,
|
|
1537
|
-
NULL);
|
|
1538
|
-
}
|
|
1539
1753
|
#endif /* WIN32 */
|
|
1540
1754
|
|
|
1541
1755
|
#ifdef WIN32
|
|
@@ -1543,39 +1757,56 @@ write_eventlog(int level, const char *line, int len)
|
|
|
1543
1757
|
#endif
|
|
1544
1758
|
|
|
1545
1759
|
/*
|
|
1546
|
-
*
|
|
1760
|
+
* get_formatted_log_time -- compute and get the log timestamp.
|
|
1761
|
+
*
|
|
1762
|
+
* The timestamp is computed if not set yet, so as it is kept consistent
|
|
1763
|
+
* among all the log destinations that require it to be consistent. Note
|
|
1764
|
+
* that the computed timestamp is returned in a static buffer, not
|
|
1765
|
+
* palloc()'d.
|
|
1547
1766
|
*/
|
|
1548
1767
|
|
|
1549
1768
|
|
|
1550
1769
|
/*
|
|
1551
|
-
*
|
|
1770
|
+
* reset_formatted_start_time -- reset the start timestamp
|
|
1552
1771
|
*/
|
|
1553
1772
|
|
|
1554
1773
|
|
|
1555
1774
|
/*
|
|
1556
|
-
*
|
|
1557
|
-
* string in log_line_prefix
|
|
1775
|
+
* get_formatted_start_time -- compute and get the start timestamp.
|
|
1558
1776
|
*
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1777
|
+
* The timestamp is computed if not set yet. Note that the computed
|
|
1778
|
+
* timestamp is returned in a static buffer, not palloc()'d.
|
|
1561
1779
|
*/
|
|
1562
1780
|
|
|
1563
1781
|
|
|
1564
1782
|
/*
|
|
1565
|
-
*
|
|
1783
|
+
* check_log_of_query -- check if a query can be logged
|
|
1566
1784
|
*/
|
|
1567
1785
|
|
|
1568
1786
|
|
|
1569
1787
|
/*
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
*
|
|
1788
|
+
* get_backend_type_for_log -- backend type for log entries
|
|
1789
|
+
*
|
|
1790
|
+
* Returns a pointer to a static buffer, not palloc()'d.
|
|
1573
1791
|
*/
|
|
1574
1792
|
|
|
1575
1793
|
|
|
1576
1794
|
/*
|
|
1577
|
-
*
|
|
1578
|
-
*
|
|
1795
|
+
* process_log_prefix_padding --- helper function for processing the format
|
|
1796
|
+
* string in log_line_prefix
|
|
1797
|
+
*
|
|
1798
|
+
* Note: This function returns NULL if it finds something which
|
|
1799
|
+
* it deems invalid in the format string.
|
|
1800
|
+
*/
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
/*
|
|
1804
|
+
* Format log status information using Log_line_prefix.
|
|
1805
|
+
*/
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
/*
|
|
1809
|
+
* Format log status info; append to the provided buffer.
|
|
1579
1810
|
*/
|
|
1580
1811
|
|
|
1581
1812
|
|
|
@@ -1663,72 +1894,29 @@ static void send_message_to_frontend(ErrorData *edata) {}
|
|
|
1663
1894
|
* not available). Used before ereport/elog can be used
|
|
1664
1895
|
* safely (memory context, GUC load etc)
|
|
1665
1896
|
*/
|
|
1897
|
+
|
|
1666
1898
|
void
|
|
1667
1899
|
write_stderr(const char *fmt,...)
|
|
1668
1900
|
{
|
|
1669
|
-
va_list
|
|
1670
|
-
|
|
1671
|
-
#ifdef WIN32
|
|
1672
|
-
char errbuf[2048]; /* Arbitrary size? */
|
|
1673
|
-
#endif
|
|
1674
|
-
|
|
1675
|
-
fmt = _(fmt);
|
|
1676
|
-
|
|
1901
|
+
va_list ap;
|
|
1677
1902
|
va_start(ap, fmt);
|
|
1678
|
-
#ifndef WIN32
|
|
1679
|
-
/* On Unix, we just fprintf to stderr */
|
|
1680
1903
|
vfprintf(stderr, fmt, ap);
|
|
1681
1904
|
fflush(stderr);
|
|
1682
|
-
#else
|
|
1683
|
-
vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
|
1684
|
-
|
|
1685
|
-
/*
|
|
1686
|
-
* On Win32, we print to stderr if running on a console, or write to
|
|
1687
|
-
* eventlog if running as a service
|
|
1688
|
-
*/
|
|
1689
|
-
if (pgwin32_is_service()) /* Running as a service */
|
|
1690
|
-
{
|
|
1691
|
-
write_eventlog(ERROR, errbuf, strlen(errbuf));
|
|
1692
|
-
}
|
|
1693
|
-
else
|
|
1694
|
-
{
|
|
1695
|
-
/* Not running as service, write to stderr */
|
|
1696
|
-
write_console(errbuf, strlen(errbuf));
|
|
1697
|
-
fflush(stderr);
|
|
1698
|
-
}
|
|
1699
|
-
#endif
|
|
1700
1905
|
va_end(ap);
|
|
1701
1906
|
}
|
|
1702
1907
|
|
|
1703
1908
|
|
|
1909
|
+
|
|
1910
|
+
|
|
1704
1911
|
/*
|
|
1705
|
-
*
|
|
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.
|
|
1706
1914
|
*
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
* whether a message should go to the postmaster log, whereas a simple >=
|
|
1710
|
-
* test is correct for testing whether the message should go to the client.
|
|
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.
|
|
1711
1917
|
*/
|
|
1712
|
-
static bool
|
|
1713
|
-
is_log_level_output(int elevel, int log_min_level)
|
|
1714
|
-
{
|
|
1715
|
-
if (elevel == LOG || elevel == LOG_SERVER_ONLY)
|
|
1716
|
-
{
|
|
1717
|
-
if (log_min_level == LOG || log_min_level <= ERROR)
|
|
1718
|
-
return true;
|
|
1719
|
-
}
|
|
1720
|
-
else if (log_min_level == LOG)
|
|
1721
|
-
{
|
|
1722
|
-
/* elevel != LOG */
|
|
1723
|
-
if (elevel >= FATAL)
|
|
1724
|
-
return true;
|
|
1725
|
-
}
|
|
1726
|
-
/* Neither is LOG */
|
|
1727
|
-
else if (elevel >= log_min_level)
|
|
1728
|
-
return true;
|
|
1729
1918
|
|
|
1730
|
-
|
|
1731
|
-
}
|
|
1919
|
+
|
|
1732
1920
|
|
|
1733
1921
|
/*
|
|
1734
1922
|
* Adjust the level of a recovery-related message per trace_recovery_messages.
|
|
@@ -1746,3 +1934,10 @@ is_log_level_output(int elevel, int log_min_level)
|
|
|
1746
1934
|
* hard-to-explain kluge.
|
|
1747
1935
|
*/
|
|
1748
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
|