I have attempted to parse names before, so this was an interesting read. I did kind of know about complexity of input restrictions to names, so I did not spend a lot of time working on that much. I did try to create a program to detect first names, common names, family names, etc. I probably spent an entire day just reading a plethora of articles on different cultures of names. Essentially, I never got around to even starting one. For most systems that I build now, I just use a display name. User enters their own first name and last name which most of my applications don't require but is sometimes required for third parties especially for payments.
https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
Wednesday, January 15, 2020
Friday, January 3, 2020
Unknown knowns: Postgres Boolean Column Default Value
I am new to Postgres and I was trying to default a boolean column to true or false. But kept getting an error:
I tried using values 1, true, TRUE, and 'TRUE'. None of these worked.
According to what I can find online, the other values should have also worked. At first, I thought maybe DBeaver was causing the problems but I get the same error when I run the same command to the VM. I do not know why this does not work. Link 1 shows that TRUE should have at least worked.
ERROR: column "ColumnName" is of type bit but default expression is of type boolean
HINT: You will need to rewrite or cast the expression.
I tried using values 1, true, TRUE, and 'TRUE'. None of these worked.
Solution
ALTER TABLE public."_TableName" ALTER COLUMN "ColumnName" SET DEFAULT '1';According to what I can find online, the other values should have also worked. At first, I thought maybe DBeaver was causing the problems but I get the same error when I run the same command to the VM. I do not know why this does not work. Link 1 shows that TRUE should have at least worked.
Reference
1 - https://www.postgresqltutorial.com/postgresql-boolean/
Labels:
buggish,
postgresql
Thursday, January 2, 2020
Unknown knowns: Postgresql (psql) Case Sensitivity Borderline Buggish
I could not find much literature on why POSTGRESQL is case sensitivity is no consistent. Obviously, it can be worked around but not very intuitive to someone new to Postgres but is experienced with other databases.
My "problem" with Postgres in my first hour was creating a table and querying the table. Postgres forces lower-case on the table name when creating if no double-quotes are used. But when you query the table, the syntax is case-sensitive so will not find the table because they are not the same cases.
Most literature I read just explains that this happens. Some argue that this is not a case-sensitivity issue, which I suppose is kind of, maybe technically true. But seriously, if I type in any language:
CREATE TABLE AbcDef
I would most definitely think that, "SELECT * FROM AbcDef", should most definitely work whether the system records the table the same way I named it.
I am just saying even if Postgres lower-cased AbcDef to abcdef, it should also search for table abcdef when I query by AbcDef. And if I really want it to be AbcDef with double-quotes, then I use double-quotes in my query. And this is why I think this is kind of buggish.
If it weren't for me trying to gain some experience with Postgres, I feel this is probably enough for me to start gaining more experience with MySql. Although the object-oriented portion is a bit intriguing.
Labels:
postgresql,
unknown knowns
Subscribe to:
Posts (Atom)