keboola / db-writer-pgsql

Postgre SQL Database Writer
MIT License
0 stars 1 forks source link

New Feature: creating TEMP tables in PostgreSQL #54

Closed lotharschulz closed 4 months ago

lotharschulz commented 4 months ago

fix: #55

Proposed changes are:

Puzzler: given this repository, I could not find functions that call the create function. I assume these functions could be also modified so we - as Keboola customers (as well as all other customers) - can benefit from the new/missing functionality.

The create table documentation reads:

If specified, the table is created as a temporary table. Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction (see ON COMMIT below). The default search_path includes the temporary schema first and so identically named existing permanent tables are not chosen for new plans while the temporary table exists, unless they are referenced with schema-qualified names. Any indexes created on a temporary table are automatically temporary as well.

I could not find documentation about the session context. I just assume in this PR, that https://github.com/keboola/db-writer-pgsql/blob/master/src/Writer/Pgsql.php#L163 does not close a session, thats why the adapted tests include: https://github.com/keboola/db-writer-pgsql/commit/aec5105fe4a547124f7fc7551504b6dcf845fe08#diff-81aaf09773b0b78a851ec6b56a65f84bd2d7c93988d368bad0ceec860dc9251bR121

lotharschulz commented 4 months ago

I close this in favour of https://github.com/keboola/db-writer-pgsql/pull/54