Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to overcome the ERROR: permission denied for language c

The answer for ERROR: permission denied for language c is not working for me:

$ psql -U postgres -d postgres
psql (15.4 (Debian 15.4-1.pgdg120+1))

postgres=> CREATE DATABASE books;
CREATE DATABASE
postgres=> \c books
You are now connected to database "books" as user "postgres".

postgres=> CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
ERROR:  permission denied for language c
postgres=> UPDATE pg_language SET lanpltrusted = true WHERE lanname LIKE 'c';
ERROR:  permission denied for table pg_language

This CREATE EXTENSION IF NOT EXISTS "uuid-ossp" is the first thing that I need to do, else I’ll get errors like:

ERROR: function uuid_generate_v4() does not exist

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

However, it is blocked by permission denied for language c. How can I make it work please?

>Solution :

You need to be a superuser to create C language functions.

And you should never, ever update catalog tables. Fortunately, since you were not a superuser, you were kept from shooting yourself in the foot.

If you yourself don’t have superuser access (and I hope you don’t, given what you were trying to do here), you’ll have to ask your DBA to run these statements for you.

Finally, you don’t need that extension to generate random UUIDs. Recent versions of PostgreSQL have gen_random_uuid().

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading