Re: Add PGDLLIMPORT to enable_hashagg
On Wed, Feb 21, 2018 at 10:14 AM, Andres Freundwrote: > Could you take the relevant commit, backport it to the > relevant branches, resolve conflicts, make possibly appropriate > adaptions, and post? > The original commit touched some new variables and therefore didn't apply cleanly. Attached are equivalent patches for REL_10_STABLE and REL9_6_STABLE. From 3e2c0a444a0e07792408841a629d83797ff5883a Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 9 Feb 2018 15:54:45 -0500 Subject: [PATCH] Mark assorted GUC variables as PGDLLIMPORT. This makes life easier for extension authors. --- src/include/miscadmin.h | 2 +- src/include/optimizer/cost.h | 30 +++--- src/include/optimizer/paths.h | 8 src/include/utils/guc.h | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 6eacd2a..e76b4b9 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -158,7 +158,7 @@ extern PGDLLIMPORT int NBuffers; extern PGDLLIMPORT int MaxBackends; extern PGDLLIMPORT int MaxConnections; extern PGDLLIMPORT int max_worker_processes; -extern int max_parallel_workers; +extern PGDLLIMPORT int max_parallel_workers; extern PGDLLIMPORT int MyProcPid; extern PGDLLIMPORT pg_time_t MyStartTime; diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 63feba0..7925e4c 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -53,21 +53,21 @@ extern PGDLLIMPORT double cpu_operator_cost; extern PGDLLIMPORT double parallel_tuple_cost; extern PGDLLIMPORT double parallel_setup_cost; extern PGDLLIMPORT int effective_cache_size; -extern Cost disable_cost; -extern int max_parallel_workers_per_gather; -extern bool enable_seqscan; -extern bool enable_indexscan; -extern bool enable_indexonlyscan; -extern bool enable_bitmapscan; -extern bool enable_tidscan; -extern bool enable_sort; -extern bool enable_hashagg; -extern bool enable_nestloop; -extern bool enable_material; -extern bool enable_mergejoin; -extern bool enable_hashjoin; -extern bool enable_gathermerge; -extern int constraint_exclusion; +extern PGDLLIMPORT Cost disable_cost; +extern PGDLLIMPORT int max_parallel_workers_per_gather; +extern PGDLLIMPORT bool enable_seqscan; +extern PGDLLIMPORT bool enable_indexscan; +extern PGDLLIMPORT bool enable_indexonlyscan; +extern PGDLLIMPORT bool enable_bitmapscan; +extern PGDLLIMPORT bool enable_tidscan; +extern PGDLLIMPORT bool enable_sort; +extern PGDLLIMPORT bool enable_hashagg; +extern PGDLLIMPORT bool enable_nestloop; +extern PGDLLIMPORT bool enable_material; +extern PGDLLIMPORT bool enable_mergejoin; +extern PGDLLIMPORT bool enable_hashjoin; +extern PGDLLIMPORT bool enable_gathermerge; +extern PGDLLIMPORT int constraint_exclusion; extern double clamp_row_est(double nrows); extern double index_pages_fetched(double tuples_fetched, BlockNumber pages, diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 4e06b2e..f22fe0a 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -20,10 +20,10 @@ /* * allpaths.c */ -extern bool enable_geqo; -extern int geqo_threshold; -extern int min_parallel_table_scan_size; -extern int min_parallel_index_scan_size; +extern PGDLLIMPORT bool enable_geqo; +extern PGDLLIMPORT int geqo_threshold; +extern PGDLLIMPORT int min_parallel_table_scan_size; +extern PGDLLIMPORT int min_parallel_index_scan_size; /* Hook for plugins to get control in set_rel_pathlist() */ typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index b89e8e8..6bcc904 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -262,7 +262,7 @@ extern char *HbaFileName; extern char *IdentFileName; extern char *external_pid_file; -extern char *application_name; +extern PGDLLIMPORT char *application_name; extern int tcp_keepalives_idle; extern int tcp_keepalives_interval; -- 2.7.4 From 4d7e9c6dd32d68e2b9d87325f5dbbedbef6ce886 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 9 Feb 2018 15:54:45 -0500 Subject: [PATCH] Mark assorted GUC variables as PGDLLIMPORT. This makes life easier for extension authors. --- src/include/optimizer/cost.h | 28 ++-- src/include/optimizer/paths.h | 6 +++--- src/include/utils/guc.h | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 2a4df2f..214e868 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -53,20 +53,20 @@ extern PGDLLIMPORT double cpu_operator_cost; extern PGDLLIMPORT double parallel_tuple_cost; extern PGDLLIMPORT double parallel_setup_cost; extern PGDLLIMPORT int effective_cache_size; -extern Cost disable_cost; -extern int
Re: Add PGDLLIMPORT to enable_hashagg
On Fri, Feb 9, 2018 at 1:01 PM, Robert Haaswrote: > > Committed. Thanks for committing this! We forgot to ask though, could you please backport this patch to 10 and maybe even 9.6? As-is I don't think these variables will be available until PG 11.
Re: Add PGDLLIMPORT lines to some variables
Sorry, I'm new to pg-hackers, so I'm not sure what the next step is. Do I submit this to commitfest? When submitting, do I submit multiple changes, one per branch this should be packported to?
Add PGDLLIMPORT lines to some variables
Hello hackers, I'm porting Citus to Windows and found that we use some variables which PG doesn't export; here is a patch which adds PGDLLIMPORT declarations to those variables. This is unfortunately required on Windows for extensions to be able to use those variables, and appears to already have been done to quite a few other variables. From 3c412b4fee7e4343b070ea85ee8b29f3ec4cc244 Mon Sep 17 00:00:00 2001 From: Brian Cloutier <git...@briancloutier.com> Date: Tue, 31 Oct 2017 17:53:42 -0700 Subject: [PATCH] Add PGDLLIMPORT declarations to some variables On Windows, PGDLLIMPORT is required for variables to be exported, for those variables to be importable by extensions. Add PGDLLIMPORT to some variables which extensions might want to use. MSDN documentation: https://docs.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-declspec-dllexport --- src/include/access/twophase.h | 2 +- src/include/commands/extension.h| 2 +- src/include/miscadmin.h | 10 +- src/include/postmaster/postmaster.h | 4 ++-- src/include/storage/fd.h| 2 +- src/include/storage/proc.h | 4 ++-- src/include/tcop/dest.h | 2 +- src/include/tcop/tcopprot.h | 2 +- src/include/utils/guc.h | 6 +++--- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index 54dec4e..f5fbbea 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -25,7 +25,7 @@ typedef struct GlobalTransactionData *GlobalTransaction; /* GUC variable */ -extern int max_prepared_xacts; +extern PGDLLIMPORT int max_prepared_xacts; extern Size TwoPhaseShmemSize(void); extern void TwoPhaseShmemInit(void); diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h index 73bba3c..551cf2b 100644 --- a/src/include/commands/extension.h +++ b/src/include/commands/extension.h @@ -28,7 +28,7 @@ * them from the extension first. */ extern PGDLLIMPORT bool creating_extension; -extern Oid CurrentExtensionObject; +extern PGDLLIMPORT Oid CurrentExtensionObject; extern ObjectAddress CreateExtension(ParseState *pstate, CreateExtensionStmt *stmt); diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index dad98de..1877769 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -150,14 +150,14 @@ extern PGDLLIMPORT bool IsUnderPostmaster; extern PGDLLIMPORT bool IsBackgroundWorker; extern PGDLLIMPORT bool IsBinaryUpgrade; -extern bool ExitOnAnyError; +extern PGDLLIMPORT bool ExitOnAnyError; extern PGDLLIMPORT char *DataDir; extern PGDLLIMPORT int NBuffers; -extern int MaxBackends; -extern int MaxConnections; -extern int max_worker_processes; +extern PGDLLIMPORT int MaxBackends; +extern PGDLLIMPORT int MaxConnections; +extern PGDLLIMPORT int max_worker_processes; extern int max_parallel_workers; extern PGDLLIMPORT int MyProcPid; @@ -238,7 +238,7 @@ extern PGDLLIMPORT int IntervalStyle; #define MAXTZLEN 10 /* max TZ name len, not counting tr. null */ extern bool enableFsync; -extern bool allowSystemTableMods; +extern PGDLLIMPORT bool allowSystemTableMods; extern PGDLLIMPORT int work_mem; extern PGDLLIMPORT int maintenance_work_mem; extern PGDLLIMPORT int replacement_sort_tuples; diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h index 0f85908..5925160 100644 --- a/src/include/postmaster/postmaster.h +++ b/src/include/postmaster/postmaster.h @@ -16,7 +16,7 @@ /* GUC options */ extern bool EnableSSL; extern int ReservedBackends; -extern int PostPortNumber; +extern PGDLLIMPORT int PostPortNumber; extern int Unix_socket_permissions; extern char *Unix_socket_group; extern char *Unix_socket_directories; @@ -44,7 +44,7 @@ extern int postmaster_alive_fds[2]; #define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ #endif -extern const char *progname; +extern PGDLLIMPORT const char *progname; extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn(); extern void ClosePostmasterPorts(bool am_syslogger); diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index faef39e..ea2ab8f 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -52,7 +52,7 @@ typedef int File; /* GUC parameter */ -extern int max_files_per_process; +extern PGDLLIMPORT int max_files_per_process; /* * This is private to fd.c, but exported for save/restore_backend_variables() diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 7dbaa81..2e59821 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -255,7 +255,7 @@ typedef struct PROC_HDR int startupBufferPinWaitBufId; } PROC_HDR; -extern PROC_HDR *ProcGlobal; +extern PGDLLIMPORT PROC_HDR *ProcGlobal; extern PGPROC *PreparedXactProcs; @@ -273,7 +273,7 @@ extern PGPROC *PreparedXactProcs; #define NUM_AUXILIARY_PROCS 4 /* config