I see, thank you for your comments, David and Adrian.In the "tiles" column actually save either the JSON array of tiles - when the user plays themOr a string (which is jsonb too) concatenated of letters - when the user swaps the letters.Maybe I should rethink my table structure (I just want to "log" all plays, swaps, skips, resigns in the words_moves table)...Or maybe I should always check for the "action" column first (acts as enum) - before accessing "tiles" column....
A table constraint like:
CASE WHEN action = "">
THEN lengh < 0
WHEN action = "">
THEN ...
ELSE false
END
Is perfectly fine - though having actual non-null values take on different meanings based upon the enum is generally not a good idea. I've been using the above to enforce conditional not null constraints when I don't want to implement explicit inheritance.
David J.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- References:
- jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Alexander Farber
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Adrian Klaver
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Alexander Farber
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Adrian Klaver
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Alexander Farber
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Adrian Klaver
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: David G. Johnston
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Adrian Klaver
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Alexander Farber
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Alexander Farber
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Adrian Klaver
- Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- From: Alexander Farber
- jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- Prev by Date: Is there a continuous backup for pg ?
- Next by Date: Re: Is there a continuous backup for pg ?
- Previous by thread: Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- Next by thread: Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
- Index(es):