Compare commits

..

No commits in common. "22655aa23132a0645fdcdce4b233a1fff0c0cf8f" and "0013ba290b6684d095d93517ff2ca1fadf79bdb9" have entirely different histories.

30 changed files with 74 additions and 532 deletions

View File

@ -250,62 +250,4 @@ SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
t
(1 row)
-- New views for pg_stat_statements in 1.11
AlTER EXTENSION pg_stat_statements UPDATE TO '1.11';
\d pg_stat_statements
View "public.pg_stat_statements"
Column | Type | Collation | Nullable | Default
------------------------+------------------+-----------+----------+---------
userid | oid | | |
dbid | oid | | |
toplevel | boolean | | |
queryid | bigint | | |
query | text | | |
plans | bigint | | |
total_plan_time | double precision | | |
min_plan_time | double precision | | |
max_plan_time | double precision | | |
mean_plan_time | double precision | | |
stddev_plan_time | double precision | | |
calls | bigint | | |
total_exec_time | double precision | | |
min_exec_time | double precision | | |
max_exec_time | double precision | | |
mean_exec_time | double precision | | |
stddev_exec_time | double precision | | |
rows | bigint | | |
shared_blks_hit | bigint | | |
shared_blks_read | bigint | | |
shared_blks_dirtied | bigint | | |
shared_blks_written | bigint | | |
local_blks_hit | bigint | | |
local_blks_read | bigint | | |
local_blks_dirtied | bigint | | |
local_blks_written | bigint | | |
temp_blks_read | bigint | | |
temp_blks_written | bigint | | |
blk_read_time | double precision | | |
blk_write_time | double precision | | |
temp_blk_read_time | double precision | | |
temp_blk_write_time | double precision | | |
wal_records | bigint | | |
wal_fpi | bigint | | |
wal_bytes | numeric | | |
jit_functions | bigint | | |
jit_generation_time | double precision | | |
jit_inlining_count | bigint | | |
jit_inlining_time | double precision | | |
jit_optimization_count | bigint | | |
jit_optimization_time | double precision | | |
jit_emission_count | bigint | | |
jit_emission_time | double precision | | |
jit_deform_count | bigint | | |
jit_deform_time | double precision | | |
SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
has_data
----------
t
(1 row)
DROP EXTENSION pg_stat_statements;

View File

@ -48,9 +48,4 @@ AlTER EXTENSION pg_stat_statements UPDATE TO '1.10';
\d pg_stat_statements
SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
-- New views for pg_stat_statements in 1.11
AlTER EXTENSION pg_stat_statements UPDATE TO '1.11';
\d pg_stat_statements
SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
DROP EXTENSION pg_stat_statements;

View File

@ -10611,7 +10611,7 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
</sect2>
<sect2 id="functions-datetime-zoneconvert">
<title><literal>AT TIME ZONE and AT LOCAL</literal></title>
<title><literal>AT TIME ZONE</literal></title>
<indexterm>
<primary>time zone</primary>
@ -10622,10 +10622,6 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
<primary>AT TIME ZONE</primary>
</indexterm>
<indexterm>
<primary>AT LOCAL</primary>
</indexterm>
<para>
The <literal>AT TIME ZONE</literal> operator converts time
stamp <emphasis>without</emphasis> time zone to/from
@ -10636,7 +10632,7 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
</para>
<table id="functions-datetime-zoneconvert-table">
<title><literal>AT TIME ZONE</literal> and <literal>AT LOCAL</literal> Variants</title>
<title><literal>AT TIME ZONE</literal> Variants</title>
<tgroup cols="1">
<thead>
<row>
@ -10669,22 +10665,6 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>timestamp without time zone</type> <literal>AT LOCAL</literal>
<returnvalue>timestamp with time zone</returnvalue>
</para>
<para>
Converts given time stamp <emphasis>without</emphasis> time zone to
time stamp <emphasis>with</emphasis> the session's
<varname>TimeZone</varname> value as time zone.
</para>
<para>
<literal>timestamp '2001-02-16 20:38:40' at local</literal>
<returnvalue>2001-02-17 03:38:40+00</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>timestamp with time zone</type> <literal>AT TIME ZONE</literal> <replaceable>zone</replaceable>
@ -10701,22 +10681,6 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>timestamp with time zone</type> <literal>AT LOCAL</literal>
<returnvalue>timestamp without time zone</returnvalue>
</para>
<para>
Converts given time stamp <emphasis>with</emphasis> time zone to
time stamp <emphasis>without</emphasis> time zone, as the time would
appear with the session's <varname>TimeZone</varname> value as time zone.
</para>
<para>
<literal>timestamp with time zone '2001-02-16 20:38:40-05' at local</literal>
<returnvalue>2001-02-16 18:38:40</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>time with time zone</type> <literal>AT TIME ZONE</literal> <replaceable>zone</replaceable>
@ -10732,25 +10696,6 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
<returnvalue>10:34:17+00</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>time with time zone</type> <literal>AT LOCAL</literal>
<returnvalue>time with time zone</returnvalue>
</para>
<para>
Converts given time <emphasis>with</emphasis> time zone to a new time
zone. Since no date is supplied, this uses the currently active UTC
offset for the session's <varname>TimeZone</varname> value.
</para>
<para>
Assuming the session's <varname>TimeZone</varname> is set to <literal>UTC</literal>:
</para>
<para>
<literal>time with time zone '05:34:17-05' at local</literal>
<returnvalue>10:34:17+00</returnvalue>
</para></entry>
</row>
</tbody>
</tgroup>
</table>
@ -10765,13 +10710,6 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
UTC, so it is not very common in practice.
</para>
<para>
The syntax <literal>AT LOCAL</literal> may be used as shorthand for
<literal>AT TIME ZONE <replaceable>local</replaceable></literal>, where
<replaceable>local</replaceable> is the session's
<varname>TimeZone</varname> value.
</para>
<para>
Examples (assuming the current <xref linkend="guc-timezone"/> setting
is <literal>America/Los_Angeles</literal>):
@ -10784,12 +10722,6 @@ SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/D
SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT LOCAL;
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 17:38:40</computeroutput>
SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
<lineannotation>Result: </lineannotation><computeroutput>17:38:40</computeroutput>
</screen>
The first example adds a time zone to a value that lacks it, and
displays the value using the current <varname>TimeZone</varname>
@ -10797,18 +10729,7 @@ SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
to the specified time zone, and returns the value without a time zone.
This allows storage and display of values different from the current
<varname>TimeZone</varname> setting. The third example converts
Tokyo time to Chicago time. The fourth example shifts the time stamp
with time zone value to the time zone currently specified by the
<varname>TimeZone</varname> setting and returns the value without a
time zone.
</para>
<para>
The fifth example is a cautionary tale. Due to the fact that there is no
date associated with the input value, the conversion is made using the
current date of the session. Therefore, this static example may show a wrong
result depending on the time of the year it is viewed because
<literal>'America/Los_Angeles'</literal> observes Daylight Savings Time.
Tokyo time to Chicago time.
</para>
<para>
@ -10824,18 +10745,6 @@ SELECT TIME WITH TIME ZONE '20:38:40-05' AT LOCAL;
<literal><replaceable>time</replaceable> AT TIME ZONE
<replaceable>zone</replaceable></literal>.
</para>
<para>
The function <literal><function>timezone</function>(<replaceable>timestamp</replaceable>)</literal>
is equivalent to the SQL-conforming construct <literal><replaceable>timestamp</replaceable>
AT LOCAL</literal>.
</para>
<para>
The function <literal><function>timezone</function>(<replaceable>time</replaceable>)</literal>
is equivalent to the SQL-conforming construct <literal><replaceable>time</replaceable>
AT LOCAL</literal>.
</para>
</sect2>
<sect2 id="functions-datetime-current">

View File

@ -274,11 +274,9 @@
</para>
<para>
Normally, the remote replication slot is created automatically when the
subscription is created using <link linkend="sql-createsubscription">
<command>CREATE SUBSCRIPTION</command></link> and it
subscription is created using <command>CREATE SUBSCRIPTION</command> and it
is dropped automatically when the subscription is dropped using
<link linkend="sql-dropsubscription"><command>DROP SUBSCRIPTION</command></link>.
In some situations, however, it can
<command>DROP SUBSCRIPTION</command>. In some situations, however, it can
be useful or necessary to manipulate the subscription and the underlying
replication slot separately. Here are some scenarios:
@ -308,9 +306,8 @@
When dropping a subscription, the replication slot should be kept.
This could be useful when the subscriber database is being moved to a
different host and will be activated from there. In that case,
disassociate the slot from the subscription using
<link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION</command></link>
before attempting to drop the subscription.
disassociate the slot from the subscription using <command>ALTER
SUBSCRIPTION</command> before attempting to drop the subscription.
</para>
</listitem>
@ -1352,8 +1349,7 @@ test_sub=# SELECT * FROM child ORDER BY a;
If a subscription is affected by this problem, the only way to resume
replication is to adjust one of the column lists on the publication
side so that they all match; and then either recreate the subscription,
or use <link linkend="sql-altersubscription-params-setadddrop-publication">
<literal>ALTER SUBSCRIPTION ... DROP PUBLICATION</literal></link> to
or use <literal>ALTER SUBSCRIPTION ... DROP PUBLICATION</literal> to
remove one of the offending publications and add it again.
</para>
</warning>
@ -1508,15 +1504,13 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
the replication origin name can be found from the server log (LSN 0/14C0378 and
replication origin <literal>pg_16395</literal> in the above case). The
transaction that produced the conflict can be skipped by using
<link linkend="sql-altersubscription-params-skip"><command>ALTER SUBSCRIPTION ... SKIP</command></link>
with the finish LSN
<command>ALTER SUBSCRIPTION ... SKIP</command> with the finish LSN
(i.e., LSN 0/14C0378). The finish LSN could be an LSN at which the transaction
is committed or prepared on the publisher. Alternatively, the transaction can
also be skipped by calling the <link linkend="pg-replication-origin-advance">
<function>pg_replication_origin_advance()</function></link> function.
Before using this function, the subscription needs to be disabled temporarily
either by <link linkend="sql-altersubscription-params-disable">
<command>ALTER SUBSCRIPTION ... DISABLE</command></link> or, the
either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
subscription can be used with the
<link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>
option. Then, you can use <function>pg_replication_origin_advance()</function>

View File

@ -51,8 +51,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
<literal>ADD</literal> and <literal>DROP</literal> clauses will add and
remove one or more tables/schemas from the publication. Note that adding
tables/schemas to a publication that is already subscribed to will require an
<link linkend="sql-altersubscription-params-refresh-publication">
<literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal></link> action on the
<literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the
subscribing side in order to become effective. Note also that
<literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables
that were specified using

View File

@ -85,7 +85,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
<title>Parameters</title>
<variablelist>
<varlistentry id="sql-altersubscription-params-name">
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
@ -94,7 +94,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-connection">
<varlistentry>
<term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
<listitem>
<para>
@ -105,7 +105,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-setadddrop-publication">
<varlistentry>
<term><literal>SET PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term>
<term><literal>ADD PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term>
<term><literal>DROP PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term>
@ -147,14 +147,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-refresh-publication">
<varlistentry>
<term><literal>REFRESH PUBLICATION</literal></term>
<listitem>
<para>
Fetch missing table information from publisher. This will start
replication of tables that were added to the subscribed-to publications
since <link linkend="sql-createsubscription">
<command>CREATE SUBSCRIPTION</command></link> or
since <command>CREATE SUBSCRIPTION</command> or
the last invocation of <command>REFRESH PUBLICATION</command>.
</para>
@ -193,7 +192,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-enable">
<varlistentry>
<term><literal>ENABLE</literal></term>
<listitem>
<para>
@ -203,7 +202,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-disable">
<varlistentry>
<term><literal>DISABLE</literal></term>
<listitem>
<para>
@ -213,7 +212,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-set">
<varlistentry>
<term><literal>SET ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
<listitem>
<para>
@ -233,7 +232,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-skip">
<varlistentry>
<term><literal>SKIP ( <replaceable class="parameter">skip_option</replaceable> = <replaceable class="parameter">value</replaceable> )</literal></term>
<listitem>
<para>
@ -273,7 +272,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-new-owner">
<varlistentry>
<term><replaceable class="parameter">new_owner</replaceable></term>
<listitem>
<para>
@ -282,7 +281,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
</listitem>
</varlistentry>
<varlistentry id="sql-altersubscription-params-new-name">
<varlistentry>
<term><replaceable class="parameter">new_name</replaceable></term>
<listitem>
<para>

View File

@ -40,7 +40,7 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
<para>
<command>DROP SUBSCRIPTION</command> cannot be executed inside a
transaction block if the subscription is associated with a replication
slot. (You can use <link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION</command></link> to unset the
slot. (You can use <command>ALTER SUBSCRIPTION</command> to unset the
slot.)
</para>
</refsect1>
@ -87,11 +87,9 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
replication slot cannot be dropped or does not exist or never existed,
the <command>DROP SUBSCRIPTION</command> command will fail. To proceed
in this situation, first disable the subscription by executing
<link linkend="sql-altersubscription-params-disable">
<literal>ALTER SUBSCRIPTION ... DISABLE</literal></link>, and then disassociate
<literal>ALTER SUBSCRIPTION ... DISABLE</literal>, and then disassociate
it from the replication slot by executing
<link linkend="sql-altersubscription-params-set">
<literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal></link>.
<literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any
actions on a remote host. Note that if the remote replication slot still
exists, it (and any related table synchronization slots) should then be

View File

@ -1792,17 +1792,6 @@ ReleaseBulkInsertStatePin(BulkInsertState bistate)
if (bistate->current_buf != InvalidBuffer)
ReleaseBuffer(bistate->current_buf);
bistate->current_buf = InvalidBuffer;
/*
* Despite the name, we also reset bulk relation extension
* state. Otherwise we can end up erroring out due to looking for free
* space in ->next_free of one partition, even though ->next_free was set
* when extending another partition. It's obviously also could be bad for
* efficiency to look at existing blocks at offsets from another
* partition, even if we don't error out.
*/
bistate->next_free = InvalidBlockNumber;
bistate->last_free = InvalidBlockNumber;
}

View File

@ -130,7 +130,7 @@ bool *wal_consistency_checking = NULL;
bool wal_init_zero = true;
bool wal_recycle = true;
bool log_checkpoints = true;
int wal_sync_method = DEFAULT_WAL_SYNC_METHOD;
int sync_method = DEFAULT_SYNC_METHOD;
int wal_level = WAL_LEVEL_REPLICA;
int CommitDelay = 0; /* precommit delay in microseconds */
int CommitSiblings = 5; /* # concurrent xacts needed to sleep */
@ -171,17 +171,17 @@ static bool check_wal_consistency_checking_deferred = false;
/*
* GUC support
*/
const struct config_enum_entry wal_sync_method_options[] = {
{"fsync", WAL_SYNC_METHOD_FSYNC, false},
const struct config_enum_entry sync_method_options[] = {
{"fsync", SYNC_METHOD_FSYNC, false},
#ifdef HAVE_FSYNC_WRITETHROUGH
{"fsync_writethrough", WAL_SYNC_METHOD_FSYNC_WRITETHROUGH, false},
{"fsync_writethrough", SYNC_METHOD_FSYNC_WRITETHROUGH, false},
#endif
{"fdatasync", WAL_SYNC_METHOD_FDATASYNC, false},
{"fdatasync", SYNC_METHOD_FDATASYNC, false},
#ifdef O_SYNC
{"open_sync", WAL_SYNC_METHOD_OPEN, false},
{"open_sync", SYNC_METHOD_OPEN, false},
#endif
#ifdef O_DSYNC
{"open_datasync", WAL_SYNC_METHOD_OPEN_DSYNC, false},
{"open_datasync", SYNC_METHOD_OPEN_DSYNC, false},
#endif
{NULL, 0, false}
};
@ -2343,8 +2343,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
* have no open file or the wrong one. However, we do not need to
* fsync more than one file.
*/
if (wal_sync_method != WAL_SYNC_METHOD_OPEN &&
wal_sync_method != WAL_SYNC_METHOD_OPEN_DSYNC)
if (sync_method != SYNC_METHOD_OPEN &&
sync_method != SYNC_METHOD_OPEN_DSYNC)
{
if (openLogFile >= 0 &&
!XLByteInPrevSeg(LogwrtResult.Write, openLogSegNo,
@ -2974,7 +2974,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
*/
*added = false;
fd = BasicOpenFile(path, O_RDWR | PG_BINARY | O_CLOEXEC |
get_sync_bit(wal_sync_method));
get_sync_bit(sync_method));
if (fd < 0)
{
if (errno != ENOENT)
@ -3139,7 +3139,7 @@ XLogFileInit(XLogSegNo logsegno, TimeLineID logtli)
/* Now open original target segment (might not be file I just made) */
fd = BasicOpenFile(path, O_RDWR | PG_BINARY | O_CLOEXEC |
get_sync_bit(wal_sync_method));
get_sync_bit(sync_method));
if (fd < 0)
ereport(ERROR,
(errcode_for_file_access(),
@ -3371,7 +3371,7 @@ XLogFileOpen(XLogSegNo segno, TimeLineID tli)
XLogFilePath(path, tli, segno, wal_segment_size);
fd = BasicOpenFile(path, O_RDWR | PG_BINARY | O_CLOEXEC |
get_sync_bit(wal_sync_method));
get_sync_bit(sync_method));
if (fd < 0)
ereport(PANIC,
(errcode_for_file_access(),
@ -8137,16 +8137,16 @@ get_sync_bit(int method)
* not included in the enum option array, and therefore will never
* be seen here.
*/
case WAL_SYNC_METHOD_FSYNC:
case WAL_SYNC_METHOD_FSYNC_WRITETHROUGH:
case WAL_SYNC_METHOD_FDATASYNC:
case SYNC_METHOD_FSYNC:
case SYNC_METHOD_FSYNC_WRITETHROUGH:
case SYNC_METHOD_FDATASYNC:
return o_direct_flag;
#ifdef O_SYNC
case WAL_SYNC_METHOD_OPEN:
case SYNC_METHOD_OPEN:
return O_SYNC | o_direct_flag;
#endif
#ifdef O_DSYNC
case WAL_SYNC_METHOD_OPEN_DSYNC:
case SYNC_METHOD_OPEN_DSYNC:
return O_DSYNC | o_direct_flag;
#endif
default:
@ -8160,9 +8160,9 @@ get_sync_bit(int method)
* GUC support
*/
void
assign_wal_sync_method(int new_wal_sync_method, void *extra)
assign_xlog_sync_method(int new_sync_method, void *extra)
{
if (wal_sync_method != new_wal_sync_method)
if (sync_method != new_sync_method)
{
/*
* To ensure that no blocks escape unsynced, force an fsync on the
@ -8188,7 +8188,7 @@ assign_wal_sync_method(int new_wal_sync_method, void *extra)
}
pgstat_report_wait_end();
if (get_sync_bit(wal_sync_method) != get_sync_bit(new_wal_sync_method))
if (get_sync_bit(sync_method) != get_sync_bit(new_sync_method))
XLogFileClose();
}
}
@ -8214,8 +8214,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
* file.
*/
if (!enableFsync ||
wal_sync_method == WAL_SYNC_METHOD_OPEN ||
wal_sync_method == WAL_SYNC_METHOD_OPEN_DSYNC)
sync_method == SYNC_METHOD_OPEN ||
sync_method == SYNC_METHOD_OPEN_DSYNC)
return;
/* Measure I/O timing to sync the WAL file */
@ -8225,29 +8225,29 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
INSTR_TIME_SET_ZERO(start);
pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC);
switch (wal_sync_method)
switch (sync_method)
{
case WAL_SYNC_METHOD_FSYNC:
case SYNC_METHOD_FSYNC:
if (pg_fsync_no_writethrough(fd) != 0)
msg = _("could not fsync file \"%s\": %m");
break;
#ifdef HAVE_FSYNC_WRITETHROUGH
case WAL_SYNC_METHOD_FSYNC_WRITETHROUGH:
case SYNC_METHOD_FSYNC_WRITETHROUGH:
if (pg_fsync_writethrough(fd) != 0)
msg = _("could not fsync write-through file \"%s\": %m");
break;
#endif
case WAL_SYNC_METHOD_FDATASYNC:
case SYNC_METHOD_FDATASYNC:
if (pg_fdatasync(fd) != 0)
msg = _("could not fdatasync file \"%s\": %m");
break;
case WAL_SYNC_METHOD_OPEN:
case WAL_SYNC_METHOD_OPEN_DSYNC:
case SYNC_METHOD_OPEN:
case SYNC_METHOD_OPEN_DSYNC:
/* not reachable */
Assert(false);
break;
default:
elog(PANIC, "unrecognized wal_sync_method: %d", wal_sync_method);
elog(PANIC, "unrecognized wal_sync_method: %d", sync_method);
break;
}

View File

@ -14508,13 +14508,6 @@ a_expr: c_expr { $$ = $1; }
COERCE_SQL_SYNTAX,
@2);
}
| a_expr AT LOCAL %prec AT
{
$$ = (Node *) makeFuncCall(SystemFuncName("timezone"),
list_make1($1),
COERCE_SQL_SYNTAX,
-1);
}
/*
* These operators must be called out explicitly in order to make use
* of bison's automatic operator-precedence handling. All other

View File

@ -398,9 +398,9 @@ pg_fsync(int fd)
errno = 0;
#endif
/* #if is to skip the wal_sync_method test if there's no need for it */
/* #if is to skip the sync_method test if there's no need for it */
#if defined(HAVE_FSYNC_WRITETHROUGH)
if (wal_sync_method == WAL_SYNC_METHOD_FSYNC_WRITETHROUGH)
if (sync_method == SYNC_METHOD_FSYNC_WRITETHROUGH)
return pg_fsync_writethrough(fd);
else
#endif

View File

@ -3125,18 +3125,3 @@ timetz_izone(PG_FUNCTION_ARGS)
PG_RETURN_TIMETZADT_P(result);
}
/* timetz_at_local()
*
* Unlike for timestamp[tz]_at_local, the type for timetz does not flip between
* time with/without time zone, so we cannot just call the conversion function.
*/
Datum
timetz_at_local(PG_FUNCTION_ARGS)
{
Datum time = PG_GETARG_DATUM(0);
const char *tzn = pg_get_timezone_name(session_timezone);
Datum zone = PointerGetDatum(cstring_to_text(tzn));
return DirectFunctionCall2(timetz_zone, zone, time);
}

View File

@ -10347,16 +10347,6 @@ get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
appendStringInfoChar(buf, ')');
return true;
case F_TIMEZONE_TIMESTAMP:
case F_TIMEZONE_TIMESTAMPTZ:
case F_TIMEZONE_TIMETZ:
/* AT LOCAL */
appendStringInfoChar(buf, '(');
get_rule_expr_paren((Node *) linitial(expr->args), context, false,
(Node *) expr);
appendStringInfoString(buf, " AT LOCAL)");
return true;
case F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_INTERVAL:
case F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_TIMESTAMPTZ:
case F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL:

View File

@ -5921,23 +5921,3 @@ generate_series_timestamptz_at_zone(PG_FUNCTION_ARGS)
{
return generate_series_timestamptz_internal(fcinfo);
}
/* timestamp_at_local()
* timestamptz_at_local()
*
* The regression tests do not like two functions with the same proargs and
* prosrc but different proname, but the grammar for AT LOCAL needs an
* overloaded name to handle both types of timestamp, so we make simple
* wrappers for it.
*/
Datum
timestamp_at_local(PG_FUNCTION_ARGS)
{
return timestamp_timestamptz(fcinfo);
}
Datum
timestamptz_at_local(PG_FUNCTION_ARGS)
{
return timestamptz_timestamp(fcinfo);
}

View File

@ -485,7 +485,7 @@ static const struct config_enum_entry wal_compression_options[] = {
extern const struct config_enum_entry wal_level_options[];
extern const struct config_enum_entry archive_mode_options[];
extern const struct config_enum_entry recovery_target_action_options[];
extern const struct config_enum_entry wal_sync_method_options[];
extern const struct config_enum_entry sync_method_options[];
extern const struct config_enum_entry dynamic_shared_memory_options[];
/*
@ -4843,9 +4843,9 @@ struct config_enum ConfigureNamesEnum[] =
gettext_noop("Selects the method used for forcing WAL updates to disk."),
NULL
},
&wal_sync_method,
DEFAULT_WAL_SYNC_METHOD, wal_sync_method_options,
NULL, assign_wal_sync_method, NULL
&sync_method,
DEFAULT_SYNC_METHOD, sync_method_options,
NULL, assign_xlog_sync_method, NULL
},
{

View File

@ -4682,12 +4682,6 @@ psql_completion(const char *text, int start, int end)
else if (TailMatches("JOIN"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_selectables);
/* ... AT [ LOCAL | TIME ZONE ] ... */
else if (TailMatches("AT"))
COMPLETE_WITH("LOCAL", "TIME ZONE");
else if (TailMatches("AT", "TIME", "ZONE"))
COMPLETE_WITH_TIMEZONE_NAME();
/* Backslash commands */
/* TODO: \dc \dd \dl */
else if (TailMatchesCS("\\?"))

View File

@ -19,15 +19,12 @@
/* Sync methods */
typedef enum WalSyncMethod
{
WAL_SYNC_METHOD_FSYNC = 0,
WAL_SYNC_METHOD_FDATASYNC,
WAL_SYNC_METHOD_OPEN, /* for O_SYNC */
WAL_SYNC_METHOD_FSYNC_WRITETHROUGH,
WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */
} WalSyncMethod;
extern PGDLLIMPORT int wal_sync_method;
#define SYNC_METHOD_FSYNC 0
#define SYNC_METHOD_FDATASYNC 1
#define SYNC_METHOD_OPEN 2 /* for O_SYNC */
#define SYNC_METHOD_FSYNC_WRITETHROUGH 3
#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */
extern PGDLLIMPORT int sync_method;
extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr;
extern PGDLLIMPORT XLogRecPtr XactLastRecEnd;

View File

@ -71,12 +71,12 @@ typedef uint16 RepOriginId;
*
* Note that we define our own O_DSYNC on Windows, but not O_SYNC.
*/
#if defined(PLATFORM_DEFAULT_WAL_SYNC_METHOD)
#define DEFAULT_WAL_SYNC_METHOD PLATFORM_DEFAULT_WAL_SYNC_METHOD
#if defined(PLATFORM_DEFAULT_SYNC_METHOD)
#define DEFAULT_SYNC_METHOD PLATFORM_DEFAULT_SYNC_METHOD
#elif defined(O_DSYNC) && (!defined(O_SYNC) || O_DSYNC != O_SYNC)
#define DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_OPEN_DSYNC
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC
#else
#define DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
#endif
#endif /* XLOG_DEFS_H */

View File

@ -57,6 +57,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202310131
#define CATALOG_VERSION_NO 202309251
#endif

View File

@ -2319,9 +2319,6 @@
{ oid => '1159', descr => 'adjust timestamp to new time zone',
proname => 'timezone', prorettype => 'timestamp',
proargtypes => 'text timestamptz', prosrc => 'timestamptz_zone' },
{ oid => '9159', descr => 'adjust timestamp to local time zone',
proname => 'timezone', provolatile => 's', prorettype => 'timestamp',
proargtypes => 'timestamptz', prosrc => 'timestamptz_at_local' },
{ oid => '1160', descr => 'I/O',
proname => 'interval_in', provolatile => 's', prorettype => 'interval',
@ -6098,9 +6095,6 @@
{ oid => '2038', descr => 'adjust time with time zone to new zone',
proname => 'timezone', prorettype => 'timetz',
proargtypes => 'interval timetz', prosrc => 'timetz_izone' },
{ oid => '9161', descr => 'adjust time to local time zone',
proname => 'timezone', provolatile => 's', prorettype => 'timetz',
proargtypes => 'timetz', prosrc => 'timetz_at_local' },
{ oid => '2039', descr => 'hash',
proname => 'timestamp_hash', prorettype => 'int4', proargtypes => 'timestamp',
prosrc => 'timestamp_hash' },
@ -6196,9 +6190,6 @@
{ oid => '2070', descr => 'adjust timestamp to new time zone',
proname => 'timezone', prorettype => 'timestamptz',
proargtypes => 'interval timestamp', prosrc => 'timestamp_izone' },
{ oid => '9160', descr => 'adjust timestamp to local time zone',
proname => 'timezone', provolatile => 's', prorettype => 'timestamptz',
proargtypes => 'timestamp', prosrc => 'timestamp_at_local' },
{ oid => '2071',
proname => 'date_pl_interval', prorettype => 'timestamp',
proargtypes => 'date interval', prosrc => 'date_pl_interval' },

View File

@ -5,4 +5,4 @@
* would prefer open_datasync on FreeBSD 13+, but that is not a good choice on
* many systems.
*/
#define PLATFORM_DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC
#define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC

View File

@ -19,4 +19,4 @@
* perform better and (b) causes outright failures on ext4 data=journal
* filesystems, because those don't support O_DIRECT.
*/
#define PLATFORM_DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC
#define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC

View File

@ -159,6 +159,6 @@ extern bool check_wal_consistency_checking(char **newval, void **extra,
GucSource source);
extern void assign_wal_consistency_checking(const char *newval, void *extra);
extern bool check_wal_segment_size(int *newval, void **extra, GucSource source);
extern void assign_wal_sync_method(int new_wal_sync_method, void *extra);
extern void assign_xlog_sync_method(int new_sync_method, void *extra);
#endif /* GUC_HOOKS_H */

View File

@ -257,40 +257,3 @@ ERROR: value too long for type character varying(5)
\.
invalid command \.
drop table oversized_column_default;
--
-- Create partitioned table that does not allow bulk insertions, to test bugs
-- related to the reuse of BulkInsertState across partitions (only done when
-- not using bulk insert). Switching between partitions often makes it more
-- likely to encounter these bugs, so we just switch on roughly every insert
-- by having an even/odd number partition and inserting evenly distributed
-- data.
--
CREATE TABLE parted_si (
id int not null,
data text not null,
-- prevent use of bulk insert by having a volatile function
rand float8 not null default random()
)
PARTITION BY LIST((id % 2));
CREATE TABLE parted_si_p_even PARTITION OF parted_si FOR VALUES IN (0);
CREATE TABLE parted_si_p_odd PARTITION OF parted_si FOR VALUES IN (1);
-- Test that bulk relation extension handles reusing a single BulkInsertState
-- across partitions. Without the fix applied, this reliably reproduces
-- #18130 unless shared_buffers is extremely small (preventing any use use of
-- bulk relation extension). See
-- https://postgr.es/m/18130-7a86a7356a75209d%40postgresql.org
-- https://postgr.es/m/257696.1695670946%40sss.pgh.pa.us
\set filename :abs_srcdir '/data/desc.data'
COPY parted_si(id, data) FROM :'filename';
-- An earlier bug (see commit b1ecb9b3fcf) could end up using a buffer from
-- the wrong partition. This test is *not* guaranteed to trigger that bug, but
-- does so when shared_buffers is small enough. To test if we encountered the
-- bug, check that the partition condition isn't violated.
SELECT tableoid::regclass, id % 2 = 0 is_even, count(*) from parted_si GROUP BY 1, 2 ORDER BY 1;
tableoid | is_even | count
------------------+---------+-------
parted_si_p_even | t | 5000
parted_si_p_odd | f | 5000
(2 rows)
DROP TABLE parted_si;

View File

@ -3135,62 +3135,6 @@ SELECT '2014-10-25 23:00:00 UTC'::timestamptz AT TIME ZONE 'MSK';
Sun Oct 26 02:00:00 2014
(1 row)
--
-- Test LOCAL time zone
--
BEGIN;
SET LOCAL TIME ZONE 'Europe/Paris';
VALUES (CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE) AT LOCAL);
column1
--------------------------
Sat Jul 08 01:38:00 1978
(1 row)
VALUES (TIMESTAMP '1978-07-07 19:38' AT LOCAL);
column1
-------------------------------
Fri Jul 07 19:38:00 1978 CEST
(1 row)
SET LOCAL TIME ZONE 'Australia/Sydney';
VALUES (CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE) AT LOCAL);
column1
--------------------------
Sat Jul 08 09:38:00 1978
(1 row)
VALUES (TIMESTAMP '1978-07-07 19:38' AT LOCAL);
column1
-------------------------------
Fri Jul 07 19:38:00 1978 AEST
(1 row)
SET LOCAL TimeZone TO 'UTC';
CREATE VIEW timestamp_local_view AS
SELECT CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE) AT LOCAL AS ttz_at_local,
timezone(CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE)) AS ttz_func,
TIMESTAMP '1978-07-07 19:38' AT LOCAL AS t_at_local,
timezone(TIMESTAMP '1978-07-07 19:38') AS t_func;
SELECT pg_get_viewdef('timestamp_local_view', true);
pg_get_viewdef
----------------------------------------------------------------------------------------------
SELECT ('Fri Jul 07 23:38:00 1978 UTC'::timestamp with time zone AT LOCAL) AS ttz_at_local,+
timezone('Fri Jul 07 23:38:00 1978 UTC'::timestamp with time zone) AS ttz_func, +
('Fri Jul 07 19:38:00 1978'::timestamp without time zone AT LOCAL) AS t_at_local, +
timezone('Fri Jul 07 19:38:00 1978'::timestamp without time zone) AS t_func;
(1 row)
\x
TABLE timestamp_local_view;
-[ RECORD 1 ]+-----------------------------
ttz_at_local | Fri Jul 07 23:38:00 1978
ttz_func | Fri Jul 07 23:38:00 1978
t_at_local | Fri Jul 07 19:38:00 1978 UTC
t_func | Fri Jul 07 19:38:00 1978 UTC
\x
DROP VIEW timestamp_local_view;
COMMIT;
--
-- Test that AT TIME ZONE isn't misoptimized when using an index (bug #14504)
--

View File

@ -262,45 +262,3 @@ SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
63025.575401
(1 row)
--
-- AT LOCAL with timetz
--
BEGIN;
SET LOCAL TimeZone TO 'UTC';
CREATE VIEW timetz_local_view AS
SELECT f1 AS dat,
timezone(f1) AS dat_func,
f1 AT LOCAL AS dat_at_local,
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_time
FROM TIMETZ_TBL
ORDER BY f1;
SELECT pg_get_viewdef('timetz_local_view', true);
pg_get_viewdef
------------------------------------------------------------------------
SELECT f1 AS dat, +
timezone(f1) AS dat_func, +
(f1 AT LOCAL) AS dat_at_local, +
(f1 AT TIME ZONE current_setting('TimeZone'::text)) AS dat_at_time+
FROM timetz_tbl +
ORDER BY f1;
(1 row)
TABLE timetz_local_view;
dat | dat_func | dat_at_local | dat_at_time
----------------+----------------+----------------+----------------
00:01:00-07 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00
01:00:00-07 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00
02:03:00-07 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00
08:08:00-04 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00
07:07:00-08 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00
11:59:00-07 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00
12:00:00-07 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00
12:01:00-07 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00
15:36:39-04 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00
15:36:39-05 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00
23:59:00-07 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00
23:59:59.99-07 | 06:59:59.99+00 | 06:59:59.99+00 | 06:59:59.99+00
(12 rows)
DROP VIEW timetz_local_view;
COMMIT;

View File

@ -283,40 +283,3 @@ copy oversized_column_default (col2) from stdin;
copy oversized_column_default from stdin (default '');
\.
drop table oversized_column_default;
--
-- Create partitioned table that does not allow bulk insertions, to test bugs
-- related to the reuse of BulkInsertState across partitions (only done when
-- not using bulk insert). Switching between partitions often makes it more
-- likely to encounter these bugs, so we just switch on roughly every insert
-- by having an even/odd number partition and inserting evenly distributed
-- data.
--
CREATE TABLE parted_si (
id int not null,
data text not null,
-- prevent use of bulk insert by having a volatile function
rand float8 not null default random()
)
PARTITION BY LIST((id % 2));
CREATE TABLE parted_si_p_even PARTITION OF parted_si FOR VALUES IN (0);
CREATE TABLE parted_si_p_odd PARTITION OF parted_si FOR VALUES IN (1);
-- Test that bulk relation extension handles reusing a single BulkInsertState
-- across partitions. Without the fix applied, this reliably reproduces
-- #18130 unless shared_buffers is extremely small (preventing any use use of
-- bulk relation extension). See
-- https://postgr.es/m/18130-7a86a7356a75209d%40postgresql.org
-- https://postgr.es/m/257696.1695670946%40sss.pgh.pa.us
\set filename :abs_srcdir '/data/desc.data'
COPY parted_si(id, data) FROM :'filename';
-- An earlier bug (see commit b1ecb9b3fcf) could end up using a buffer from
-- the wrong partition. This test is *not* guaranteed to trigger that bug, but
-- does so when shared_buffers is small enough. To test if we encountered the
-- bug, check that the partition condition isn't violated.
SELECT tableoid::regclass, id % 2 = 0 is_even, count(*) from parted_si GROUP BY 1, 2 ORDER BY 1;
DROP TABLE parted_si;

View File

@ -611,29 +611,6 @@ SELECT '2014-10-25 22:00:00 UTC'::timestamptz AT TIME ZONE 'MSK';
SELECT '2014-10-25 22:00:01 UTC'::timestamptz AT TIME ZONE 'MSK';
SELECT '2014-10-25 23:00:00 UTC'::timestamptz AT TIME ZONE 'MSK';
--
-- Test LOCAL time zone
--
BEGIN;
SET LOCAL TIME ZONE 'Europe/Paris';
VALUES (CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE) AT LOCAL);
VALUES (TIMESTAMP '1978-07-07 19:38' AT LOCAL);
SET LOCAL TIME ZONE 'Australia/Sydney';
VALUES (CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE) AT LOCAL);
VALUES (TIMESTAMP '1978-07-07 19:38' AT LOCAL);
SET LOCAL TimeZone TO 'UTC';
CREATE VIEW timestamp_local_view AS
SELECT CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE) AT LOCAL AS ttz_at_local,
timezone(CAST('1978-07-07 19:38 America/New_York' AS TIMESTAMP WITH TIME ZONE)) AS ttz_func,
TIMESTAMP '1978-07-07 19:38' AT LOCAL AS t_at_local,
timezone(TIMESTAMP '1978-07-07 19:38') AS t_func;
SELECT pg_get_viewdef('timestamp_local_view', true);
\x
TABLE timestamp_local_view;
\x
DROP VIEW timestamp_local_view;
COMMIT;
--
-- Test that AT TIME ZONE isn't misoptimized when using an index (bug #14504)
--

View File

@ -84,20 +84,3 @@ SELECT date_part('microsecond', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
SELECT date_part('millisecond', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
SELECT date_part('second', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
--
-- AT LOCAL with timetz
--
BEGIN;
SET LOCAL TimeZone TO 'UTC';
CREATE VIEW timetz_local_view AS
SELECT f1 AS dat,
timezone(f1) AS dat_func,
f1 AT LOCAL AS dat_at_local,
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_time
FROM TIMETZ_TBL
ORDER BY f1;
SELECT pg_get_viewdef('timetz_local_view', true);
TABLE timetz_local_view;
DROP VIEW timetz_local_view;
COMMIT;

View File

@ -3016,7 +3016,6 @@ WalSnd
WalSndCtlData
WalSndSendDataCallback
WalSndState
WalSyncMethod
WalTimeSample
WalUsage
WalWriteMethod