Create table in Postgressql [duplicate] - postgresql

This question already has answers here:
Dataclip Error ERROR: cannot execute INSERT in a read-only transaction [duplicate]
(1 answer)
`ERROR: cannot execute TRUNCATE TABLE in a read-only transaction` in Heroku PostgreSQL
(3 answers)
Closed 10 months ago.
I'm trying to create a data table in Postgress in Heroku.
While creating a table I'm getting ERROR: cannot execute CREATE TABLE in a read-only transaction error.
Select commands are working fine, but creating table not working.
What permission I'm missing?
I'm trying to do this using Dataclips and https://app.popsql.com/

Hello salesforce developper,
You seem to have a problem with the credentials of your user. If you read the documentation you will see that the default user credential allow only
Run SELECT on tables in the database
INSERT new data
UPDATE data
DELETE data from tables
On Postgres 10 and above, view some usage statistics and monitoring data
So you need to go to the Credentials tab, find the credential you want to configure, and select one of the permission levels. The levels are:
No permissions — no access privileges on any table in the database
Read-only permissions — read access on every table in the database
Read-write permissions — read and write access on every table in the database, including the ability to delete data, plus the ability to generate values from sequences
Configuring permissions on an existing credential```
More information at:
https://devcenter.heroku.com/articles/heroku-postgresql-credentials#creating-a-new-credential

Related

"row is too big (...) maximum size 8160" when running "grant connect on database"

I'm facing weird issue with postgres 11.
I'm creating a bunch of users and then assigning them some roles but also letting them to connect to certain database.
After successfully creating 2478 roles when I try to create new user I get this error:
db=# create user foo;
CREATE ROLE
db=# grant connect on database db to foo;
ERROR: row is too big: size 8168, maximum size 8160
Same error shows up in db log.
I checked if db volume is not running out of space, there is still 1T to spare there...
I can't imagine postgres trying to insert more than 8k when running simple grant...?
edit:
It seems there was similar question asked already (usage privileges on schema):
ERROR: row is too big: size 8168, maximum size 8164
So the solution would be to create one role, say connect_to_my_db and grant connect to that role, and then instead of running GRANT connect to each user do GRANT connect_to_my_db.
You found the solution yourself, let me add an explanation of the cause of the error:
Each table row is stored in one of the 8KB blocks of the table, so that is its size limit.
Normal tables have a TOAST table, where long attributes can be stored out-of-line. This allows PostgreSQL to store very long rows.
Now system catalog tables do not have TOAST tables, so rows are limited to 8KB size.
The access control list of an object is stored in the object's catalog, so many permissions on a table can exceed the limit.
Be glad — if you had to manage permissions for thousands of users individually, you'd end up in DBA hell anyway.

Upload .csv to postgresql database - Datagrip vs. DbVisualizer

All, I have extensively researched this, and spoken with our Database admin/CTO and we've done our best to solve before posting.
I want to upload .csv data to a postgresql table (call it my_table)
I have the following grants for it:
DELETE,
INSERT,
SELECT,
TRUNCATE,
UPDATE,
The upload works great with DbVisualizer Pro (I have a trial version), but Datagrip (which I paid for) says I need to be the Table Owner (which creates problems elsewhere = above my pay grade)
What am I missing? I get the same result whether I use the GUI or write an UPDATE query
ERROR: must be owner of relation my_table.
[42501] ERROR: must be owner of relation my_table
Turn off Disable Indices and Triggers, Lock table (may be faster)

Linking MS Access table to PG Admin schema

I would like to link a MS Access table to a table in PG admin if it is possible for use in a Postgres query. I have searched for an answer but all I can find is answers for listing postgres tables in Access which is almost the opposite of what I want to do.
I want to be able to access the data entered in an access form without having to continually import the data into a table in PG Admin.
I'm not even sure that is possible but any method that is easier than importing the table into PG Admin every day would be useful.
Thanks
Gary
Try the PostgreSQL OGR Foreign Data Wrapper. Its built for spatial data, but it works perfectly well with non-spatial tables. If you have the PostGIS extension installed you will already have it.
https://github.com/pramsey/pgsql-ogr-fdw
There are several examples on that page, but the command
ogr_fdw_info -s <pathToAccessFile> -l <tablename>
will return create server and a create foreign table statements which you can edit as required then run in pgAdmin.

How to create a table in postgreSQL without execute DDL script

I'm creating an application where the user can create tables in database (by using an assistant).
Sometimes I get a deadlock because I can't modify database structure while sessions are active (AccessExclusiveLock).
I'm trying to find a way to create a table without executing DDL script.
( or to figure out my current problem )

Do not have select privilege for temporary table in db2 stored procedure

I am running a stored procedure in DB2 10.1 which creates a created global temporary table and it returns the following error message that seems to say that it cannot select from the temporary table that it has just created in the same stored procedure
"USER" does not have the required authorization or privilege to
perform operation "SELECT" on object "MYSCHEMA.MYTABLE"..
SQLCODE=-551, SQLSTATE=42501, DRIVER=4.16.53
I have not encountered this problem with the other stored procedures and they create temp tables in the same way. The user privileges are controlled by groups, but due to issues with the groups I have started to give privileges to the users directly.
I cannot grant select permissions to the temp table because its not yet created and not sure how to fix this situation.
Has anyone come across this problem before and if so how did you fix it?
Thanks for any help.