Re: [GENERAL] drop table if exists ;

2012-09-19 Thread Craig Ringer
On 09/19/2012 07:54 PM, Marc Mamin wrote: hello, I've found a small logical issue while writing a migration script: create table vtest (foo int); create view vtest_v as select * from vtest; drop table if exists vtest_v; ERROR: "vtest_v" is not a table drop view if exists vtest; ERROR:

[GENERAL] drop table if exists ;

2012-09-19 Thread Marc Mamin
hello, I've found a small logical issue while writing a migration script: create table vtest (foo int); create view vtest_v as select * from vtest; drop table if exists vtest_v; ERROR: "vtest_v" is not a table drop view if exists vtest; ERROR: "vtest" is not a view this may be seen as a ni

Re: [GENERAL] DROP TABLE Appears to Fail [SOLVED]

2011-06-28 Thread Rich Shepard
On Tue, 28 Jun 2011, Rick Genter wrote: After issuing the \d you are still in the middle of your command. Witness the following copy/paste of a terminal session: Ah, so! I didn't see this. Thank you very much, Rich -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To m

Re: [GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread John R Pierce
postgres=# drop table foo postgres-# \d specifically note the prompt. the -# means you're in the middle of a command. =# means its ready for a new command. as another example... pierce=# create table foo (id integer); CREATE TABLE pierce=# drop pierce-# table pierce-# foo

Re: [GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread Rick Genter
After issuing the \d you are still in the middle of your command. Witness the following copy/paste of a terminal session: bash-3.2$ ./psql Password: psql (8.4.4) Type "help" for help. postgres=# create table foo (bar int); CREATE TABLE postgres=# drop table foo postgres-# \d List of relat

Re: [GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread Rich Shepard
On Tue, 28 Jun 2011, Rick Genter wrote: Silly question, but did you try it with a semicolon after the drop table? Rick, See my answer to Andy: that's incorrect syntax and psql complains. I've noticed that if you are in the middle of a statement and issue a \ command, psql ignores the SQL

Re: [GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread Rich Shepard
On Wed, 29 Jun 2011, Andy Firel wrote: it might be sufficient to add a semicolon to your drop statement: # drop table station_type; Andy, Actually, that's not true. On a whim I tried that and psql complained about a syntax error at the initial 'd'. Rich -- Sent via pgsql-general mailing l

Re: [GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread Andy Firel
Hi Rich, it might be sufficient to add a semicolon to your drop statement: # drop table station_type; HTH, Andy - Ursprüngliche Mail - > I cannot recall issuing a DROP TABLE command from psql that did not > work, > but seem to have this as a new experience. > > When I look at the datab

Re: [GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread Rick Genter
Silly question, but did you try it with a semicolon after the drop table? # drop table station_type; I've noticed that if you are in the middle of a statement and issue a \ command, psql ignores the SQL you've typed in and just does the \ command. On Tue, Jun 28, 2011 at 3:34 PM, Rich Shepard w

[GENERAL] DROP TABLE Appears to Fail

2011-06-28 Thread Rich Shepard
I cannot recall issuing a DROP TABLE command from psql that did not work, but seem to have this as a new experience. When I look at the database table list with '\d' I see public | station_type | table| rshepard public | station_type_statype_seq

Re: [GENERAL] drop table but file still exists

2009-05-15 Thread Simon Riggs
On Fri, 2009-05-15 at 09:09 +0200, Luca Ferrari wrote: > I'm just curious to know why after a drop table the disk file is emptied but > still existent. What is the reason why the file is not deleted immediately? To avoid various problems the files are removed after the next checkpoint. -- Si

Re: [GENERAL] drop table but file still exists

2009-05-15 Thread Tom Lane
Luca Ferrari writes: > I'm just curious to know why after a drop table the disk file is emptied but > still existent. What is the reason why the file is not deleted immediately? It's protecting against some obscure race condition involving reassignment of the relfilenode number to a new table.

[GENERAL] drop table but file still exists

2009-05-15 Thread Luca Ferrari
Hi, I'm just curious to know why after a drop table the disk file is emptied but still existent. What is the reason why the file is not deleted immediately? Thanks, Luca -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postg

Re: [GENERAL] drop table cascade doesn't drop manual sequences

2007-10-14 Thread Tom Lane
Andreas Kretschmer <[EMAIL PROTECTED]> writes: > Tom Lane <[EMAIL PROTECTED]> schrieb: >> In 8.2 and up you can use ALTER SEQUENCE ... OWNED BY ... to establish a >> link that will make a manually created sequence go away when its "owner" >> column is dropped. In 8.1 that aspect of SERIAL is hidde

Re: [GENERAL] drop table cascade doesn't drop manual sequences

2007-10-14 Thread Andreas Kretschmer
Tom Lane <[EMAIL PROTECTED]> schrieb: > "Scott Marlowe" <[EMAIL PROTECTED]> writes: > > On 10/10/07, Guilherme <[EMAIL PROTECTED]> wrote: > >> If I insert a sequence later on table creation with alter table, drop > >> table cascade simply doesn't drop this sequence even when I specify > >> CASCADE

Re: [GENERAL] drop table cascade doesn't drop manual sequences

2007-10-14 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > On 10/10/07, Guilherme <[EMAIL PROTECTED]> wrote: >> If I insert a sequence later on table creation with alter table, drop >> table cascade simply doesn't drop this sequence even when I specify >> CASCADE. > This is normal. In 8.2 and up you can use A

Re: [GENERAL] drop table cascade doesn't drop manual sequences

2007-10-14 Thread Scott Marlowe
On 10/10/07, Guilherme <[EMAIL PROTECTED]> wrote: > Hello folks, > > I'm new to postgres and I'm using version 8.1 > > Here's the problem anyway: > > If I insert a sequence later on table creation with alter table, drop > table cascade simply doesn't drop this sequence even when I specify > CASCADE

[GENERAL] drop table cascade doesn't drop manual sequences

2007-10-14 Thread Guilherme
Hello folks, I'm new to postgres and I'm using version 8.1 Here's the problem anyway: If I insert a sequence later on table creation with alter table, drop table cascade simply doesn't drop this sequence even when I specify CASCADE. works create table bla(id serial); drop

Re: [GENERAL] drop table if exists mytable;

2007-02-10 Thread Anton Melser
> I need to do a "drop table if exists" type thing. I realise I can Install 8.2 or use this function, posted by David Fetter: Thanks for your answers... so this really was something that was missing (I think it a little rich to come out with a "are you using a version without this" when it has

Re: [GENERAL] drop table if exists mytable;

2007-02-10 Thread Andreas Kretschmer
Anton Melser <[EMAIL PROTECTED]> schrieb: > Hi, > I need to do a "drop table if exists" type thing. I realise I can Install 8.2 or use this function, posted by David Fetter: -- -- posted by David Fetter -- CREATE OR REPLACE FUNCTION drop_table(TEXT) RETURNS VOID STRICT LANGUAGE plpgsql AS $$ BEG

Re: [GENERAL] drop table if exists mytable;

2007-02-10 Thread Gurjeet Singh
I am not sure if I understood the problem correctly!!! Can you not use the standard command "DROP TABLE IF EXISTS table1" that PG provides? http://www.postgresql.org/docs/8.2/interactive/sql-droptable.html Or is it that you are on a version of PG where "IF EXISTS" syntax is not available? Rega

[GENERAL] drop table if exists mytable;

2007-02-10 Thread Anton Melser
Hi, I need to do a "drop table if exists" type thing. I realise I can easily look in pg_tables, but for testing (if), don't I need to use a procedural language? In which case, I will need to install it if it doesn't exist - but I don't know how to test to see whether a language exists without usin

Re: [GENERAL] drop table before create

2005-08-27 Thread A. Kretschmer
am 26.08.2005, um 2:11:30 +0430 mailte Lee Harr folgendes: > >I have not been able to work out how to do this is Postgres 8 > >(pseudo-code) > > if exists table foo > > drop table foo; > > end > > create table foo; > >If I go with > > drop table foo; > > create table foo; > >then it barfs on

Re: [GENERAL] drop table before create

2005-08-25 Thread Lee Harr
I have not been able to work out how to do this is Postgres 8 (pseudo-code) if exists table foo drop table foo; end create table foo; If I go with drop table foo; create table foo; then it barfs on an empty db. The assumption here is that the SQL is coming in on a script via the

[GENERAL] drop table before create

2005-08-23 Thread Mark Probert
Hi .. I have not been able to work out how to do this is Postgres 8 (pseudo-code) if exists table foo drop table foo; end create table foo; If I go with drop table foo; create table foo; then it barfs on an empty db. I can find the table name in pg_class but I am not sure of where t

Re: [GENERAL] Drop table

2004-12-07 Thread Michael Fuhr
On Tue, Dec 07, 2004 at 01:20:07PM +0530, Nageshwar Rao wrote: > Not able to drop a table,though nobody is accessing the table.I am able to > insert the records and delete the records.When I give drop table it just > hangs there .No error message. Another transaction might be holding a lock on th

[GENERAL] Drop table

2004-12-06 Thread Nageshwar Rao
Title: Message Not able to drop a table,though nobody is accessing the table.I am able to insert the records and delete the records.When I give drop table it just hangs there .No error message. any specific reasons thx  

[GENERAL] DROP TABLE wildcard

2001-05-02 Thread Andy Koch
Is it possible to drop multiple tables with SQL on the system tables: I tried this: DROP TABLE from pg_tables where tablename LIKE 'table_num_%'; Which for whatever reason would delete 0 items despite it should have matched on several. Of course I'm not even sure pg_tables would be the smart