sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Missing check for update on PostgreSQL

Open ghost opened this issue 4 years ago • 0 comments

The following query is compiled, although it should not, since the is_deleted column does not exist.

UPDATE
	public.articles
SET
	is_deleted = TRUE
WHERE
	id = $1;

Schema:

CREATE TABLE public.articles (
    id integer NOT NULL,
    company integer NOT NULL,
    name text NOT NULL,
    sort_order integer DEFAULT 0 NOT NULL,
    object_type smallint NOT NULL,
    image text,
    "group" integer,
    notes text DEFAULT ''::text NOT NULL
);

I am using PostgreSQL 13.

https://play.sqlc.dev/p/3b7f89f370c2d2f1aff72fb0953a00d98d52ec2cc195d848dca81cacec4c3344

ghost avatar Feb 07 '21 13:02 ghost