Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Transaction Isolation Level #345

Open
lxndrcx opened this issue Nov 10, 2023 · 2 comments
Open

Connection Transaction Isolation Level #345

lxndrcx opened this issue Nov 10, 2023 · 2 comments

Comments

@lxndrcx
Copy link

lxndrcx commented Nov 10, 2023

Question

Is there a way (or could there be) to set the TRANSACTION ISOLATION LEVEL for the whole connection? I am connecting to a database with hundreds of tables, so I am using the schema import to get them all.

I have seen #200 and I understand I control it on a table-by-table basis using WITH in queries. This is not convenient for hundreds of tables.

I think it's possible to set the isolation level per connection (or at least per transaction), so it would be helpful to be able to set that in the Foreign Server configuration.

Thanks in advance for reading my question.


I'll include version information even though I'm not suggesting there is an issue:

Operating system

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"

Version of tds_fdw

List of installed extensions
  Name   | Version |   Schema   |                                    Description                                    
---------+---------+------------+-----------------------------------------------------------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 tds_fdw | 2.0.3   | public     | Foreign data wrapper for querying a TDS database (Sybase or Microsoft SQL Server)

Version of PostgreSQL

version                                                           
-----------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)

Version of FreeTDS

ii  freetds-common            1.2.3-1                      all          configuration files for FreeTDS SQL client libraries
@GeoffMontee
Copy link
Collaborator

This is not currently possible, but this is a great feature request. Thanks!

@GeoffMontee
Copy link
Collaborator

If anyone wants to submit a pull request for this, it looks like one way to implement it would be to call dbsetopt() and set DBISOLATION: https://github.com/FreeTDS/freetds/blob/4dc87b0800b67f3dbf4eddbdf35eab3bc133d2f7/src/dblib/dblib.c#L4495

Of course, another way would be to execute SET TRANSACTION ISOLATION LEVEL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants