8

On https://www.enterprisedb.com/downloads/postgres-postgresql-downloads :

PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, macOS, Solaris), and Windows. It offers the following programming languages: PL/pgSQL, PL/SQL, Java, Python, Ruby, C/C+, PHP, Perl, Tcl, Scheme. Postgres also offers the following Library interfaces: OCI, libpq, JDBC, ODBC, .NET, Perl, Python, Ruby, C/C+, PHP, Lisp, Scheme, and Qt.

I use PHP and PostgreSQL. I send and receive data with the PHP extension pg_*, which uses/is libpq. I've done this for like two decades.

What do they mean that PostgreSQL "offers" PHP, before it lists the "library interfaces"? And in that list of "library interfaces", it confusingly again lists PHP...

Am I missing something fundamental? Does PostgreSQL allow me to mix PHP syntax into SQL queries or something crazy like that?

2
  • 1
    I'd say that is sloppy wording. Read: There is a PHP interface to PostgreSQL. Oct 5, 2021 at 6:22
  • 2
    Since you are asking what a vendor (or anyone really) means by a statement on their website, you should also ask them directly: enterprisedb.com/contact Oct 5, 2021 at 14:50

1 Answer 1

9

Language extensions allow you to write user-defined functions in additional programming languages. Most people are aware of SQL and PL/pgSQL, but Postgres also ships with extensions for Perl, Python, and Tcl. Here is the introduction to procedural languages from the Postgres documentation. You can't quite "mix" the syntax, but you could write a complex analytical function in Python and run it inside your Postgres instance with a simple SELECT.

Some quick googling finds that third parties have produced language extensions for PHP and Java, so I'm guessing EDB's marketing team took those and ran with them. PL/PHP hasn't been updated in over a decade and PL/Java was offered by EDB themselves on earlier versions of their server, so take those statements with a grain of salt.

"Library interfaces" refers what are more commonly known as drivers. These drivers provide connections and services from a programming language to the Postgres server. You're familiar with the pgsql driver in PHP, which is fairly simple; compare that to the features provided by the psycopg2 driver for Python, which provides type-specific conversions and bindings to native Python objects.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.