Re: Upgrade from v8rc5 to 8.0.0 fails

Lists: pgsql-novice
From: "Keith Worthington" <keithw(at)narrowpathinc(dot)com>
To: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Upgrade from v8rc5 to 8.0.0 fails
Date: 2005-01-21 22:50:40
Message-ID: 20050121225040.M87791@narrowpathinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi All,

We are chasing a few problems around and I thought it would be a good idea to
move to the offical release prior to chaing our tails.

The download, build and check all went well. However, when I execute a gmake
install I got lots of errors saying "Cannot open: File exists" That doesn't
shock me since I am upgrading but what is the proper way to perform the
install when upgrading?

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Keith Worthington <keithw(at)narrowpathinc(dot)com>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Upgrade from v8rc5 to 8.0.0 fails
Date: 2005-01-22 02:36:07
Message-ID: 20050122023607.GA60540@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Fri, Jan 21, 2005 at 05:50:40PM -0500, Keith Worthington wrote:

> The download, build and check all went well. However, when I execute a gmake
> install I got lots of errors saying "Cannot open: File exists"

What are the exact errors? Post just a few to start with; we might
not need to see all of them.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: Keith Worthington <KeithW(at)NarrowPathInc(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Upgrade from v8rc5 to 8.0.0 fails
Date: 2005-01-23 00:31:38
Message-ID: 41F2F06A.4090107@NarrowPathInc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Michael Fuhr wrote:

>On Fri, Jan 21, 2005 at 05:50:40PM -0500, Keith Worthington wrote:
>
>
>
>>The download, build and check all went well. However, when I execute a gmake
>>install I got lots of errors saying "Cannot open: File exists"
>>
>>
>
>What are the exact errors? Post just a few to start with; we might
>not need to see all of them.
>
>
Michael,

Thanks for the reply. I have reviewed all of the errors and found that
I made a mistake. After I compiled the code I switched to the user
postgres to run the check. After the check was successful I FORGOT to
exit to the root account to install the software. Once I found that the
install went fine.

--
Kind Regards,
Keith


From: Afton & Ray Still <rastill(at)shaw(dot)ca>
To: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: find column names from query
Date: 2005-01-24 06:46:15
Message-ID: 008201c501e0$66f1c570$7c884146@rayshome
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hello,
I'm trying to find a way to get the column names of a table, knowing only the table name. (I'm trying to display the contents of various hidden support tables to the DB administrator)

here's what's happening:
user picks a table name from a select list (HTML),
a SELECT * FROM selected_table ... query is sent (PHP)
nested for loops print out the table data (PHP and HTML)
works great to here, although I realize I'm cheating a little.
problem is the data has no column labels.

going through the documentation I found the following:

SELECT attname::regclass FROM pg_attribute WHERE attrelid = travel::regclass

I'm trying to get the attname, which should be the column name, from the pg_attribute "table"(or catalog?) when attrelid, which should be the table name, which I have.

trying this query in PgadminIII I get:
ERROR: cannot cast type name to regclass

I could go through and hardcode the table data into the application, but I'd prefer not to.

Any suggestions to make this work, or for better methods appreciated.
Ray

Attachment Content-Type Size
unknown_filename text/plain 137 bytes

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Afton & Ray Still <rastill(at)shaw(dot)ca>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: find column names from query
Date: 2005-01-24 08:42:41
Message-ID: 20050124084241.GA40343@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Sun, Jan 23, 2005 at 11:46:15PM -0700, Afton & Ray Still wrote:

> going through the documentation I found the following:
>
> SELECT attname::regclass FROM pg_attribute WHERE attrelid = travel::regclass

Are you sure the example looked like that? attname is a name type
and shouldn't be cast to regclass, and "travel" should be in single
quotes if it's a table name. Try this:

SELECT attname FROM pg_attribute WHERE attrelid = 'travel'::regclass;

Here's something a little more useful:

SELECT attname
FROM pg_attribute
WHERE attrelid = 'travel'::regclass
AND attisdropped IS FALSE
AND attnum >= 1
ORDER BY attnum;

If you're using PostgreSQL 7.4 or later then you could also use the
Information Schema; see the documentation for details.

SELECT column_name
FROM information_schema.columns
WHERE table_name = 'travel'
ORDER BY ordinal_position;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: "Tjibbe Rijpma" <t(dot)b(dot)rijpma(at)student(dot)tudelft(dot)nl>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: find column names from query
Date: 2005-01-24 08:55:13
Message-ID: 001701c501f2$6b65bc30$0100a8c0@TJIBBE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I have the same kind of problem in PLpgsql.

But a solution for your problem in PHP can be the functions:

$int_colums = pg_num_fields($result);

for ( $col = 0; $col < $int_colums; $col++ ) {
$field_name = pg_field_name( $this->str_pg_result, $col);
echo '<td>' . $field_name . '</td>' ;
}
----- Original Message -----
From: Afton & Ray Still
To: PostgreSQL Novice
Sent: Monday, January 24, 2005 7:46
Subject: [NOVICE] find column names from query

Hello,
I'm trying to find a way to get the column names of a table, knowing only the table name. (I'm trying to display the contents of various hidden support tables to the DB administrator)

here's what's happening:
user picks a table name from a select list (HTML),
a SELECT * FROM selected_table ... query is sent (PHP)
nested for loops print out the table data (PHP and HTML)
works great to here, although I realize I'm cheating a little.
problem is the data has no column labels.

going through the documentation I found the following:

SELECT attname::regclass FROM pg_attribute WHERE attrelid = travel::regclass

I'm trying to get the attname, which should be the column name, from the pg_attribute "table"(or catalog?) when attrelid, which should be the table name, which I have.

trying this query in PgadminIII I get:
ERROR: cannot cast type name to regclass

I could go through and hardcode the table data into the application, but I'd prefer not to.

Any suggestions to make this work, or for better methods appreciated.
Ray

------------------------------------------------------------------------------

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 1/19/2005

------------------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly


From: Afton & Ray Still <rastill(at)shaw(dot)ca>
To: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: find column names from query
Date: 2005-01-24 14:12:25
Message-ID: 00ad01c5021e$bac19390$7c884146@rayshome
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


----- Original Message -----
From: "Michael Fuhr" <mike(at)fuhr(dot)org>
To: "Afton & Ray Still" <rastill(at)shaw(dot)ca>
Cc: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Sent: Monday, January 24, 2005 1:42 AM
Subject: Re: [NOVICE] find column names from query

> On Sun, Jan 23, 2005 at 11:46:15PM -0700, Afton & Ray Still wrote:
>
>> going through the documentation I found the following:
>>
>> SELECT attname::regclass FROM pg_attribute WHERE attrelid =
>> travel::regclass
>
> Are you sure the example looked like that?

The original example was:
SELECT attrelid::regclass, array_accum(attname)
FROM pg_attribute
WHERE attnum > 0 AND attrelid = 'pg_user'::regclass
GROUP BY attrelid;but (copied from above) I cut it down toSELECT
attname::regclass FROM pg_attribute WHERE attrelid = travel::regclass (oops,
missed the ''. I also used a different table name.as found
at:http://www.postgresql.org/docs/8.0/interactive/xaggr.html

> attname is a name type
> and shouldn't be cast to regclass, and "travel" should be in single
> quotes if it's a table name. Try this:
>
> SELECT attname FROM pg_attribute WHERE attrelid = 'travel'::regclass;
>
> Here's something a little more useful:
>
> SELECT attname
> FROM pg_attribute
> WHERE attrelid = 'travel'::regclass
> AND attisdropped IS FALSE
> AND attnum >= 1
> ORDER BY attnum;
>
> If you're using PostgreSQL 7.4 or later then you could also use the
> Information Schema; see the documentation for details.
>
> SELECT column_name
> FROM information_schema.columns
> WHERE table_name = 'travel'
> ORDER BY ordinal_position;
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 1/19/2005
>

Ray

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 1/19/2005


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Afton & Ray Still <rastill(at)shaw(dot)ca>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: find column names from query
Date: 2005-01-24 15:47:17
Message-ID: 20050124154717.GA43578@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Mon, Jan 24, 2005 at 07:12:25AM -0700, Afton & Ray Still wrote:
> >
> > Are you sure the example looked like that?
>
> The original example was:
> SELECT attrelid::regclass, array_accum(attname)
> FROM pg_attribute
> WHERE attnum > 0 AND attrelid = 'pg_user'::regclass
> GROUP BY attrelid;but (copied from above) I cut it down toSELECT
> attname::regclass FROM pg_attribute WHERE attrelid = travel::regclass
> (oops, missed the ''. I also used a different table name.as found
> at:http://www.postgresql.org/docs/8.0/interactive/xaggr.html

Notice that the original has attrelid::regclass but you changed it
to attname::regclass -- that change caused the "cannot cast type
name to regclass" error that you originally reported. See the
"Object Identifier Types" section in the "Data Types" chapter of
the documentation for more info about regclass, and the "pg_attribute"
section in the "System Catalogs" chapter for more info about the
columns in that table.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: Afton & Ray Still <rastill(at)shaw(dot)ca>
To: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: find column names from query
Date: 2005-01-24 15:59:43
Message-ID: 00e501c5022d$b84af070$7c884146@rayshome
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

It's working now.
Thanks all for your help and explanations.
Ray

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 1/19/2005