Обсуждение: Upgrade from v8rc5 to 8.0.0 fails

Поиск
Список
Период
Сортировка

Upgrade from v8rc5 to 8.0.0 fails

От
"Keith Worthington"
Дата:
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


Re: Upgrade from v8rc5 to 8.0.0 fails

От
Michael Fuhr
Дата:
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/

Re: Upgrade from v8rc5 to 8.0.0 fails

От
Keith Worthington
Дата:
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

find column names from query

От
Afton & Ray Still
Дата:
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

Re: find column names from query

От
Michael Fuhr
Дата:
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/

Re: find column names from query

От
"Tjibbe Rijpma"
Дата:
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 -----
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@postgresql.org so that your
      message can get through to the mailing list cleanly

Re: find column names from query

От
Afton & Ray Still
Дата:
----- Original Message -----
From: "Michael Fuhr" <mike@fuhr.org>
To: "Afton & Ray Still" <rastill@shaw.ca>
Cc: "PostgreSQL Novice" <pgsql-novice@postgresql.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


Re: find column names from query

От
Michael Fuhr
Дата:
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/

Re: find column names from query

От
Afton & Ray Still
Дата:
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