sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Sass-like variables

Open ehfeng opened this issue 3 years ago • 0 comments

What do you want to change?

I would like Sass-like variables to be written in sql so I can use the same value across both a column's default and a insert default (in the event of a null parameter). This is useful for being able to have optional parameters for insert statements.

create table plants(color text not null default :default_color);

insert into plants(color) values (coalesce(sqlc.narg(c), :default_color);

What database engines need to be changed?

No response

What programming language backends need to be changed?

No response

ehfeng avatar Aug 05 '22 20:08 ehfeng