cockroachdb / cockroachdb/cockroach

sql: `CREATE TEMPORARY TABLE` showed in the event log with wrong schema name

Open
#104,836 0 comments 0 reactions 0 assignees View on GitHub
C-bug
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Repro:

```sql
SET experimental_enable_temp_tables = 'on';
CREATE TEMPORARY TABLE table_with_long_name(x int);
SHOW TABLES;
```

This gives

```sql
schema_name | table_name | type | owner | estimated_row_count | locality
--------------------------------+----------------------+-------+-------+---------------------+-----------
pg_temp_1686703917124342900_1 | table_with_long_name | table | root | 0 | NULL
(1 row)

```
But in the log directory, search with the table name: ` pcregrep -rM "table_with_long_name" ./cockroach-data`, it will show the event with the wrong schema name:

```
./cockroach-data/roach1/logs/cockroach-sql-schema.log:I230614 00:52:40.883745 2335 5@util/log/event_log.go:32 ⋮ [T1,n1,client=127.0.0.1:39868,user=root] 3 ={"Timestamp":1686703960865096900,"EventType":"create_table","Statement":"CREATE TEMPORARY TABLE ‹defaultdb›.public.‹table_with_long_name› (‹x› INT8)","Tag":"CREATE TABLE","User":"root","DescriptorID":105,"ApplicationName":"$ cockroach sql","TableName":"‹defaultdb.public.table_with_long_name›"}
```

It should not be `‹defaultdb›.public.‹table_with_long_name›`, but `‹defaultdb›.‹pg_temp_1686703917124342900_1›.‹table_with_long_name›`.

Version: v23.1.1

Jira issue: CRDB-28741

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.