electric-sql / pglite

Lightweight Postgres packaged as WASM into a TypeScript library for the browser, Node.js, Bun and Deno
https://electric-sql.com
Apache License 2.0
4.76k stars 81 forks source link

Missing has_parameter_privilege function #66

Closed kamilogorek closed 3 months ago

kamilogorek commented 3 months ago

Currently, pglite is using a fork of v15 (as per https://github.com/electric-sql/pglite/issues/57), however despite has_parameter_privilege function being added in said v15, it's not possible to call it and it will throw with function has_parameter_privilege does not exist.

I checked a few other privilege functions, and they work as expected, eg.

SELECT pg_has_role('pg_read_all_settings', 'MEMBER');
SELECT has_column_privilege('test', 'name', 'SELECT');
SELECT has_schema_privilege('public', 'USAGE');

ref: https://pgpedia.info/h/has_parameter_privilege.html ref: https://pgpedia.info/p/privilege.html

samwillis commented 3 months ago

PGlite is currently built on a fork of v15 dev (https://github.com/electric-sql/postgres-wasm/commits/base/) from Jul 13, 2021. has_parameter_privilege was added in an Apr 6, 2022 commit https://github.com/postgres/postgres/commit/a0ffa885e478f5eeacc4e250e35ce25a4740c487

As you noted #57 will fix this.

The footprint on of our changes are not large, and so it shouldn't be a big job to rebase.

kamilogorek commented 3 months ago

Ah, good catch, thanks! Will close this one so it's not lingering on the Issues page. And if someone searches for a similar issue, they'll stumble upon it here anyway.