Home > OS >  Postgresql: join readonly database with csv-file
Postgresql: join readonly database with csv-file

Time:10-26

The task is to join data from local cdv-file with data from remote database. On this database I have readonly writes. So I can't create new tables in this db.

Only recommended way (which I have found) to do this is to: 1. Create new table in db 2. Copy (import) content of csv-file in this new table. 3. Make join between tables.

But I have no writes to create any tables in my database.

What another possible way solve this problem

CodePudding user response:

You cannot join with something that is not a database object, so you will have to create an object in the database.

The least invasive method is to use a file_fdw foreign table for the CSV file and join that with the table. Then you don't have to modify the foreign table definition if you modify the file.

  • Related