Thread: Two novice questions

Two novice questions

From
Jonathan Chum
Date:
I have two problems. One, I would like to know how to remove a database. It
would always keep saying this:

PostgreSQL said: ERROR: DROP DATABASE: Database "blazeboard" is being
accessed by other users

I'm sure no one else is accessing it because I'm the only one who knows
that the database exists and ps doesn't show any other users connecting to it.

My second question is that I have created a table with a column, FID.
However, when I SELECT FID FROM table, it will result:

blazeboard=# SELECT FID FROM forum;
ERROR:  Attribute 'fid' not found

Could this be a bug? I'm using v7.03 if it matters. Thanks, and please
reply also to my email if you do reply.


Re: Two novice questions

From
Mike Castle
Date:
On Sun, Jan 14, 2001 at 03:40:56AM -0500, Jonathan Chum wrote:
> PostgreSQL said: ERROR: DROP DATABASE: Database "blazeboard" is being
> accessed by other users
>
> I'm sure no one else is accessing it because I'm the only one who knows
> that the database exists and ps doesn't show any other users connecting to it.

1)  Try using the dropdb script if you're not.
2)  Connect to the database template1 and then do the drop, not to the
database you're trying to connect to (that's what the drobdb script does).
--
       Mike Castle       Life is like a clock:  You can work constantly
  dalgoda@ix.netcom.com  and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

Re: Two novice questions

From
Tom Lane
Date:
Jonathan Chum <jchum@techdevelopers.com> writes:
> PostgreSQL said: ERROR: DROP DATABASE: Database "blazeboard" is being
> accessed by other users

It's difficult to see how you could get this error unless there is at
least one backend connected to the target database.  Check for
background processes you've forgotten about, etc etc.

> My second question is that I have created a table with a column, FID.
> However, when I SELECT FID FROM table, it will result:

> blazeboard=# SELECT FID FROM forum;
> ERROR:  Attribute 'fid' not found

What does "\d forum" show as the column name?

If you created the table along the lines of
    create table forum ("FID" int, ...);
then all subsequent references to that column name will have to be
double-quoted as well.  Unquoted names are implicitly folded to lower
case ... quoted ones are not.

            regards, tom lane

Re: Two novice questions

From
Jonathan Chum
Date:
Thank you. I figured it out. However I still cannot drop the database, so
each time I want to start fresh/clean, I have to delete the tables and
sequences and then recreate the tables and sequences.

At 09:18 PM 1/14/2001 -0500, Tom Lane wrote:
>Jonathan Chum <jchum@techdevelopers.com> writes:
> > PostgreSQL said: ERROR: DROP DATABASE: Database "blazeboard" is being
> > accessed by other users
>
>It's difficult to see how you could get this error unless there is at
>least one backend connected to the target database.  Check for
>background processes you've forgotten about, etc etc.
>
> > My second question is that I have created a table with a column, FID.
> > However, when I SELECT FID FROM table, it will result:
>
> > blazeboard=# SELECT FID FROM forum;
> > ERROR:  Attribute 'fid' not found
>
>What does "\d forum" show as the column name?
>
>If you created the table along the lines of
>         create table forum ("FID" int, ...);
>then all subsequent references to that column name will have to be
>double-quoted as well.  Unquoted names are implicitly folded to lower
>case ... quoted ones are not.
>
>                         regards, tom lane


Where docs on transactions?

From
Francisco Reyes
Date:
Started looking at the tutorial and user documentation today. I did not
see however any documentation on transactions. Did I miss it?



Re: Two novice questions

From
"Anthony E . Greene"
Date:
On Sun, 14 Jan 2001 03:40:56 Jonathan Chum wrote:
>I have two problems. One, I would like to know how to remove a database. It

Use "destroydb databasename" at a shell command line.

>My second question is that I have created a table with a column, FID.
>However, when I SELECT FID FROM table, it will result:

Column names should always be lowercase or quoted:

  SELECT "FID" FROM forum;  (if the column name is "FID" -- unlikely)
or
  SELECT fid FROM forum;    (if the column name is "fid")

Tony
--
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>