Re: Get a table name

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Get a table name
Дата
Msg-id 4B3809D7.9090407@opencloud.com
обсуждение исходный текст
Ответ на Get a table name  (Gianvito Pio <pio.gianvito@gmail.com>)
Ответы Re: Get a table name  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Gianvito Pio wrote:
> Hi all,
> I'm trying to get the table name of a column in this way:
>
> ResultSet rs;
>         try
>         {
>             rs = ps.executeQuery();
>             ResultSetMetaData rsmd = rs.getMetaData();
>             System.out.println(rsmd.getTableName(..));
>
> but the getTableName( ..) method gives me an empty string. Isn't there a
> way to know the table name of a specific field I'm obtaining? Thanks

You can use PGResultSetMetaData.getBaseTableName() if you want to know
the name of the underlying table that provided the data for a column
(where known).

We concluded a while back that getTableName() is meant to return the
aliased table name in the query, not the underlying table name. It's not
easy for the driver to find the aliased name, so it always returns an
empty string, as you found.

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Maciek Sakrejda
Дата:
Сообщение: Re: Get a table name
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Get a table name