cockroachdb / cockroachdb/cockroach
VARCHAR Column Vectors and VARCHAR constants/literals are incorrectly being shown as `text` type.
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Column vectors from a VARCHAR column are being incorrectly shown as the `text` type with `pg_typeof(VARCHAR_COLUMN)`.
SQL Literals / Constants also have this same issue.
**To Reproduce**
To reproduce:
`CREATE TABLE t (v VARCHAR);`
`INSERT INTO t VALUES ('testvarchar');`
`SELECT pg_typeof(v) FROM t;`
Result:
```
pg_typeof
-------------
text
(1 row)
```
and for the SQL literal/constant case, we can reproduce with:
`SELECT pg_typeof('test'::VARCHAR);`
Result:
```
pg_typeof
-------------
text
(1 row)
```
**Expected behavior**
The expected behavior should align with PostgreSQL's `pg_typeof()` behavior, which returns:
```
pg_typeof
-------------------
character varying
(1 row)
```
for both of these scenarios.
**Environment:**
The latest CRDB master branch exhibits this issue.
Jira issue: CRDB-51633
Contributor guide
Assessment
This issue has not been assessed yet.