Re: Create index statement does nothing

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "Bowman, Randall" <randall(dot)bowman(at)spglobal(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Create index statement does nothing
Date: 2017-10-11 06:55:51
Message-ID: 1507704951.2627.5.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Randall Bowman wrote:
> I’m executing a create index statement in jdbc.
> The statement executes without error but the index does not show up in the database.
> I execute “select * from pg_indexes where tablename = 'mkteodprice'” in pgAdmin
> and it returns no rows.
> When I execute
> "create index "Temp_4419_1507660884753" on systestdata01p.mktEODPrice ( priceDate, tradingItemId, PacVerToFeedPop )"
> in pgAdmin the index is created as expected.
> The java statement that I’m using is “int n = _statement.executeUpdate( sql );”
> Later in the java code I attempt to drop the index and it fails because the index
> does not exist.
>  
> Log entry for create:
> sendParse  FE=> Parse(stmt=null,query="BEGIN",oids={})
> sendBind  FE=> Bind(stmt=null,portal=null)
> sendExecute  FE=> Execute(portal=null,limit=0)
> sendParse  FE=> Parse(stmt=null,query="create index "Temp_4419_1507660884753" on systestdata01p.mktEODPrice ( priceDate, tradingItemId, PacVerToFeedPop )",oids={})
> sendBind  FE=> Bind(stmt=null,portal=null)
> sendDescribePortal  FE=> Describe(portal=null)
> sendExecute  FE=> Execute(portal=null,limit=1)
> sendSync  FE=> Sync
> processResults  <=BE ParseComplete [null]
> processResults  <=BE BindComplete [unnamed]
> receiveCommandStatus  <=BE CommandStatus(BEGIN)
> processResults  <=BE ParseComplete [null]
> processResults  <=BE BindComplete [unnamed]
> processResults  <=BE NoData
> receiveCommandStatus  <=BE CommandStatus(CREATE INDEX)
> receiveRFQ  <=BE ReadyForQuery(T)

That looks like the CREATE INDEX is tunning inside a transaction,
because it is preceeded by a BEGIN.

If that transaction is not committed, it is not surprising that the
index is not there afterwards.

I would turn on statement logging on the PostgreSQL server to see
what arrives at the backend.

Yours,
Laurenz Albe

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2017-10-11 16:35:04 Re: Spring Transactional Support
Previous Message Robert Price 2017-10-11 00:36:19 Spring Transactional Support