Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlsmith: internal error, trailing bytes in encoded value #104323

Closed
irfansharif opened this issue Jun 5, 2023 · 4 comments
Closed

sqlsmith: internal error, trailing bytes in encoded value #104323

irfansharif opened this issue Jun 5, 2023 · 4 comments
Assignees
Labels
branch-master Failures and bugs on the master branch. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. C-test-failure Broken test (automatically or manually discovered). O-roachtest T-sql-queries SQL Queries Team

Comments

@irfansharif
Copy link
Contributor

irfansharif commented Jun 5, 2023

I saw the following assertion trip up in a CI run.

	test artifacts and logs in: /artifacts/sqlsmith/setup=empty/setting=no-mutations/run_1
(sqlsmith.go:240).func3: error: pq: internal error: 35 trailing bytes in encoded value: [15 15 20 64 0 0 1 144 0 0 4 144 0 0 8 116 101 115 116 106 115 111 110 15 16 0 8 148 245 167 155 5 176 156 27]
stmt:
WITH
	with5045 ("c%qol41326")
		AS (
			SELECT
				*
			FROM
				(
					VALUES
						(🙄func273()),
						((NULL, '{"test": "json"}':::JSONB, (), '1992-03-04 16:39:38.000223+00':::TIMESTAMPTZ)),
						(
							(NULL, '[{"EvG": [true, "baz", false], "MPRRONv": 0.2980103397565371, "foo": {"8rNz5y": true, "baz": null, "kRMYs": false}, "uyRcxposI": "foo"}, {"1rMfbBSOg": {"USyO": true}, "Li5": 1.261090300252655, "a": "7c7QH82", "nsAleYB": "rga3g"}, {"bar": 2.439379404706056}, true, 0.23533439446032228]':::JSONB, (), NULL)
						)
				)
					AS "\\uE1B1t%Ab 21645" ("c%qol41326")
		)
SELECT
	"c%40te_ref1478"."c%qol41326" AS "c͚oL41327"
FROM
	with5045 AS "c%40te_ref1478"
GROUP BY
	"c%40te_ref1478"."c%qol41326"
HAVING
	bool_and(true::BOOL)::BOOL
LIMIT
	95:::INT8;
[20:17:12]	--- FAIL: sqlsmith/setup=empty/setting=no-mutations (413.48s)

Jira issue: CRDB-28467

@irfansharif irfansharif added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. C-test-failure Broken test (automatically or manually discovered). O-roachtest branch-master Failures and bugs on the master branch. labels Jun 5, 2023
@blathers-crl blathers-crl bot added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jun 5, 2023
@rafiss rafiss removed the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jun 6, 2023
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Jun 6, 2023
@cucaroach
Copy link
Contributor

I'm probably being paranoid but could be related to: #101693

@DrewKimball
Copy link
Collaborator

Full repro should look like this:

CREATE FUNCTION 🙄func273()
	RETURNS RECORD
	STABLE
	LANGUAGE SQL
	AS $funcbody$SELECT (NULL,) AS col26062 FROM (VALUES (2137750727:::OID, 1599972205:::OID, NULL), (0:::OID, 492979399:::OID, 2455666027:::OID), (2751738740:::OID, 4243148485:::OID, 51225265:::OID)) AS """tab13358" (col26059, col26060, col26061) WHERE NULL$funcbody$;

WITH
	with5045 ("c%qol41326")
		AS (
			SELECT
				*
			FROM
				(
					VALUES
						(🙄func273()),
						((NULL, '{"test": "json"}':::JSONB, (), '1992-03-04 16:39:38.000223+00':::TIMESTAMPTZ)),
						(
							(NULL, '[{"EvG": [true, "baz", false], "MPRRONv": 0.2980103397565371, "foo": {"8rNz5y": true, "baz": null, "kRMYs": false}, "uyRcxposI": "foo"}, {"1rMfbBSOg": {"USyO": true}, "Li5": 1.261090300252655, "a": "7c7QH82", "nsAleYB": "rga3g"}, {"bar": 2.439379404706056}, true, 0.23533439446032228]':::JSONB, (), NULL)
						)
				)
					AS "\\uE1B1t%Ab 21645" ("c%qol41326")
		)
SELECT
	"c%40te_ref1478"."c%qol41326" AS "cÍšoL41327"
FROM
	with5045 AS "c%40te_ref1478"
GROUP BY
	"c%40te_ref1478"."c%qol41326"
HAVING
	bool_and(true::BOOL)::BOOL
LIMIT
	95:::INT8;

But running on master, 23.1.2, and 23.1.0 results in a build-time error:

ERROR: VALUES types tuple{unknown, jsonb, tuple, timestamptz} and tuple{unknown} cannot be matched

The JSON syntax is unimplemented in 22.2.

I think this was likely introduced by #98162 and fixed by #103078, so we should be good to close it out.

@irfansharif
Copy link
Contributor Author

(Confirmed that the SHA the CI run was from didn't include 8b1d21e.)

@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. C-test-failure Broken test (automatically or manually discovered). O-roachtest T-sql-queries SQL Queries Team
Projects
Archived in project
Development

No branches or pull requests

6 participants