Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: must be owner of type character varying or type json

I need to cast varchar to json using:

CREATE CAST (character varying AS json) WITHOUT FUNCTION as ASSIGNMENT;

Connecting to Postgres with the master account of my RDS Postgres instance, I get the following error

ERROR:  must be owner of type character varying or type json

The owner is rdsadmin:

\dT+ varchar                                                      
               List of data types
Schema   |       Name        | Internal name | Size | Elements |  Owner   | Access privileges |                            Description
------------+-------------------+---------------+------+----------+----------+-------------------+-------------------------------------------------------------------
 pg_catalog | character varying | varchar       | var  |          | rdsadmin |                   | varchar(length), non-blank-padded string, variable storage length

Now I don't have rdsadmin password, is there any other way to run this query?

like image 569
Guardian Avatar asked Oct 20 '25 03:10

Guardian


1 Answers

I don't think you can bootstrap your way to the full rdsadmin privileges.

However it seems that you can make yourself the owner of types:

ALTER TYPE json OWNER TO myowner;

And then you can create casts for that type to your heart's content.

like image 90
Rachel K. Westmacott Avatar answered Oct 22 '25 21:10

Rachel K. Westmacott