summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2014-02-01 03:25:01 +0000
committerRobert Haas2014-02-01 03:25:01 +0000
commitc7de3295ba9db6649c32568bb46b91f1160da8d3 (patch)
tree52bda214aaf8fa4bcc80eb8593c06807f2dc776d
parente01fc2377bfdb6a519aea7007a57c901c8a95da6 (diff)
parentd1981719adbcc05fa15f540e8fc4327907991fc6 (diff)
Merge branch 'master' into slot2slot2
-rw-r--r--contrib/chkpass/chkpass.c9
-rw-r--r--doc/src/sgml/catalogs.sgml3
-rw-r--r--doc/src/sgml/client-auth.sgml4
-rw-r--r--doc/src/sgml/func.sgml6
-rw-r--r--doc/src/sgml/monitoring.sgml6
-rw-r--r--doc/src/sgml/postgres-fdw.sgml62
-rw-r--r--doc/src/sgml/ref/select.sgml24
-rw-r--r--doc/src/sgml/wal.sgml7
-rw-r--r--src/backend/libpq/be-secure.c13
-rw-r--r--src/backend/storage/ipc/procsignal.c9
-rw-r--r--src/backend/storage/lmgr/proc.c42
-rw-r--r--src/bin/psql/tab-complete.c30
-rw-r--r--src/include/catalog/pg_amproc.h52
-rw-r--r--src/interfaces/libpq/fe-secure.c6
-rw-r--r--src/tools/entab/entab.c36
-rwxr-xr-xsrc/tools/pgindent/pgindent12
16 files changed, 253 insertions, 68 deletions
diff --git a/contrib/chkpass/chkpass.c b/contrib/chkpass/chkpass.c
index 0c9fec0e67..dc66075f98 100644
--- a/contrib/chkpass/chkpass.c
+++ b/contrib/chkpass/chkpass.c
@@ -70,6 +70,7 @@ chkpass_in(PG_FUNCTION_ARGS)
char *str = PG_GETARG_CSTRING(0);
chkpass *result;
char mysalt[4];
+ char *crypt_output;
static char salt_chars[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -92,7 +93,13 @@ chkpass_in(PG_FUNCTION_ARGS)
mysalt[1] = salt_chars[random() & 0x3f];
mysalt[2] = 0; /* technically the terminator is not necessary
* but I like to play safe */
- strcpy(result->password, crypt(str, mysalt));
+
+ if ((crypt_output = crypt(str, mysalt)) == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("crypt() failed")));
+ strcpy(result->password, crypt_output);
+
PG_RETURN_POINTER(result);
}
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 19fe69ef12..dca24fc070 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -5980,7 +5980,8 @@
<entry><structfield>tgconstrindid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
- <entry>The index supporting a unique, primary key, or referential integrity constraint</entry>
+ <entry>The index supporting a unique, primary key, referential integrity,
+ or exclusion constraint</entry>
</row>
<row>
diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml
index 14870401fb..9b26d01061 100644
--- a/doc/src/sgml/client-auth.sgml
+++ b/doc/src/sgml/client-auth.sgml
@@ -83,7 +83,7 @@
Fields can contain white space if the field value is double-quoted.
Quoting one of the keywords in a database, user, or address field (e.g.,
<literal>all</> or <literal>replication</>) makes the word lose its special
- character, and just match a database, user, or host with that name.
+ meaning, and just match a database, user, or host with that name.
</para>
<para>
@@ -408,7 +408,7 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
<term><literal>md5</></term>
<listitem>
<para>
- Require the client to supply an MD5-encrypted password for
+ Require the client to supply a double-MD5-hashed password for
authentication.
See <xref linkend="auth-password"> for details.
</para>
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 07dcba01d3..aa2b068e74 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10282,7 +10282,7 @@ table2-mapping
<entry>
Expands a JSON array to a set of JSON values.
</entry>
- <entry><literal>json_array_elements('[1,true, [2,false]]')</literal></entry>
+ <entry><literal>SELECT * FROM json_array_elements('[1,true, [2,false]]')</literal></entry>
<entry>
<programlisting>
value
@@ -10300,11 +10300,11 @@ table2-mapping
</indexterm>
<literal>json_array_elements_text(json)</literal>
</entry>
- <entry><type>SETOF json</type></entry>
+ <entry><type>SETOF text</type></entry>
<entry>
Expands a JSON array to a set of text values.
</entry>
- <entry><literal>json_array_elements_text('["foo", "bar"]')</literal></entry>
+ <entry><literal>SELECT * FROM json_array_elements_text('["foo", "bar"]')</literal></entry>
<entry>
<programlisting>
value
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index d301d9c5c3..a37e6b6f33 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -185,9 +185,11 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<filename>pg_stat_tmp</filename> by default.
For better performance, <varname>stats_temp_directory</> can be
pointed at a RAM-based file system, decreasing physical I/O requirements.
- When the server shuts down, a permanent copy of the statistics
+ When the server shuts down cleanly, a permanent copy of the statistics
data is stored in the <filename>global</filename> subdirectory, so that
- statistics can be retained across server restarts.
+ statistics can be retained across server restarts. When recovery is
+ performed at server start (e.g. after immediate shutdown, server crash,
+ and point-in-time recovery), all statistics counters are reset.
</para>
</sect2>
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 35924f19f2..e6f6e20581 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -376,6 +376,68 @@
</sect2>
<sect2>
+ <title>Examples</title>
+
+ <para>
+ Here is an example of creating a foreign table with
+ <literal>postgres_fdw</>. First install the extension:
+ </para>
+
+<programlisting>
+CREATE EXTENSION postgres_fdw;
+</programlisting>
+
+ <para>
+ Then create a foreign server using <xref linkend="sql-createserver">.
+ In this example we wish to connect to a <productname>PostgreSQL</> server
+ on host <literal>192.83.123.89</literal> listening on
+ port <literal>5432</literal>. The database to which the connection is made
+ is named <literal>foreign_db</literal> on the remote server:
+
+<programlisting>
+CREATE SERVER foreign_server
+ FOREIGN DATA WRAPPER postgres_fdw
+ OPTIONS (host '192.83.123.89', port '5432', dbname 'foreign_db');
+</programlisting>
+ </para>
+
+ <para>
+ A user mapping, defined with <xref linkend="sql-createusermapping">, is
+ needed as well to identify the role that will be used on the remote
+ server:
+
+<programlisting>
+CREATE USER MAPPING FOR local_user
+ SERVER foreign_server
+ OPTIONS (user 'foreign_user', password 'password');
+</programlisting>
+ </para>
+
+ <para>
+ Now it is possible to create a foreign table with
+ <xref linkend="sql-createforeigntable">. In this example we
+ wish to access the table named <structname>some_schema.some_table</>
+ on the remote server. The local name for it will
+ be <structname>foreign_table</>:
+
+<programlisting>
+CREATE FOREIGN TABLE foreign_table (
+ id serial NOT NULL,
+ data text
+)
+ SERVER foreign_server
+ OPTIONS (schema_name 'some_schema', table_name 'some_table');
+</programlisting>
+
+ It's essential that the data types and other properties of the columns
+ declared in <command>CREATE FOREIGN TABLE</> match the actual remote table.
+ Column names must match as well, unless you attach <literal>column_name</>
+ options to the individual columns to show how they are named in the remote
+ table.
+ </para>
+ </sect2>
+
+ <sect2>
<title>Author</title>
<para>
Shigeru Hanada <email>shigeru.hanada@gmail.com</email>
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index f9f83f34f7..9a468b98c0 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -654,6 +654,12 @@ GROUP BY <replaceable class="parameter">expression</replaceable> [, ...]
the grouped columns (or a subset thereof) are the primary key of
the table containing the ungrouped column.
</para>
+
+ <para>
+ Currently, <literal>FOR NO KEY UPDATE</>, <literal>FOR UPDATE</>,
+ <literal>FOR SHARE</> and <literal>FOR KEY SHARE</> cannot be
+ specified with <literal>GROUP BY</literal>.
+ </para>
</refsect2>
<refsect2 id="SQL-HAVING">
@@ -690,6 +696,12 @@ HAVING <replaceable class="parameter">condition</replaceable>
within aggregate functions. Such a query will emit a single row if the
<literal>HAVING</literal> condition is true, zero rows if it is not true.
</para>
+
+ <para>
+ Currently, <literal>FOR NO KEY UPDATE</>, <literal>FOR UPDATE</>,
+ <literal>FOR SHARE</> and <literal>FOR KEY SHARE</> cannot be
+ specified with <literal>HAVING</literal>.
+ </para>
</refsect2>
<refsect2 id="SQL-WINDOW">
@@ -825,6 +837,12 @@ UNBOUNDED FOLLOWING
</para>
<para>
+ Currently, <literal>FOR NO KEY UPDATE</>, <literal>FOR UPDATE</>,
+ <literal>FOR SHARE</> and <literal>FOR KEY SHARE</> cannot be
+ specified with <literal>WINDOW</literal>.
+ </para>
+
+ <para>
Window functions are described in detail in
<xref linkend="tutorial-window">,
<xref linkend="syntax-window-functions">, and
@@ -920,6 +938,12 @@ SELECT DISTINCT ON (location) location, time, report
will normally contain additional expression(s) that determine the
desired precedence of rows within each <literal>DISTINCT ON</> group.
</para>
+
+ <para>
+ Currently, <literal>FOR NO KEY UPDATE</>, <literal>FOR UPDATE</>,
+ <literal>FOR SHARE</> and <literal>FOR KEY SHARE</> cannot be
+ specified with <literal>DISTINCT</literal>.
+ </para>
</refsect2>
<refsect2 id="SQL-UNION">
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 059697e2b3..c72253227e 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -193,9 +193,10 @@
</listitem>
<listitem>
<para>
- Data pages are not currently checksummed, though full page images recorded
- in WAL records will be protected. Data pages have a 16-bit field available
- for future use with a data page checksum feature.
+ Data pages are not currently checksummed by default, though full page images
+ recorded in WAL records will be protected; see<link
+ linkend="app-initdb-data-checksums"><application>initdb</></link>
+ for details about enabling data page checksums.
</para>
</listitem>
<listitem>
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index a04701e555..71f9747300 100644
--- a/src/backend/libpq/be-secure.c
+++ b/src/backend/libpq/be-secure.c
@@ -822,6 +822,13 @@ initialize_SSL(void)
#endif
SSL_library_init();
SSL_load_error_strings();
+
+ /*
+ * We use SSLv23_method() because it can negotiate use of the highest
+ * mutually supported protocol version, while alternatives like
+ * TLSv1_2_method() permit only one specific version. Note that we
+ * don't actually allow SSL v2 or v3, only TLS protocols (see below).
+ */
SSL_context = SSL_CTX_new(SSLv23_method());
if (!SSL_context)
ereport(FATAL,
@@ -880,9 +887,11 @@ initialize_SSL(void)
SSLerrmessage())));
}
- /* set up ephemeral DH keys, and disallow SSL v2 while at it */
+ /* set up ephemeral DH keys, and disallow SSL v2/v3 while at it */
SSL_CTX_set_tmp_dh_callback(SSL_context, tmp_dh_cb);
- SSL_CTX_set_options(SSL_context, SSL_OP_SINGLE_DH_USE | SSL_OP_NO_SSLv2);
+ SSL_CTX_set_options(SSL_context,
+ SSL_OP_SINGLE_DH_USE |
+ SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
/* set up ephemeral ECDH keys */
initialize_ecdh();
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 6ebabce72f..6526b2688a 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -149,6 +149,13 @@ CleanupProcSignalState(int status, Datum arg)
slot = &ProcSignalSlots[pss_idx - 1];
Assert(slot == MyProcSignalSlot);
+ /*
+ * Clear MyProcSignalSlot, so that a SIGUSR1 received after this point
+ * won't try to access it after it's no longer ours (and perhaps even
+ * after we've unmapped the shared memory segment).
+ */
+ MyProcSignalSlot = NULL;
+
/* sanity check */
if (slot->pss_pid != MyProcPid)
{
@@ -285,7 +292,7 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
- if (set_latch_on_sigusr1)
+ if (set_latch_on_sigusr1 && MyProc != NULL)
SetLatch(&MyProc->procLatch);
latch_sigusr1_handler();
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 45a48229a5..fb449a8820 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -774,6 +774,7 @@ ProcKill(int code, Datum arg)
{
/* use volatile pointer to prevent code rearrangement */
volatile PROC_HDR *procglobal = ProcGlobal;
+ PGPROC *proc;
Assert(MyProc != NULL);
@@ -802,31 +803,34 @@ ProcKill(int code, Datum arg)
*/
LWLockReleaseAll();
- /* Release ownership of the process's latch, too */
- DisownLatch(&MyProc->procLatch);
+ /*
+ * Clear MyProc first; then disown the process latch. This is so that
+ * signal handlers won't try to clear the process latch after it's no
+ * longer ours.
+ */
+ proc = MyProc;
+ MyProc = NULL;
+ DisownLatch(&proc->procLatch);
SpinLockAcquire(ProcStructLock);
/* Return PGPROC structure (and semaphore) to appropriate freelist */
if (IsAnyAutoVacuumProcess())
{
- MyProc->links.next = (SHM_QUEUE *) procglobal->autovacFreeProcs;
- procglobal->autovacFreeProcs = MyProc;
+ proc->links.next = (SHM_QUEUE *) procglobal->autovacFreeProcs;
+ procglobal->autovacFreeProcs = proc;
}
else if (IsBackgroundWorker)
{
- MyProc->links.next = (SHM_QUEUE *) procglobal->bgworkerFreeProcs;
- procglobal->bgworkerFreeProcs = MyProc;
+ proc->links.next = (SHM_QUEUE *) procglobal->bgworkerFreeProcs;
+ procglobal->bgworkerFreeProcs = proc;
}
else
{
- MyProc->links.next = (SHM_QUEUE *) procglobal->freeProcs;
- procglobal->freeProcs = MyProc;
+ proc->links.next = (SHM_QUEUE *) procglobal->freeProcs;
+ procglobal->freeProcs = proc;
}
- /* PGPROC struct isn't mine anymore */
- MyProc = NULL;
-
/* Update shared estimate of spins_per_delay */
procglobal->spins_per_delay = update_spins_per_delay(procglobal->spins_per_delay);
@@ -855,6 +859,7 @@ AuxiliaryProcKill(int code, Datum arg)
{
int proctype = DatumGetInt32(arg);
PGPROC *auxproc PG_USED_FOR_ASSERTS_ONLY;
+ PGPROC *proc;
Assert(proctype >= 0 && proctype < NUM_AUXILIARY_PROCS);
@@ -865,16 +870,19 @@ AuxiliaryProcKill(int code, Datum arg)
/* Release any LW locks I am holding (see notes above) */
LWLockReleaseAll();
- /* Release ownership of the process's latch, too */
- DisownLatch(&MyProc->procLatch);
+ /*
+ * Clear MyProc first; then disown the process latch. This is so that
+ * signal handlers won't try to clear the process latch after it's no
+ * longer ours.
+ */
+ proc = MyProc;
+ MyProc = NULL;
+ DisownLatch(&proc->procLatch);
SpinLockAcquire(ProcStructLock);
/* Mark auxiliary proc no longer in use */
- MyProc->pid = 0;
-
- /* PGPROC struct isn't mine anymore */
- MyProc = NULL;
+ proc->pid = 0;
/* Update shared estimate of spins_per_delay */
ProcGlobal->spins_per_delay = update_spins_per_delay(ProcGlobal->spins_per_delay);
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 5a6fe7d2d7..1d69b95387 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1622,12 +1622,12 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_CONST("IDENTITY");
}
- /* ALTER TABLESPACE <foo> with RENAME TO, OWNER TO, SET, RESET */
+ /* ALTER TABLESPACE <foo> with RENAME TO, OWNER TO, SET, RESET, MOVE */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
{
static const char *const list_ALTERTSPC[] =
- {"RENAME TO", "OWNER TO", "SET", "RESET", NULL};
+ {"RENAME TO", "OWNER TO", "SET", "RESET", "MOVE", NULL};
COMPLETE_WITH_LIST(list_ALTERTSPC);
}
@@ -1649,6 +1649,27 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_LIST(list_TABLESPACEOPTIONS);
}
+ /* ALTER TABLESPACE <foo> MOVE ALL|TABLES|INDEXES|MATERIALIZED VIEWS */
+ else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
+ pg_strcasecmp(prev3_wd, "TABLESPACE") == 0 &&
+ pg_strcasecmp(prev_wd, "MOVE") == 0)
+ {
+ static const char *const list_TABLESPACEMOVETARGETS[] =
+ {"ALL", "TABLES", "INDEXES", "MATERIALIZED VIEWS", NULL};
+
+ COMPLETE_WITH_LIST(list_TABLESPACEMOVETARGETS);
+ }
+ else if ((pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
+ pg_strcasecmp(prev2_wd, "MOVE") == 0) ||
+ (pg_strcasecmp(prev5_wd, "TABLESPACE") == 0 &&
+ pg_strcasecmp(prev3_wd, "MOVE") == 0 &&
+ pg_strcasecmp(prev2_wd, "MATERIALIZED") == 0))
+ {
+ static const char *const list_TABLESPACEMOVEOPTIONS[] =
+ {"OWNED BY", "TO", NULL};
+
+ COMPLETE_WITH_LIST(list_TABLESPACEMOVEOPTIONS);
+ }
/* ALTER TEXT SEARCH */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
@@ -2559,8 +2580,9 @@ psql_completion(char *text, int start, int end)
* but we may as well tab-complete both: perhaps some users prefer one
* variant or the other.
*/
- else if (pg_strcasecmp(prev3_wd, "FETCH") == 0 ||
- pg_strcasecmp(prev3_wd, "MOVE") == 0)
+ else if ((pg_strcasecmp(prev3_wd, "FETCH") == 0 ||
+ pg_strcasecmp(prev3_wd, "MOVE") == 0) &&
+ pg_strcasecmp(prev_wd, "TO") != 0)
{
static const char *const list_FROMIN[] =
{"FROM", "IN", NULL};
diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h
index c090be4ee8..66bd76505a 100644
--- a/src/include/catalog/pg_amproc.h
+++ b/src/include/catalog/pg_amproc.h
@@ -121,8 +121,6 @@ DATA(insert ( 1988 1700 1700 1 1769 ));
DATA(insert ( 1989 26 26 1 356 ));
DATA(insert ( 1989 26 26 2 3134 ));
DATA(insert ( 1991 30 30 1 404 ));
-DATA(insert ( 2994 2249 2249 1 2987 ));
-DATA(insert ( 3194 2249 2249 1 3187 ));
DATA(insert ( 1994 25 25 1 360 ));
DATA(insert ( 1996 1083 1083 1 1107 ));
DATA(insert ( 2000 1266 1266 1 1358 ));
@@ -134,7 +132,12 @@ DATA(insert ( 2233 703 703 1 380 ));
DATA(insert ( 2234 704 704 1 381 ));
DATA(insert ( 2789 27 27 1 2794 ));
DATA(insert ( 2968 2950 2950 1 2960 ));
+DATA(insert ( 2994 2249 2249 1 2987 ));
+DATA(insert ( 3194 2249 2249 1 3187 ));
DATA(insert ( 3522 3500 3500 1 3514 ));
+DATA(insert ( 3626 3614 3614 1 3622 ));
+DATA(insert ( 3683 3615 3615 1 3668 ));
+DATA(insert ( 3901 3831 3831 1 3870 ));
/* hash */
@@ -171,9 +174,18 @@ DATA(insert ( 2231 1042 1042 1 1080 ));
DATA(insert ( 2235 1033 1033 1 329 ));
DATA(insert ( 2969 2950 2950 1 2963 ));
DATA(insert ( 3523 3500 3500 1 3515 ));
+DATA(insert ( 3903 3831 3831 1 3902 ));
/* gist */
+DATA(insert ( 1029 600 600 1 2179 ));
+DATA(insert ( 1029 600 600 2 2583 ));
+DATA(insert ( 1029 600 600 3 1030 ));
+DATA(insert ( 1029 600 600 4 2580 ));
+DATA(insert ( 1029 600 600 5 2581 ));
+DATA(insert ( 1029 600 600 6 2582 ));
+DATA(insert ( 1029 600 600 7 2584 ));
+DATA(insert ( 1029 600 600 8 3064 ));
DATA(insert ( 2593 603 603 1 2578 ));
DATA(insert ( 2593 603 603 2 2583 ));
DATA(insert ( 2593 603 603 3 2579 ));
@@ -209,14 +221,13 @@ DATA(insert ( 3702 3615 3615 4 3696 ));
DATA(insert ( 3702 3615 3615 5 3700 ));
DATA(insert ( 3702 3615 3615 6 3697 ));
DATA(insert ( 3702 3615 3615 7 3699 ));
-DATA(insert ( 1029 600 600 1 2179 ));
-DATA(insert ( 1029 600 600 2 2583 ));
-DATA(insert ( 1029 600 600 3 1030 ));
-DATA(insert ( 1029 600 600 4 2580 ));
-DATA(insert ( 1029 600 600 5 2581 ));
-DATA(insert ( 1029 600 600 6 2582 ));
-DATA(insert ( 1029 600 600 7 2584 ));
-DATA(insert ( 1029 600 600 8 3064 ));
+DATA(insert ( 3919 3831 3831 1 3875 ));
+DATA(insert ( 3919 3831 3831 2 3876 ));
+DATA(insert ( 3919 3831 3831 3 3877 ));
+DATA(insert ( 3919 3831 3831 4 3878 ));
+DATA(insert ( 3919 3831 3831 5 3879 ));
+DATA(insert ( 3919 3831 3831 6 3880 ));
+DATA(insert ( 3919 3831 3831 7 3881 ));
/* gin */
@@ -345,20 +356,14 @@ DATA(insert ( 3659 3614 3614 2 3656 ));
DATA(insert ( 3659 3614 3614 3 3657 ));
DATA(insert ( 3659 3614 3614 4 3658 ));
DATA(insert ( 3659 3614 3614 5 2700 ));
-DATA(insert ( 3626 3614 3614 1 3622 ));
-DATA(insert ( 3683 3615 3615 1 3668 ));
-DATA(insert ( 3901 3831 3831 1 3870 ));
-DATA(insert ( 3903 3831 3831 1 3902 ));
-DATA(insert ( 3919 3831 3831 1 3875 ));
-DATA(insert ( 3919 3831 3831 2 3876 ));
-DATA(insert ( 3919 3831 3831 3 3877 ));
-DATA(insert ( 3919 3831 3831 4 3878 ));
-DATA(insert ( 3919 3831 3831 5 3879 ));
-DATA(insert ( 3919 3831 3831 6 3880 ));
-DATA(insert ( 3919 3831 3831 7 3881 ));
/* sp-gist */
+DATA(insert ( 3474 3831 3831 1 3469 ));
+DATA(insert ( 3474 3831 3831 2 3470 ));
+DATA(insert ( 3474 3831 3831 3 3471 ));
+DATA(insert ( 3474 3831 3831 4 3472 ));
+DATA(insert ( 3474 3831 3831 5 3473 ));
DATA(insert ( 4015 600 600 1 4018 ));
DATA(insert ( 4015 600 600 2 4019 ));
DATA(insert ( 4015 600 600 3 4020 ));
@@ -374,10 +379,5 @@ DATA(insert ( 4017 25 25 2 4028 ));
DATA(insert ( 4017 25 25 3 4029 ));
DATA(insert ( 4017 25 25 4 4030 ));
DATA(insert ( 4017 25 25 5 4031 ));
-DATA(insert ( 3474 3831 3831 1 3469 ));
-DATA(insert ( 3474 3831 3831 2 3470 ));
-DATA(insert ( 3474 3831 3831 3 3471 ));
-DATA(insert ( 3474 3831 3831 4 3472 ));
-DATA(insert ( 3474 3831 3831 5 3473 ));
#endif /* PG_AMPROC_H */
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index 7e7a4f9ff1..d8ac40c784 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -967,8 +967,10 @@ init_ssl_system(PGconn *conn)
}
/*
- * Only SSLv23_method() negotiates higher protocol versions;
- * alternatives like TLSv1_2_method() permit one specific version.
+ * We use SSLv23_method() because it can negotiate use of the highest
+ * mutually supported protocol version, while alternatives like
+ * TLSv1_2_method() permit only one specific version. Note that we
+ * don't actually allow SSL v2 or v3, only TLS protocols (see below).
*/
SSL_context = SSL_CTX_new(SSLv23_method());
if (!SSL_context)
diff --git a/src/tools/entab/entab.c b/src/tools/entab/entab.c
index 3b849f2a72..19b1740c9b 100644
--- a/src/tools/entab/entab.c
+++ b/src/tools/entab/entab.c
@@ -51,13 +51,18 @@ main(int argc, char **argv)
{
int tab_size = 8,
min_spaces = 2,
+ only_comment_periods = FALSE,
protect_quotes = FALSE,
+ protect_leading_whitespace = FALSE,
del_tabs = FALSE,
clip_lines = FALSE,
+ in_comment = FALSE,
+ was_period = FALSE,
prv_spaces,
col_in_tab,
escaped,
- nxt_spaces;
+ nxt_spaces,
+ in_leading_whitespace;
char in_line[BUFSIZ],
out_line[BUFSIZ],
*src,
@@ -74,7 +79,7 @@ main(int argc, char **argv)
if (strcmp(cp, "detab") == 0)
del_tabs = 1;
- while ((ch = getopt(argc, argv, "cdhqs:t:")) != -1)
+ while ((ch = getopt(argc, argv, "cdhlmqs:t:")) != -1)
switch (ch)
{
case 'c':
@@ -83,6 +88,13 @@ main(int argc, char **argv)
case 'd':
del_tabs = TRUE;
break;
+ case 'l':
+ protect_leading_whitespace = TRUE;
+ break;
+ case 'm':
+ /* only process text followed by periods in C comments */
+ only_comment_periods = TRUE;
+ break;
case 'q':
protect_quotes = TRUE;
break;
@@ -97,6 +109,8 @@ main(int argc, char **argv)
fprintf(stderr, "USAGE: %s [ -cdqst ] [file ...]\n\
-c (clip trailing whitespace)\n\
-d (delete tabs)\n\
+ -l (protect leading whitespace)\n\
+ -m (only C comment periods)\n\
-q (protect quotes)\n\
-s minimum_spaces\n\
-t tab_width\n",
@@ -134,13 +148,24 @@ main(int argc, char **argv)
if (escaped == FALSE)
quote_char = ' ';
escaped = FALSE;
+ in_leading_whitespace = TRUE;
/* process line */
while (*src != NUL)
{
col_in_tab++;
+
+ /* look backward so we handle slash-star-slash properly */
+ if (!in_comment && src > in_line &&
+ *(src - 1) == '/' && *src == '*')
+ in_comment = TRUE;
+ else if (in_comment && *src == '*' && *(src + 1) == '/')
+ in_comment = FALSE;
+
/* Is this a potential space/tab replacement? */
- if (quote_char == ' ' && (*src == ' ' || *src == '\t'))
+ if ((!only_comment_periods || (in_comment && was_period)) &&
+ (!protect_leading_whitespace || !in_leading_whitespace) &&
+ quote_char == ' ' && (*src == ' ' || *src == '\t'))
{
if (*src == '\t')
{
@@ -192,6 +217,11 @@ main(int argc, char **argv)
/* Not a potential space/tab replacement */
else
{
+ /* allow leading stars in comments */
+ if (in_leading_whitespace && *src != ' ' && *src != '\t' &&
+ (!in_comment || *src != '*'))
+ in_leading_whitespace = FALSE;
+ was_period = (*src == '.');
/* output accumulated spaces */
output_accumulated_spaces(&prv_spaces, &dst);
/* This can only happen in a quote. */
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 8e45b18a9a..8633c62c5a 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -22,10 +22,11 @@ my $indent_opts =
# indent-dependant settings
my $extra_opts = "";
-my ($typedefs_file, $code_base, $excludes, $indent, $build);
+my ($typedefs_file, $typedef_str, $code_base, $excludes, $indent, $build);
my %options = (
"typedefs=s" => \$typedefs_file,
+ "list-of-typedefs=s" => \$typedef_str,
"code-base=s" => \$code_base,
"excludes=s" => \$excludes,
"indent=s" => \$indent,
@@ -126,6 +127,15 @@ sub load_typedefs
my @typedefs = <$typedefs_fh>;
close($typedefs_fh);
+ # add command-line-supplied typedefs?
+ if (defined($typedef_str))
+ {
+ foreach my $typedef (split(m/[, \t\n]+/, $typedef_str))
+ {
+ push(@typedefs, $typedef . "\n");
+ }
+ }
+
# remove certain entries
@typedefs =
grep { !m/^(FD_SET|date|interval|timestamp|ANY)\n?$/ } @typedefs;