Обсуждение: DatabaseMetaData.getCatalogs()

Поиск
Список
Период
Сортировка

DatabaseMetaData.getCatalogs()

От
jason@netspade.com
Дата:
Hi,

Is there a reason why getCatalogs() is not supported in the JDBC driver? First of all, what is the definition of a
catalog?The MySQL JDBC driver simply returns a list of the databases so a simple select datname from pg_database; would
dothe same thing. However there is probably a reason for this and I would be grateful if you would explain.
 

I'm writing a database admin tool and so far I've made my own Connector class to implement things like this.

Thanks,
Jason Davies

jason@netspade.com


Re: DatabaseMetaData.getCatalogs()

От
jason@netspade.com
Дата:
[[[ Original Message from Peter Eisentraut <peter_e@gmx.net> ]]]

> jason@netspade.com writes:
>
> > Is there a reason why getCatalogs() is not supported in the JDBC driver? First
> of all, what is the definition of a catalog? The MySQL JDBC driver simply returns
> a list of the databases so a simple select datname from pg_database; would do
> the same thing. However there is probably a reason for this and I would be grateful
> if you would explain.
>
> It is as of three minutes ago.

Thanks a lot :) How can I help with coding the JDBC classes? I have some code for getting table privileges etc. which
I'dlike to add. Do I need a cvs username or should I post the code here? 

Thanks,
Jason Davies

jason@netspade.com

Re: DatabaseMetaData.getCatalogs()

От
Bruce Momjian
Дата:
> [[[ Original Message from Peter Eisentraut <peter_e@gmx.net> ]]]
>
> > jason@netspade.com writes:
> >
> > > Is there a reason why getCatalogs() is not supported in the JDBC driver? First
> > of all, what is the definition of a catalog? The MySQL JDBC driver simply returns
> > a list of the databases so a simple select datname from pg_database; would do
> > the same thing. However there is probably a reason for this and I would be grateful
> > if you would explain.
> >
> > It is as of three minutes ago.
>
> Thanks a lot :) How can I help with coding the JDBC classes? I have some code for getting table privileges etc. which
I'dlike to add. Do I need a cvs username or should I post the code here? 

Just send over a context diff patch, either against 7.1.2 or CVS.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: DatabaseMetaData.getCatalogs()

От
Bruce Momjian
Дата:
I am Cc'ing the jdbc list.

> [[[ Original Message from Bruce Momjian <pgman@candle.pha.pa.us> ]]]
>
> >
> > Just send over a context diff patch, either against 7.1.2 or CVS.
>
> Okay here's a context diff against CVS for getting table privileges. I may have more code to add (I noticed
getColumnPrivileges()is not completed - could use my routine for parsing pg_class.relacl?). 
>
> Jason Davies
>
> jason@netspade.com

[ Attachment, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: DatabaseMetaData.getCatalogs()

От
jason@netspade.com
Дата:
[[[ Original Message from Bruce Momjian <pgman@candle.pha.pa.us> ]]]

>
> Just send over a context diff patch, either against 7.1.2 or CVS.

Okay here's a context diff against CVS for getting table privileges. I may have more code to add (I noticed
getColumnPrivileges()is not completed - could use my routine for parsing pg_class.relacl?). 

Jason Davies

jason@netspade.com
Вложения

Re: DatabaseMetaData.getCatalogs()

От
Tom Lane
Дата:
jason@netspade.com writes:
> Okay here's a context diff against CVS for getting table privileges.

This appears not to be correct for current sources --- the privilege
set has changed since 7.1.

            regards, tom lane

Re: DatabaseMetaData.getCatalogs()

От
jason@netspade.com
Дата:
[[[ Original Message from Tom Lane <tgl@sss.pgh.pa.us> ]]]

> jason@netspade.com writes:
> > Okay here's a context diff against CVS for getting table privileges.
>
> This appears not to be correct for current sources --- the privilege
> set has changed since 7.1.

Ah you probably know better than me. It works in 7.1 for me, but does it have to be backwards compatible? Where can I
findout how the new privilege set works? 

Thanks,
Jason

Re: DatabaseMetaData.getCatalogs()

От
Peter Eisentraut
Дата:
jason@netspade.com writes:

> Okay here's a context diff against CVS for getting table privileges. I may have more code to add (I noticed
getColumnPrivileges()is not completed - could use my routine for parsing pg_class.relacl?). 

The list of columns you return is wrong.  There is no COLUMN_NAME column.
TABLE_CAT should be filled in with the database name (should be available
via getConnection().getCatalog()).  A missing TABLE_SCHEM should be set to
null (in the SQL sense).  Also you have GRANTOR and GRANTEE mixed up,
besides the fact that PostgreSQL doesn't store the GRANTEE at all (yet).

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: DatabaseMetaData.getCatalogs()

От
jason@netspade.com
Дата:
[[[ Original Message from Peter Eisentraut <peter_e@gmx.net> ]]]

> The list of columns you return is wrong.  There is no COLUMN_NAME column.

Does PostgreSQL actually support privileges for individual columns?

> TABLE_CAT should be filled in with the database name (should be available
> via getConnection().getCatalog()).  A missing TABLE_SCHEM should be set to
> null (in the SQL sense).  Also you have GRANTOR and GRANTEE mixed up,
> besides the fact that PostgreSQL doesn't store the GRANTEE at all (yet).

Sorry about that. Surely the grantee is the username in the relacl field e.g. {"=","jason=arwR"} and the grantor is the
ownerof the table? 

Jason

Re: DatabaseMetaData.getCatalogs()

От
Peter Eisentraut
Дата:
jason@netspade.com writes:

> > The list of columns you return is wrong.  There is no COLUMN_NAME column.
>
> Does PostgreSQL actually support privileges for individual columns?

No.  Even if it would, this would belong into
DatabaseMetaData.getColumnPrivileges().  getColumnPrivileges() could still
be implemented, it would just look at the table privileges instead.

> > TABLE_CAT should be filled in with the database name (should be available
> > via getConnection().getCatalog()).  A missing TABLE_SCHEM should be set to
> > null (in the SQL sense).  Also you have GRANTOR and GRANTEE mixed up,
> > besides the fact that PostgreSQL doesn't store the GRANTEE at all (yet).
>
> Sorry about that. Surely the grantee is the username in the relacl
> field e.g. {"=","jason=arwR"} and the grantor is the owner of the
> table?

Most likely, but it could also be any superuser.  Since we don't allow
grant options anyway I would just set it to null to not confuse the issue.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter