I am trying to copy my PostgreSQL query result set into an excel file since Tableau Public does not connect to PostgreSQL.
I am unsure how to get my result set into excel. I've been watching countless YouTube vids and read numerous stack overflow & postgresql threads to no avail. I am using postgresql 14 on pgadmin on a Mac. Appreciate any response!
The code below is what I tried and I get this error message:
copy (select * from emp) to '/Users/my_name/Desktop/sql_query.csv' with csv
ERROR: could not open file "/Users/my_name/Desktop/sql_query.csv" for writing: Permission denied
HINT: COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy.
SQL state: 42501
I also tried \copy and got this error message:
ERROR: syntax error at or near "\"
LINE 1: \copy (select * from emp) to '/Users/my_name/Desktop/sq...
^
SQL state: 42601
Character: 1
Related
I am new to Postgres and we are using it for tests reports, we had an issue with our environment that entered duplicate keys to one of the table and since then we are getting this message when trying to run migration scripts:
error: migration failed: right sibling's left-link doesn't match: block 9550 links to 12028 instead of expected 12027 in index "log_attach_id_idx" in line 0: UPDATE log SET project_id = (SELECT project_id FROM item_project WHERE item_project.item_id=log.item_id LIMIT 1); (details: pq: right sibling's left-link doesn't match: block 9550 links to 12028 instead of expected 12027 in index "log_attach_id_idx")
I tried to run pg_dump and got this error:
pg_dump: error: query was: SELECT pg_catalog.pg_get_viewdef('457544'::pg_catalog.oid) AS viewdef
pg_dumpall: error: pg_dump failed on database "reportportal", exiting
Can anyone help here?
Restore your backup, and research what parameters you changed and what you did to end up with data corruption in the first place.
PostgreSQL. When I try to backup the database via pgAdmin, I get error
pg_dump: error: Dumping the contents of table "filearchives" failed: PQgetResult() failed.
pg_dump: error: Error message from server: ������: missing chunk number 0 for toast value 1508672 in pg_toast_1245716
pg_dump: error: The command was: COPY public.filearchives (id, usedtime, docid, options, filesize, filename, stream) TO stdout;"
I followed these instructions: https://gist.github.com/supix/80f9a6111dc954cf38ee99b9dedf187a
There were similar errors for REINDEX and VACUUM on the main table (filearchives), but nothing for pg_toast and I was able to select all rows in the main table (filearchives), while there was supposed to be "Corrupted chunk read!".
When I do it via psql, there is no error message, but the backup is incomplete.
The database itself is working fine at the moment.
How to recover the database without removing records? Is there a way to create a backup?
I am running the following query in dBVisualizer
select top 100 * from analytical.dwh_sales where _material = '000032';
And is working propertly
But when the same query is executed in another computer (an export from my dBVisualizer installation to another machine) we are having the following error:
[Code: 500310, SQL State: 42703] [Amazon](500310) Invalid operation: column "loc_XXX " does not exist in dwh_sales;
I dont if you can notice is adding a space to loc_XXX(space) . Not sure if is why is working in a computer and not in another.
After trying to upgrade a shadow-copy of our PostgreSQL 9.6.6 RDS instance to 10.4, most operations on the database, including those done with a "root" user (the one created when setting up the database), result in an error like this:
SQL Error [42501]: ERROR: permission denied for schema public
Position: 15
Another example is a query like select * from example_table limit 100; which results in the error:
SQL Error [42P01]: ERROR: relation "example_table" does not exist
Position: 15
ERROR: relation "example_table" does not exist
Position: 15
ERROR: relation "example_table" does not exist
Position: 15
However, I am able to execute SELECT * FROM pg_catalog.pg_tables where schemaname = 'public'; which correctly lists all my tables
The upgrade logs don't seem to show anything unusual. I've been unable to find any RDS-specific instructions on upgrading from 9.x to 10.x so I assumed that the normal upgrade procedure in the interface (which I've used in the past and seems to be using a pg_upgrade operation) would "just work". Is there anything I'm missing?
When you run a query in db2 commandline tool you get explanations like:
db2 => select * from sysibm.systables where owner = 'SAM' and type = 'T';
SQL0206N "OWNER" is not valid in the context where it is used.
SQLSTATE=42703
However, when ran in SQL tab in SquirrelSQL you get only:
Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=OWNER, DRIVER=4.13.127
SQLState: 42703
ErrorCode: -206
Does anybody know of a way of making SquirrelSQL display explanation for the error code like db2 cmd line?
OS: Win 7 x64, db2 10.1
There's a bug in DB2 plugin, I have managed to fix it and posted solution at http://sourceforge.net/p/squirrel-sql/bugs/1073/