Forums Ruby

Links for SQL Tree Extensions, Mercurial VCS

Subscribe to Links for SQL Tree Extensions, Mercurial VCS 2 post(s), 2 voice(s)

 
Avatar Russell Yano... 1 post

Here’s a nice page that explains the Oracle “CONNECT BY” SQL extension, which lets you work with trees easily and efficiently:

http://philip.greenspun.com/sql/trees.html

Postgres has a connectby() function which does something similar, but unfortunately it isn’t built by default (it’s in the contrib/ folder in the Postgres sources).

Here are some links for the Mercurial version control system:

Homepage           http://www.selenic.com/mercurial/wiki/
Book               http://hgbook.red-bean.com/
Windows GUI        http://tortoisehg.sourceforge.net/
Subversion client  http://cheeseshop.python.org/pypi/hgsvn/

The first couple of chapters of the Mercurial book are an excellent read if you have time to go through them. There are also shorter tutorials on the Mercurial home page.

Part of what I said about the Mercurial Subversion client turned out not to be true. It can only “pull” changes from a remote Subversion repository, not “push” them back. To get changes back to the Subversion repository, you currently have to check them in with the normal svn client.

- Russ

 
Avatar Scott Woods Administrator 41 post(s)

Cool, thanks for the links, Russ.

For everyone who wasn’t at the meetup last night, Russ recommended Mercurial as one of the better version control systems (VCS) for people who haven’t used a VCS before. Easy to use and understand, and doesn’t require a server at first—you can just download and start using it.

We got on the tree vs. nested set vs. “connect by” topic when Tony was talking about using nested sets vs. conventional trees in your database. Conventional trees (using a parent_id column that points back into the same table) are the obvious method for representing a hierarchy in a database, but the SQL language doesn’t provide any elegant way to traverse such a structure or select cohesive subsets of the tree. Nested sets are a functionally equivalent way of representing the data, and while they’re not as obvious or easy for humans to grasp, they match SQL’s capabilities well and allow for the types of queries that you’d commonly like to do on trees. Here’s Tony’s follow up in another thread which includes a link to a comparison of the two techniques.

Russ brought up the fact the Oracle (and PostgreSQL with a recompile) have an extension to the SQL language that provides the best of both worlds; you can structure your trees the “obvious” conventional way, and the language extension provides an easy and efficient way to then work with the trees.

Forums Ruby