Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!gem.mps.ohio-state.edu!usc!bloom-beacon!eru!luth!sunic!mcsun!ukc!tcdcs!wsl!harry From: harry@wsl.UUCP (Henry M. Moreau on wsl) Newsgroups: comp.databases Subject: Informix dirpath values, was Re: Duplicating Informix SQL Database Keywords: informix system catalogues Message-ID: <264@wsl.UUCP> Date: 2 Oct 89 23:12:36 GMT References:<574@pan.UUCP> <2411@infmx.UUCP> <575@pan.UUCP> Reply-To: harry@wsl.ie (Henry M. Moreau on wsl) Organization: Workhorse Systems, Dublin, Ireland Lines: 51 In the context of other problems with Informix software e.g. - Totally inadequate query optimisation. - Incredibly slow sorting. - Inability to recognise that records have just been added to a table if statistics are not updated, this problem of dirpath seems to me very trivial. Yes, I too have screwed up a database because of it, but the rule about altering tables was easily discovered. As an adjunct, here's a little shell script that I use frequently on our databases to ensure that dirpath entries are in order: #!/bin/sh # # Check and fix dirpath values in systables for informix. # case $# in 0) echo usage ckidp database >&2 exit 1 esac # Get dirpath values that start with / tf=/tmp/ckdp$$ isql $1 - > $tf << @@@ select dirpath from systables where dirpath matches "/*" @@@ # Strip trailing spaces off any lines that begin with / # Get two tagged regular expressions out of each dirpath value # that correspond to the leading pathname and the basename of # the table's file. # Use this to create an update statement. # E.G. if $tf contains a line: # /u/me/db/table123 # The resulting SQL statement is # update systables set dirpath = "table123" where dirpath "/u/me/db/table123" sed -n '/^\//s/ *$// /^\//s/\(.*\)\/\(.*\)/update systables set dirpath = "\2" where dirpath = "&"/p' $tf | isql $1 - rm -f $tf ************************************************************************* * Henry M. Moreau * snail: Workhorse Systems Ltd. * email: harry@wsl.ie * * * 16, Morehampton Road *********************** * * Dublin, 4 * phone: 608721 * * * Ireland * * ************************************************************************* * Opinions expressed herein do not necessarily correspond to opinions * * that I have expressed in the past. * *************************************************************************