Skip to content

Bug: introspection queries #361

@euri10

Description

@euri10

Description

running a test suite using sqlspec and asyncpg I noticed the following log on my db, I suppose it's coming from sqlspec but not 100% sure.

2026-02-06 14:04:58.742 UTC [96] ERROR:  syntax error at or near ":" at character 494
2026-02-06 14:04:58.742 UTC [96] STATEMENT:  SELECT
	a.attname::text AS column_name,
	pg_catalog.pg_get_expr(d.adbin, d.adrelid)::text AS column_default,
	pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type,
	CASE WHEN a.attnotnull THEN 'NO' ELSE 'YES' END AS is_nullable
	FROM pg_catalog.pg_attribute AS a
	INNER JOIN pg_catalog.pg_class AS c ON a.attrelid = c.oid
	INNER JOIN pg_catalog.pg_namespace AS n ON c.relnamespace = n.oid
	LEFT JOIN
	pg_catalog.pg_attrdef AS d
	ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	WHERE
	c.relname =: table_name
	AND n.nspname =: schema_name
	AND a.attnum > 0
	AND NOT a.attisdropped
	ORDER BY a.attnum;

I suppose sqlspec runs some introspection queries ?
if yes and this comes from

WHERE c.relname = :table_name
then look at the slight difference ie the space, my docker db container tells me c.relname =: table_name

so there might be a slight error in the replacement of bind-parameters and I wouldnt be surprised if the casting above in the query with 2 colons doest mess with the parsing.

URL to code causing the issue

No response

MCVE

# Your MCVE code here

Steps to reproduce

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

"In the format of: ![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"

Logs

Package Version

0.38.4

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions