You are here: Re: No phpPgAdmin delete or edit links when browsing « PHP Programming Language « IT news, forums, messages
Re: No phpPgAdmin delete or edit links when browsing

Posted by Dan99 on 01/24/08 14:06

On Jan 23, 3:07 pm, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
> Dan99 wrote:
> > So my postgre got upgraded from 7.4 to 8.1 and my phpPgAdmin also got
> > upgraded. Now though, I am only able to use the edit/delete buttons on
> > some of the tables when browsing.
>
> When you want to update or delete a row, phpPgAdmin needs to be able to
> unambiguously identify it using a primary key. I'm guessing that the
> tables which don't have edit/delete buttons are those tables without a
> primary key.
>
> PostgreSQL 7.x had a feature called OIDs enabled by default. OIDs (Object
> Identifiers) are a number which uniquely identify every row in your
> database. OIDs are able to act as a default primary key when no other
> unique column exists.
>
> In PostgreSQL 8.x, OIDs are disabled by default. They can be enabled by
> setting default_with_oids=on in postgresql.conf (however, this won't
> affect existing tables -- just new ones you create), or by adding "WITH
> OIDS" to your CREATE TABLE statement.
>
> The solution is to make sure that all your tables have a primary key
> designated. Luckily, you can designate a primary key without having to re-
> create that table from scratch. You need to make sure that there is a
> column or combination of columns which is per-row unique. For example in a
> table of books, the book's ISBN number might make a good primary key. And
> for a table keeping a tally of votes in a poll, and only allowing one vote
> per poll per person, then the combination of user-id and poll-id would
> work.
>
> Then just:
>
> ALTER TABLE my_books
> ADD PRIMARY KEY (isbn);
>
> ALTER TABLE my_poll_results
> ADD PRIMARY KEY (userid, pollid);
>
> --
> Toby A Inkster BSc (Hons) ARCS
> [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
> [OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 24 days, 7:02.]
>
> CSS to HTML Compiler
> http://tobyinkster.co.uk/blog/2008/01/22/css-compile/

Would it be enough to do something like
SELECT * INTO table2 FROM table WITH OIDS
so as to duplicate the table this time using OIDS, the reason why I
ask this is because a lot of the tables do not have a single unique
identifying tag (one of the downfalls of the system I inherited from
previous webmasters) In other words I am looking for a way to enable
OIDS on existing tables or to recreate the tables exactly with OIDS

Thanks,
Daniel

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация