DDL in transactions?

Поиск
Список
Период
Сортировка
От Giuseppe Sacco
Тема DDL in transactions?
Дата
Msg-id 1112254334.3881.8.camel@localhost
обсуждение исходный текст
Ответы Re: DDL in transactions?  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Hi,
I have a question about 7.4 jdbc driver. I am executing this code:

--------------------
conn=datasource.getPooledConnection().getConnection();
conn.setAutoCommit(false);
stmt=conn.createStatement();

stmt.executeUpdate("CREATE TABLE X (X VARCHAR(100))");
//stmt.commit(); // <= Look at this line
stmt.executeUpdate("INSERT INTO X VALUES ('string')");
stmt.commit();

stmt.close();
conn.close();
--------------------

And I found that, using postgresql jdbc driver, I need to add the
commit() call that is commented out, otherwise I get an error like
'relation X does not exists'.

My question is: why? Shouldn't DDL be executed immediately?

Thank you for your response,
Giuseppe Sacco


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

Предыдущее
От: fake@dusk.homelinux.org
Дата:
Сообщение: Re: jdbc/callable statment error]
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: DDL in transactions?