Seems bug in postgres_fdw?
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t36129psql -h localhost -U postgresBuilt from patchset v5 (message #5), July 28, 2026 at 07:57 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t36129_5 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t36129_5 && git checkout t36129_5Patchset v5 (message #5) is on t36129_5
Hi All,
Below are findings for postgres_fdw related to timezone.
-- Remote Sever
Server A (timezone = 'US/Eastern')
Create table public.test_timestamp(
col1 varchar,
ins_ts timestamp without time zone not null default
current_timestamp
) without oids;
( Assume time is 10:00:00 AM EST ) insert into public.test_timestamp( col1
) values ('foo');
select ins_ts from public.test_timestamp;
--- Returns 10:00:00
delete from public.test_timestamp;
-- Local Server
Server B (timezone = 'US/Eastern')
CREATE SERVER server_1 FOREIGN DATA WRAPPER postgres_fdw OPTIONS (port
'5433', dbname 'pgbench');
CREATE USER MAPPING FOR PUBLIC SERVER server_1 OPTIONS (password '');
Create foreign table public.foreign_table(
col1 varchar
) SERVER server_1
OPTIONS (schema_name 'public', table_name 'test_timestamp');
( Assume time is 10:00:00 AM EST ) insert into public.foreign_table( col1 )
values ('from remote');
Now, on Server A, again issue
select ins_ts from public.test_timestamp;
--- Returns 15:00:00
Here , Why postgresql takes different time when remote table and foreign
table have different definition for timestamp column?
I think create foreign table should not allowed , If allowed it should give
same result.
--
Thanks and Regards,
Sachin Kotwal
Sachin Kotwal <kotsachin@gmail.com> writes:
Here , Why postgresql takes different time when remote table and foreign
table have different definition for timestamp column?
I believe postgres_fdw sets the timezone in its remote session to UTC
for predictability of results. Your table definition is really at fault
for being dependent on what the session timezone is.
Personally I'd make the ins_ts column be timestamp with time zone, but
if you really don't want to do that, you could consider making the default
expression be "current_timestamp AT TIME ZONE 'something'" to force the
rotated value to be in a particular zone.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Mon, Feb 27, 2017 at 10:10 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Sachin Kotwal <kotsachin@gmail.com> writes:
Here , Why postgresql takes different time when remote table and foreign
table have different definition for timestamp column?I believe postgres_fdw sets the timezone in its remote session to UTC
for predictability of results. Your table definition is really at fault
for being dependent on what the session timezone is.Personally I'd make the ins_ts column be timestamp with time zone, but
if you really don't want to do that, you could consider making the default
expression be "current_timestamp AT TIME ZONE 'something'" to force the
rotated value to be in a particular zone.regards, tom lane
Tom -
Attached is a doc patch that updates the documentation for postgres-fdw to
include the actual values for the 4 session variables that are set. Does
that make sense to clarify?
Thanks
-Dave
Attachments:
0001-Document-postgres-fdw-session-settings-for-parameter.patchtext/x-patch; charset=US-ASCII; name=0001-Document-postgres-fdw-session-settings-for-parameter.patchDownload+26-6
On Thu, Mar 2, 2017 at 3:28 AM, Rader, David <davidr@openscg.com> wrote:
Attached is a doc patch that updates the documentation for postgres-fdw to
include the actual values for the 4 session variables that are set. Does
that make sense to clarify?
From my point of view, this would be a sensible thing to document,
although I feel like the grammar is not quite right, because after
"establishes remote session settings for the parameters" my brain
expects a list of parameters rather than a list of parameters and the
corresponding values. I think it reads better if you change "for the
parameters" to "for various parameters".
</nitpicking>
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, Mar 4, 2017 at 12:52 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Thu, Mar 2, 2017 at 3:28 AM, Rader, David <davidr@openscg.com> wrote:
Attached is a doc patch that updates the documentation for postgres-fdw
to
include the actual values for the 4 session variables that are set. Does
that make sense to clarify?From my point of view, this would be a sensible thing to document,
although I feel like the grammar is not quite right, because after
"establishes remote session settings for the parameters" my brain
expects a list of parameters rather than a list of parameters and the
corresponding values. I think it reads better if you change "for the
parameters" to "for various parameters".</nitpicking>
Revised doc patch attached with various parameters.
On Mon, Mar 6, 2017 at 9:45 AM, Rader, David <davidr@openscg.com> wrote:
Revised doc patch attached with various parameters.
Committed.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers