duckdb / duckdb/duckdb-sqlite

CREATE TABLE with DATE column in sqlite saves column as VARCHAR (missing affinity?)

Open
#166 1 comment 0 reactions 0 assignees View on GitHub
reproduced
Dominant language
C
Stars
291
Forks
45
Avg merge
10h 13m
Merged PRs (30d)
18

Description

### What happens?

Cannot `CREATE TABLE` on **sqlite** with DATE column (it is saved as VARCHAR instead).

But when `ALTER TABLE t ADD COLUMN c DATE` still saves the new column as DATE.

### To Reproduce

Using DuckDB (CLI) v1.3.2 (Ossivalis) 0b83e5d2f6

```sql
CREATE TABLE db.a (a INT, b DATE);
DESCRIBE db.a;
```
```text
┌─────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐
│ column_name │ column_type │ null │ key │ default │ extra │
│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │
├─────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤
│ a │ BIGINT │ YES │ NULL │ NULL │ NULL │
│ b │ VARCHAR │ YES │ NULL │ NULL │ NULL │
└─────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┘
```
```sql
ALTER TABLE db.a ADD COLUMN c DATE;
DESCRIBE db.a;
```
```text
┌─────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐
│ column_name │ column_type │ null │ key │ default │ extra │
│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │
├─────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤
│ a │ BIGINT │ YES │ NULL │ NULL │ NULL │
│ b │ VARCHAR │ YES │ NULL │ NULL │ NULL │
│ c │ DATE │ YES │ NULL │ NULL │ NULL │
└─────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┘
```

### OS:

Ubuntu 24.04.2 x86_64

### DuckDB Version:

v1.3.2 (Ossivalis) 0b83e5d2f6

### DuckDB Client:

CLI

### Hardware:

_No response_

### Full Name:

Dat Bui

### Affiliation:

Holistics Software (holistics.io)

### What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

### Did you include all relevant data sets for reproducing the issue?

Yes

### Did you include all code required to reproduce the issue?

- [x] Yes, I have

### Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

- [x] Yes, I have

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.