PostgreSQL 7.3: SQL Key Words

PostgreSQL: Documentation: Manuals: PostgreSQL 7.3: SQL Key Words

It’s very annoying that ‘user’ is a reserved word in postgresql. You also get really crappy error messages (at least with the various forms of quoting I’ve tried to use) when you try to create a table called ‘user’

$ psql web
Welcome to psql 7.4.8, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

web=# create table user (a int(10), b int); ERROR:  syntax error at or near “user” at character 14
web=# create table “user” (a int(10), b int);
ERROR:  syntax error at or near “(” at character 27
web=# create table ‘user’ (a int(10), b int);
ERROR:  syntax error at or near “‘user'” at character 14
web=# create table `user` (a int(10), b int);
ERROR:  syntax error at or near “`” at character 14
web=#
web=#

You will even get the “at character X” if you’re piping something into psql. Hrrm… a line number would be useful.

It also means that I can’t compare results from MySQL and Postgresql involving a table called ‘user’. Bummer.

Any postgresql gurus out there got a solution for me?

Rusty on floating point (and keeping neat code)

Rusty talks about the “fun” of floating point and how this all ties into Wesnoth.

Platform consistency is certainly a good thing – so I’m guessing the attack_prediction code isn’t run by each node in a network game in a way where machines could disagree on the outcome.

This does however bring up an interesting thing. What if, in the future, it was going to be on a per-node basis and people wanted it to be consistent. How do you warn that this isn’t the case (to somebody who is really just reading the docs on this function)?

Is it easy (or is there even a good way) to separate code that’s on one machine versus every one? In NDB we have some protocols where some things are done on a master and others on the slaves (and sometimes, when we go back to refactor the code, we move some of this stuff around – e.g. some work on the BACKUP block that I did a while ago).

In NDB we rely on separate documentation (a diagram showing what signals go where and from who) and keep the code for executing the signals together in the code. We require the coder to think when they’re changing things about where the code is going to be executed (on the master, the slave or both).

We’ve also started to get some better habits in naming structures that are only going to be filled out on the master (or slave) or both. Writing code that looks at the wrong thing has been a source of bugs (especially while hacking on something) that are annoying to track down.

So how do we have these functions that in some cases shouldn’t be used (e.g. when consistency across platforms is important, or should only be used on the slave side of a distributed protocol)? Or rather, how do we warn others (and ourselves) from getting it wrong in the future?

Is the ultimate answer just that “you should read the code and understand it before you use it”? Probably, because any comments are going to be out of date anyway….

i now look forward to some sort of discussion.

Beat on “state of the dolphin” (or: Why Software is never really ready until a .20 release)

Beat Vontobel blogs about “fuþark: The silence of futhark and the state of the dolphin” which is basically about how he’s found that the 5.0.20 release of MySQL is when the 5.0 release is really starting to shine.

This confirms my theory (that I’ve had for quite a while now… like years) that a software release is never really mature until it hits about .20 (that’s dot twenty, not dot two).

When something reaches .10 (dot ten) it’s no longer going to be annoying for most uses, but .20 means that you’re going to be happy. Don’t ask me really why this is the case, but it is.

Think about the 2.6 kernel (yes, Linux Kernel – honestly, you think i was talking about something else?). At about 2.6.10, it would no longer be a pain to use and get things going – everything was starting to be smooth. As we’re getting closer to .20, things are getting better too. Mind you, everything here does run 2.6 now (and so does my mum’s machine – which is always a good sign of something being ready). With 2.4 hitting .20 – you’d never even think about using 2.2, 2.4 was perfect (except when you wanted 2.6).

GNOME (and everything attached to it) is getting to be a really good desktop – ever since about the 2.10 release I’ve been using just much more of the GNOMEy way of doing things because they’re actually getting useful and usable (don’t get me wrong, previous releases were good too – but a lot more things annoyed me). As the releases have progressed, I’m increasingly convinced that 2.20 will be the “we’re here” release. 2.14 is a lot better, but there’s still a bunch of stuff that has to be done before it’s totally kick-ass.

There are no surprises in MySQL 4.0 (it’s past .20 – at .26 now). Everybody knows and trusts it. 4.1 is at 4.1.18 – which is about as good as a .20 and it’s a pretty happy release. But due to 4.0 being rather solid – a lot of people have just stuck there. We’re seeing a bunch move to 5.0 – but my theory is that this will be 5.0.20 or above. Hrrm… anybody see a pattern?

MySQL 5.1 is at 5.1.10 (or so) and it’s stopped being annoying, and that great march towards a .20 is healthy and active.

GCC 2.95 had a lot of respect for a very long time (now it’s just a bit old). Note that .95 is higher than .20 :)

EMACS is at version 21, but ed is only at .2 (hrrm.. and which is used by more people as their editor i wonder).

aptitude at 0.2.15 (getting to .20) – while apt is at 0.6.40 (above .20). RPM is only at 4.0.4 – so a bit to go there :)

The version of postgresql is 7.5.9 over here… so getting to the .1 stage, but away from the .20. (now I’m going to watch comments fill up with postgesql guys going on about something, i just know it :) But there is 7.3.14 – a lot closer to .20!

MythTV is at 0.19 – getting closer to the .20 release (it’s a lot better than even just a few releases ago).

(versions here mostly taken from whatever ubuntu 5.04 has)

Note that attempting to skip a whole bunch of versions and label your software 95, 98, 2003 or whatever doesn’t get you “.20” status. Neither does just skipping to “.20” automatically. It’s about hard work and removing annoying things (we tend to call them bugs).

This is a really stupid metric of software maturity. It is, however, disturbingly accurate.

My MySQL UC2006 talk – more working on it

MySQL UC 2006 – April 24-27, 2006 – Santa Clara, CA – MySQL Cluster: New Features and Enhancements

So I’ve done some more run throughs to get things running smoother (and made some more edits along the way). At some point I will stop fiddling with the darn thing. It’s going to be fine (repeat, take 8 times and call me in the morning if pain persists).

Some features take a lot longer to explain than others. It’s quite interesting really.

I’ve tried to strike a balance between good overviews of technology and the down-and-dirty details. Hopefully it’s a good balance and fits the audience. I’m assuming a bit of knowledge about Cluster (I think the SQL knowledge should be a given – it’s a technical talk at the MySQL UC!). I’m expecting to be thrown a bunch of questions througouht – and hopefully really good questions (and one’s that I’ve anticipated and if people only wait for the next thing i was going to say…).

I’ve put a lot of prep into this talk – hopefully the effort shows (in a good way!).

So come along and hear me talk about what we’ve been up to in the lovely land of Cluster.

final prep on UC presentation (and new toy)

I bought a new toy yesterday (and about time I did). A Logitech presentation clicker thingy:

Picture(14) (1).jpg

It has the laser pointer, the forward and backwards slide buttons and, arguably most interestingly, a built-in timer with vibrate alert.

What’s annoying is that the forward/back is done by page up and page down – and this doesn’t work for the “appear on click” thing for OO.org. Luckily for me, I just about never use that “feature” as the in version of OOo that Ubuntu ships in their stable release (5.04) is just too darn buggy in that area. I do sometimes wonder if people use the stable release of their product for any real work.

But it’s a nice little device and seems to be an improvement of the using the remote control feature of my phone to do the same thing (if you didn’t do anything for X seconds, it disconnected and had to renegotiate something that took a few seconds).

doxygen loves the RAM

Why when running doxygen over the mysql tree (5.0 or 5.1) do I have a process with 590MB of RSS memory?

Not exactly inspiring confidence. Although I guess I’m lucky because I have the RAM to do that in (on any box around here I actually use frequently).

The output of doxygen can be really useful when trying to learn (or remember) the relationships between various bits of code. I find it a bit faster than switching between buffers in an editor and then trying to remember where some class was defined. links are a good thing.

It’d be great if we switched all our public API docs to doxygen, as the output really is quite nice. In fact, internal APIs wouldn’t be bad either. Although, naturally, the real documentation is the source, which (luckily) the doxygen output also makes easy to view.

I’ve rigged up this script to automatically pull the latest out of the public repository (using the free bk client) and generate doxygen docs. About time I share this with the world. get_trees.sh you also need the doxygen template (rename it to Doxyfile.template in the same directory as get_trees.sh)

I run this in cron @daily.

my phpbms branch

I’ve had to fix a few small bugs in the release of phpbms. So I’ve put my bzr archives up

bzr clone http://www.flamingspork.com/src/bms.upstream/

and

bzr clone http://www.flamingspork.com/src/bms.stewart/

Hopefully there’ll be another release soon that incorporates these fixes – some are on the sourceforge page and some are in the source repo.

totally quivering over phpBMS

phpBMS

Basically I want something to generate invoices for me. This should greatly help in a bunch of things – namely not being a retard and fucking it up every month.

Primarily I want to just be able to *not* have a whole bunch of spreadsheet files (one for each month of work plus one for each months expenses) and actually have something that works and takes a lot of the pain away for me.

Then I can do queries to fill out stuff for the tax office.

I think phpBMS fufills this for me. In fact, I’m very much inclined to migrate to it right now.

It stores all its data in a MySQL Database (which is nice, as I use that – and like it). It also means I can do arbitrary queries (in fact, the queries it does are viewable via the Web UI – funky!)

It’s even buzzword compliant with AJAX.

getting rid of duplicate emails, elegantly

I like duplicate emails in the way that everybody is thinking. This is different.

Due to a bug in offlineimap i hit a little while ago, it’s managed to make copies (sometimes even two copies) of each email in certain folders. Now, this isn’t so bad as

a) email didn’t get lost

b) it’s just using extra disk, and disk is cheap.

but it is annoying when searching.

It’s also annoying because it’s decided to do this on folders such as INBOX/MySQL/bugs which contains an email for each change to a bug report even since I joined the company. That adds up to a lot of wasted inodes and disk blocks.

So, I’ve revived this project that I have in the back of my head of efficiently storing email in a database and being able to sync between instances of it.

This gives us some nice advantages. you can use replication to keep a backup of your email. You can put it in Cluster and have high availability email.

We can also do some neat tricks with tables of all that info that you need to display lists of emails and probably get performance boosts instead of having to open each mail as we currently do. i.e. current email solutions don’t scale to a million emails in a folder.

Partitioning will also be useful to make searches quicker (odds are what we’re searching for is recent and all sorts of foo).

Anyway…. it’s interesting to see the bunch of errors that gets thrown up by the Mail::Box perl module on some of my Maildirs. Hrrm… I may have to resort to my own more error tolerant code. I’m determined to write scripts that can not possibly loose anything.

MySQL Users Conference 2006 – April 24-27, 2006 – Santa Clara, CA

MySQL Users Conference 2006 – April 24-27, 2006 – Santa Clara, CA

I’m presenting “MySQL Cluster: New Features and Enhancements”. It’s going to be a riot. Lots of sexy new stuff to go on about. I’ll also be running a Cluster BoF and am really looking forward to chatting to people about Cluster and what we can do to make it better for our users.

So come along and talk to me while I’m there.

I’ll be sure to use the word “thongs” in the Australian sense as much as possible.

So come along, or I’ll be forced to ask “Where the bloody hell are ya?

MemberDB – A Membership Database 0.4

MemberDB – A Membership Database

I released 0.4 today. A rather long awaited release. No doubt there’ll be bugs and the need for a 0.4.1 or something – but this is relatively bug free and has a bunch of new cool stuff to chew on.

It’s also the first real release to support MySQL 5.0 (previous releases won’t work as MemberDB heavily uses views).

Photo out of the hotel room window

DSCN7380-small.JPG

At the recent MySQL DevConf in Sorrento, Italy, I decided to take a photo out the window of my hotel room. Here it is. I’ve stayed at worse places, just :)

It also looked really similar to this from the breakfast and lunch room.

Pity we were then stuck in the basement working for most of the day. But it rocked. Got through lots of stuff, which is good.

adnarim_abroad making me homesick

adnarim_abroad: I know it’s controversial to say, but i’

I now want to be bumming around Melbourne city during the games. My house is 2mins walk from a  train station that’s less than 30mins to the middle of town. But never spend enough time there.

It’ll be good to get home.

Although i think the tired and hungover thing isn’t helping.