Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgwire: TimeZone ParameterStatus field incorrect with offsets #42404

Closed
otan opened this issue Nov 12, 2019 · 5 comments
Closed

pgwire: TimeZone ParameterStatus field incorrect with offsets #42404

otan opened this issue Nov 12, 2019 · 5 comments
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@otan
Copy link
Contributor

otan commented Nov 12, 2019

Found in #42376.

When using SET TIME ZONE +3 on initialisation or after changes over pgwire, the output in ParameterStatus is mismatching:

# cockroach
{"Type":"ParameterStatus","Name":"TimeZone","Value":"6"}
# postgres
{"Type":"ParameterStatus","Name":"TimeZone","Value":"\u003c+06\u003e-06"}

Furthermore, adding timezones such as -7.55 is incorrect.

See tests in pkg/sql/pgwire/testdata/pgtest/connection_params for more info.

Epic CRDB-8948

@otan otan added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-sql-pgcompat Semantic compatibility with PostgreSQL labels Nov 12, 2019
@awoods187 awoods187 added the S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. label Nov 12, 2019
@github-actions
Copy link

github-actions bot commented Jun 4, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz
Copy link
Contributor

knz commented Jun 5, 2021

still current

@jlinder jlinder added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jun 16, 2021
@RichardJCai
Copy link
Contributor

RichardJCai commented Sep 22, 2021

I believe this is because of timezones are formatted in the respective databases.

CRDB

demo@127.0.0.1:26257/movr> show timezone;
  timezone
------------
  -11.5
(1 row)

PG

rcai=# show timezone;
    TimeZone
----------------
 <-11:30>+11:30
(1 row)

Not exactly sure why PG formats like this

rcai=# set time zone 11;
SET
rcai=# show timezone;
 TimeZone
----------
 <+11>-11
(1 row)

rcai=# set timezone = -12;
SET
rcai=# show timezone;
 TimeZone
----------
 <-12>+12
(1 row)

Also with intervals:

rcai=# sET TIME ZONE INTERVAL  '1 hour';
SET
rcai=# show timezone;
 TimeZone
----------
 <+01>-01

demo@127.0.0.1:26257/movr> sET TIME ZONE INTERVAL  '1 hour';
warning: cannot save command-line history: write_history: illegal byte sequence

SET

Time: 2ms total (execution 0ms / network 1ms)

demo@127.0.0.1:26257/movr> show timezone;
   timezone
--------------
  '01:00:00'
(1 row)
Time: 1ms total (execution 1ms / network 0ms)

@otan
Copy link
Contributor Author

otan commented Oct 22, 2021

@RichardJCai i believe you have fixed this?

@otan
Copy link
Contributor Author

otan commented Oct 22, 2021

resolved by #70716

@otan otan closed this as completed Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

5 participants