Re: How do I recognize a system catalog table?
Posted in 1997
David Williams wrote: |Cannot you somehow get to sysmaster:sysdatabase and then check within |systables for that database? Or check the partnum for the table |against all tables in all databases in sysmaster.. Let's take that one at a time: |Cannot you somehow get to sysmaster:sysdatabase and then check within |systables for that database? Yes but not in a single query. It will have to be from a 4GL (or, if I ever get a round to it) perl. Not one to freeze while waiting for answers, I gave up on the shell/sql script and have gone with a 4GL report for my purposes. Besides making the coding easier, I was also interested in getting the data horizontally formatted. This is the approach I have decided on. David's next point: | Or check the partnum for the table |against all tables in all databases in sysmaster.. This means going backwards - from a list of databases (which I would have to obtain from sysmaster anyway) to the partition numbers of the catalogs of each database, then storing that list to compare against when I scan systabinfo for the info I really want. HMMmmm.. There used to be a "bug" wherein I could be connected to database A, create a temp table, disconnect form A, connect to B... And I could still access that temp table wiothout qualifying it. As I recall, it was too useful a bug to fix but I don't know if it was ever made into a cannonized feature. Still it's an awful lotta ifs. Besides, to switch databases based on a variable database name, I still need 4GL. >I would add more but I'm in Win95 now and sysmaster.sql is on my Linux >partition.. I guess there is no WABI in Linux for Win-95. Madison, David, Marco: Thanks for all the help. I add one last item on this thread, from someone who mailed me and did not post, minus identifying address lines. The info is relevant to this thread (but the sender did not desire public ID). ======================================================================== You can't. ti_flags is simply the partition flags from the partition page. The sysmaster database is treated like any other database. The only difference is that since the partition number for the pseudo tables does not point to a "real" partition, the engine does not use the same "execution" routines. Rather there is a specific routine to gather the information for that specific "table". Remember, these are not really tables, but are actually memory link lists of information kept in shared memory. The engine does not have to set special flags for the catalog tables because each of the catalog tables has a specific tabid within the database, and the dictionary management routines know those tabids. That's why there is an index on tabid within systables. Since the engine knows that tabid 1 is always systables, tabid 2 is always syscolumns, etc., there is no reason to set a special flag on the partition page that indicates that. So - no, there is no way to identify the catalogue tables from systabinfo. As far as the other bits in the ti_flags -- sorry, can't give them out as they are only documented in the source .h file that contains the #define of them. ======================================================================== Again, thanks for an interesting discussion. -- -- Jake (Never yelled "CROWDED THEATER!" during a fire) +------------------------------------------------------------+ | The expedient performance of a task with excessive concern | | regarding its duration-to-completion engenders a virtual | | certainty of diminished benefit therefrom. | | -- Benjamin Franklin (but he said it in 3 words) | +------------------------------------------------------------+