SkipLabs / skdb

SKDB is an embedded SQL database that stays in sync.
https://skdb.io
MIT License
95 stars 9 forks source link

Cannot insert expressions #175

Open gregsexton opened 1 month ago

gregsexton commented 1 month ago
skdb> select 'foo' || 'bar';
┌──────────┐
│  col<0>  │
├──────────┤
│ "foobar" │
└──────────┘
skdb> create table test (x text);
skdb> insert into test values ('foo');
skdb> insert into test values ('foo' || 'bar');
insert into test values ('foo' || 'bar'); 
^
|
 ----- ERROR
Error: line 1, character 0:
Arbitrary expressions not supported for INSERT

But this as a workaround does work.

skdb> insert into test select 'foo' || 'bar';
skdb> select * from test;
┌──────────┐
│    x     │
├──────────┤
│  "foo"   │
│ "foobar" │
└──────────┘
jberdine commented 1 month ago

Yes, this is on my radar. I'm hesitant to implement this as an expansion to a SELECT as it is needlessly inefficient and lifting the limitation should be possible with mostly just a bit of refactoring work.

gregsexton commented 1 month ago

For sure. Just pointing out that users can work around the limitation.