Just for the hell of it, I”ve decided to build a blogging tool.
You know, a blogger or MovableType type tool.
Why? Because I can. And because I’ll learn stuff doing it.
I’m building it on my Linux box in PHP against a Postgres database.
When I started this project, I sort of gave in and had it running against mySQL — while I hate it, it is the dominant open-source database (for better or for worse…). MoveableType runs against this, and MT is used all over the Blogsphere, so whatever…
As I began coding and wanted to do stuff, however, I quickly ran out of obscenities to use for this sad excuse of a database.
I rebuilt tables in Postgres and I have not looked back. Everything I’ve wanted to do is easily handled in Postgres. Damn. Nice database.
One thing I don’t particularily like – and maybe there’s a way around it – is the string concatination operator — it’s “||” (without quotes, obviously)>
To me, that’s an “or” operator — I’m used to the ampersand (&) or a period (“.”) for string concatenation. I wouldn’t mind the double pipes, except that it is so much like an OR operator. Seems weird.
Example, a value of “Mary” in the first_name column. To make it “Mary Ann” one would enter:
Update tableName set first_name = first_name || ‘ Ann’ where [some restriction…name_id = 12 or whatever]
To me, this reads “Update first name to first name OR Ann where…..but that’s just me, I guess.
On the other hand, Postgres is so Oracle-like that there might be another way to do this that is more traditional. Still, it’s a little non-intuitive to me (I tried the ampersand and dot before hitting Google and finding a solution). Update: All my searching tells me that the double pipe — || — is the only string concatenation operator. Oh well. Can’t say I’m thrilled with that, but what the hell…
Note: mySQL’s way of doing this is to use the word fragment “concat” — now that’s WAY weird, to me…