Bug: enum types in schema other than public and Connection.createArrayOf

Поиск
Список
Период
Сортировка
От Hans Klett
Тема Bug: enum types in schema other than public and Connection.createArrayOf
Дата
Msg-id C4746C300EA2D34FAF7805BBA5F4F5F9919A80F6@reactor.sldomain.com
обсуждение исходный текст
Список pgsql-jdbc
Hello,

I found an issue with Connection.createArrayOf() when using qualified
enum type names. It doesn't like the qualified type name, and when you
give it the unqualified type name it just picks an enum type even if it's not
in the public schema. If the enum type name exists in multiple schemas it just
picks one, seemingly at random.

For instance, in database foo:
CREATE SCHEMA bar;
CREATE SCHEMA baz;
CREATE TYPE bar.mood AS ENUM ('happy', 'sad');
CREATE TYPE baz.mood AS ENUM ('grumpy', 'sassy');

Java:
    final Properties props = new Properties();
    props.setProperty("user", "postgres");
    props.setProperty("password", "postgres");
    try (final Connection conn = DriverManager.getConnection("jdbc:postgresql:foo", props)) {
        final String[] strings = { "sad", "happy" };

        // Works, but picks either baz.mood or bar.mood.
        // I haven't figured out how it picks which one to use.
        conn.createArrayOf("mood", strings);

        // Throws org.postgresql.util.PSQLException:
        //        Unable to find server array type for provided name bar.mood
        conn.createArrayOf("bar.mood", strings);
    }

Thanks!
- Hans


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

Предыдущее
От: Alexis Meneses
Дата:
Сообщение: Re: Patch to allow setting schema/search_path in the connectionURL
Следующее
От: cowwoc
Дата:
Сообщение: Why is version 9.3-1102 missing Connection.getSchema() support?