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

Composites -- Built-in postgres table types #250

Open
DanSantimore opened this issue Oct 7, 2022 · 1 comment
Open

Composites -- Built-in postgres table types #250

DanSantimore opened this issue Oct 7, 2022 · 1 comment
Milestone

Comments

@DanSantimore
Copy link

This is a question on supported functionality that I don't see address explicitly in the docs.

When I create a table in postgres, it generates a type with the same name, which I can then use in a function. E.g., table name = "tracking" so I can write a function like this:

CREATE OR REPLACE FUNCTION platform.public.tracking_insert (items tracking[]) RETURNS TABLE(key varchar, status varchar)
    AS $$ Blah Blah $$ LANGUAGE SQL;

Should I expect that to be resolvable using DataTypeName on NpgsqlParameter like so?:

new NpgsqlParameter<List<MachineTestTracking>>() { TypedValue = _items, DataTypeName = "tracking"}

Further technical details

Npgsql version: 6.0.5
PostgreSQL version: 12.11

Thanks for the quick look!

@roji
Copy link
Member

roji commented Oct 7, 2022

Yes, that's possible - but you have to opt into Npgsql loading the composite type definitions for these tables by setting Load Table Composites=true in the connection strings (see docs). It's true that it would be good to mention this on the enums & composites page.

@roji roji transferred this issue from npgsql/npgsql Oct 7, 2022
@roji roji added this to the 7.0.0 milestone Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants