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: Alias Type Information is not propagated to pgwire or pg_attribute #16769

Closed
m-schneider opened this issue Jun 28, 2017 · 2 comments
Closed
Assignees
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-pgwire pgwire protocol issues. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Milestone

Comments

@m-schneider
Copy link
Contributor

m-schneider commented Jun 28, 2017

We currently have a 1:1 mapping from datum type to what we send to the wire.

Example:

root@:26257/test> CREATE TABLE types(a int8, b int2);
CREATE TABLE
root@:26257/test> SELECT attname, atttypid, typname FROM pg_attribute a JOIN pg_type t ON a.atttypid=t.oid WHERE attrelid = 'types'::REGCLASS;
+---------+----------+---------+
| attname | atttypid | typname |
+---------+----------+---------+
| a       |       20 | int8    |
| b       |       20 | int8    |
+---------+----------+---------+

We need to update our pgwire code to send the actual types, and update pg_attribute to display the proper types as well.

@m-schneider m-schneider self-assigned this Jun 28, 2017
@jordanlewis jordanlewis changed the title sql: Alias Type Information is not propagated to pgwire. sql: Alias Type Information is not propagated to pgwire or pg_attribute Jun 28, 2017
@jordanlewis jordanlewis added this to the Later milestone Mar 9, 2018
@knz knz added A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-pgwire pgwire protocol issues. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. labels Apr 27, 2018
@bobvawter bobvawter self-assigned this Dec 10, 2018
@bobvawter bobvawter modified the milestones: Later, 2.2 Dec 10, 2018
@knz
Copy link
Contributor

knz commented Dec 13, 2018

As discussed with Bob today, this is an area which I plainly forgot to address during my type cleanups last summer.

@jordanlewis
Copy link
Member

This is no longer a problem:

[email protected]:65166/defaultdb> CREATE TABLE types(a int8, b int2);
CREATE TABLE

Time: 2.888ms

[email protected]:65166/defaultdb> SELECT attname, atttypid, typname FROM pg_attribute a JOIN pg_type t ON a.atttypid=t.oid WHERE attrelid = 'types'::REGCLASS;
  attname | atttypid | typname
+---------+----------+---------+
  b       |       21 | int2
  a       |       20 | int8
  rowid   |       20 | int8

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 A-sql-pgwire pgwire protocol issues. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

No branches or pull requests

4 participants