2010年12月16日星期四

[fw-mvc] Re: Table query error: the pk exists but query errors...

UPDATE: very sorry! I WAS using the wrong database! Eeesh, I need to
look more carefully next time. Apologies to anyone who looked at this
for me!

--regards,
nathan

On Thu, Dec 16, 2010 at 12:33 PM, Nathan Garlington <garlinto@gmail.com> wrote:
> I was wondering if any of you have encountered an error similar to the
> one I have been experiencing. I am using ZF-1.11.1 and the pdo_pgsql
> driver to connect to a postgresql-9.0.1 database.
> The error:
>
> "Primary key column(s) (author_id) are not columns in this table ()"
>
> I have checked to make sure that I am on the right database. The table
> is the 'authors' table and looks like this:
>
> CREATE TABLE authors (
>    author_id integer NOT NULL,
>    display_name text NOT NULL,
>    name text NOT NULL
> );
>
> CREATE SEQUENCE authors_author_id_seq
>    START WITH 1
>    INCREMENT BY 1
>    NO MINVALUE
>    NO MAXVALUE
>    CACHE 1;
>
> ALTER TABLE ONLY authors
>    ADD CONSTRAINT authors_pkey PRIMARY KEY (author_id);
>
> The permissions have been setup correctly. I don't understand why the
> $this->_table->fetchAll(); errors out on this. I can manually run the
> SQL from the command line against the table successfully:
>
>     'select authors.* from public.authors;'
>
> And no problems, lists all 4 tuples from the table. Is there something
> wrong with the way I am trying to run the "fetchAll" method? I have
> this same problem on a categories table as well. Very confounding.
>
> --regards,
> nathan
>

没有评论: