Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
6c68c51
Recalculate search_path after ALTER ROLE.
jeff-davis Aug 7, 2023
8836f71
Remove test from commit fa2e874946.
jeff-davis Aug 10, 2023
87fc7a9
Cache by-reference missing values in a long lived context
adunstan Aug 22, 2023
e55b936
doc: Replace list of drivers and PLs with wiki link
danielgustafsson Aug 23, 2023
11ae674
Avoid unnecessary plancache revalidation of utility statements.
tglsfdc Aug 24, 2023
61bd06b
Initialize ListenSocket array earlier.
hlinnaka Aug 29, 2023
bc112bc
Avoid possible overflow with ltsGetFreeBlock() in logtape.c
michaelpq Aug 29, 2023
1faec64
postgres_fdw: Fix test for parameterized foreign scan.
Aug 30, 2023
76e39bc
Fix out-of-bound read in gtsvector_picksplit()
michaelpq Sep 4, 2023
cf8604a
doc: mention libpq regression tests
bmomjian Sep 5, 2023
9b02a25
doc: mention that to_char() values are rounded
bmomjian Sep 6, 2023
1fa06b0
pg_basebackup: Generate valid temporary slot names under PQbackendPID()
michaelpq Sep 7, 2023
33524f9
doc: remove mention of backslash doubling in strings
bmomjian Sep 8, 2023
43e1733
Make recovery report error message when invalid page header is found.
MasaoFujii Oct 5, 2021
e795abe
Fix uninitialized access to InitialRunningXacts during decoding after…
Sep 12, 2023
c515a0d
Fix incorrect logic in plan dependency recording
david-rowley Sep 13, 2023
b9846b0
Improve error message on snapshot import in snapmgr.c
michaelpq Sep 14, 2023
44f96ed
Revert "Improve error message on snapshot import in snapmgr.c"
michaelpq Sep 14, 2023
b364840
Track nesting depth correctly when drilling down into RECORD Vars.
tglsfdc Sep 15, 2023
2e32fa4
Don't crash if cursor_to_xmlschema is used on a non-data-returning Po…
tglsfdc Sep 18, 2023
b106a09
Fix GiST README's explanation of the NSN cross-check.
hlinnaka Sep 19, 2023
f64386e
Update comment about set_join_pathlist_hook().
Sep 21, 2023
1c6d1fa
Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions.
tglsfdc Sep 22, 2023
704b692
Doc: copy-edit the introductory para for the pg_class catalog.
tglsfdc Sep 22, 2023
1a354d6
Don't trust unvalidated xl_tot_len.
macdice Sep 22, 2023
d138da9
Don't use Perl pack('Q') in 039_end_of_wal.pl.
macdice Sep 23, 2023
ba5316e
pg_upgrade: check for types removed in pg12
alvherre Sep 25, 2023
b8941cb
Limit to_tsvector_byid's initial array allocation to something sane.
tglsfdc Sep 25, 2023
4170969
Collect dependency information for parsed CallStmts.
tglsfdc Sep 25, 2023
972bcc9
pg_dump: tests: Correct test condition for invalid databases
anarazel Sep 25, 2023
fc83cd7
Fix edge-case for xl_tot_len broken by bae868ca.
macdice Sep 25, 2023
ccf5176
doc: Tell about "vcregress taptest" for regression tests on Windows
michaelpq Sep 25, 2023
ebe216d
Fix another bug in parent page splitting during GiST index build.
hlinnaka Sep 26, 2023
9faea9c
doc: mention GROUP BY columns can reference target col numbers
bmomjian Sep 26, 2023
87c7aef
doc: pg_upgrade, clarify standby servers must remain running
bmomjian Sep 26, 2023
ad82c42
doc: clarify the behavior of unopenable listen_addresses
bmomjian Sep 26, 2023
bb3c2b8
doc: clarify handling of time zones with "time with time zone"
bmomjian Sep 26, 2023
79b3814
doc: clarify the effect of concurrent work_mem allocations
bmomjian Sep 26, 2023
c99c0f6
Stop using "-multiply_defined suppress" on macOS.
tglsfdc Sep 27, 2023
d0a6c30
unaccent: Tweak value of PYTHON when building without Python support
michaelpq Sep 27, 2023
5699e5b
Fix typo in src/backend/access/transam/README.
Sep 28, 2023
8850050
Add missing TidRangePath handling in print_path()
david-rowley Sep 28, 2023
b0bdfa7
Fix checking of index expressions in CompareIndexInfo().
tglsfdc Sep 28, 2023
cb38938
Fix btmarkpos/btrestrpos array key wraparound bug.
petergeoghegan Sep 28, 2023
699954b
doc: Change statistics function xref to the right target
danielgustafsson Sep 29, 2023
1f86340
Doc: improve description of dump/restore's --clean and --if-exists.
tglsfdc Sep 29, 2023
640e1ba
Suppress macOS warnings about duplicate libraries in link commands.
tglsfdc Sep 29, 2023
3e41172
Remove environment sensitivity in pl/tcl regression test.
tglsfdc Sep 30, 2023
049b262
Fix briefly showing old progress stats for ANALYZE on inherited tables.
hlinnaka Sep 30, 2023
e82968b
In COPY FROM, fail cleanly when unsupported encoding conversion is ne…
tglsfdc Oct 1, 2023
f15dd61
Fix datalen calculation in tsvectorrecv().
tglsfdc Oct 1, 2023
552241c
Flush WAL stats in bgwriter
hlinnaka Oct 2, 2023
b5e4a8e
Fail hard on out-of-memory failures in xlogreader.c
michaelpq Oct 3, 2023
76201ae
Avoid memory size overflow when allocating backend activity buffer
michaelpq Oct 3, 2023
f3857e4
Fix memory leak in Memoize code
david-rowley Oct 5, 2023
2424c13
Remove extra parenthesis from comment.
Oct 6, 2023
94382fb
Doc: use CURRENT_USER not USER in plpgsql trigger examples.
tglsfdc Oct 9, 2023
ff43e1c
Fix bug in GenericXLogFinish().
jeff-davis Oct 10, 2023
cd32d36
doc: document the need to analyze partitioned tables
bmomjian Oct 10, 2023
278edcb
doc: add SSL configuration section reference
bmomjian Oct 10, 2023
91247e9
doc: foreign servers with pushdown need matching collation
bmomjian Oct 10, 2023
7ec28b8
doc: clarify that SSPI and GSSAPI are interchangeable
bmomjian Oct 10, 2023
c700612
Fix incorrect step generation in HASH partition pruning
david-rowley Oct 12, 2023
adc9745
Doc: fix grammatical errors for enable_partitionwise_aggregate
david-rowley Oct 12, 2023
2382af7
Fix runtime partition pruning for HASH partitioned tables
david-rowley Oct 12, 2023
5843c2a
Don't spuriously report FD_SETSIZE exhaustion on Windows.
nmisch Oct 14, 2023
f461aaf
Dissociate btequalimage() from interval_ops, ending its deduplication.
nmisch Oct 14, 2023
ba3e1f8
Acquire ControlFileLock in relevant SQL functions.
macdice Oct 15, 2023
727cbd5
Try to handle torn reads of pg_control in frontend.
macdice Oct 16, 2023
ec3a8f4
Update the documentation on recovering from (M)XID exhaustion.
robertmhaas Oct 16, 2023
68f8472
Ensure we have a snapshot while dropping ON COMMIT DROP temp tables.
tglsfdc Oct 16, 2023
52e7893
Avoid calling proc_exit() in processes forked by system().
nathan-bossart Oct 17, 2023
2b05121
Back-patch test cases for timetz_zone/timetz_izone.
tglsfdc Oct 17, 2023
9362091
windows: msvc: Define STDIN/OUT/ERR_FILENO.
nathan-bossart Oct 17, 2023
8452699
jit: Support opaque pointers in LLVM 16.
macdice Oct 18, 2023
2525f53
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.
macdice Oct 18, 2023
1264b2c
jit: Changes for LLVM 17.
macdice Oct 18, 2023
c51dbb5
Improve pglz_decompress's defenses against corrupt compressed data.
tglsfdc Oct 19, 2023
991dcb5
Doc: update CREATE OPERATOR's statement about => as an operator.
tglsfdc Oct 20, 2023
811bf12
Dodge a compiler bug affecting timetz_zone/timetz_izone.
tglsfdc Oct 20, 2023
bbba8bc
Fix min_dynamic_shared_memory on Windows.
macdice Oct 21, 2023
57604e6
Log LLVM library version in configure output.
macdice Oct 22, 2023
9aedd86
Doc: indexUnchanged is strictly a hint.
petergeoghegan Oct 24, 2023
1ec72fe
Fix problems when a plain-inheritance parent table is excluded.
tglsfdc Oct 24, 2023
9de790c
doc: Fix some typos and grammar
michaelpq Oct 25, 2023
c5fdcb7
Doc: remove misleading info about ecpg's CONNECT/DISCONNECT DEFAULT.
tglsfdc Oct 25, 2023
b228339
Fix overflow when calculating timestamp distance in BRIN
tvondra Oct 27, 2023
272981f
Fix calculation in brin_minmax_multi_distance_date
tvondra Oct 27, 2023
ccdf008
Fix minmax-multi on infinite date/timestamp values
tvondra Oct 27, 2023
8157b18
Fix minmax-multi distance for extreme interval values
tvondra Oct 27, 2023
3fbe319
Remove PHOT from our default timezone abbreviations list.
tglsfdc Oct 28, 2023
fe3962f
Fix intra-query memory leak when a SRF returns zero rows.
tglsfdc Oct 28, 2023
745f2db
btree_gin: Fix calculation of leftmost interval value.
deanrasheed Oct 29, 2023
1766401
amcheck: Distinguish interrupted page deletion from corruption.
nmisch Oct 30, 2023
5018fb3
Diagnose !indisvalid in more SQL functions.
nmisch Oct 30, 2023
04aa112
Adjust the order of the prechecks in pgrowlocks()
david-rowley Oct 31, 2023
f4df4ea
doc: 1-byte varlena headers can be used for user PLAIN storage
bmomjian Oct 31, 2023
05cbb58
doc: add function argument and query parameter limits
bmomjian Oct 31, 2023
cabfa0a
doc: improve ALTER SYSTEM description of value list quoting
bmomjian Oct 31, 2023
d954cf7
doc: Replace reference to ERRCODE_RAISE_EXCEPTION by "raise_exception"
michaelpq Nov 1, 2023
fcff79d
doc: ALTER DEFAULT PRIVILEGES does not affect inherited roles
bmomjian Nov 3, 2023
c3e5f11
Doc: update CREATE RULE ref page's hoary discussion of views.
tglsfdc Nov 3, 2023
6e3e44d
pg_upgrade: Add missing newline to message
petere Nov 3, 2023
6581de0
doc: CREATE DATABASE doesn't copy db-level perms. from template
bmomjian Nov 3, 2023
aadc71a
doc: \copy can get data values \. and end-of-input confused
bmomjian Nov 3, 2023
72998fb
Backport fixups
reshke Aug 25, 2026
a1bb62c
Update regression expected files to match new backport
reshke Aug 25, 2026
a32e9c2
Update non-optimizer regression expected files for PG/CBDB plan diffe…
reshke Aug 26, 2026
7526a4f
Fix remaining regression expected diffs for optimizer variants
reshke Aug 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/llvm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
if echo $pgac_llvm_version | $AWK -F '.' '{ if ([$]1 >= 4 || ([$]1 == 3 && [$]2 >= 9)) exit 1; else exit 0;}';then
AC_MSG_ERROR([$LLVM_CONFIG version is $pgac_llvm_version but at least 3.9 is required])
fi
AC_MSG_NOTICE([using llvm $pgac_llvm_version])

# need clang to create some bitcode files
AC_ARG_VAR(CLANG, [path to clang compiler to generate bitcode])
Expand Down
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5458,6 +5458,8 @@ fi
if echo $pgac_llvm_version | $AWK -F '.' '{ if ($1 >= 4 || ($1 == 3 && $2 >= 9)) exit 1; else exit 0;}';then
as_fn_error $? "$LLVM_CONFIG version is $pgac_llvm_version but at least 3.9 is required" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: using llvm $pgac_llvm_version" >&5
$as_echo "$as_me: using llvm $pgac_llvm_version" >&6;}

# need clang to create some bitcode files

Expand Down
89 changes: 89 additions & 0 deletions contrib/amcheck/t/005_pitr.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group

# Test integrity of intermediate states by PITR to those states
use strict;
use warnings;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

# origin node: generate WAL records of interest.
my $origin = PostgreSQL::Test::Cluster->new('origin');
$origin->init(has_archiving => 1, allows_streaming => 1);
$origin->append_conf('postgresql.conf', 'autovacuum = off');
$origin->start;
$origin->backup('my_backup');
# Create a table with each of 6 PK values spanning 1/4 of a block. Delete the
# first four, so one index leaf is eligible for deletion. Make a replication
# slot just so pg_waldump will always have access to later WAL.
my $setup = <<EOSQL;
BEGIN;
CREATE EXTENSION amcheck;
CREATE TABLE not_leftmost (c text);
ALTER TABLE not_leftmost ALTER c SET STORAGE PLAIN;
INSERT INTO not_leftmost
SELECT repeat(n::text, database_block_size / 4)
FROM generate_series(1,6) t(n), pg_control_init();
ALTER TABLE not_leftmost ADD CONSTRAINT not_leftmost_pk PRIMARY KEY (c);
DELETE FROM not_leftmost WHERE c ~ '^[1-4]';
SELECT pg_create_physical_replication_slot('for_waldump', true, false);
COMMIT;
EOSQL
$origin->safe_psql('postgres', $setup);
my $before_vacuum_walfile =
$origin->safe_psql('postgres', "SELECT pg_walfile_name(pg_current_wal_lsn())");
# VACUUM to delete the aforementioned leaf page. Force an XLogFlush() by
# dropping a permanent table. That way, the XLogReader infrastructure can
# always see VACUUM's records, even under synchronous_commit=off. Finally,
# find the LSN of that VACUUM's last UNLINK_PAGE record.
my $vacuum = <<EOSQL;
SET synchronous_commit = off;
VACUUM (VERBOSE, INDEX_CLEANUP ON) not_leftmost;
CREATE TABLE XLogFlush ();
DROP TABLE XLogFlush;
SELECT pg_walfile_name(pg_current_wal_flush_lsn());
EOSQL
my $after_unlink_walfile = $origin->safe_psql('postgres', $vacuum);
$origin->stop;
my $unlink_lsn = do {
local %ENV = $origin->_get_env();
my $stdout;
run_log(['pg_waldump', '-p', $origin->data_dir . '/pg_wal',
$before_vacuum_walfile, $after_unlink_walfile],
'>', \$stdout);
$stdout =~ m|^rmgr: Btree .*, lsn: ([/0-9A-F]+), .*, desc: UNLINK_PAGE left|m;
$1;
};
die "did not find UNLINK_PAGE record" unless $unlink_lsn;

# replica node: amcheck at notable points in the WAL stream
my $replica = PostgreSQL::Test::Cluster->new('replica');
$replica->init_from_backup($origin, 'my_backup', has_restoring => 1);
$replica->append_conf('postgresql.conf',
"recovery_target_lsn = '$unlink_lsn'");
$replica->append_conf('postgresql.conf', 'recovery_target_inclusive = off');
$replica->append_conf('postgresql.conf', 'recovery_target_action = promote');
$replica->start;
$replica->poll_query_until('postgres', "SELECT pg_is_in_recovery() = 'f';")
or die "Timed out while waiting for PITR promotion";
# recovery done; run amcheck
my $debug = "SET client_min_messages = 'debug1'";
my ($rc, $stderr);
$rc = $replica->psql(
'postgres',
"$debug; SELECT bt_index_parent_check('not_leftmost_pk', true)",
stderr => \$stderr);
print STDERR $stderr, "\n";
is($rc, 0, "bt_index_parent_check passes");
like(
$stderr,
qr/interrupted page deletion detected/,
"bt_index_parent_check: interrupted page deletion detected");
$rc = $replica->psql(
'postgres',
"$debug; SELECT bt_index_check('not_leftmost_pk', true)",
stderr => \$stderr);
print STDERR $stderr, "\n";
is($rc, 0, "bt_index_check passes");

done_testing();
96 changes: 91 additions & 5 deletions contrib/amcheck/verify_nbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "access/xact.h"
#include "catalog/index.h"
#include "catalog/pg_am.h"
#include "catalog/pg_opfamily_d.h"
#include "commands/tablecmds.h"
#include "lib/bloomfilter.h"
#include "miscadmin.h"
Expand Down Expand Up @@ -145,6 +146,9 @@ static void bt_check_every_level(Relation rel, Relation heaprel,
bool rootdescend);
static BtreeLevel bt_check_level_from_leftmost(BtreeCheckState *state,
BtreeLevel level);
static bool bt_leftmost_ignoring_half_dead(BtreeCheckState *state,
BlockNumber start,
BTPageOpaque start_opaque);
static void bt_recheck_sibling_links(BtreeCheckState *state,
BlockNumber btpo_prev_from_target,
BlockNumber leftcurrent);
Expand Down Expand Up @@ -337,10 +341,20 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
errmsg("index \"%s\" metapage has equalimage field set on unsupported nbtree version",
RelationGetRelationName(indrel))));
if (allequalimage && !_bt_allequalimage(indrel, false))
{
bool has_interval_ops = false;

for (int i = 0; i < IndexRelationGetNumberOfKeyAttributes(indrel); i++)
if (indrel->rd_opfamily[i] == INTERVAL_BTREE_FAM_OID)
has_interval_ops = true;
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index \"%s\" metapage incorrectly indicates that deduplication is safe",
RelationGetRelationName(indrel))));
RelationGetRelationName(indrel)),
has_interval_ops
? errhint("This is known of \"interval\" indexes last built on a version predating 2023-11.")
: 0));
}

/* Check index, possibly against table it is an index on */
bt_check_every_level(indrel, heaprel, heapkeyspace, parentcheck,
Expand Down Expand Up @@ -764,7 +778,7 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
*/
if (state->readonly)
{
if (!P_LEFTMOST(opaque))
if (!bt_leftmost_ignoring_half_dead(state, current, opaque))
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("block %u is not leftmost in index \"%s\"",
Expand Down Expand Up @@ -818,8 +832,16 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
*/
}

/* Sibling links should be in mutual agreement */
if (opaque->btpo_prev != leftcurrent)
/*
* Sibling links should be in mutual agreement. There arises
* leftcurrent == P_NONE && btpo_prev != P_NONE when the left sibling
* of the parent's low-key downlink is half-dead. (A half-dead page
* has no downlink from its parent.) Under heavyweight locking, the
* last bt_leftmost_ignoring_half_dead() validated this btpo_prev.
* Without heavyweight locking, validation of the P_NONE case remains
* unimplemented.
*/
if (opaque->btpo_prev != leftcurrent && leftcurrent != P_NONE)
bt_recheck_sibling_links(state, opaque->btpo_prev, leftcurrent);

/* Check level */
Expand Down Expand Up @@ -900,6 +922,66 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
return nextleveldown;
}

/*
* Like P_LEFTMOST(start_opaque), but accept an arbitrarily-long chain of
* half-dead, sibling-linked pages to the left. If a half-dead page appears
* under state->readonly, the database exited recovery between the first-stage
* and second-stage WAL records of a deletion.
*/
static bool
bt_leftmost_ignoring_half_dead(BtreeCheckState *state,
BlockNumber start,
BTPageOpaque start_opaque)
{
BlockNumber reached = start_opaque->btpo_prev,
reached_from = start;
bool all_half_dead = true;

/*
* To handle the !readonly case, we'd need to accept BTP_DELETED pages and
* potentially observe nbtree/README "Page deletion and backwards scans".
*/
Assert(state->readonly);

while (reached != P_NONE && all_half_dead)
{
Page page = palloc_btree_page(state, reached);
BTPageOpaque reached_opaque = (BTPageOpaque) PageGetSpecialPointer(page);

CHECK_FOR_INTERRUPTS();

/*
* Try to detect btpo_prev circular links. _bt_unlink_halfdead_page()
* writes that side-links will continue to point to the siblings.
* Check btpo_next for that property.
*/
all_half_dead = P_ISHALFDEAD(reached_opaque) &&
reached != start &&
reached != reached_from &&
reached_opaque->btpo_next == reached_from;
if (all_half_dead)
{
XLogRecPtr pagelsn = PageGetLSN(page);

/* pagelsn should point to an XLOG_BTREE_MARK_PAGE_HALFDEAD */
ereport(DEBUG1,
(errcode(ERRCODE_NO_DATA),
errmsg_internal("harmless interrupted page deletion detected in index \"%s\"",
RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u right block=%u page lsn=%X/%X.",
reached, reached_from,
LSN_FORMAT_ARGS(pagelsn))));

reached_from = reached;
reached = reached_opaque->btpo_prev;
}

pfree(page);
}

return all_half_dead;
}

/*
* Raise an error when target page's left link does not point back to the
* previous target page, called leftcurrent here. The leftcurrent page's
Expand Down Expand Up @@ -940,6 +1022,9 @@ bt_recheck_sibling_links(BtreeCheckState *state,
BlockNumber btpo_prev_from_target,
BlockNumber leftcurrent)
{
/* taking BTPageOpaque from metapage would give irrelevant findings */
Assert(leftcurrent != P_NONE);

if (!state->readonly)
{
Buffer lbuf;
Expand Down Expand Up @@ -1923,7 +2008,8 @@ bt_child_highkey_check(BtreeCheckState *state,
opaque = (BTPageOpaque) PageGetSpecialPointer(page);

/* The first page we visit at the level should be leftmost */
if (first && !BlockNumberIsValid(state->prevrightlink) && !P_LEFTMOST(opaque))
if (first && !BlockNumberIsValid(state->prevrightlink) &&
!bt_leftmost_ignoring_half_dead(state, blkno, opaque))
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("the first child of leftmost target page is not leftmost of its level in index \"%s\"",
Expand Down
6 changes: 3 additions & 3 deletions contrib/btree_gin/btree_gin.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ leftmostvalue_interval(void)
{
Interval *v = palloc(sizeof(Interval));

v->time = DT_NOBEGIN;
v->day = 0;
v->month = 0;
v->time = PG_INT64_MIN;
v->day = PG_INT32_MIN;
v->month = PG_INT32_MIN;
return IntervalPGetDatum(v);
}

Expand Down
16 changes: 11 additions & 5 deletions contrib/btree_gin/expected/interval.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@ CREATE TABLE test_interval (
i interval
);
INSERT INTO test_interval VALUES
( '-178000000 years' ),
( '03:55:08' ),
( '04:55:08' ),
( '05:55:08' ),
( '08:55:08' ),
( '09:55:08' ),
( '10:55:08' )
( '10:55:08' ),
( '178000000 years' )
;
CREATE INDEX idx_interval ON test_interval USING gin (i);
SELECT * FROM test_interval WHERE i<'08:55:08'::interval ORDER BY i;
i
--------------------------
@ 178000000 years ago
@ 3 hours 55 mins 8 secs
@ 4 hours 55 mins 8 secs
@ 5 hours 55 mins 8 secs
(3 rows)
(4 rows)

SELECT * FROM test_interval WHERE i<='08:55:08'::interval ORDER BY i;
i
--------------------------
@ 178000000 years ago
@ 3 hours 55 mins 8 secs
@ 4 hours 55 mins 8 secs
@ 5 hours 55 mins 8 secs
@ 8 hours 55 mins 8 secs
(4 rows)
(5 rows)

SELECT * FROM test_interval WHERE i='08:55:08'::interval ORDER BY i;
i
Expand All @@ -40,12 +44,14 @@ SELECT * FROM test_interval WHERE i>='08:55:08'::interval ORDER BY i;
@ 8 hours 55 mins 8 secs
@ 9 hours 55 mins 8 secs
@ 10 hours 55 mins 8 secs
(3 rows)
@ 178000000 years
(4 rows)

SELECT * FROM test_interval WHERE i>'08:55:08'::interval ORDER BY i;
i
---------------------------
@ 9 hours 55 mins 8 secs
@ 10 hours 55 mins 8 secs
(2 rows)
@ 178000000 years
(3 rows)

4 changes: 3 additions & 1 deletion contrib/btree_gin/sql/interval.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ CREATE TABLE test_interval (
);

INSERT INTO test_interval VALUES
( '-178000000 years' ),
( '03:55:08' ),
( '04:55:08' ),
( '05:55:08' ),
( '08:55:08' ),
( '09:55:08' ),
( '10:55:08' )
( '10:55:08' ),
( '178000000 years' )
;

CREATE INDEX idx_interval ON test_interval USING gin (i);
Expand Down
Loading
Loading