Re: Issue while creating index dynamically

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Issue while creating index dynamically
Date: 2024-07-23 20:32:27
Message-ID: 1085896.1721766747@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> On Tue, Jul 23, 2024 at 4:10 PM veem v <veema0000(at)gmail(dot)com> wrote:
>> But we are getting an error while executing saying it cant be executed in
>> transaction block with "CONCURRENTLY". So I want to understand , is there
>> any alternate way to get away with this?

> I'd write that in bash, not in a DO block.

Yeah. I thought for a bit about using contrib/dblink to carry out
the commands in a different session, but I don't think that'll work:
CREATE INDEX CONCURRENTLY would think it has to wait out the
transaction running the DO block at some steps. Shove the logic
over to the client side and you're good to go.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-07-23 20:35:42 Re: re-novice coming back to pgsql: porting an SQLite update statement to postgres
Previous Message Ron Johnson 2024-07-23 20:20:59 Re: Issue while creating index dynamically