demetrixbio / FSharp.Data.Npgsql

F# type providers to support statically typed access to input parameters and result set of sql statement in idiomatic F# way. Data modifications via statically typed tables.
Apache License 2.0
127 stars 16 forks source link

Adding a (failing) test case for inserting to table with generated columns #90

Closed legezam closed 4 years ago

legezam commented 4 years ago

This new test case is for demonstrating the issue with type provider.

The issue is basically this: If you are trying to insert a row to a table with generated columns, even if you don't supply value for the generated column, the type provider attempts to insert to that column. At least the error i get suggests that:

42601: cannot insert into column "result"

table def:

--
-- Name: table_with_computed_columns; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.table_with_computed_columns (
    id integer NOT NULL,
    operand_1 integer NOT NULL,
    operand_2 integer NOT NULL,
    result integer GENERATED ALWAYS AS ((operand_1 * operand_2)) STORED
);