postgresql_16:5.3.15 Informix Compatibility Mode
PostgreSQL 16 > Client Interfaces > ECPG — Embedded SQL in C > Informix Compatibility Mode
ecpg can be run in a so-called *Informix compatibility mode*. If this mode is active, it tries to behave as if it were the Informix precompiler for Informix E/SQL. Generally spoken this will allow you to use the dollar sign instead of the EXEC SQL primitive to introduce embedded SQL commands: $int j = 3; $CONNECT TO :dbname; $CREATE TABLE test(i INT PRIMARY KEY, j INT); $INSERT INTO test(i, j) VALUES (7, :j); $COMMIT;
Note
There must not be any white space between the $ and a following preprocessor directive, that is, include, define, ifdef, etc. Otherwise, the preprocessor will parse the token as a host variable.
There are two compatibility modes: INFORMIX, INFORMIX_SE
When linking programs that use this compatibility mode, remember to link against libcompat that is shipped with ECPG.
Besides the previously explained syntactic sugar, the Informix compatibility mode ports some functions for input, output and transformation of data as well as embedded SQL statements known from E/SQL to ECPG.
Informix compatibility mode is closely connected to the pgtypeslib library of ECPG. pgtypeslib maps SQL data types to data types within the C host program and most of the additional functions of the Informix compatibility mode allow you to operate on those C host program types. Note however that the extent of the compatibility is limited. It does not try to copy Informix behavior; it allows you to do more or less the same operations and gives you functions that have the same name and the same basic behavior but it is no drop-in replacement if you are using Informix at the moment. Moreover, some of the data types are different. For example, PostgreSQL's datetime and interval types do not know about ranges like for example YEAR TO MINUTE so you won't find support in ECPG for that either.
Subsections
- postgresql_16:5.3.15.1 Additional Types
- postgresql_16:5.3.15.2 Additional/Missing Embedded SQL Statements
- postgresql_16:5.3.15.3 Informix-compatible SQLDA Descriptor Areas
- postgresql_16:5.3.15.4 Additional Functions
- postgresql_16:5.3.15.5 Additional Constants