Thread

  1. Re: [HACKERS] Re: New pg_pwd patch and stuff

    Peter T Mount <psqlhack@maidast.demon.co.uk> — 1998-01-14T06:52:45Z

    On Tue, 13 Jan 1998, todd brandys wrote:
    
    > On Sun, 11 Jan 1998, Bruce Momjian wrote:
    > 
    > > OK, general question.  Does pg_user need to be readable?  Do
    > > non-postgres users want to see who owns each table?  I don't know.
    > 
    > I'd say yes, as we have stuff in JDBC yet to implement that will access
    > this table.
    > 
    > ----------------------------------
    > 
    > What is it that you need to implement in JDBC for which a general user needs
    > to be able to see tables that other users own?  If this is some type of admin,
    > 'stuff' that the postgres user will execute, then he/she will be able to run it
    > no problem.
    
    It's a call that's part of the JDBC specification. so it can be called by
    user code, or admin code.
    
    Here's what I have on it.
    
    Interface java.sql.DatabaseMetaData
    
     public abstract ResultSet getTablePrivileges(String catalog,
                                                  String schemaPattern,
                                                  String tableNamePattern)
    					throws SQLException
                                                                            
              
              Get a description of the access rights for each table available
              in a catalog. Note that a table privilege applies to one or 
              more columns in the table. It would be wrong to assume that    
              this priviledge applies to all columns (this may be true for
              some systems but is not true for all.)
       
              Only privileges matching the schema and table name criteria are
              returned. They are ordered by TABLE_SCHEM, TABLE_NAME, and
              PRIVILEGE.
              
              Each privilige description has the following columns:
       
             1. TABLE_CAT String => table catalog (may be null)     
             2. TABLE_SCHEM String => table schema (may be null)
             3. TABLE_NAME String => table name                          
             4. GRANTOR => grantor of access (may be null)  
             5. GRANTEE String => grantee of access              
             6. PRIVILEGE String => name of access (SELECT, INSERT, UPDATE,
                REFRENCES, ...)                                                    
             7. IS_GRANTABLE String => "YES" if grantee is permitted to grant
                to others; "NO" if not; null if unknown                     
              
       
            Parameters:                                                   
                    catalog - a catalog name; "" retrieves those without a   
                    catalog; null means drop catalog name from the selection
                    criteria                        
                    schemaPattern - a schema name pattern; "" retrieves those
                    without a schema                                         
                    tableNamePattern - a table name pattern             
              
            Returns:
                    ResultSet - each row is a table privilege description
       
            Throws: SQLException                                    
                    if a database-access error occurs.          
    
            See Also:                                       
                    getSearchStringEscape                        
    
    -- 
    Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
    Main Homepage: http://www.demon.co.uk/finder
    Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk