Bug with DatabaseMetaData and temporary tables/schemas

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Bug with DatabaseMetaData and temporary tables/schemas
Дата
Msg-id ib1l67$e22$1@dough.gmane.org
обсуждение исходный текст
Ответы Re: Bug with DatabaseMetaData and temporary tables/schemas  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Hi,

DatabaseMetaData does not correctly report the implicitely created temporary schema when creating a temporary table.

I ran the following code using a 9.0.1 database on Windows XP, with the postgresql-9.0-801.jdbc4.jar driver:

rs = con.getMetaData().getSchemas();
System.out.println("before create table: ");
while (rs.next())
{
    System.out.println("schema: " + rs.getString(1));
}
rs.close();

stmt = con.createStatement();
stmt.execute("create temporary table foo (id integer)");
System.out.println("after create table: ");
rs = con.getMetaData().getSchemas();
while (rs.next())
{
    System.out.println("schema: " + rs.getString(1));
}
rs.close();

rs = stmt.executeQuery("select nspname from pg_namespace");
while (rs.next())
{
    System.out.println("schema from pg_namespace: " + rs.getString(1));
}
rs.close();

On an otherwise empty database this produces the following output:

before create table:
schema: information_schema
schema: pg_catalog
schema: pg_toast_temp_1
schema: pg_toast_temp_2
schema: pg_toast_temp_3
schema: public

after create table:
schema: information_schema
schema: pg_catalog
schema: pg_toast_temp_1
schema: pg_toast_temp_2
schema: pg_toast_temp_3
schema: public

schema from pg_namespace: pg_toast
schema from pg_namespace: pg_temp_1
schema from pg_namespace: pg_toast_temp_1
schema from pg_namespace: pg_catalog
schema from pg_namespace: information_schema
schema from pg_namespace: public
schema from pg_namespace: pg_temp_2
schema from pg_namespace: pg_toast_temp_2
schema from pg_namespace: pg_temp_3
schema from pg_namespace: pg_toast_temp_3

So the pg_temp_X schema(s) are there, but getSchemas() does not return them.

Am I missing something, or is this a bug in the driver?

Regards
Thomas

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

Предыдущее
От: Perepelkin Andrew
Дата:
Сообщение: Re: Invalid Column Length
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: Bug with DatabaseMetaData and temporary tables/schemas