Repository navigation
PG 18: sync to upstream 18.6 and reapply downstream patch series - #16
Conversation
`_fingerprintNotifyStmt` previously fingerprinted the payload, which meant NOTIFY statements with different payloads produced different fingerprints. Now the payload is ignored, bringing it in line with existing (intentional) behavior for the channel name of focusing on the structure, not data.
* Add fingerprint tests involving role names. * Ignore role field of CreateRoleStmt * Ignore newname and subname fields of RenameStmt. * Have fingerprinting ignore rolename field on RoleSpec struct, which ignores role names in DROP ROLE, GRANT, and REASSIGN OWNED BY statements
…START TRANSACTION (pganalyze#358) These are significant, e.g. differentiating between read-only transactions, serialization mode, etc.
This makes libpg_query return the standard "stack depth limit exceeded" error that Postgres also shows for overly deep queries, instead of crashing when stack depth gets exceeded. This error is triggered by appropriately placed calls to the Postgres check_stack_depth() function, and goes together with initializing the stack base and depth in pg_query_init. The maximum stack depth is handled similar to Postgres max_stack_depth variable, defaulting to 100 kB, and auto-sized up to 2MB. Because we may be called in threads with varying stack sizes, and from different host program locations, the allowed stack depth is recalculated for each call to libpg_query. Per multiple reports from OSS-Fuzz.
* Fix PL/pgSQL parsing without function bodies Return PostgreSQL errors when CREATE FUNCTION or DO omits its AS clause instead of asserting or dereferencing a null source pointer in release builds. Add regression coverage for both malformed statement types. Fixes pganalyze#362. * Skip non-PL/pgSQL functions before checking for a body, add more checks Check the language before requiring an AS clause, so that valid SQL-standard function bodies (LANGUAGE sql RETURN ... / BEGIN ATOMIC) are skipped as before instead of returning an error. For PL/pgSQL functions, also raise upstream's "duplicate function body specified" and "inline SQL function body only valid for language SQL" errors, as in Postgres' interpret_AS_clause function. In passing, fix a related memory leak for raw parser's stderr buffer when the input contains no CREATE FUNCTION or DO statements, which previously leaked. --------- Co-authored-by: Darren Carreras <283775510+carrerasdarren-cell@users.noreply.github.com> Co-authored-by: Lukas Fittl <lukas@fittl.com>
Every field macro in the generated outfuncs/readfuncs defs now receives the enclosing message type as its first argument, and the generated _read* functions take const message pointers. Current backends ignore the new argument; this prepares for a protobuf backend that uses per-message accessor functions (pg_query_<MsgType>_set_<field>).
Previously, getting the tokens from the scanner required working with a Protobuf result, causing any pure C caller to have to deal with the Protobuf library (protobuf-c). That included the deparser as well when locating the comment data in a query. Since we are about to change the library we use, this would require every such caller to update as well. Instead, introduce a better abstraction that avoids involving the Protobuf layer at all, instead allowing the caller to walk a simple list of PgQueryScanToken structs.
We could have made this an error a while ago (as the TODO notes), but at this point we might have callers relying on being able to pass in trees without the version set, or with a different minor version. To keep things simple, drop the assert and add a note.
This avoids having a stale stack base reference when calling functions in libpg_query that don't go through the ...enter_memory_context() handling, but contain a call to check_stack_depth(). This is currently not the case but a future commit intends to add a modified vendored libary that can also be called directly outside of libpg_query, and could otherwise incorrectly error out with a stack depth error.
The upb library is developed as part of the main Protobuf project, to support other language bindings (e.g. Ruby), but is not officially released as a C library. However, it provides two main benefits that make it useful for our use case: (1) It allows limiting parse depth for complex protobuf structures, avoiding crashes, (2) it is substantially faster, in part due to having a built-in arena allocation mechanism. Since the upstream protobuf-c project appears to not be actively maintained (and upb certainly is) this seems worth it from that perspective as well. The main risks are incompatible API changes done by upstream upb (which they explicitly note the in their README), and the larger amount of code we have to vendor.
_fingerprintNode cuts off overly deep parse trees at 100 levels, but the generated code for fields with a specific node type (e.g. SelectStmt larg/rarg) calls the type's function directly and never checked the depth. A long chain of set operations could therefore recurse until the stack overflowed, crashing pg_query_fingerprint. Apply the same cutoff in that code path. This changes the fingerprint for set operation chains deeper than 100 levels, which now consistently cut off like other deeply nested nodes already do. Update test/complex.c accordingly, since it fingerprints a 10,000-way UNION ALL chain.
The stack depth checks added previously sit in the generic node dispatchers (_outNode, _readNode, deparseExpr, raw_expression_tree_walker). Fields with a specific node type are handled by calling that type's function directly, bypassing those dispatchers. A long chain of set operations (SELECT 1 UNION SELECT 1 UNION ...) nests SelectStmt in SelectStmt this way, and could overflow the stack before ever reaching a check, crashing the process. Add checks in every place that recurses this way: - The WRITE_SPECIFIC_NODE_PTR_FIELD / READ_SPECIFIC_NODE_PTR_FIELD macros in the JSON, protobuf and protobuf C++ out funcs, and the read funcs. Also add the check to _readNode itself, which was missed previously. - deparseSelectStmt and deparseStmt in the deparser, which only checked in deparseExpr so far. - const_record_walker in normalize, which recurses into itself directly for each SelectStmt clause. Extend test/stack_depth to run every entry point against a deep set operation chain in addition to the deep expression chain.
Returning from inside the PG_TRY block skips PG_END_TRY, which leaves PG_exception_stack pointing at the sigjmp_buf of a frame that no longer exists. A later error raised while walking a sibling node would then longjmp into that dead frame.
The catch-all PG_CATCH in the default case exists to ignore node types the walker doesn't know. But it also swallowed "stack depth limit exceeded", and then returned a partially normalized query as if it was complete. Re-throw that error instead, so the caller sees it.
The stderr buffer is malloc-ed by pg_query_raw_parse and only known to pg_query_summary_internal until it returns. If one of the walks raises (e.g. "stack depth limit exceeded"), the outer PG_CATCH never sees it, so free it before passing on the error. Also cover pg_query_summary in test/stack_depth, which was missing. Under valgrind this catches the leak.
exprLocation recurses into child nodes, e.g. down the left operand of an A_Expr, without checking stack depth. The grammar calls it to compute the error position for "multiple ORDER BY clauses not allowed", so a query like "(SELECT ORDER BY a) ORDER BY x+x+x..." overflows the stack during raw parsing, before any of the other stack depth checks are reached. The grammar builds the deep expression itself without recursing, so this is the first place that walks it. Add a check_stack_depth() call to exprLocation, via a new patch to the Postgres source, so this returns "stack depth limit exceeded" instead of crashing. Fixes https://issues.oss-fuzz.com/issues/524166379
This was previously set to binary to avoid issues with git checkouts messing up the line endings, but that caused diffs to hide changes in regression tests. Instead use the "-text" indicator to achieve the same effect, with the exception of a single test that must be binary due to the use of WIN1252 encoding instead of UTF-8.
…ence (pganalyze#371) Previously we littered various code portions with special casing for adding parens when the contained expression was one that needed wrapping parens to avoid changing the meaning of the overall SQL. But that logic was incomplete, and overly emphasised "a_expr"/etc grammar, when operator precedence is actually a more important aspect. Introduce a new needsParensForPrecedence helper (and a few additional functions for it to use), that returns whether the specified node needs wrapping parens. Also, introduce deparseExprOperand which acts like deparseExpr, but adds the wrapping parens if needed. In passing, improve needsParensAsBExpr for correctness, introduce needsParensAsCExpr along similar lines, and invert the parens handling of deparseAIndirection for correctness. Further, drop the context argument from deparseFuncCall, as it is no longer needed. Adjust expression tests where we previously added unnecessary parens, and additional tests for complex cases that are now handled correctly. Further, rework deparse depth test to reflect changes in deparsing and skip deparse depth test on protobuf-cpp backend. This worked by accident when we first merged the upb backend, since protobuf-cpp was hitting its own stack depth limit instead of the limit we intended to test. With the change to the deparser, that limit is no longer hit in the same way, and we instead fail CI. Since protobuf-cpp is mainly tested to ensure we don't regress the JSON format compatibility, we can safely skip this test and not have the explicit depth limit for protobuf-cpp. Co-authored-by: Sean Linsley <code@seanlinsley.com>
pganalyze#374) When building a dotted name, like in a "SET a.b.c = ..." statement, the parser calls psprintf for each individual part, concatenating to the result, but not freeing the prior string. Whilst we could solve this with a pfree call, the more idiomatic way is to use a Postgres list structure, and then call NameListToString to get the result. This avoids both the memory use issue, and reduces runtime for extreme cases. Per report from OSS-fuzz.
… Postgres 17 compatibility (pganalyze#361) * Move RangeVar fingerprint function directly to pg_query_fingerprint.c This was previously maintained as part of the fingerprint generation script, which is hard to reason about and frustrating to work with when making changes. Since we're planning to add more logic to this, instead make it a custom implementation, similar to Postgres' approach for RangeTblEntry. * Fingerprint: Add options to control RangeVar fingerprinting This adds a fingerprint options bitmask as a third argument to pg_query_fingerprint_opts, which is a breaking change for existing callers (pass PG_QUERY_FINGERPRINT_DEFAULT to keep current behavior). The options currently only affect how RangeVar nodes (relation references) are fingerprinted, addressing two different use cases: Table/schema/alias handling (bits 0-3): By default, relation references follow Postgres 18+ query ID behavior (see Postgres commit 787514b30bb): in SELECT/DML contexts the alias name is fingerprinted, the relation name is ignored when an alias is present, and schema names are ignored. Two flags adjust this independently: PG_QUERY_FINGERPRINT_RANGEVAR_IGNORE_ALIASES always fingerprints relation names and ignores aliases. PG_QUERY_FINGERPRINT_RANGEVAR_INCLUDE_SCHEMA also fingerprints schema names in SELECT/DML contexts. PG_QUERY_FINGERPRINT_RANGEVAR_PG17_COMPAT combines these flags, and matches how Postgres 17 and earlier calculate query IDs, and how libpg_query 17 and earlier calculated fingerprints. Relation name handling (bits 4-7): By default, sequences of 2 or more digits in relation names are ignored, so that queries on date/number suffixed tables (e.g. partitions like "orders_2024_01") get the same fingerprint. Setting PG_QUERY_FINGERPRINT_FULL_RELNAME fingerprints the full relation name instead. Note that when PG_QUERY_FINGERPRINT_RANGEVAR_IGNORE_ALIASES is off, and an alias is present, the relation name handling does not take effect.
…can (pganalyze#378) This reworks the lexer patch we apply to treat comments as significant tokens only when requested, specifically when calling pg_query_scan and related scanner-based functions. There are edge cases where treating them as significant in the parser causes problems, specifically when comments are in between related tokens ("NOT /* comment */ IN"), or when they are between string literals that get concatenated. In passing we drop a modification we've done to the PL/pgSQL scanner, since its not really needed for now. Fixes pganalyze#377 and pganalyze#365.
pg_query_normalize() did not know where some string constants were, so it searched the query text for them: DefElem arguments by scanning for the next quote or dollar sign, subscription connection strings with strstr(), and NOTIFY payloads by scanning from the first comma. Each can land in the middle of a token, misled by an identifier like a$b or a comma inside a quoted identifier. Two constants recorded that way overlap, making generate_normalized_query() compute a negative copy length. Instead, have the parser record the locations through an added patch on top of the Postgres parser. Additionally, always check the no-overlap invariant at runtime rather than only in assert-enabled builds. The new fields are excluded from fingerprints (as all locations are), but they will show up in parse tree output.
This ensures that a bad input doesn't cause the deparser to crash, and instead returns an error. For use cases outside of libpg_query that do not work with user input, the new PG_QUERY_DEPARSE_NO_STRICT_CHECKS define can be used to turn off the most detailed checks, which will provide slightly better performance.
This was missing and caused empty elements to be present in parsetrees.
Use the upstream 18-latest tree as the baseline for replaying downstream-only patches separately. Preserve both lineages so 18-constructive can advance without rewriting history.
(cherry picked from commit 9c5f199)
(cherry picked from commit 3ea8bf6)
(cherry picked from commit 3d40d3c)
dump_return() and dump_return_next() had retvarno commented out, so RETURN <variable> / RETURN NEXT <variable> (composite variables, OUT parameters, trigger NEW/OLD) lost the return target in the JSON output. Emit retvarno when it is >= 0; an expression return keeps retvarno -1 and only its expr. Ported from fork commit 3a28fab. Upstream context: pganalyze#355, pganalyze#402. Adds regression samples to test/plpgsql_samples.sql and regenerates the expected JSON. (cherry picked from commit a98ab3c)
(cherry picked from commit b97d4df)
(cherry picked from commit 9b59edc)
Keep the source spelling, modifiers, and array bounds of declared types, including catalog references that cannot be resolved by the standalone parser. Use SQL type names for datums without declaration text. (cherry picked from commit 00cb04c)
(cherry picked from commit ed10375)
(cherry picked from commit 4ef70d9)
…; add record datatype patch file
|
Review complete. 🟡 3 medium 💬 Inline comments (2)
📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Typmod rendered as raw integer in // src/postgres/src_backend_utils_adt_format_type.c
347 printTypmod(const char *typname, int32 typmod, Oid typmodout)
348 {
349 return psprintf("%s(%d)", typname, (int) typmod);}
🧹 Nitpicks (1) — 🟢 1 low
The change brings four PostgreSQL 17/18-era PL/pgSQL patches into the vendored parser: datatype text is now captured from source spelling (including
Reviewed commit: 1e54c6b |
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
This PR ports PostgreSQL 18 PL/pgSQL upstream patches into libpg_query, adding record-variable alias tracking in the JSON output, source-spelling-preserving datatype parsing, and bare-RETURN compatibility, alongside mock syscache updates and new regression tests.
Key findings
- 🟡 Array suffix silently dropped on
%TYPE/%ROWTYPE— src_pl_plpgsql_src_pl_gram.c:5417 - 🟡 Breaking change to
typnameJSON values — src_pl_plpgsql_src_pl_comp.c:1592 - 🟡 Typmod rendered as raw integer in
typname— src_backend_utils_adt_format_type.c:347
| /* Standalone catalog references may not have a resolved type OID. */ | ||
| if (is_array && OidIsValid(result->typoid)) | ||
| result = plpgsql_build_datatype_arrayof(result); |
There was a problem hiding this comment.
🟡 bug · medium
Array suffix silently dropped on %TYPE/%ROWTYPE
In read_datatype, endlocation consumes the []/ARRAY tokens but the new guard only applies the array type when OidIsValid(result->typoid) (src/postgres/src_pl_plpgsql_src_pl_gram.c:5417-5419). In this standalone parser plpgsql_parse_wordtype, plpgsql_parse_cwordtype and the rowtype variants all return palloc0 structs with typoid = InvalidOid (src/postgres/src_pl_plpgsql_src_pl_comp.c:1276), so the guard never fires for any %TYPE/%ROWTYPE declaration. Declarations like x t%type[] silently produce a scalar/record variable instead of an array — previously the unconditional plpgsql_build_datatype_arrayof errored loudly — while the captured typname text (e.g. t%type[]) still claims an array.
📋 Prompt for AI Agents
In src/postgres/src_pl_plpgsql_src_pl_gram.c, in read_datatype around lines 5417-5421, the condition if (is_array && OidIsValid(result->typoid)) silently discards array decoration for %TYPE/%ROWTYPE results whose typoid is InvalidOid (always the case in this standalone parser, since plpgsql_parse_wordtype etc. return palloc0 structs). Either propagate the array decoration into the resulting PLpgSQL_type, or raise yyerror when is_array is set and the array type could not be built, so array-ness is never silently lost; also ensure the captured ds text (assigned to result->typname at line 5463) stays consistent with the result.
| typ->typname = format_type_extended(typeStruct->oid, typmod, | ||
| FORMAT_TYPE_TYPEMOD_GIVEN); | ||
| typ->typoid = typeStruct->oid; |
There was a problem hiding this comment.
🟡 api-change · medium
Breaking change to typname JSON values
The serialized PLpgSQL_type.typname changes from catalog spelling to canonical/source spelling: build_datatype now uses format_type_extended (src/postgres/src_pl_plpgsql_src_pl_comp.c:1592-1593) and parse_datatype overwrites it with the raw source text (src/postgres/src_pl_plpgsql_src_pl_gram.c:6336). Consumers of the pg_query_parse_plpgsql JSON output that key on the old vocabulary (varchar, int4, _text) will mis-handle every datum. This is a wire-format change to the library's primary public output; in-repo fixtures are updated, but external consumers are not.
📋 Prompt for AI Agents
In the project documentation (README section describing the parse_plpgsql JSON output), document that typname values changed from catalog spelling (varchar, int4, bool, _text) to format_type_extended/source-text spelling (character varying, integer, boolean, text[]), that the change is intentional for deparse support, and bump the library version so consumers can detect the schema change.
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
Devin Review found 4 findings. Devin automatically fixed all 4 findings.
Fixed by Devin (4)
- Custom arrays rejected in multi-target assignments — Reproduced: SELECT a,b INTO v,x with v mytype[] errored. Unknown custom types resolve to RECORDOID, so their arrays (RECORDARRAYOID) are now scalar array variables like in real PG; regression sample added.
- False OUT parameter on skipped functions — Reproduced: LANGUAGE sql function emitted out_param_varno 0. Skipped-function placeholders now set out_param_varno = -1 (both DO and CREATE FUNCTION paths); regression sample added.
- Ordinary functions mistaken for triggers — Reproduced: RETURNS trigger.foo with an argument errored as a trigger. Trigger detection now only matches unqualified or pg_catalog-qualified trigger/event_trigger; regression samples added.
- Database-qualified trigger declarations rejected — Reproduced: RETURNS mydb.pg_catalog.trigger errored. Detection now checks the component before the type name, so pg_catalog.trigger and db.pg_catalog.trigger both count; regression sample added.
There was a problem hiding this comment.
Devin Review found 3 findings. All 3 findings are left for you to triage below.
There was a problem hiding this comment.
🟡 Normalization reuses existing NOTIFY parameters
When a batch contains a parameterized NOTIFY, const_record_walker skips its payload parameter. Normalization can assign that same parameter number to a different statement’s literal.
Devin left this for you to triage: src/pg_query_normalize.c is byte-identical to upstream 18-latest (7663e07) and none of our patches touch it. It also only affects normalization, which the parser libraries don't use. I recommend no fork patch: track it for upstream once Dan approves.
(Refers to this code)
Learn more
The grammar stores a parameterized notification payload as a ParamRef, leaving the string payload empty. The normalizer's parameter visitor tracks the highest existing parameter so generated placeholders start above it. The notification branch never invokes that visitor.
Example: NOTIFY a, $1; NOTIFY b, 'hello'; currently normalizes to NOTIFY a, $1; NOTIFY b, $1;. The new placeholder needs to be $2.
Recommended fix: Visit payload_param when present, leaving literal payload handling unchanged. Add the mixed batch to both normalization test suites.
Was this helpful? React with 👍 or 👎 to provide feedback.
| out_arena = upb_Arena_New(); | ||
| parse_result = pg_query_ParseResult_new(out_arena); |
There was a problem hiding this comment.
🔴 Protobuf conversion crashes under memory pressure
When upb cannot allocate a parse message, pg_query_nodes_to_protobuf passes NULL to a setter and crashes instead of returning an error. Summary serialization repeats the unchecked allocations and can also silently omit entries.
Devin left this for you to triage: This file is byte-identical to upstream pganalyze 18-latest (7663e07) and none of our patches touch it, so it came in with the core sync. I recommend leaving the fork matching upstream and tracking it as a possible upstream report once Dan approves upstream contact.
Learn more
The public protobuf parser catches PostgreSQL errors from serialization, but that cannot catch a native null-pointer dereference. The generated statement allocator explicitly returns NULL on allocation failure, and the serializer's statement loop passes that result straight to the generated writer. Summary serialization similarly passes unchecked message pointers to setters and ignores failed insertions for aliases, CTE names, and statement types. The protobuf reader also needs to check whether it obtained an arena before calling the decoder.
Example: The SQL parser successfully parses SELECT 1, but the arena cannot allocate the first protobuf statement. The serializer dereferences the missing statement rather than returning an out-of-memory error to the caller.
Recommended fix: Check arena and message creation, repeated-field additions, and map insertions. Raise ERRCODE_OUT_OF_MEMORY for allocation failures and make the exception handler cover arena ownership from creation through cleanup. Extend the scan allocation fault-injection tests to cover these public APIs.
Was this helpful? React with 👍 or 👎 to provide feedback.
| /* | ||
| * In case the new limit would put us below 100 kB, ignore it, since that | ||
| * is our required minimum and the default of the setting. | ||
| */ | ||
| if (new_limit <= 100) | ||
| return; |
There was a problem hiding this comment.
🔴 Deep calls reuse stale stack limits
When a thread calls the parser with less stack space, set_max_stack_depth can leave a larger limit from an earlier call. Recursive parsing can then exhaust the native stack before the guard trips.
Devin left this for you to triage: src/pg_query.c is byte-identical to upstream 18-latest (7663e07) and none of our patches touch it, so it came in with the core sync. I recommend no fork patch: keep it tracked as a possible upstream issue once Dan approves upstream contact.
Learn more
The parser enters a fresh stack-depth check for each call, but exit clears only the saved stack base. The depth checker compares stack use to a thread-local limit that persists between calls. When the new calculation falls below the minimum, the early return leaves the previous, potentially much larger budget in place.
Example: A thread with a 1 MiB stack first calls the parser near the top of its stack and sets a limit close to 512 KiB. A later call on that thread has only 350 KiB free. It retains the earlier limit instead of using the 100 KiB default, so a recursive walk can run into the stack guard page first.
Recommended fix: Clamp each calculated budget to the supported minimum instead of returning early. Add a same-thread regression test that enters the parser at two different stack depths.
| /* | |
| * In case the new limit would put us below 100 kB, ignore it, since that | |
| * is our required minimum and the default of the setting. | |
| */ | |
| if (new_limit <= 100) | |
| return; | |
| /* Keep the default minimum without reusing a higher limit from a prior call. */ | |
| if (new_limit < 100) | |
| new_limit = 100; |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Brings
18-constructiveto upstream PostgreSQL 18.6 and reapplies all 11 downstream PG 18 patches in one merge, so production never sits on the core sync alone (which drops fork-only PL/pgSQL behavior). This branch contains the core sync from #15 (feat/sync-pg18-upstream@0870a3c, the upstream18-latestmerge); #15 stays open only as a readable view of the upstream part. Patch tracker: https://github.com/constructive-io/constructive-planning/issues/2564.Merge with a merge commit so the upstream sync history is preserved. Once this merges, GitHub will show #15 as merged too, since its commits will be in
18-constructive.Commits on top of the core sync (cherry-picked in order, one per branch, conflicts resolved by keeping both sides):
feat/plpgsql-qualified-schema-typesfix/plpgsql-qualified-func-block-labelfix/pg18-typed-variadicretvarnofor RETURN / RETURN NEXTfeat/pg18-plpgsql-retvarnoout_param_varnofeat/pg18-out-param-varnofix/scan-oom-checksfeat/plpgsql-record-datatypefeat/pg18-declared-type-spellingALIAS FORdeclarationsdevin/1795314076-plpgsql-alias-forfix/plpgsql-return-compatfeat/pg18-stack-hardeningStacking commit:
test/plpgsql_samples.expected.jsonregenerated from the combined build. Per-branch snapshots can't be composed (several branches change the same fields, e.g._text→text[],retvarno,out_param_varno, recorddatatype), so it is the output of the stacked parser.custom_type_arrayssample withmyschema.mytype[](narrowed topublic.mytype[]on the record branch because the qualified-schema patch wasn't in its base).patches/17_plpgsql_record_datatypes.patch(parse_datatypekeeps source spelling) and syncedscripts/mocks/build_datatype.cwith vendoredbuild_datatype.stack_depth/serializer call sites use the alias-awareplpgsqlToJSON(func, &aliases)inside the stack-hardeningPG_TRY.Review fixes (each with a regression sample in
test/plpgsql_samples.sql):mytype[]→RECORDARRAYOID, since unknown types resolve toRECORDOID) are nowPLPGSQL_TTYPE_SCALARarray vars, as in real PG, instead of records;SELECT a, b INTO v, xwithv mytype[]no longer errors.out_param_varno = -1, so they no longer emit"out_param_varno":0.trigger/event_triggerwhen unqualified or qualified bypg_catalog(incl.db.pg_catalog.trigger);RETURNS trigger.mytypeis an ordinary function.Testing
make testpasses (all native suites incl.parse_plpgsql,stack_depth,scan_oom); all 19patches/apply cleanly in Makefile order to pristine PostgreSQL 18.6.versions/18WASM against this branch: 141/150; the 9 failures also occur with the core sync alone (version180006vs pinned180004, andwasm-recoverytests now gettingstack depth limit exceeded/out of memoryinstead of WASM traps).*_locationfields in round-trip checks and deparses record declaration defaults.src/wasm_wrapper.cand the emcc include paths (vendor/upb,vendor/upb/third_party/utf8_range) need porting; I used a local port only for testing.Implemented in session Combine PG 18 patch branches into one PR
Review with Devin · Open in Devin Desktop