🌐 AI搜索 & 代理 主页
Skip to content

Commit 409543d

Browse files
committed
Move pg_int64 back to postgres_ext.h
Fix for commit 3c86223. That commit moved the typedef of pg_int64 from postgres_ext.h to libpq-fe.h, because the only remaining place where it might be used is libpq users, and since the type is obsolete, the intent was to limit its scope. The problem is that if someone builds an extension against an older (pre-PG18) server version and a new (PG18) libpq, they might get two typedefs, depending on include file order. This is not allowed under C99, so they might get warnings or errors, depending on the compiler and options. The underlying types might also be different (e.g., long int vs. long long int), which would also lead to errors. This scenario is plausible when using the standard Debian packaging, which provides only the newest libpq but per-major-version server packages. The fix is to undo that part of commit 3c86223. That way, the typedef is in the same header file across versions. At least, this is the safest fix doable before PostgreSQL 18 releases. Reviewed-by: Thomas Munro <thomas.munro@gmail.com> Discussion: https://www.postgresql.org/message-id/25144219-5142-4589-89f8-4e76948b32db%40eisentraut.org
1 parent 176002c commit 409543d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/include/postgres_ext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#ifndef POSTGRES_EXT_H
2525
#define POSTGRES_EXT_H
2626

27+
#include <stdint.h>
28+
2729
/*
2830
* Object ID is a fundamental type in Postgres.
2931
*/
@@ -42,6 +44,9 @@ typedef unsigned int Oid;
4244
/* the above needs <stdlib.h> */
4345

4446

47+
/* deprecated name for int64_t, formerly used in client API declarations */
48+
typedef int64_t pg_int64;
49+
4550
/*
4651
* Identifiers of error message fields. Kept here to keep common
4752
* between frontend and backend, and also to export them to libpq

src/interfaces/libpq/libpq-fe.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,6 @@ typedef struct pgNotify
234234
struct pgNotify *next; /* list link */
235235
} PGnotify;
236236

237-
/* deprecated name for int64_t */
238-
typedef int64_t pg_int64;
239-
240237
/* pg_usec_time_t is like time_t, but with microsecond resolution */
241238
typedef int64_t pg_usec_time_t;
242239

0 commit comments

Comments
 (0)