Re: Bug in CREATE/DROP TABLESPACE command

From: William Garrison <postgres(at)mobydisk(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Bug in CREATE/DROP TABLESPACE command
Date: 2007-03-22 18:40:03
Message-ID: 4602CD83.2090801@mobydisk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Not a transaction block. A batch of commands submitted to the server in
a single call. In MSSQL land, I call that a batch. I don't know the
PostgreSql term. If you are using the pgadmin3 GUI, then I mean pressing
F5 once is a single batch. Pressing it twice is two batches.

The following will submit this as one batch, and will NOT reproduce the
problem:

1) Open pgadmin3. Open the query tool. Paste in the following.
CREATE TABLESPACE bad_tablespace LOCATION E'C:\\postgresql\\MyDatabase';
DROP TABLESPACE IF EXISTS bad_tablespace;
CREATE TABLESPACE bad_tablespace LOCATION E'Z:\\postgresql\\MyDatabase';
DROP TABLESPACE IF EXISTS bad_tablespace;
2) Press F5

However, the following submits it in 3 batches, and will reproduce the
problem:
1) Open pgadmin3. Open the query tool. Paste in the following.
CREATE TABLESPACE bad_tablespace LOCATION E'C:\\postgresql\\MyDatabase';
2) Press F5
3) Delete the text, and replace it with the following:
DROP TABLESPACE IF EXISTS bad_tablespace;
CREATE TABLESPACE bad_tablespace LOCATION E'Z:\\postgresql\\MyDatabase';
4) Press F5
5) Delete the text, and replace it with the following:
DROP TABLESPACE IF EXISTS bad_tablespace;
6) Press F5

Strangely, I am unable to duplicate the problem with psql. I thought it
would submit a single batch if I didn't press enter between each
command, but it doesn't seem to work that way.

If there is a better term please let me know.

Tom Lane wrote:
> William Garrison <postgres(at)mobydisk(dot)com> writes:
>> -- Drop the tablespace and re-create in in an invalid location
>> -- This only causes the bug if both these commands are run in one batch
>
> What do you mean by "one batch" exactly? Both CREATE and DROP TABLESPACE
> refuse to run in a transaction block, so I'm confused about this.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-03-22 18:41:28 Re: Insert fail: could not open relation with OID 3221204992
Previous Message araza 2007-03-22 18:30:55 Re: Insert fail: could not open relation with OID 3221204992

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Browne 2007-03-22 19:25:22 Re: TOASTing smaller things
Previous Message Bruce Momjian 2007-03-22 18:26:48 Re: CREATE INDEX and HOT - revised design