Re: How do I recognize a system catalog table?
Posted in 1997
>Hi Family.
>
>If I run a query against systables in any database, I can exclude system
>catalogs from my result simply by adding the clause: WHERE TABID < 99.
>However, I am putting together a utility that will run against the
>sysmaster database - tables systabinfo, systabnames. From this
>perspective, there seems to be no distinction between database tables
>and the system catalog tables in those databases.
>
>The only possibility seems to be in the ti_flags column of systabinfo.
>without really rigorous checking, it seems that the ti_flags column for
>a system catalog has the 0x2 bit turned on; non-catalogs seem to have
>the 0x1 bit and temp tables in the bogus SORTTEMP database seem to have
>these bits turned off.
>
>Q1:
>Can anyone confirm - with true knowledge - that I have come to a correct
>conclusion regarding these flags?
Wrong - those are the page/row locking
>
>Q2:
>Carrying this to an unsurprising follow-up: Does anyone have genuine
>information (read: Documentation) on what in *&^%! these flags all stand
>for? It's not in the FM. (That's the fine manual - get your mind out of
>the gutter! ;-)
>
>Q3:
>Assuming my empirical conclusion to be correct regarding that low two
>bits of ti_flags, what kind of expression can I use to isolate this
>digit?
Try select bitval(ti_flags, 1) from systabinfo
>
>I don't know of any bitwise AND operator that works in SQL. I'd like to
>specify ordinary tables with "and ti_flags = 1" but I just noticed a
>table whose ti_flags is 0X00000901, so this shortcut fails. Also, the
>trick of multiplying the ti_flags by 0x10000000 (268435456) to shift the
>low digit up, followed by dividing it back down will aslo fail, because
>it will quickly incur an arithemtic error:
> 1215: Value exceeds limit of INTEGER precision>
>I have already found out that I cannot use bracketed substrings on
>hex(ti_flags). e.g. hex(ti_flags)[10,10]. I have also noticed that
>although ti_flags is a 16-bit column, the hex() function displays it as
>a 32-bit value.
>
>So how do I isolate bits in the ti_flags column?
>
>Thanks.
>--
> -- Jake (Never yelled "CROWDED THEATER!" during a fire)
Jake,
The catalog tables for sysmaster still have the tabid < 99 business. The
pseudo tables have a partition number < 1048576 (0x0100000).
The views have a tabtype of "V"
Madison Pruet