patch-on-extension.patch

application/octet-stream

Filename: patch-on-extension.patch
Type: application/octet-stream
Part: 0
Message: Re: Extensions support for pg_dump, patch v27

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
doc/src/sgml/catalogs.sgml 0 0
src/backend/commands/conversioncmds.c 0 0
src/backend/commands/extension.c 0 0
src/backend/utils/adt/genfile.c 0 0
src/backend/utils/adt/varlena.c 0 0
src/backend/utils/init/postinit.c 0 0
src/backend/utils/misc/guc.c 0 0
src/bin/psql/tab-complete.c 0 0
src/include/commands/extension.h 0 0
src/include/utils/genfile.h 0 0
src/test/regress/expected/rules.out 0 0
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index edd2be1..c333a01 100644
*** a/doc/src/sgml/catalogs.sgml
--- b/doc/src/sgml/catalogs.sgml
***************
*** 6383,6396 ****
      <tbody>
       <row>
        <entry><structfield>schema</structfield></entry>
!       <entry><type>text</type></entry>
        <entry>The name of the schema where the extension is registered,
        or <literal>NULL</literal> when the extension is not installed.</entry>
       </row>
  
       <row>
        <entry><structfield>name</structfield></entry>
!       <entry><type>text</type></entry>
        <entry>The name of the extensions</entry>
       </row>
  
--- 6383,6396 ----
      <tbody>
       <row>
        <entry><structfield>schema</structfield></entry>
!       <entry><type>name</type></entry>
        <entry>The name of the schema where the extension is registered,
        or <literal>NULL</literal> when the extension is not installed.</entry>
       </row>
  
       <row>
        <entry><structfield>name</structfield></entry>
!       <entry><type>name</type></entry>
        <entry>The name of the extensions</entry>
       </row>
  
diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c
index 3df231d..7aca611 100644
*** a/src/backend/commands/conversioncmds.c
--- b/src/backend/commands/conversioncmds.c
***************
*** 32,38 ****
  #include "utils/rel.h"
  #include "utils/syscache.h"
  
! static void AlterConversionOwner_internal(Relation rel, Oid convOid,
  							  Oid newOwnerId);
  
  /*
--- 32,38 ----
  #include "utils/rel.h"
  #include "utils/syscache.h"
  
! static void AlterConversionOwner_internal(Relation rel, Oid conversionOid,
  							  Oid newOwnerId);
  
  /*
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c
index 5e6b279..4350659 100644
*** a/src/backend/commands/extension.c
--- b/src/backend/commands/extension.c
***************
*** 28,33 ****
--- 28,34 ----
   */
  #include "postgres.h"
  
+ #include <dirent.h>
  #include <unistd.h>
  
  #include "access/xact.h"
*************** typedef struct ExtensionControlFile
*** 73,93 ****
  	char *schema;       /* when not relocatable, an extension can force its schema */
  } ExtensionControlFile;
  
- /* expansible list of extensions */
- typedef struct ExtensionList
- {
- 	ExtensionControlFile *exts;		/* => palloc'd array */
- 	int	numrefs;		/* current number of extensions */
- 	int	maxrefs;		/* current size of palloc'd array */
- } ExtensionList;
- 
- /*
-  * Context to reuse between extension listing SRF calls
-  */
- typedef struct extension_fctx
- {
- 	directory_fctx dir;
- } extension_fctx;
  
  static bool extension_is_relocatable(Oid ext_oid);
  
--- 74,79 ----
*************** read_extension_script_file(const Extensi
*** 309,315 ****
  				 errmsg("invalid source encoding name \"%s\"",
  						pg_encoding_to_char(control->encoding))));
  
! 	content = (bytea *)DatumGetPointer(raw);
  
  	/* make sure that source string is valid */
  	len = VARSIZE_ANY_EXHDR(content);
--- 295,301 ----
  				 errmsg("invalid source encoding name \"%s\"",
  						pg_encoding_to_char(control->encoding))));
  
! 	content = DatumGetByteaP(raw);
  
  	/* make sure that source string is valid */
  	len = VARSIZE_ANY_EXHDR(content);
*************** read_extension_script_file(const Extensi
*** 327,336 ****
  }
  
  /*
!  * Execute given SQL string, and returns true only when success.
   */
! static bool
! execute_sql_string(const char *sql)
  {
  	/*
  	 * We abuse some internal knowledge from spi.h here. As we don't know
--- 313,322 ----
  }
  
  /*
!  * Execute given SQL string. filename is used only to report errors.
   */
! static void
! execute_sql_string(const char *sql, const char *filename)
  {
  	/*
  	 * We abuse some internal knowledge from spi.h here. As we don't know
*************** execute_sql_string(const char *sql)
*** 344,355 ****
  		elog(ERROR, "SPI_connect failed");
  
  	if (SPI_execute(sql, false, 0) < SPI_OK_UTILITY)
! 		return false;
  
  	if (SPI_finish() != SPI_OK_FINISH)
  		elog(ERROR, "SPI_finish failed");
- 
- 	return true;
  }
  
   /*
--- 330,341 ----
  		elog(ERROR, "SPI_connect failed");
  
  	if (SPI_execute(sql, false, 0) < SPI_OK_UTILITY)
! 		ereport(ERROR,
! 				(errcode(ERRCODE_DATA_EXCEPTION),
! 				 errmsg("could not execute sql file: '%s'", filename)));
  
  	if (SPI_finish() != SPI_OK_FINISH)
  		elog(ERROR, "SPI_finish failed");
  }
  
   /*
*************** execute_extension_script(ExtensionContro
*** 439,448 ****
  			Oid first_schema = linitial_oid(search_path);
  			list_free(search_path);
  
! 			if (!execute_sql_string(sql))
! 				ereport(ERROR,
! 						(errcode(ERRCODE_DATA_EXCEPTION),
! 						 errmsg("could not execute sql file: '%s'", filename)));
  
  			/*
  			 * CREATE EXTENSION foo WITH SCHEMA bar;
--- 425,431 ----
  			Oid first_schema = linitial_oid(search_path);
  			list_free(search_path);
  
! 			execute_sql_string(sql, filename);
  
  			/*
  			 * CREATE EXTENSION foo WITH SCHEMA bar;
*************** execute_extension_script(ExtensionContro
*** 477,486 ****
  										CStringGetTextDatum("@extschema@"),
  										CStringGetTextDatum(schema))));
  
! 			if (!execute_sql_string(sql))
! 				ereport(ERROR,
! 						(errcode(ERRCODE_DATA_EXCEPTION),
! 						 errmsg("could not execute sql file: '%s'", filename)));
  		}
  	}
  	PG_CATCH();
--- 460,466 ----
  										CStringGetTextDatum("@extschema@"),
  										CStringGetTextDatum(schema))));
  
! 			execute_sql_string(sql, filename);
  		}
  	}
  	PG_CATCH();
*************** CreateExtension(CreateExtensionStmt *stm
*** 536,541 ****
--- 516,530 ----
  				 errhint("Must be superuser to create an extension.")));
  
  	/*
+ 	 * We use global variables to track the extension being created, so we
+ 	 * can create only one extension at the same time.
+ 	 */
+ 	if (create_extension)
+ 		ereport(ERROR,
+ 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ 				 errmsg("nested CREATE EXTENSION is not supported")));
+ 
+ 	/*
  	 * This check is done once here, early, before we bother parsing the
  	 * control file, then redone once we have the ExclusiveLock on the
  	 * pg_extension catalog to forbid having two backends concurrently
*************** DropExtension(DropExtensionStmt *stmt)
*** 748,754 ****
  		ereport(ERROR,
  				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
  				 errmsg("permission denied to drop extension \"%s\"",
! 						stmt->extname),
  				 errhint("Must be superuser to drop an extension.")));
  
  	/*
--- 737,743 ----
  		ereport(ERROR,
  				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
  				 errmsg("permission denied to drop extension \"%s\"",
! 						extname),
  				 errhint("Must be superuser to drop an extension.")));
  
  	/*
*************** pg_extension_flag_dump(PG_FUNCTION_ARGS)
*** 1023,1030 ****
  }
  
  /*
!  * This function lists all extensions, the one currently already installed
!  * but also the one available for installation. For those, we parse the
   * control file and return the information that would be available in the
   * pg_extension catalog.
   *
--- 1012,1019 ----
  }
  
  /*
!  * This function lists all extensions not only already installed ones
!  * but also the ones available for installation. For those, we parse the
   * control file and return the information that would be available in the
   * pg_extension catalog.
   *
*************** pg_extension_flag_dump(PG_FUNCTION_ARGS)
*** 1033,1092 ****
  Datum
  pg_available_extensions(PG_FUNCTION_ARGS)
  {
! 	FuncCallContext *funcctx;
! 	struct dirent *de;
! 	extension_fctx *fctx;
  
  	if (!superuser())
  		ereport(ERROR,
  				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
  				 (errmsg("must be superuser to get extensions listings"))));
  
! 	if (SRF_IS_FIRSTCALL())
! 	{
! 		MemoryContext  oldcontext;
! 		TupleDesc	   tupdesc;
! 
! 		funcctx = SRF_FIRSTCALL_INIT();
! 		oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
! 
! 		tupdesc = CreateTemplateTupleDesc(4, false);
! 		TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
! 						   NAMEOID, -1, 0);
! 		TupleDescInitEntry(tupdesc, (AttrNumber) 2, "version",
! 						   TEXTOID, -1, 0);
! 		TupleDescInitEntry(tupdesc, (AttrNumber) 3, "relocatable",
! 						   BOOLOID, -1, 0);
! 		TupleDescInitEntry(tupdesc, (AttrNumber) 4, "comment",
! 						   TEXTOID, -1, 0);
  
! 		funcctx->tuple_desc = BlessTupleDesc(tupdesc);
  
! 		fctx = (extension_fctx *) palloc(sizeof(extension_fctx));
! 		fctx->dir.location = get_extension_control_basepath();
! 		fctx->dir.dirdesc  = AllocateDir(fctx->dir.location);
  
! 		if (!fctx->dir.dirdesc)
! 			ereport(ERROR,
! 					(errcode_for_file_access(),
! 					 errmsg("could not open directory \"%s\": %m",
! 							fctx->dir.location)));
  
! 		funcctx->user_fctx = fctx;
! 		MemoryContextSwitchTo(oldcontext);
! 	}
  
! 	funcctx = SRF_PERCALL_SETUP();
! 	fctx = (extension_fctx *) funcctx->user_fctx;
  
! 	while ((de = ReadDir(fctx->dir.dirdesc, fctx->dir.location)) != NULL)
  	{
  		ExtensionControlFile *control;
  		char	   *extname;
! 		Datum		values[5];
! 		bool		nulls[5];
! 		int         i = 0;
! 		HeapTuple	tuple;
  
  		if (!is_extension_control_filename(de->d_name))
  			continue;
--- 1022,1081 ----
  Datum
  pg_available_extensions(PG_FUNCTION_ARGS)
  {
! #define PG_EXTENSIONS_COLS 	4
! 	ReturnSetInfo	   *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
! 	TupleDesc			tupdesc;
! 	Tuplestorestate	   *tupstore;
! 	MemoryContext		per_query_ctx;
! 	MemoryContext		oldcontext;
! 	char			   *location;	/* share/contrib path */
! 	DIR				   *dir;		/* share/contrib directory */
! 	struct dirent	   *de;
  
  	if (!superuser())
  		ereport(ERROR,
  				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
  				 (errmsg("must be superuser to get extensions listings"))));
  
! 	/* check to see if caller supports us returning a tuplestore */
! 	if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
! 		ereport(ERROR,
! 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
! 				 errmsg("set-valued function called in context that cannot accept a set")));
! 	if (!(rsinfo->allowedModes & SFRM_Materialize))
! 		ereport(ERROR,
! 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
! 				 errmsg("materialize mode required, but it is not " \
! 						"allowed in this context")));
  
! 	/* Build a tuple descriptor for our result type */
! 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
! 		elog(ERROR, "return type must be a row type");
  
! 	per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
! 	oldcontext = MemoryContextSwitchTo(per_query_ctx);
  
! 	tupstore = tuplestore_begin_heap(true, false, work_mem);
! 	rsinfo->returnMode = SFRM_Materialize;
! 	rsinfo->setResult = tupstore;
! 	rsinfo->setDesc = tupdesc;
  
! 	MemoryContextSwitchTo(oldcontext);
  
! 	location = get_extension_control_basepath();
! 	dir  = AllocateDir(location);
! 	if (dir == NULL)
! 		ereport(ERROR,
! 				(errcode_for_file_access(),
! 				 errmsg("could not open directory \"%s\": %m",
! 						location)));
  
! 	while ((de = ReadDir(dir, location)) != NULL)
  	{
  		ExtensionControlFile *control;
  		char	   *extname;
! 		Datum		values[PG_EXTENSIONS_COLS];
! 		bool		nulls[PG_EXTENSIONS_COLS];
  
  		if (!is_extension_control_filename(de->d_name))
  			continue;
*************** pg_available_extensions(PG_FUNCTION_ARGS
*** 1101,1124 ****
  		memset(values, 0, sizeof(values));
  		memset(nulls, 0, sizeof(nulls));
  
  		values[0] = DirectFunctionCall1(namein, CStringGetDatum(control->name));
! 		values[2] = BoolGetDatum(control->relocatable);
! 
  		if (control->version == NULL)
  			nulls[1] = true;
  		else
  			values[1] = CStringGetTextDatum(control->version);
! 
  		if (control->comment == NULL)
  			nulls[3] = true;
  		else
  			values[3] = CStringGetTextDatum(control->comment);
  
! 		tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
! 		SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
  	}
! 	FreeDir(fctx->dir.dirdesc);
! 	SRF_RETURN_DONE(funcctx);
  }
  
  /*
--- 1090,1119 ----
  		memset(values, 0, sizeof(values));
  		memset(nulls, 0, sizeof(nulls));
  
+ 		/* name */
  		values[0] = DirectFunctionCall1(namein, CStringGetDatum(control->name));
! 		/* version */
  		if (control->version == NULL)
  			nulls[1] = true;
  		else
  			values[1] = CStringGetTextDatum(control->version);
! 		/* relocatable */
! 		values[2] = BoolGetDatum(control->relocatable);
! 		/* comment */
  		if (control->comment == NULL)
  			nulls[3] = true;
  		else
  			values[3] = CStringGetTextDatum(control->comment);
  
! 		tuplestore_putvalues(tupstore, tupdesc, values, nulls);
  	}
! 
! 	/* clean up and return the tuplestore */
! 	tuplestore_donestoring(tupstore);
! 
! 	FreeDir(dir);
! 
! 	return (Datum) 0;
  }
  
  /*
*************** AlterExtensionNamespace(char *name, cons
*** 1138,1149 ****
  void
  AlterExtensionNamespace_oid(Oid extensionOid, Oid nspOid)
  {
! 	Oid			     oldNspOid = InvalidOid;
! 	ObjectAddress   *object, *dep;
! 	Relation	depRel;
! 	ScanKeyData key[2];
! 	SysScanDesc depScan;
! 	HeapTuple	depTup;
  
  	if (!superuser())
  		ereport(ERROR,
--- 1133,1145 ----
  void
  AlterExtensionNamespace_oid(Oid extensionOid, Oid nspOid)
  {
! 	Oid				oldNspOid = InvalidOid;
! 	ObjectAddress  *object,
! 				   *dep;
! 	Relation		depRel;
! 	ScanKeyData		key[2];
! 	SysScanDesc		depScan;
! 	HeapTuple		depTup;
  
  	if (!superuser())
  		ereport(ERROR,
*************** AlterExtensionNamespace_oid(Oid extensio
*** 1205,1211 ****
  			ereport(ERROR,
  					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
  					 (errmsg("this extension does not support SET SCHEMA"),
! 					  errdetail("%s is not in the extension's schema [%i %i]",
  								getObjectDescription(dep),
  								oldNspOid,
  								dep_oldNspOid))));
--- 1201,1207 ----
  			ereport(ERROR,
  					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
  					 (errmsg("this extension does not support SET SCHEMA"),
! 					  errdetail("%s is not in the extension's schema [%d %d]",
  								getObjectDescription(dep),
  								oldNspOid,
  								dep_oldNspOid))));
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index aaffd38..3bdfc64 100644
*** a/src/backend/utils/adt/genfile.c
--- b/src/backend/utils/adt/genfile.c
***************
*** 28,37 ****
  #include "postmaster/syslogger.h"
  #include "storage/fd.h"
  #include "utils/builtins.h"
- #include "utils/genfile.h"
  #include "utils/memutils.h"
  #include "utils/timestamp.h"
  
  /*
   * Convert a "text" filename argument to C string, and check it's allowable.
   *
--- 28,43 ----
  #include "postmaster/syslogger.h"
  #include "storage/fd.h"
  #include "utils/builtins.h"
  #include "utils/memutils.h"
  #include "utils/timestamp.h"
  
+ typedef struct
+ {
+ 	char	   *location;
+ 	DIR		   *dirdesc;
+ } directory_fctx;
+ 
+ 
  /*
   * Convert a "text" filename argument to C string, and check it's allowable.
   *
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 274f1d0..e111d26 100644
*** a/src/backend/utils/adt/varlena.c
--- b/src/backend/utils/adt/varlena.c
***************
*** 24,30 ****
  #include "miscadmin.h"
  #include "parser/scansup.h"
  #include "regex/regex.h"
- #include "utils/array.h"
  #include "utils/builtins.h"
  #include "utils/bytea.h"
  #include "utils/lsyscache.h"
--- 24,29 ----
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 493f289..f3ca5a5 100644
*** a/src/backend/utils/init/postinit.c
--- b/src/backend/utils/init/postinit.c
***************
*** 29,35 ****
  #include "catalog/pg_database.h"
  #include "catalog/pg_db_role_setting.h"
  #include "catalog/pg_tablespace.h"
- #include "commands/extension.h"
  #include "libpq/auth.h"
  #include "libpq/libpq-be.h"
  #include "mb/pg_wchar.h"
--- 29,34 ----
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 17232ab..2c95ef8 100644
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
*************** extern char *temp_tablespaces;
*** 128,133 ****
--- 128,134 ----
  extern bool synchronize_seqscans;
  extern bool fullPageWrites;
  extern int	ssl_renegotiation_limit;
+ extern char *SSLCipherSuites;
  
  #ifdef TRACE_SORT
  extern bool trace_sort;
*************** extern bool trace_syncscan;
*** 139,148 ****
  extern bool optimize_bounded_sort;
  #endif
  
- #ifdef USE_SSL
- extern char *SSLCipherSuites;
- #endif
- 
  static void set_config_sourcefile(const char *name, char *sourcefile,
  					  int sourceline);
  
--- 140,145 ----
*************** static const char *assign_log_destinatio
*** 151,162 ****
  
  #ifdef HAVE_SYSLOG
  static int	syslog_facility = LOG_LOCAL0;
  
  static bool assign_syslog_facility(int newval,
  					   bool doit, GucSource source);
  static const char *assign_syslog_ident(const char *ident,
  					bool doit, GucSource source);
- #endif
  
  static bool assign_session_replication_role(int newval, bool doit,
  								GucSource source);
--- 148,161 ----
  
  #ifdef HAVE_SYSLOG
  static int	syslog_facility = LOG_LOCAL0;
+ #else
+ static int	syslog_facility = 0;
+ #endif
  
  static bool assign_syslog_facility(int newval,
  					   bool doit, GucSource source);
  static const char *assign_syslog_ident(const char *ident,
  					bool doit, GucSource source);
  
  static bool assign_session_replication_role(int newval, bool doit,
  								GucSource source);
*************** static const struct config_enum_entry se
*** 279,286 ****
  	{NULL, 0, false}
  };
  
- #ifdef HAVE_SYSLOG
  static const struct config_enum_entry syslog_facility_options[] = {
  	{"local0", LOG_LOCAL0, false},
  	{"local1", LOG_LOCAL1, false},
  	{"local2", LOG_LOCAL2, false},
--- 278,285 ----
  	{NULL, 0, false}
  };
  
  static const struct config_enum_entry syslog_facility_options[] = {
+ #ifdef HAVE_SYSLOG
  	{"local0", LOG_LOCAL0, false},
  	{"local1", LOG_LOCAL1, false},
  	{"local2", LOG_LOCAL2, false},
*************** static const struct config_enum_entry sy
*** 289,297 ****
  	{"local5", LOG_LOCAL5, false},
  	{"local6", LOG_LOCAL6, false},
  	{"local7", LOG_LOCAL7, false},
  	{NULL, 0}
  };
- #endif
  
  static const struct config_enum_entry track_function_options[] = {
  	{"none", TRACK_FUNC_OFF, false},
--- 288,298 ----
  	{"local5", LOG_LOCAL5, false},
  	{"local6", LOG_LOCAL6, false},
  	{"local7", LOG_LOCAL7, false},
+ #else
+ 	{"none", 0, false},
+ #endif
  	{NULL, 0}
  };
  
  static const struct config_enum_entry track_function_options[] = {
  	{"none", TRACK_FUNC_OFF, false},
*************** int			tcp_keepalives_count;
*** 409,417 ****
   */
  static char *log_destination_string;
  
- #ifdef HAVE_SYSLOG
  static char *syslog_ident_str;
- #endif
  static bool phony_autocommit;
  static bool session_auth_is_superuser;
  static double phony_random_seed;
--- 410,416 ----
*************** static struct config_string ConfigureNam
*** 2530,2536 ****
  		"postgresql-%Y-%m-%d_%H%M%S.log", NULL, NULL
  	},
  
- #ifdef HAVE_SYSLOG
  	{
  		{"syslog_ident", PGC_SIGHUP, LOGGING_WHERE,
  			gettext_noop("Sets the program name used to identify PostgreSQL "
--- 2529,2534 ----
*************** static struct config_string ConfigureNam
*** 2540,2546 ****
  		&syslog_ident_str,
  		"postgres", assign_syslog_ident, NULL
  	},
- #endif
  
  	{
  		{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
--- 2538,2543 ----
*************** static struct config_string ConfigureNam
*** 2679,2685 ****
  		"pg_catalog.simple", assignTSCurrentConfig, NULL
  	},
  
- #ifdef USE_SSL
  	{
  		{"ssl_ciphers", PGC_POSTMASTER, CONN_AUTH_SECURITY,
  			gettext_noop("Sets the list of allowed SSL ciphers."),
--- 2676,2681 ----
*************** static struct config_string ConfigureNam
*** 2687,2695 ****
  			GUC_SUPERUSER_ONLY
  		},
  		&SSLCipherSuites,
! 		"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH", NULL, NULL
  	},
- #endif   /* USE_SSL */
  
  	{
  		{"application_name", PGC_USERSET, LOGGING_WHAT,
--- 2683,2695 ----
  			GUC_SUPERUSER_ONLY
  		},
  		&SSLCipherSuites,
! #ifdef USE_SSL
! 		"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH",
! #else
! 		"none",
! #endif
! 		NULL, NULL
  	},
  
  	{
  		{"application_name", PGC_USERSET, LOGGING_WHAT,
*************** static struct config_enum ConfigureNames
*** 2806,2821 ****
  		LOGSTMT_NONE, log_statement_options, NULL, NULL
  	},
  
- #ifdef HAVE_SYSLOG
  	{
  		{"syslog_facility", PGC_SIGHUP, LOGGING_WHERE,
  			gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."),
  			NULL
  		},
  		&syslog_facility,
! 		LOG_LOCAL0, syslog_facility_options, assign_syslog_facility, NULL
! 	},
  #endif
  
  	{
  		{"session_replication_role", PGC_SUSET, CLIENT_CONN_STATEMENT,
--- 2806,2824 ----
  		LOGSTMT_NONE, log_statement_options, NULL, NULL
  	},
  
  	{
  		{"syslog_facility", PGC_SIGHUP, LOGGING_WHERE,
  			gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."),
  			NULL
  		},
  		&syslog_facility,
! #ifdef HAVE_SYSLOG
! 		LOG_LOCAL0,
! #else
! 		0,
  #endif
+ 		syslog_facility_options, assign_syslog_facility, NULL
+ 	},
  
  	{
  		{"session_replication_role", PGC_SUSET, CLIENT_CONN_STATEMENT,
*************** assign_log_destination(const char *value
*** 7636,7649 ****
  	return value;
  }
  
- #ifdef HAVE_SYSLOG
- 
  static bool
  assign_syslog_facility(int newval, bool doit, GucSource source)
  {
  	if (doit)
  		set_syslog_parameters(syslog_ident_str ? syslog_ident_str : "postgres",
  							  newval);
  
  	return true;
  }
--- 7639,7653 ----
  	return value;
  }
  
  static bool
  assign_syslog_facility(int newval, bool doit, GucSource source)
  {
+ #ifdef HAVE_SYSLOG
  	if (doit)
  		set_syslog_parameters(syslog_ident_str ? syslog_ident_str : "postgres",
  							  newval);
+ #endif
+ 	/* Without syslog support, just ignore it */
  
  	return true;
  }
*************** assign_syslog_facility(int newval, bool 
*** 7651,7662 ****
  static const char *
  assign_syslog_ident(const char *ident, bool doit, GucSource source)
  {
  	if (doit)
  		set_syslog_parameters(ident, syslog_facility);
  
  	return ident;
  }
- #endif   /* HAVE_SYSLOG */
  
  
  static bool
--- 7655,7668 ----
  static const char *
  assign_syslog_ident(const char *ident, bool doit, GucSource source)
  {
+ #ifdef HAVE_SYSLOG
  	if (doit)
  		set_syslog_parameters(ident, syslog_facility);
+ #endif
+ 	/* Without syslog support, it will always be set to "none", so ignore */
  
  	return ident;
  }
  
  
  static bool
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 747fa52..dad99f8 100644
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
*************** static const SchemaQuery Query_for_list_
*** 586,592 ****
  #define Query_for_list_of_available_extensions \
  " SELECT pg_catalog.quote_ident(name) "\
  "   FROM pg_catalog.pg_available_extensions "\
! "  WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND NOT installed"
  
  /*
   * This is a list of all "things" in Pgsql, which can show up after CREATE or
--- 586,592 ----
  #define Query_for_list_of_available_extensions \
  " SELECT pg_catalog.quote_ident(name) "\
  "   FROM pg_catalog.pg_available_extensions "\
! "  WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND installed IS NULL"
  
  /*
   * This is a list of all "things" in Pgsql, which can show up after CREATE or
diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h
index cc5e7ed..c51460c 100644
*** a/src/include/commands/extension.h
--- b/src/include/commands/extension.h
***************
*** 16,22 ****
  
  #include "catalog/dependency.h"
  #include "catalog/objectaddress.h"
- #include "utils/genfile.h"
  
  
  /*
--- 16,21 ----
diff --git a/src/include/utils/genfile.h b/src/include/utils/genfile.h
index e343a9d..e69de29 100644
*** a/src/include/utils/genfile.h
--- b/src/include/utils/genfile.h
***************
*** 1,25 ****
- /*--------------------------------------------------------------------
-  * genfile.h
-  *
-  * External declarations pertaining to backend/utils/misc/genfile.c
-  *
-  * Copyright (c) 2000-2010, PostgreSQL Global Development Group
-  *
-  * src/include/utils/genfile.h
-  *--------------------------------------------------------------------
-  */
- #ifndef GENFILE_H
- #define GENFILE_H
- 
- #include <dirent.h>
- 
- /*
-  * We need this in extension.c in the SRF that lists available extensions.
-  */
- typedef struct directory_fctx
- {
- 	char	   *location;
- 	DIR		   *dirdesc;
- } directory_fctx;
- 
- #endif   /* GENFILE_H */
--- 0 ----
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index 455f0db..3afdba3 100644
*** a/src/test/regress/expected/rules.out
--- b/src/test/regress/expected/rules.out
*************** SELECT viewname, definition FROM pg_view
*** 1279,1285 ****
            viewname           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  -----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   iexit                       | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
!  pg_available_extensions     | SELECT e.name, e.version, e.relocatable, e.comment, e.installed FROM pg_extensions() e(name, version, relocatable, comment, installed);
   pg_cursors                  | SELECT c.name, c.statement, c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time);
   pg_group                    | SELECT pg_authid.rolname AS groname, pg_authid.oid AS grosysid, ARRAY(SELECT pg_auth_members.member FROM pg_auth_members WHERE (pg_auth_members.roleid = pg_authid.oid)) AS grolist FROM pg_authid WHERE (NOT pg_authid.rolcanlogin);
   pg_indexes                  | SELECT n.nspname AS schemaname, c.relname AS tablename, i.relname AS indexname, t.spcname AS tablespace, pg_get_indexdef(i.oid) AS indexdef FROM ((((pg_index x JOIN pg_class c ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace))) WHERE ((c.relkind = 'r'::"char") AND (i.relkind = 'i'::"char"));
--- 1279,1285 ----
            viewname           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  -----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   iexit                       | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
!  pg_available_extensions     | SELECT n.nspname AS schema, e.name, x.extversion AS installed, e.version, e.relocatable, e.comment FROM ((pg_available_extensions() e(name, version, relocatable, comment) LEFT JOIN pg_extension x ON ((e.name = x.extname))) LEFT JOIN pg_namespace n ON ((n.oid = x.extnamespace)));
   pg_cursors                  | SELECT c.name, c.statement, c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time);
   pg_group                    | SELECT pg_authid.rolname AS groname, pg_authid.oid AS grosysid, ARRAY(SELECT pg_auth_members.member FROM pg_auth_members WHERE (pg_auth_members.roleid = pg_authid.oid)) AS grolist FROM pg_authid WHERE (NOT pg_authid.rolcanlogin);
   pg_indexes                  | SELECT n.nspname AS schemaname, c.relname AS tablename, i.relname AS indexname, t.spcname AS tablespace, pg_get_indexdef(i.oid) AS indexdef FROM ((((pg_index x JOIN pg_class c ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace))) WHERE ((c.relkind = 'r'::"char") AND (i.relkind = 'i'::"char"));