2

My current programming project has me accessing a PostgreSQL database in Python3 using psycopg2 library. Although everything is going well, I am finding there are subtle differences between the open-source PostgreSQL and the EnterpriseDB version (also known as Postgres Plus Advanced Server or PPAS). Thus, I need to be able to determine if a database connection is to a PPAS instance or a regular PostgreSQL instance.

Is there a way to do this via the psycopg2 API or by querying the database?

I suspect there might be a way to do this using SELECT version() but I am unsure what possible values I might see to indicate which platform I am on.

Ben Russell
  • 127
  • 1
  • 6

1 Answers1

0

Assuming PPAS is a superset (?) of Postgresql you can issue a query calling a function or system table that only exists in PPAS.

  • If it succeeds it's PPAS.
  • If it fails then it's not PPAS and should be Postgresql. Or you are unlucky enough to be some other kind of error.
cachique
  • 1,150
  • 1
  • 12
  • 16