question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default constraint does not work for float and boolean

See original GitHub issue
status {
        abc as boolean <DEFAULT true>
}

Leads to error: Line 10 - This constraint value must be of a Short

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Oct 15, 2020

@mena-bosch it does replicate for floats (and doubles) that end with .0 - i.e. 1.0 Seems like I only tested with .0 values before…

It gets weirder.

  • foo as float <DEFAULT 0.0> --> ok
  • foo as float <DEFAULT 0.1> --> ok
  • foo as float <DEFAULT 1.0> --> no viable alternative at input '1.0' ¯_(ツ)_/¯
  • foo as float <DEFAULT 2.0> --> ok again…

Also worth noting the parsing error messages are different in case of boolean vs float.

  • boo as boolean <DEFAULT true> --> This constraint value must be of a Short

Probably different issues in the grammar.

0reactions
ghostcommented, Oct 26, 2020

Closing this and #2490 since it’s merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify Default Values for Columns - SQL Server
You can use SQL Server Management Studio to specify a default value that will be entered into the table column. You can set...
Read more >
Default Value Constraint | CockroachDB Docs
The Default Value constraint specifies a value to populate a column with if none is provided.
Read more >
Postgres Alter Column Integer to Boolean
Try this: ALTER TABLE mytabe ALTER COLUMN mycolumn DROP DEFAULT; ALTER TABLE mytabe ALTER mycolumn TYPE bool USING CASE WHEN mycolumn=0 THEN FALSE...
Read more >
Default Column Values in JPA
When we take a look at the SQL table definition, we won't see any default value in it: create table user ( id...
Read more >
DEFAULT clause of CREATE TABLE
If you specify no default value for a column, the default is NULL unless you place a NOT NULL constraint on the column....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found