Description
Bug Description
I have a table in Postgres with the following structure:
which is then mapped to the following model:
since upgrading to verison 1.13.0 InsertAsync has started returning an empty GUID for the identifier:
It works fine if the account used to connect to the database is a member of the super user role or is the owner of the table but fails when I use a normal user account that is not the owner which makes me think it might have something to do with information schema permissions. The same code worked using the previous version of RepoDb.
Interestingly the synchronous version of Insert does not seem to be effected.
Additional information:
I believe RepoDb is executing the following SQL internally to get informaiton about the table:
SELECT c.column_name , Cast(( CASE
WHEN c.column_name = tmp.column_name THEN 1 ELSE 0 END) AS BOOLEAN) AS isprimary , CASE
WHEN c.is_identity = 'YES' OR position('NEXTVAL' IN upper(c.column_default)) >= 1 THEN true
ELSE false
END AS isidentity , cast(c.is_nullable AS boolean) AS isnullable , c.data_type AS datatype , CASE
WHEN c.column_default IS NOT NULL THEN true
ELSE false
END AS hasdefaultvalue
FROM information_schema.columns c
LEFT JOIN ( SELECT c.table_schema , c.table_name , c.column_name , c.column_default
FROM information_schema.table_constraints tc
JOIN information_schema.constraint_column_usage AS ccu
using (constraint_schema, constraint_name) JOIN information_schema.columns AS c
ON c.table_schema = tc.constraint_schema
AND tc.table_name = c.table_name
AND ccu.column_name = c.column_name
WHERE tc.constraint_type = 'PRIMARY KEY' ) tmp
ON tmp.table_schema = c.table_schema
AND tmp.table_name = c.table_name
AND tmp.column_name = c.column_name
WHERE c.table_name = 'asset_type'AND c.table_schema = 'public';`
when I execute this as a superuser I get:
but when I execute the same query as a normal user i get the following results: