adelsz / pgtyped

pgTyped - Typesafe SQL in TypeScript
https://pgtyped.dev
MIT License
2.91k stars 94 forks source link

Variables inside DO block not detected #549

Open timvandam opened 9 months ago

timvandam commented 9 months ago

Describe the bug Variables inside of DO blocks (psql) are not detected, but it does compile just fine.

Expected behavior It should give the correct type for the query by detecting the variable

Test case

/* @name createNamedSequenceIfNotExists */
DO LANGUAGE plpgsql $$
BEGIN
    EXECUTE FORMAT('CREATE SEQUENCE IF NOT EXISTS %I', :sequenceName!);
END;
$$;

It generates the type

export type ICreateNamedSequenceIfNotExistsParams = void;