ERROR: cannot determine type of empty array

Hi Guys,

Kindly need your help with my issue.
After we upgrade the version from v20.1.17 to v20.2.13, in some tables we cannot run show columns.

The error would be like this

but, in another server it’s working well.

I still don’t know what is the root cause.

when i run cockroach debug zip
this error also show in cockroach.log

thank you guys

Welcome back to the forum! Is the other server running v20.2.13? Was it upgraded as well?

fyi, the cluster is running in single node mode.
the only issue its on when run SHOW COLUMN

when i run the SELECT query its working.

Yeah, the upgrade is success.

Hello!

Just to clarify:

  • server 1 and server 2 are both running v20.2.13
  • when you run SHOW COLUMNS from audits; on server 1 you get the type error
  • when you run SHOW COLUMNS from audits; on server 2 the query is successful

Is the above correct? If so, can you share the schema of the table with us (SHOW CREATE TABLE table_name;)? Feel free to change the table names before sharing. We are just interested in the types.

Hi Lauren

Is the above correct?
yes, it correct and Server 1 and Server 2 is different cluster.

After i did some investigation, i found something curious.

Here it is,

I have a database, called as an database_a

table_name
audits
komeng_1

Below is the columns name

Komeng_1			
column_name	data_type	is_nullable	column_default
Id_1	INT8	FALSE	NULL
Id_2	INT8	FALSE	NULL
cerita_id	STRING	FALSE	NULL
dok_id	INT8	FALSE	NULL
bapak_id	INT8	TRUE	NULL
dipanggil_id	INT8[]	FALSE	ARRAY[]
top_komeng	BOOL	TRUE	FALSE
created_at	TIMESTAMP	FALSE	now():::TIMESTAMP
updated_at	TIMESTAMP	FALSE	now():::TIMESTAMP
deleted_at	TIMESTAMP	TRUE	NULL


audit			
column_name	data_type	is_nullable	column_default
pelaku_id	INT8	FALSE	NULL
audit_type	STRING	FALSE	NULL
audit_id	INT8	FALSE	NULL
aksi	STRING	FALSE	NULL
ganti_audit	JSONB	TRUE	NULL
dibuat_kapan	TIMESTAMP	FALSE	now():::TIMESTAMP
rowid	INT8	FALSE	unique_rowid()

After i drop the komeng_1 table, actually i can run the show columns from audits
I still dont know what is the exact problem.

Thanks for the helpful information! We think the error is caused by this column in Komeng_1:
dipanggil_id INT8[] FALSE ARRAY []

The column default is just ARRAY[] and not ARRAY[]::INT8[]. To fix the problem without dropping the whole table, run ALTER TABLE komeng_1 ALTER COLUMN dipanggil_id SET DEFAULT ARRAY[]::INT8[];.

However, we aren’t sure how a column was created with a default of ARRAY[]. Do you know how the table and column were created in the first place? Was it on a really old version of CRDB? Or perhaps created on an IMPORT or something?

Hi Lauren

The column default is just ARRAY[] and not ARRAY[]::INT8[] . To fix the problem without dropping the whole table, run ALTER TABLE komeng_1 ALTER COLUMN dipanggil_id SET DEFAULT ARRAY[]::INT8[]; .

Yes, its working now

Thanks for the help

Do you know how the table and column were created in the first place? Was it on a really old version of CRDB?

Yes, it from the old version CRDB (1.1.7)

1 Like