{"Entry":{"collection":"tool","key":"ecpg","name":"ecpg","aliases":["ecpg"],"metadata":{"aliases":["ecpg"],"category":"Client applications","content_hash":"42d17ba54eb3df3fe6d60c81df266b3556115000637f31dc1d2f902eb0941556","imported_at":"2026-09-30T00:40:33.936981+08:00","name":"ecpg","name_zh":"","slug":"ecpg","summary":"ecpg — embedded SQL C preprocessor"}},"Definition":{"Collection":"tool","Key":"ecpg","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"ecpg","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[],"options":[{"description":"Automatically generate certain C code from SQL code. Currently, this works for EXEC SQL TYPE .","names":["-c"],"signature":"-c"},{"description":"Set a compatibility mode. mode can be INFORMIX , INFORMIX_SE , or ORACLE .","names":["-C mode"],"signature":"-C mode"},{"description":"Define a preprocessor symbol, equivalently to the EXEC SQL DEFINE directive. If no value is specified, the symbol is defined with the value 1 .","names":["-D symbol [= value ]"],"signature":"-D symbol [= value ]"},{"description":"Process header files. When this option is specified, the output file extension becomes .h not .c , and the default input file extension is .pgh not .pgc . Also, the -c option is forced on.","names":["-h"],"signature":"-h"},{"description":"Parse system include files as well.","names":["-i"],"signature":"-i"},{"description":"Specify an additional include path, used to find files included via EXEC SQL INCLUDE . Defaults are . (current directory), /usr/local/include , the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include ), and /usr/include , in that order.","names":["-I directory"],"signature":"-I directory"},{"description":"Specifies that ecpg should write all its output to the given filename . Write -o - to send all output to standard output.","names":["-o filename"],"signature":"-o filename"},{"description":"Selects run-time behavior. Option can be one of the following: no_indicator Do not use indicators but instead use special values to represent null values. Historically there have been databases using this approach. prepare Prepare all statements before using them. Libecpg will keep a cache of prepared statements and reuse a statement if it gets executed again. If the cache runs full, libecpg will free the least used statement. questionmarks Allow question mark as placeholder for compatibility reasons. This used to be the default long ago.","names":["-r option"],"signature":"-r option"},{"description":"Turn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when EXEC SQL COMMIT is issued.","names":["-t"],"signature":"-t"},{"description":"Print additional information including the version and the \"include\" path.","names":["-v"],"signature":"-v"},{"description":"Print the ecpg version and exit.","names":["--version"],"signature":"--version"},{"description":"Show help about ecpg command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"}],"synopsis":["ecpg [ option ...] file ..."]},"comparison_hash":"9b115ab9dbd18516028622d20fe8fe477e01f88cb80ad0615213dea618875d6d","description":["ecpg — embedded SQL C preprocessor"],"environment":[],"facts":[{"label":"Documented executable","value":"ecpg"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"12"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-ECPG\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003eecpg\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003eecpg\u003c/span\u003e — embedded SQL C preprocessor\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.8.4.1\"\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] \u003cem class=\"replaceable\"\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e...\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-ECPG-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e will convert each input file given on the command line to the corresponding C output file. If an input file name does not have any extension, \u003ccode class=\"filename\"\u003e.pgc\u003c/code\u003e is assumed. The file's extension will be replaced by \u003ccode class=\"filename\"\u003e.c\u003c/code\u003e to construct the output file name. But the output file name can be overridden using the \u003ccode class=\"option\"\u003e-o\u003c/code\u003e option.\u003c/p\u003e\n\u003cp\u003eIf an input file name is just \u003ccode class=\"literal\"\u003e-\u003c/code\u003e, \u003ccode class=\"command\"\u003eecpg\u003c/code\u003e reads the program from standard input (and writes to standard output, unless that is overridden with \u003ccode class=\"option\"\u003e-o\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003eThis reference page does not describe the embedded SQL language. See \u003ca class=\"xref\" href=\"/docs/18/ecpg.html\" title=\"Chapter 34. ECPG — Embedded SQL in C\"\u003eChapter 34\u003c/a\u003e for more information on that topic.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.8.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAutomatically generate certain C code from SQL code. Currently, this works for \u003ccode class=\"literal\"\u003eEXEC SQL TYPE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C \u003cem class=\"replaceable\"\u003e\u003ccode\u003emode\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a compatibility mode. \u003cem class=\"replaceable\"\u003e\u003ccode\u003emode\u003c/code\u003e\u003c/em\u003e can be \u003ccode class=\"literal\"\u003eINFORMIX\u003c/code\u003e, \u003ccode class=\"literal\"\u003eINFORMIX_SE\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eORACLE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003esymbol\u003c/code\u003e\u003c/em\u003e[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefine a preprocessor symbol, equivalently to the \u003ccode class=\"command\"\u003eEXEC SQL DEFINE\u003c/code\u003e directive. If no \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified, the symbol is defined with the value \u003ccode class=\"literal\"\u003e1\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eProcess header files. When this option is specified, the output file extension becomes \u003ccode class=\"literal\"\u003e.h\u003c/code\u003e not \u003ccode class=\"literal\"\u003e.c\u003c/code\u003e, and the default input file extension is \u003ccode class=\"literal\"\u003e.pgh\u003c/code\u003e not \u003ccode class=\"literal\"\u003e.pgc\u003c/code\u003e. Also, the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option is forced on.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eParse system include files as well.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify an additional include path, used to find files included via \u003ccode class=\"literal\"\u003eEXEC SQL INCLUDE\u003c/code\u003e. Defaults are \u003ccode class=\"filename\"\u003e.\u003c/code\u003e (current directory), \u003ccode class=\"filename\"\u003e/usr/local/include\u003c/code\u003e, the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e include directory which is defined at compile time (default: \u003ccode class=\"filename\"\u003e/usr/local/pgsql/include\u003c/code\u003e), and \u003ccode class=\"filename\"\u003e/usr/include\u003c/code\u003e, in that order.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies that \u003ccode class=\"command\"\u003eecpg\u003c/code\u003e should write all its output to the given \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. Write \u003ccode class=\"literal\"\u003e-o -\u003c/code\u003e to send all output to standard output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects run-time behavior. \u003cem class=\"replaceable\"\u003e\u003ccode\u003eOption\u003c/code\u003e\u003c/em\u003e can be one of the following:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003eno_indicator\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not use indicators but instead use special values to represent null values. Historically there have been databases using this approach.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003eprepare\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrepare all statements before using them. Libecpg will keep a cache of prepared statements and reuse a statement if it gets executed again. If the cache runs full, libecpg will free the least used statement.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003equestionmarks\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllow question mark as placeholder for compatibility reasons. This used to be the default long ago.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eTurn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when \u003ccode class=\"command\"\u003eEXEC SQL COMMIT\u003c/code\u003e is issued.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint additional information including the version and the \"include\" path.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003eecpg\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003eecpg\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.8.7\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eWhen compiling the preprocessed C code files, the compiler needs to be able to find the \u003cspan class=\"application\"\u003eECPG\u003c/span\u003e header files in the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e include directory. Therefore, you might have to use the \u003ccode class=\"option\"\u003e-I\u003c/code\u003e option when invoking the compiler (e.g., \u003ccode class=\"literal\"\u003e-I/usr/local/pgsql/include\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003ePrograms using C code with embedded SQL have to be linked against the \u003ccode class=\"filename\"\u003elibecpg\u003c/code\u003e library, for example using the linker options \u003ccode class=\"literal\"\u003e-L/usr/local/pgsql/lib -lecpg\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe value of either of these directories that is appropriate for the installation can be found out using \u003ca class=\"xref\" href=\"/docs/18/app-pgconfig.html\" title=\"pg_config\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_config\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.8.8\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eIf you have an embedded SQL C source file named \u003ccode class=\"filename\"\u003eprog1.pgc\u003c/code\u003e, you can create an executable program using the following sequence of commands:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eecpg prog1.pgc\ncc -I/usr/local/pgsql/include -c prog1.c\ncc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-ecpg.html","options":[{"description":"Automatically generate certain C code from SQL code. Currently, this works for EXEC SQL TYPE .","names":["-c"],"signature":"-c","source_url":"/docs/18/app-ecpg.html","summary":"Automatically generate certain C code from SQL code. Currently, this works for EXEC SQL TYPE ."},{"description":"Set a compatibility mode. mode can be INFORMIX , INFORMIX_SE , or ORACLE .","names":["-C mode"],"signature":"-C mode","source_url":"/docs/18/app-ecpg.html","summary":"Set a compatibility mode. mode can be INFORMIX , INFORMIX_SE , or ORACLE ."},{"description":"Define a preprocessor symbol, equivalently to the EXEC SQL DEFINE directive. If no value is specified, the symbol is defined with the value 1 .","names":["-D symbol [= value ]"],"signature":"-D symbol [= value ]","source_url":"/docs/18/app-ecpg.html","summary":"Define a preprocessor symbol, equivalently to the EXEC SQL DEFINE directive. If no value is specified, the symbol is defined with the value 1 ."},{"description":"Process header files. When this option is specified, the output file extension becomes .h not .c , and the default input file extension is .pgh not .pgc . Also, the -c option is forced on.","names":["-h"],"signature":"-h","source_url":"/docs/18/app-ecpg.html","summary":"Process header files. When this option is specified, the output file extension becomes .h not .c , and the default input file extension is .pgh not .pgc . Also, the -c option is forced on."},{"description":"Parse system include files as well.","names":["-i"],"signature":"-i","source_url":"/docs/18/app-ecpg.html","summary":"Parse system include files as well."},{"description":"Specify an additional include path, used to find files included via EXEC SQL INCLUDE . Defaults are . (current directory), /usr/local/include , the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include ), and /usr/include , in that order.","names":["-I directory"],"signature":"-I directory","source_url":"/docs/18/app-ecpg.html","summary":"Specify an additional include path, used to find files included via EXEC SQL INCLUDE . Defaults are . (current directory), /usr/local/include , the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include ), and /usr/include , in that order."},{"description":"Specifies that ecpg should write all its output to the given filename . Write -o - to send all output to standard output.","names":["-o filename"],"signature":"-o filename","source_url":"/docs/18/app-ecpg.html","summary":"Specifies that ecpg should write all its output to the given filename . Write -o - to send all output to standard output."},{"description":"Selects run-time behavior. Option can be one of the following: no_indicator Do not use indicators but instead use special values to represent null values. Historically there have been databases using this approach. prepare Prepare all statements before using them. Libecpg will keep a cache of prepared statements and reuse a statement if it gets executed again. If the cache runs full, libecpg will free the least used statement. questionmarks Allow question mark as placeholder for compatibility reasons. This used to be the default long ago.","names":["-r option"],"signature":"-r option","source_url":"/docs/18/app-ecpg.html","summary":"Selects run-time behavior. Option can be one of the following:"},{"description":"Turn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when EXEC SQL COMMIT is issued.","names":["-t"],"signature":"-t","source_url":"/docs/18/app-ecpg.html","summary":"Turn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when EXEC SQL COMMIT is issued."},{"description":"Print additional information including the version and the \"include\" path.","names":["-v"],"signature":"-v","source_url":"/docs/18/app-ecpg.html","summary":"Print additional information including the version and the \"include\" path."},{"description":"Print the ecpg version and exit.","names":["--version"],"signature":"--version","source_url":"/docs/18/app-ecpg.html","summary":"Print the ecpg version and exit."},{"description":"Show help about ecpg command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-ecpg.html","summary":"Show help about ecpg command line arguments, and exit."}],"related":[],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"signature":"ecpg [ option ...] file ...","sources":[{"anchor":"","file":"app-ecpg.html","label":"18.6 English manual · app-ecpg.html","sha256":"46e369f91d3516a728d286bbeab8bf7500f9e5016436847622154cb3777b5173","url":"/docs/18/app-ecpg.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["ecpg [ option ...] file ..."],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-c","url":"/docs/18/app-ecpg.html"},"summary":"Automatically generate certain C code from SQL code. Currently, this works for EXEC SQL TYPE ."},{"signature":{"text":"-C mode","url":"/docs/18/app-ecpg.html"},"summary":"Set a compatibility mode. mode can be INFORMIX , INFORMIX_SE , or ORACLE ."},{"signature":{"text":"-D symbol [= value ]","url":"/docs/18/app-ecpg.html"},"summary":"Define a preprocessor symbol, equivalently to the EXEC SQL DEFINE directive. If no value is specified, the symbol is defined with the value 1 ."},{"signature":{"text":"-h","url":"/docs/18/app-ecpg.html"},"summary":"Process header files. When this option is specified, the output file extension becomes .h not .c , and the default input file extension is .pgh not .pgc . Also, the -c option is forced on."},{"signature":{"text":"-i","url":"/docs/18/app-ecpg.html"},"summary":"Parse system include files as well."},{"signature":{"text":"-I directory","url":"/docs/18/app-ecpg.html"},"summary":"Specify an additional include path, used to find files included via EXEC SQL INCLUDE . Defaults are . (current directory), /usr/local/include , the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include ), and /usr/include , in that order."},{"signature":{"text":"-o filename","url":"/docs/18/app-ecpg.html"},"summary":"Specifies that ecpg should write all its output to the given filename . Write -o - to send all output to standard output."},{"signature":{"text":"-r option","url":"/docs/18/app-ecpg.html"},"summary":"Selects run-time behavior. Option can be one of the following:"},{"signature":{"text":"-t","url":"/docs/18/app-ecpg.html"},"summary":"Turn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when EXEC SQL COMMIT is issued."},{"signature":{"text":"-v","url":"/docs/18/app-ecpg.html"},"summary":"Print additional information including the version and the \"include\" path."},{"signature":{"text":"--version","url":"/docs/18/app-ecpg.html"},"summary":"Print the ecpg version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-ecpg.html"},"summary":"Show help about ecpg command line arguments, and exit."}],"title":"Documented options"}]},"ManualEvidence":{"manual_path":"app-ecpg.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-ecpg.html","label":"18.6 English manual · app-ecpg.html","sha256":"46e369f91d3516a728d286bbeab8bf7500f9e5016436847622154cb3777b5173","url":"/docs/18/app-ecpg.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"ecpg","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ecpg","Summary":"ecpg — embedded SQL C preprocessor","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-ECPG\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003eecpg\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003eecpg\u003c/span\u003e — embedded SQL C preprocessor\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.8.4.1\"\u003e\u003ccode\u003eecpg\u003c/code\u003e [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] \u003cem\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e...\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-ECPG-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003eecpg\u003c/code\u003e is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003eecpg\u003c/code\u003e will convert each input file given on the command line to the corresponding C output file. If an input file name does not have any extension, \u003ccode\u003e.pgc\u003c/code\u003e is assumed. The file\u0026#39;s extension will be replaced by \u003ccode\u003e.c\u003c/code\u003e to construct the output file name. But the output file name can be overridden using the \u003ccode\u003e-o\u003c/code\u003e option.\u003c/p\u003e\n\u003cp\u003eIf an input file name is just \u003ccode\u003e-\u003c/code\u003e, \u003ccode\u003eecpg\u003c/code\u003e reads the program from standard input (and writes to standard output, unless that is overridden with \u003ccode\u003e-o\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003eThis reference page does not describe the embedded SQL language. See \u003ca href=\"/docs/18/ecpg.html\" rel=\"nofollow\"\u003eChapter 34\u003c/a\u003e for more information on that topic.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.8.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003eecpg\u003c/code\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-c\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAutomatically generate certain C code from SQL code. Currently, this works for \u003ccode\u003eEXEC SQL TYPE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-C \u003cem\u003e\u003ccode\u003emode\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a compatibility mode. \u003cem\u003e\u003ccode\u003emode\u003c/code\u003e\u003c/em\u003e can be \u003ccode\u003eINFORMIX\u003c/code\u003e, \u003ccode\u003eINFORMIX_SE\u003c/code\u003e, or \u003ccode\u003eORACLE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-D \u003cem\u003e\u003ccode\u003esymbol\u003c/code\u003e\u003c/em\u003e[=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefine a preprocessor symbol, equivalently to the \u003ccode\u003eEXEC SQL DEFINE\u003c/code\u003e directive. If no \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified, the symbol is defined with the value \u003ccode\u003e1\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eProcess header files. When this option is specified, the output file extension becomes \u003ccode\u003e.h\u003c/code\u003e not \u003ccode\u003e.c\u003c/code\u003e, and the default input file extension is \u003ccode\u003e.pgh\u003c/code\u003e not \u003ccode\u003e.pgc\u003c/code\u003e. Also, the \u003ccode\u003e-c\u003c/code\u003e option is forced on.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eParse system include files as well.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-I \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify an additional include path, used to find files included via \u003ccode\u003eEXEC SQL INCLUDE\u003c/code\u003e. Defaults are \u003ccode\u003e.\u003c/code\u003e (current directory), \u003ccode\u003e/usr/local/include\u003c/code\u003e, the \u003cspan\u003ePostgreSQL\u003c/span\u003e include directory which is defined at compile time (default: \u003ccode\u003e/usr/local/pgsql/include\u003c/code\u003e), and \u003ccode\u003e/usr/include\u003c/code\u003e, in that order.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-o \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies that \u003ccode\u003eecpg\u003c/code\u003e should write all its output to the given \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. Write \u003ccode\u003e-o -\u003c/code\u003e to send all output to standard output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-r \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects run-time behavior. \u003cem\u003e\u003ccode\u003eOption\u003c/code\u003e\u003c/em\u003e can be one of the following:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eno_indicator\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not use indicators but instead use special values to represent null values. Historically there have been databases using this approach.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eprepare\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrepare all statements before using them. Libecpg will keep a cache of prepared statements and reuse a statement if it gets executed again. If the cache runs full, libecpg will free the least used statement.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003equestionmarks\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllow question mark as placeholder for compatibility reasons. This used to be the default long ago.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eTurn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when \u003ccode\u003eEXEC SQL COMMIT\u003c/code\u003e is issued.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint additional information including the version and the \u0026#34;include\u0026#34; path.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003eecpg\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003eecpg\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.8.7\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eWhen compiling the preprocessed C code files, the compiler needs to be able to find the \u003cspan\u003eECPG\u003c/span\u003e header files in the \u003cspan\u003ePostgreSQL\u003c/span\u003e include directory. Therefore, you might have to use the \u003ccode\u003e-I\u003c/code\u003e option when invoking the compiler (e.g., \u003ccode\u003e-I/usr/local/pgsql/include\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003ePrograms using C code with embedded SQL have to be linked against the \u003ccode\u003elibecpg\u003c/code\u003e library, for example using the linker options \u003ccode\u003e-L/usr/local/pgsql/lib -lecpg\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe value of either of these directories that is appropriate for the installation can be found out using \u003ca href=\"/docs/18/app-pgconfig.html\" title=\"pg_config\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_config\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.8.8\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eIf you have an embedded SQL C source file named \u003ccode\u003eprog1.pgc\u003c/code\u003e, you can create an executable program using the following sequence of commands:\u003c/p\u003e\n\u003cpre\u003eecpg prog1.pgc\ncc -I/usr/local/pgsql/include -c prog1.c\ncc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"7f00527fb0b9f683bb44c0fe10602541cbe7b428a3a950399c154d8ea2d48ef8","Payload":{"description":["ecpg — embedded SQL C preprocessor"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-ECPG\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003eecpg\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003eecpg\u003c/span\u003e — embedded SQL C preprocessor\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.8.4.1\"\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] \u003cem class=\"replaceable\"\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e...\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-ECPG-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e will convert each input file given on the command line to the corresponding C output file. If an input file name does not have any extension, \u003ccode class=\"filename\"\u003e.pgc\u003c/code\u003e is assumed. The file's extension will be replaced by \u003ccode class=\"filename\"\u003e.c\u003c/code\u003e to construct the output file name. But the output file name can be overridden using the \u003ccode class=\"option\"\u003e-o\u003c/code\u003e option.\u003c/p\u003e\n\u003cp\u003eIf an input file name is just \u003ccode class=\"literal\"\u003e-\u003c/code\u003e, \u003ccode class=\"command\"\u003eecpg\u003c/code\u003e reads the program from standard input (and writes to standard output, unless that is overridden with \u003ccode class=\"option\"\u003e-o\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003eThis reference page does not describe the embedded SQL language. See \u003ca class=\"xref\" href=\"/docs/18/ecpg.html\" title=\"Chapter 34. ECPG — Embedded SQL in C\"\u003eChapter 34\u003c/a\u003e for more information on that topic.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.8.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eecpg\u003c/code\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAutomatically generate certain C code from SQL code. Currently, this works for \u003ccode class=\"literal\"\u003eEXEC SQL TYPE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C \u003cem class=\"replaceable\"\u003e\u003ccode\u003emode\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a compatibility mode. \u003cem class=\"replaceable\"\u003e\u003ccode\u003emode\u003c/code\u003e\u003c/em\u003e can be \u003ccode class=\"literal\"\u003eINFORMIX\u003c/code\u003e, \u003ccode class=\"literal\"\u003eINFORMIX_SE\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eORACLE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003esymbol\u003c/code\u003e\u003c/em\u003e[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefine a preprocessor symbol, equivalently to the \u003ccode class=\"command\"\u003eEXEC SQL DEFINE\u003c/code\u003e directive. If no \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified, the symbol is defined with the value \u003ccode class=\"literal\"\u003e1\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eProcess header files. When this option is specified, the output file extension becomes \u003ccode class=\"literal\"\u003e.h\u003c/code\u003e not \u003ccode class=\"literal\"\u003e.c\u003c/code\u003e, and the default input file extension is \u003ccode class=\"literal\"\u003e.pgh\u003c/code\u003e not \u003ccode class=\"literal\"\u003e.pgc\u003c/code\u003e. Also, the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option is forced on.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eParse system include files as well.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify an additional include path, used to find files included via \u003ccode class=\"literal\"\u003eEXEC SQL INCLUDE\u003c/code\u003e. Defaults are \u003ccode class=\"filename\"\u003e.\u003c/code\u003e (current directory), \u003ccode class=\"filename\"\u003e/usr/local/include\u003c/code\u003e, the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e include directory which is defined at compile time (default: \u003ccode class=\"filename\"\u003e/usr/local/pgsql/include\u003c/code\u003e), and \u003ccode class=\"filename\"\u003e/usr/include\u003c/code\u003e, in that order.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies that \u003ccode class=\"command\"\u003eecpg\u003c/code\u003e should write all its output to the given \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. Write \u003ccode class=\"literal\"\u003e-o -\u003c/code\u003e to send all output to standard output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects run-time behavior. \u003cem class=\"replaceable\"\u003e\u003ccode\u003eOption\u003c/code\u003e\u003c/em\u003e can be one of the following:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003eno_indicator\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not use indicators but instead use special values to represent null values. Historically there have been databases using this approach.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003eprepare\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrepare all statements before using them. Libecpg will keep a cache of prepared statements and reuse a statement if it gets executed again. If the cache runs full, libecpg will free the least used statement.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003equestionmarks\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllow question mark as placeholder for compatibility reasons. This used to be the default long ago.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eTurn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when \u003ccode class=\"command\"\u003eEXEC SQL COMMIT\u003c/code\u003e is issued.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint additional information including the version and the \"include\" path.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003eecpg\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003eecpg\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.8.7\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eWhen compiling the preprocessed C code files, the compiler needs to be able to find the \u003cspan class=\"application\"\u003eECPG\u003c/span\u003e header files in the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e include directory. Therefore, you might have to use the \u003ccode class=\"option\"\u003e-I\u003c/code\u003e option when invoking the compiler (e.g., \u003ccode class=\"literal\"\u003e-I/usr/local/pgsql/include\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003ePrograms using C code with embedded SQL have to be linked against the \u003ccode class=\"filename\"\u003elibecpg\u003c/code\u003e library, for example using the linker options \u003ccode class=\"literal\"\u003e-L/usr/local/pgsql/lib -lecpg\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe value of either of these directories that is appropriate for the installation can be found out using \u003ca class=\"xref\" href=\"/docs/18/app-pgconfig.html\" title=\"pg_config\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_config\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.8.8\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eIf you have an embedded SQL C source file named \u003ccode class=\"filename\"\u003eprog1.pgc\u003c/code\u003e, you can create an executable program using the following sequence of commands:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eecpg prog1.pgc\ncc -I/usr/local/pgsql/include -c prog1.c\ncc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-c","url":"/docs/18/app-ecpg.html"},"summary":"Automatically generate certain C code from SQL code. Currently, this works for EXEC SQL TYPE ."},{"signature":{"text":"-C mode","url":"/docs/18/app-ecpg.html"},"summary":"Set a compatibility mode. mode can be INFORMIX , INFORMIX_SE , or ORACLE ."},{"signature":{"text":"-D symbol [= value ]","url":"/docs/18/app-ecpg.html"},"summary":"Define a preprocessor symbol, equivalently to the EXEC SQL DEFINE directive. If no value is specified, the symbol is defined with the value 1 ."},{"signature":{"text":"-h","url":"/docs/18/app-ecpg.html"},"summary":"Process header files. When this option is specified, the output file extension becomes .h not .c , and the default input file extension is .pgh not .pgc . Also, the -c option is forced on."},{"signature":{"text":"-i","url":"/docs/18/app-ecpg.html"},"summary":"Parse system include files as well."},{"signature":{"text":"-I directory","url":"/docs/18/app-ecpg.html"},"summary":"Specify an additional include path, used to find files included via EXEC SQL INCLUDE . Defaults are . (current directory), /usr/local/include , the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include ), and /usr/include , in that order."},{"signature":{"text":"-o filename","url":"/docs/18/app-ecpg.html"},"summary":"Specifies that ecpg should write all its output to the given filename . Write -o - to send all output to standard output."},{"signature":{"text":"-r option","url":"/docs/18/app-ecpg.html"},"summary":"Selects run-time behavior. Option can be one of the following:"},{"signature":{"text":"-t","url":"/docs/18/app-ecpg.html"},"summary":"Turn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit transaction block. In the default mode, commands are committed only when EXEC SQL COMMIT is issued."},{"signature":{"text":"-v","url":"/docs/18/app-ecpg.html"},"summary":"Print additional information including the version and the \"include\" path."},{"signature":{"text":"--version","url":"/docs/18/app-ecpg.html"},"summary":"Print the ecpg version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-ecpg.html"},"summary":"Show help about ecpg command line arguments, and exit."}],"title":"Documented options"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
