From 17f04a13d9b9b6c1535bc97e69775ac0b6b4bec8 Mon Sep 17 00:00:00 2001 From: Joe Drumgoole Date: Sat, 14 Nov 2026 15:30:40 +0000 Subject: [PATCH 1/3] Rust PG server: a PL/pgSQL DECLARE of text that is not one type name is 42601 (RP-617) Co-Authored-By: Claude Opus 5.5 --- .../rp-617-declare-not-one-type-name.md | 13 ++++ crates/secantus-pg/src/lib.rs | 7 +- crates/secantus-pgplan/src/lib.rs | 71 +++++++++++++++++-- tasks/backlog-rust-postgres.md | 13 ---- tests/backlog/test_rp_found_rp573.py | 4 +- 5 files changed, 89 insertions(+), 19 deletions(-) create mode 100644 changelog.d/rp-617-declare-not-one-type-name.md diff --git a/changelog.d/rp-617-declare-not-one-type-name.md b/changelog.d/rp-617-declare-not-one-type-name.md new file mode 100644 index 000000000..43b5cd5c3 --- /dev/null +++ b/changelog.d/rp-617-declare-not-one-type-name.md @@ -0,0 +1,13 @@ +### A PL/pgSQL declaration whose type is not one type name is refused + +A DECLARE such as `x int(3)` or `x varchar(nosuch)` used to be created, and +fail later or never. The Rust PostgreSQL server now refuses it at CREATE as +PostgreSQL does: `typeStringToTypeName` reads the text with the grammar, and +text that is not one type name is a 42601 syntax error at its token, with +the context `invalid type name "..."`. + +#### Fixed + +- A PL/pgSQL DECLARE whose type text is not one type name is 42601 at the + token the grammar stops at, placed in the CREATE's text. +- Fixes RP-617 (tests/backlog/test_rp_found_rp573.py::test_declare_of_text_that_is_not_one_type_name) diff --git a/crates/secantus-pg/src/lib.rs b/crates/secantus-pg/src/lib.rs index cac96726c..3896fa9c6 100644 --- a/crates/secantus-pg/src/lib.rs +++ b/crates/secantus-pg/src/lib.rs @@ -14614,13 +14614,18 @@ impl PgHandler { } None => match secantus_pgplan::plpgsql_declared_type(&d.typname) { Ok(()) => continue, + Err(refused @ secantus_pgplan::DeclaredTypeError::SyntaxAt(_, at)) => { + at_percent = Some(at); + refused + } Err(refused) => refused, }, }; let offset = plpgsql_fn::declared_type_offset(body, d).map(|at| at + at_percent.unwrap_or(0)); let (e, at_type) = match refused { - secantus_pgplan::DeclaredTypeError::AtType(e) => (e, true), + secantus_pgplan::DeclaredTypeError::AtType(e) + | secantus_pgplan::DeclaredTypeError::SyntaxAt(e, _) => (e, true), secantus_pgplan::DeclaredTypeError::Compile(e) => (e, false), secantus_pgplan::DeclaredTypeError::PseudoType(t) => ( secantus_pgplan::Error::Sqlstate( diff --git a/crates/secantus-pgplan/src/lib.rs b/crates/secantus-pgplan/src/lib.rs index 6edd3d25a..5681519e7 100644 --- a/crates/secantus-pgplan/src/lib.rs +++ b/crates/secantus-pgplan/src/lib.rs @@ -7781,6 +7781,9 @@ pub enum DeclaredTypeError { /// A pseudo-type, as printed: 0A000 `variable "x" has pseudo-type t`, /// with the compiler's frame (RP-618). PseudoType(&'static str), + /// Text that is not one type name (RP-617): `typeStringToTypeName`'s + /// syntax error, and the byte offset in the text of the token it is at. + SyntaxAt(Error, usize), } /// The relation a `name%ROWTYPE` names, as `plpgsql_parse_wordrowtype` @@ -7857,6 +7860,32 @@ fn plpgsql_pseudo_type(tn: &pg_query::protobuf::TypeName) -> Option<&'static str .map(|(_, t)| *t) } +/// `typeStringToTypeName`'s refusal of `text` (`raw_parser` in +/// `RAW_PARSE_TYPE_NAME` mode): the grammar's syntax error, and the byte +/// offset in `text` of the token it names (the end of the text for `at end +/// of input`). `None` when the text is one type name. +fn type_syntax_error(text: &str) -> Option<(String, usize)> { + const PREFIX: &str = "select null::"; + let probe = format!("{PREFIX}{text}"); + let message = match pg_query::parse(&probe) { + Ok(_) => return None, + Err(pg_query::Error::Parse(m)) => m, + Err(_) => return None, + }; + if message.ends_with("at end of input") { + return Some((message, text.len())); + } + let near = message + .strip_prefix("syntax error at or near \"")? + .strip_suffix('"')?; + let scan = pg_query::scan(&probe).ok()?; + scan.tokens + .iter() + .filter(|t| t.start as usize >= PREFIX.len()) + .find(|t| probe.get(t.start as usize..t.end as usize) == Some(near)) + .map(|t| (message.clone(), t.start as usize - PREFIX.len())) +} + pub fn plpgsql_declared_type(text: &str) -> std::result::Result<(), DeclaredTypeError> { let text = text.trim(); // The type text as SQL reads a cast's target type. @@ -7903,7 +7932,10 @@ pub fn plpgsql_declared_type(text: &str) -> std::result::Result<(), DeclaredType return Ok(()); } let Some(tn) = type_name(text) else { - return Ok(()); + return match type_syntax_error(text) { + Some((message, at)) => Err(DeclaredTypeError::SyntaxAt(Error::Parse(message), at)), + None => Ok(()), + }; }; match routine_type_missing(&tn) { Ok(None) => { @@ -8803,6 +8835,31 @@ pub fn plpgsql_io_folds(source: &str, target: &str) -> bool { !stable_io(s, false) && !stable_io(t, true) } +#[cfg(test)] +mod declared_type_syntax_tests { + use super::*; + + /// Text that is not one type name is the grammar's syntax error, at its + /// token in the text (RP-617). + #[test] + fn text_that_is_not_one_type_name_is_a_syntax_error() { + let at = |t: &str| match plpgsql_declared_type(t) { + Err(DeclaredTypeError::SyntaxAt(e, at)) => Some((e.to_string(), at)), + _ => None, + }; + assert_eq!( + at("int(3)"), + Some(("syntax error at or near \"(\"".into(), 3)) + ); + assert_eq!( + at("varchar(nosuch)"), + Some(("syntax error at or near \"nosuch\"".into(), 8)) + ); + assert_eq!(at("varchar(3)"), None); + assert_eq!(at("int"), None); + } +} + #[cfg(test)] mod plpgsql_assigns_via_io_tests { use super::plpgsql_assigns_via_io as io; @@ -53097,6 +53154,9 @@ mod rp573_declared_types { Err(DeclaredTypeError::AtType(e)) => Some((true, e.sqlstate().into(), e.to_string())), Err(DeclaredTypeError::Compile(e)) => Some((false, e.sqlstate().into(), e.to_string())), Err(DeclaredTypeError::PseudoType(t)) => Some((false, "0A000".into(), t.into())), + Err(DeclaredTypeError::SyntaxAt(e, _)) => { + Some((true, e.sqlstate().into(), e.to_string())) + } } } @@ -53115,8 +53175,8 @@ mod rp573_declared_types { /// A DECLARE's type is looked up as `parse_datatype` and the /// `%ROWTYPE` lookups do (RP-573): a missing type at the type, a /// missing schema 3F000, a `%ROWTYPE`'s missing relation 42P01 with - /// no position; a `%TYPE` and a text that is not one type name are - /// not checked here. + /// no position; a `%TYPE` is not checked here, and a text that is not + /// one type name is the grammar's syntax error (RP-617). #[test] fn a_declared_type_is_looked_up() { for ok in [ @@ -53131,11 +53191,14 @@ mod rp573_declared_types { "text[3]", "x%type", "t.a%type", - "int(3)", ] { assert_eq!(refused(ok), None, "{ok}"); } let at = |sqlstate: &str, message: &str| Some((true, sqlstate.into(), message.into())); + assert_eq!( + refused("int(3)"), + at("42601", "syntax error at or near \"(\"") + ); assert_eq!( refused("nosuch573"), at("42704", "type \"nosuch573\" does not exist") diff --git a/tasks/backlog-rust-postgres.md b/tasks/backlog-rust-postgres.md index efdb1f638..849914435 100644 --- a/tasks/backlog-rust-postgres.md +++ b/tasks/backlog-rust-postgres.md @@ -3393,19 +3393,6 @@ RP-573 a DECLARE's type is looked up at CREATE FUNCTION and before a DO block runs (`check_plpgsql_declarations`), from the type text libpg_query keeps; what follows is what that lookup does not yet check. -- [ ] **A PL/pgSQL DECLARE whose type text is not one type name is - created.** `read_datatype` passes the text to `parse_datatype` unless - it is a `%TYPE` of a variable or column it finds, and a text that is - not one type name is 42601 at the token, with the CONTEXT `invalid - type name "..."`: on PostgreSQL 15.19 `declare x nosuch573%type` is - `syntax error at or near "%"` at 78, `y nosuch573.x%type` the same at - 87, `x int(3)` `syntax error at or near "("` at 72 and `x - varchar(nosuch)` `syntax error at or near "nosuch"` at 77. Here each - is created. libpg_query stubs the `%TYPE` lookups out - (`plpgsql_parse_wordtype` returns NULL), so finding the variable or - column is this server's to do, in the block scopes PL/pgSQL keeps. - Verify: tests/backlog/test_rp_found_rp573.py::test_declare_of_text_that_is_not_one_type_name - Backlog-ID: RP-617 - [ ] **A `pg_temp` type in a session with no temporary schema is a missing type, not a missing schema.** `LookupExplicitNamespace` finds `pg_temp` only once the session has made its temp schema, so on diff --git a/tests/backlog/test_rp_found_rp573.py b/tests/backlog/test_rp_found_rp573.py index 03b4af17a..382503307 100644 --- a/tests/backlog/test_rp_found_rp573.py +++ b/tests/backlog/test_rp_found_rp573.py @@ -89,8 +89,10 @@ def _compiled(dsn: str, queries: list[str]) -> list[Any]: ] -@pytest.mark.backlog("RP-617") +@pytest.mark.backlog_fixed("RP-617") def test_declare_of_text_that_is_not_one_type_name(dsn: str) -> None: + """A DECLARE whose type text was not one type name was created; + `typeStringToTypeName` refuses it with the grammar's syntax error.""" assert _compiled(dsn, NOT_ONE_TYPE_NAME) == [ ("42601", 'syntax error at or near "%"', "78", 'invalid type name "nosuch573%type"'), ("42601", 'syntax error at or near "%"', "87", 'invalid type name "nosuch573.x%type"'), From ff1223bfb46ee9cd1ccab65819f5317905bbb530 Mon Sep 17 00:00:00 2001 From: Joe Drumgoole Date: Sat, 14 Nov 2026 15:30:40 +0000 Subject: [PATCH 2/3] Rust PG server: a PL/pgSQL declaration keeps a quoted type name's case (RP-865) Co-Authored-By: Claude Opus 5.5 --- changelog.d/rp-865-quoted-declared-type.md | 11 ++++ crates/secantus-pg/src/plpgsql_fn.rs | 67 +++++++++++++++++++--- tasks/backlog-rust-postgres.md | 9 --- tests/backlog/test_rp_found_rp839.py | 3 +- 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 changelog.d/rp-865-quoted-declared-type.md diff --git a/changelog.d/rp-865-quoted-declared-type.md b/changelog.d/rp-865-quoted-declared-type.md new file mode 100644 index 000000000..f1279dd88 --- /dev/null +++ b/changelog.d/rp-865-quoted-declared-type.md @@ -0,0 +1,11 @@ +### A PL/pgSQL variable of a quoted type name keeps its case + +`declare x "Over845"` used to look up the type `over845`, and fail with +42704. The Rust PostgreSQL server now reads a declaration's type as the +grammar does, keeping a quoted name's case, so a variable of a mixed-case +domain is created and its constraints are checked when it is assigned. + +#### Fixed + +- A PL/pgSQL declaration of a quoted, mixed-case type name keeps its case. +- Fixes RP-865 (tests/backlog/test_rp_found_rp839.py::test_a_plpgsql_declaration_keeps_a_quoted_types_case) diff --git a/crates/secantus-pg/src/plpgsql_fn.rs b/crates/secantus-pg/src/plpgsql_fn.rs index 90c044840..1683ce0ca 100644 --- a/crates/secantus-pg/src/plpgsql_fn.rs +++ b/crates/secantus-pg/src/plpgsql_fn.rs @@ -1013,13 +1013,26 @@ pub fn declared_type_offset(body: &str, d: &Declared) -> Option { } /// A type name as PL/pgSQL records it (`pg_catalog.int4`, `int `, -/// `pg_catalog."integer"`) in the server's canonical spelling. +/// `pg_catalog."integer"`) in the server's canonical spelling. A quoted +/// name keeps its case, as the grammar reads it (RP-865); the rest folds. fn canonical_type(raw: &str) -> String { - let t = raw - .trim() - .trim_start_matches("pg_catalog.") - .replace('"', ""); - let t = t.trim().to_ascii_lowercase(); + let t = raw.trim(); + let t = t.strip_prefix("pg_catalog.").unwrap_or(t); + let mut folded = String::with_capacity(t.len()); + let mut chars = t.chars().peekable(); + let mut quoted = false; + while let Some(c) = chars.next() { + match c { + '"' if quoted && chars.peek() == Some(&'"') => { + chars.next(); + folded.push('"'); + } + '"' => quoted = !quoted, + c if quoted => folded.push(c), + c => folded.push(c.to_ascii_lowercase()), + } + } + let t = folded.trim().to_string(); let (base, array) = match t.strip_suffix("[]") { Some(b) => (b.trim().to_string(), true), None => (t, false), @@ -3683,8 +3696,34 @@ fn length_read_type(base: &str) -> String { } } +/// A canonical type (see [`canonical_type`]) as SQL text: a name the +/// grammar would fold (`Over845`) is quoted, so the cast names the same +/// type (RP-865). A modifier or `[]` after the name is kept as written. fn sql_type(ty: &str) -> String { - ty.to_string() + let plain = |w: &str| { + w.chars() + .next() + .is_some_and(|c| c.is_ascii_lowercase() || c == '_') + && w.chars() + .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '$') + }; + let end = ty.find(['(', '[']).unwrap_or(ty.len()); + let (name, rest) = ty.split_at(end); + let name = name.trim_end(); + if name.contains(' ') || name.split('.').all(plain) { + return ty.to_string(); + } + let quoted: Vec = name + .split('.') + .map(|w| { + if plain(w) { + w.to_string() + } else { + format!("\"{}\"", w.replace('"', "\"\"")) + } + }) + .collect(); + format!("{}{rest}", quoted.join(".")) } /// A `CALL`'s arguments as written: the variable each names (a named @@ -3730,6 +3769,20 @@ mod rp573_declarations { /// The variables a body declares, with their type text as written and /// their line; a routine's parameters and the compiler's own variables /// are not among them (RP-573). + /// A quoted type name keeps its case, and is quoted again where it is + /// spliced into a cast (RP-865). + #[test] + fn a_quoted_type_keeps_its_case() { + assert_eq!(canonical_type("\"Over845\""), "Over845"); + assert_eq!(canonical_type("public.\"My\"\"T\""), "public.My\"T"); + assert_eq!(canonical_type("pg_catalog.\"integer\""), "int4"); + assert_eq!(canonical_type("VARCHAR(3)"), "varchar(3)"); + assert_eq!(sql_type("Over845"), "\"Over845\""); + assert_eq!(sql_type("public.My\"T[]"), "public.\"My\"\"T\"[]"); + assert_eq!(sql_type("varchar(3)"), "varchar(3)"); + assert_eq!(sql_type("double precision"), "double precision"); + } + #[test] fn declared_types_are_the_bodys() { let sql = "create function f573(a int) returns int language plpgsql as $$\n\ diff --git a/tasks/backlog-rust-postgres.md b/tasks/backlog-rust-postgres.md index 849914435..0db22e694 100644 --- a/tasks/backlog-rust-postgres.md +++ b/tasks/backlog-rust-postgres.md @@ -3913,15 +3913,6 @@ Measured on PostgreSQL 15.19 (the shared reference on port 5415) with the `_SETUP` in `tests/backlog/test_rp_found_rp839.py` and `"Over845"` a domain over its `"Mx839"`. -- [ ] **A PL/pgSQL declaration folds a quoted type name to lower case.** - `do $$ declare x "Over845" := 5; begin raise notice '%', x; end $$` - prints `NOTICE: 5` on PostgreSQL 15.19 (`parse_datatype` reads the - type as the grammar does, keeping a quoted name's case), and an - assignment of 0 to such a variable is 23514 `value for domain - "Over845" violates check constraint "Mx839_check"`. Here each is - 42704 `type "over845" does not exist`. - Verify: tests/backlog/test_rp_found_rp839.py::test_a_plpgsql_declaration_keeps_a_quoted_types_case - Backlog-ID: RP-865 ## Found while working RP-692 (2026-11-10) diff --git a/tests/backlog/test_rp_found_rp839.py b/tests/backlog/test_rp_found_rp839.py index aacf33bb6..9533995a7 100644 --- a/tests/backlog/test_rp_found_rp839.py +++ b/tests/backlog/test_rp_found_rp839.py @@ -184,8 +184,9 @@ def test_a_char_columns_default_casts_to_bpchar(dsn: str) -> None: # quoted identifier's case, and a domain's errors name it quoted. Here the # quoted name is folded to lower case and not found (42704 `type "over845" # does not exist`). -@pytest.mark.backlog("RP-865") +@pytest.mark.backlog_fixed("RP-865") def test_a_plpgsql_declaration_keeps_a_quoted_types_case(dsn: str) -> None: + """A PL/pgSQL declaration folded a quoted type name to lower case.""" got = _answers( dsn, [ From f22c8202eb5a4fa8313c7651d5b61ee9507c427f Mon Sep 17 00:00:00 2001 From: Joe Drumgoole Date: Sat, 14 Nov 2026 16:05:17 +0000 Subject: [PATCH 3/3] Rust PG server: an escape-string literal's input error is placed (RP-867) Co-Authored-By: Claude Opus 5.5 --- .../rp-867-escaped-literal-position.md | 15 +++ crates/secantus-pgplan/src/errpos.rs | 106 +++++++++++++++++- tasks/backlog-rust-postgres.md | 13 --- tests/backlog/test_rp_found_rp605.py | 6 +- 4 files changed, 121 insertions(+), 19 deletions(-) create mode 100644 changelog.d/rp-867-escaped-literal-position.md diff --git a/changelog.d/rp-867-escaped-literal-position.md b/changelog.d/rp-867-escaped-literal-position.md new file mode 100644 index 000000000..6a1474bae --- /dev/null +++ b/changelog.d/rp-867-escaped-literal-position.md @@ -0,0 +1,15 @@ +### An escape-string literal's input error is placed + +`select E'a\tb'::int4` now reports its 22P02 at the literal, position 8, as +PostgreSQL 15.19 does. The error position was found by matching the value the +message quotes against each literal's spelling, and an escape-string literal +whose escapes decode to something else (a real tab for `\t`) never matched. +The literal's escapes are now decoded as the scanner decodes them before the +comparison, for plain casts and for `int2vector` / `oidvector` input alike. + +#### Fixed + +- Rust PG server: an input error from an `E'...'` literal holding an escape + carries the literal's position. + +Fixes RP-867 (tests/backlog/test_rp_found_rp605.py::test_escaped_literal_input_error_has_a_position) diff --git a/crates/secantus-pgplan/src/errpos.rs b/crates/secantus-pgplan/src/errpos.rs index 52c642165..12484625c 100644 --- a/crates/secantus-pgplan/src/errpos.rs +++ b/crates/secantus-pgplan/src/errpos.rs @@ -14,6 +14,68 @@ use super::*; struct Tok<'a> { start: usize, text: &'a str, + /// An escape-string literal with an escape: the plain literal its + /// value spells (`E'a\\tb'` as `'ab'`). + decoded: Option, +} + +/// The plain literal an escape-string literal's body (`a\\tb`, between +/// `E'` and `'`) reads as, its escapes decoded as the scanner decodes them +/// (`scan.l`'s `xe` rules): `\b \f \n \r \t`, octal `\ooo`, hex `\xhh`, +/// `\uXXXX`, `\UXXXXXXXX`, any other `\c` as `c`, and `''` as `'`. +/// `None` when an escape names no character. +fn decode_escape_literal(body: &str) -> Option { + let mut out = String::with_capacity(body.len()); + let mut it = body.chars().peekable(); + let take = |it: &mut std::iter::Peekable, n: usize, radix: u32| { + let mut v = 0u32; + let mut k = 0; + while k < n { + match it.peek().and_then(|c| c.to_digit(radix)) { + Some(d) => { + v = v * radix + d; + it.next(); + k += 1; + } + None => break, + } + } + (k > 0).then_some(v) + }; + while let Some(c) = it.next() { + match c { + '\'' => { + it.next_if_eq(&'\''); + out.push('\''); + } + '\\' => match it.next()? { + 'b' => out.push('\x08'), + 'f' => out.push('\x0c'), + 'n' => out.push('\n'), + 'r' => out.push('\r'), + 't' => out.push('\t'), + d @ '0'..='7' => { + let mut v = d as u32 - '0' as u32; + for _ in 0..2 { + match it.peek().and_then(|c| c.to_digit(8)) { + Some(x) => { + v = v * 8 + x; + it.next(); + } + None => break, + } + } + out.push(char::from_u32(v)?); + } + 'x' => out.push(char::from_u32(take(&mut it, 2, 16)?)?), + 'u' => out.push(char::from_u32(take(&mut it, 4, 16)?)?), + 'U' => out.push(char::from_u32(take(&mut it, 8, 16)?)?), + other => out.push(other), + }, + c => out.push(c), + } + } + Some(out) } fn unquote_ident(text: &str) -> String { @@ -93,7 +155,9 @@ fn element_literal(toks: &[Tok], value: &str) -> Option { w[1].text == "::" && crate::vectors::is_vector(&w[2].text.to_ascii_lowercase()) && w[0] - .text + .decoded + .as_deref() + .unwrap_or(w[0].text) .strip_prefix('\'') .and_then(|r| r.strip_suffix('\'')) .is_some_and(|body| vector_tail(&body.replace("''", "'"))) @@ -111,7 +175,7 @@ fn input_literal(toks: &[Tok], value: &str) -> Option { let lit = format!("'{}'", value.replace('\'', "''")); let i = toks .iter() - .position(|t| t.text == lit) + .position(|t| t.text == lit || t.decoded.as_deref() == Some(lit.as_str())) .or_else(|| element_literal(toks, value))?; // A literal cast to a string type first is a text VALUE when the // target's input function reads it, at execution, where there is @@ -324,11 +388,20 @@ pub fn error_position(sql: &str, sqlstate: &str, message: &str) -> Option // its `E`: under `standard_conforming_strings = off` every // plain literal reaches here rewritten as one // (`escape_strings`), and the `E` maps back to its quote. + let decoded = text + .get(..2) + .filter(|p| p.eq_ignore_ascii_case("E'") && text.contains('\\')) + .and_then(|_| decode_escape_literal(text.get(2..text.len().checked_sub(1)?)?)) + .map(|v| format!("'{}'", v.replace('\'', "''"))); let text = match text.get(..2) { Some("E'" | "e'") => &text[1..], _ => text, }; - Some(Tok { start: s, text }) + Some(Tok { + start: s, + text, + decoded, + }) }) .collect(); let pos = |start: usize| Some(sql.get(..start)?.chars().count() + 1); @@ -809,3 +882,30 @@ fn regtype_literal_names(tok: &str, full: &str) -> bool { text.to_ascii_lowercase() == full } } + +#[cfg(test)] +mod escape_literal_tests { + use super::*; + + #[test] + fn an_escaped_literal_input_error_is_placed_at_its_e() { + let msg = "invalid input syntax for type integer: \"a\tb\""; + assert_eq!( + error_position("select E'a\\tb'::int4", "22P02", msg), + Some(8) + ); + let msg = "invalid input syntax for type smallint: \"1\t2\""; + assert_eq!( + error_position("select E'1\\t2'::int2vector", "22P02", msg), + Some(8) + ); + } + + #[test] + fn escapes_decode_as_the_scanner_reads_them() { + assert_eq!( + decode_escape_literal(r"a\101\x42C\q''").as_deref(), + Some("aABCq'") + ); + } +} diff --git a/tasks/backlog-rust-postgres.md b/tasks/backlog-rust-postgres.md index 0db22e694..e51ff231a 100644 --- a/tasks/backlog-rust-postgres.md +++ b/tasks/backlog-rust-postgres.md @@ -4067,19 +4067,6 @@ statement is VALUES-only and runs there as written. The gap tests are in Verify: tests/backlog/test_rp_found_rp854.py::test_an_undefined_column_in_a_grouped_query_is_42703 Backlog-ID: RP-874 -## Found while working RP-605 (2026-11-11) - -Measured on PostgreSQL 15.19; none of it needs DDL. The gap tests are in -`tests/backlog/test_rp_found_rp605.py`. - -- [ ] **An escape-string literal's input error has no position when an - escape is in its value.** `select E'a\tb'::int4` is 22P02 at 8 on - PostgreSQL 15.19; here it has none, `errpos.rs` matching the quoted - value (with a real tab) against the literal's spelling (`\t`). - `E'x'::int4`, with no escape, is placed. - Verify: tests/backlog/test_rp_found_rp605.py::test_escaped_literal_input_error_has_a_position - Backlog-ID: RP-867 - ## Found while working RP-565 (2026-11-12) Measured on a private, freshly initdb'd PostgreSQL 15.19 cluster. The gap diff --git a/tests/backlog/test_rp_found_rp605.py b/tests/backlog/test_rp_found_rp605.py index 361e2ee23..444ff2c89 100644 --- a/tests/backlog/test_rp_found_rp605.py +++ b/tests/backlog/test_rp_found_rp605.py @@ -45,15 +45,15 @@ def test_out_of_range_literal_has_a_position(sql: str, dsn: str) -> None: assert _error(dsn, sql) == ("22003", OUT_OF_RANGE[sql], "8") -# An escape-string literal whose value holds a decoded escape: at the -# literal (position 8) too. +# An escape-string literal whose value holds a decoded escape was +# unplaced; it is at the literal (position 8) too. ESCAPED = { "select E'a\\tb'::int4": 'invalid input syntax for type integer: "a\tb"', "select E'1\\t2'::int2vector": 'invalid input syntax for type smallint: "1\t2"', } -@pytest.mark.backlog("RP-867") +@pytest.mark.backlog_fixed("RP-867") @pytest.mark.parametrize("sql", list(ESCAPED)) def test_escaped_literal_input_error_has_a_position(sql: str, dsn: str) -> None: assert _error(dsn, sql) == ("22P02", ESCAPED[sql], "8")