™N
å~¡4c       sû      d  GH H d GH H	 d GH
 H d GH d GH d GH H d GH H d GH d GH d  GH H k  l  k l  d	 „  Z % d
 „  Z / d „  Z 8 d „  Z A d „  Z J d „  Z T d „  Z	 \ d „  Z
 d d „  Z l d „  Z d S(   sD   ____________________________________________________________________s9   MODULE SYSCAT.PY : PARSES SOME POSTGRESQL SYSTEM CATALOGSs=   This module is designed for being imported from python promptsD   In order to run the samples included here, first create a connections8   using :                        cnx = syscat.connect(...)s/   then start the demo with:      syscat.demo(cnx)s9   Some results may be empty, depending on your base status.sA   If you want to adjust the display to your screen size (rows), yous7   can type:                      syscat.src_size = [rows]c    s      |  i d ƒ } " | Sd  S(   Ns+  select bc.relname as class_name, ic.relname as index_name, a.attname from pg_class bc, pg_class ic, pg_index i, pg_attribute a where i.indrelid = bc.oid and i.indexrelid = bc.oid   and i.indkey[0] = a.attnum and a.attrelid = bc.oid   and i.indproc = '0'::oid order by class_name, index_name, attname(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_simple_ind s   c    s    % & |  i d ƒ } , | Sd  S(   Nsô   select c.relname, a.attname, t.typname from pg_class c, pg_attribute a, pg_type t where c.relkind = 'r' and c.relname !~ '^pg_'   and c.relname !~ '^Inv' and a.attnum > 0   and a.attrelid = c.oid and a.atttypid = t.oid order by relname, attname(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_all_attr% s   c    s    / 0 |  i d ƒ } 5 | Sd  S(   NsÑ   select u.usename, t.typname from pg_type t, pg_user u where u.usesysid = int2in(int4out(t.typowner))   and t.typrelid = '0'::oid and t.typelem = '0'::oid   and u.usename <> 'postgres' order by usename, typname(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_user_base_type/ s   c    s    8 9 |  i d ƒ } > | Sd  S(   Nsá   select o.oprname as right_unary,   lt.typname as operand, result.typname as return_type from pg_operator o, pg_type lt, pg_type result where o.oprkind='r' and o.oprleft = lt.oid   and o.oprresult = result.oid order by operand(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_right_unary_operator8 s   c    s    A B |  i d ƒ } G | Sd  S(   Nsá   select o.oprname as left_unary,   rt.typname as operand, result.typname as return_type from pg_operator o, pg_type rt, pg_type result where o.oprkind='l' and o.oprright = rt.oid   and o.oprresult = result.oid order by operand(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_left_unary_operatorA s   c    s    J K |  i d ƒ } Q | Sd  S(   Ns  select o.oprname as binary_op,   rt.typname as right_opr, lt.typname as left_opr,   result.typname as return_type from pg_operator o, pg_type rt, pg_type lt, pg_type result where o.oprkind = 'b' and o.oprright = rt.oid   and o.oprleft = lt.oid and o.oprresult = result.oid(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_binary_operatorJ s   c    s$   T U |  i d | ƒ } Y | Sd  S(   Ns©   select p.proname, p.pronargs, t.typname from pg_proc p, pg_language l, pg_type t where p.prolang = l.oid and p.prorettype = t.oid   and l.lanname = '%s' order by proname(   s   pgcnxs   querys   ls   result(   s   pgcnxs   ls   results	   syscat.pys   list_lang_funcT s   c    s    \ ] |  i d ƒ } ` | Sd  S(   Nsp   select a.aggname, t.typname from pg_aggregate a, pg_type t where a.aggbasetype = t.oid order by aggname, typname(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_agg_func\ s   c    s    d e |  i d ƒ } i | Sd  S(   NsÞ   select am.amname, opc.opcname, opr.oprname from pg_am am, pg_amop amop, pg_opclass opc, pg_operator opr where amop.amopid = am.oid and amop.amopclaid = opc.oid   and amop.amopopr = opr.oid order by amname, opcname, oprname(   s   pgcnxs   querys   result(   s   pgcnxs   results	   syscat.pys   list_op_classd s   c    sA  l m d GHn t  |  ƒ } o t | i ƒ  | i ƒ  ƒ p d GHq t |  ƒ } r t | i ƒ  | i ƒ  ƒ s d GHt t |  ƒ } u t | i ƒ  | i ƒ  ƒ v d GHw t |  ƒ } x t | i ƒ  | i ƒ  ƒ y d GHz t	 |  ƒ } { t | i ƒ  | i ƒ  ƒ | d GH} t
 |  ƒ } ~ t | i ƒ  | i ƒ  ƒ  d GH€ t |  d ƒ }  t | i ƒ  | i ƒ  ƒ ‚ d	 GHƒ t |  d
 ƒ } „ t | i ƒ  | i ƒ  ƒ … d GH† t |  d ƒ } ‡ t | i ƒ  | i ƒ  ƒ ˆ d GH‰ t |  ƒ } Š t | i ƒ  | i ƒ  ƒ ‹ d GHŒ t |  ƒ }  t | i ƒ  | i ƒ  ƒ d  S(   Ns   Listing simple indices ...s   Listing all attributes ...s'   Listing all user-defined base types ...s,   Listing all left-unary operators defined ...s-   Listing all right-unary operators defined ...s    Listing all binary operators ...s&   Listing C external function linked ...s   Cs    Listing C internal functions ...s   internals!   Listing SQL functions defined ...s   sqls!   Listing 'aggregate functions' ...s   Listing 'operator classes' ...(   s   list_simple_inds   pgcnxs   temps   displays
   listfieldss	   getresults   list_all_attrs   list_user_base_types   list_left_unary_operators   list_right_unary_operators   list_binary_operators   list_lang_funcs   list_agg_funcs   list_op_class(   s   pgcnxs   temps	   syscat.pys   demol sB   N(   s   pgexts   *s   pgtoolss   list_simple_inds   list_all_attrs   list_user_base_types   list_right_unary_operators   list_left_unary_operators   list_binary_operators   list_lang_funcs   list_agg_funcs   list_op_classs   demo(    s	   syscat.pys   ? s6   


			
