.net - PostgreSQL equivalent to SQL Server's TVP -


sql server has table value parameters allows pass array of values parameter.

what appropiate way achieve similar postgresql query can like:

select * product id in ($1)

i'm using npgsql .net library.

https://www.nuget.org/packages/npgsql/3.0.5

in postgresql can use arrays instead of list of ids like:

... id = any('{1, 2, 3}'::int[]) 

or

... id = any(array[1, 2, 3]) 

which means id 1 of array's items.

read more arrays operators , functions.

to pass array parameter third party languages can use @ least first variant:

... id = any($1 ::int[]) 

where $1 string parameter looks {1, 2, 3}. note space between $1 , ::int[] - may necessary clients.

not sure c# supports array parameters directly.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -