|
13 | 13 | * included by libpq client programs. In particular, a libpq client
|
14 | 14 | * should not assume that the encoding IDs used by the version of libpq
|
15 | 15 | * it's linked to match up with the IDs declared here.
|
| 16 | + * To help prevent mistakes, relevant functions that are exported by |
| 17 | + * libpq have a physically different name when being referenced |
| 18 | + * statically. |
16 | 19 | *
|
17 | 20 | *-------------------------------------------------------------------------
|
18 | 21 | */
|
@@ -562,6 +565,23 @@ surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second)
|
562 | 565 | }
|
563 | 566 |
|
564 | 567 |
|
| 568 | +/* |
| 569 | + * The functions in this list are exported by libpq, and we need to be sure |
| 570 | + * that we know which calls are satisfied by libpq and which are satisfied |
| 571 | + * by static linkage to libpgcommon. (This is because we might be using a |
| 572 | + * libpq.so that's of a different major version and has encoding IDs that |
| 573 | + * differ from the current version's.) The nominal function names are what |
| 574 | + * are actually used in and exported by libpq, while the names exported by |
| 575 | + * libpgcommon.a and libpgcommon_srv.a end in "_private". |
| 576 | + */ |
| 577 | +#if defined(USE_PRIVATE_ENCODING_FUNCS) || !defined(FRONTEND) |
| 578 | +#define pg_char_to_encoding pg_char_to_encoding_private |
| 579 | +#define pg_encoding_to_char pg_encoding_to_char_private |
| 580 | +#define pg_valid_server_encoding pg_valid_server_encoding_private |
| 581 | +#define pg_valid_server_encoding_id pg_valid_server_encoding_id_private |
| 582 | +#define pg_utf_mblen pg_utf_mblen_private |
| 583 | +#endif |
| 584 | + |
565 | 585 | /*
|
566 | 586 | * These functions are considered part of libpq's exported API and
|
567 | 587 | * are also declared in libpq-fe.h.
|
|
0 commit comments