mojolicious / sql-abstract-pg

:elephant: PostgreSQL features for SQL::Abstract
https://metacpan.org/pod/SQL::Abstract::Pg
Artistic License 2.0
5 stars 3 forks source link

INSERT without fields or values should result in a different SQL syntax #4

Open akarelas opened 2 years ago

akarelas commented 2 years ago

Steps to reproduce the behavior

When I do:

say $abstract->insert('a_table', {});

...I get:

INSERT INTO a_table VALUES ()

...which is invalid syntax in PostgreSQL v14 (results in error ERROR: syntax error at or near ")")

Expected behavior

The following SQL string should be output:

INSERT INTO a_table DEFAULT VALUES
kraih commented 2 years ago

Interesting idea.

akarelas commented 2 years ago

According to https://www.postgresql.org/docs/7.1/sql-insert.html, DEFAULT VALUES is supported all the way back to PostgreSQL v7.1.