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

sql: Pretty Printing of Tuples does not match postgres #25522

Closed
BramGruneir opened this issue May 15, 2018 · 2 comments · Fixed by #28151
Closed

sql: Pretty Printing of Tuples does not match postgres #25522

BramGruneir opened this issue May 15, 2018 · 2 comments · Fixed by #28151
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.

Comments

@BramGruneir
Copy link
Member

We do not pretty print tuples the same way that postgres does.

Postgres:

SELECT (1, 2, 'hello', NULL, NULL), (true, NULL, (false, 6.6, false));
      row      |       row
---------------+------------------
 (1,2,hello,,) | (t,,"(f,6.6,f)")

Cockroach:

SELECT (1, 2, 'hello', NULL, NULL), (true, NULL, (false, 6.6, false));
+-----------------------------+--------------------------------+
| (1, 2, 'hello', NULL, NULL) |   (true, NULL, (false, 6.6,    |
|                             |            false))             |
+-----------------------------+--------------------------------+
| (1,2,'hello',,)             | (true,,(false, 6.6, false))    |
+-----------------------------+--------------------------------+
@BramGruneir BramGruneir added the A-sql-pgcompat Semantic compatibility with PostgreSQL label May 15, 2018
@BramGruneir
Copy link
Member Author

@justinj I was told you fixed arrays for a similar issue.

@jordanlewis
Copy link
Member

jordanlewis commented May 18, 2018

See the FmtArrays and fmtWithinArray format flags.

@knz knz added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Jul 21, 2018
craig bot pushed a commit that referenced this issue Aug 1, 2018
28128: sql: casting to timestamp should strip tz info r=jordanlewis a=jordanlewis

And binary operations between timestamp and timestamptz should strip the
tz from the timestamptz.

Confirmed that all of this behavior matches postgres (and that it didn't
before).

Release note (bug fix): correct casts and binary operators between
timestamptz and timestamp in some cases.

28149: sql: avoid using Tuple in RangePartition r=knz a=knz

Forked off  #28143, needed for #25522 / #26624.

The `Tuple` AST node is really for scalar tuples. RangePartition is
not using a scalar tuple. So split them.

Release note: None

Co-authored-by: Jordan Lewis <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
craig bot pushed a commit that referenced this issue Aug 2, 2018
28151: sql: fix the pg text representation of tuples/arrays r=knz a=knz

Forked off #28143.
Fixes #25522.

This patch fixes the conversion of arrays and tuples to text for the
purpose of emitting the arrays/tuples back to a client through pgwire.
This now properly supports nested arrays, arrays containing tuples,
tuples containing arrays, etc. Labels in tuples are never emitted
through pgwire.

Release note (bug fix): CockroachDB supports a wider range of tuple
and array values in query results.

Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig craig bot closed this as completed in #28151 Aug 2, 2018
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants