You don't need to supply a value for the sequence in the insert. Postgres
will take care of that if the table is set up correctly with one column as
SERIAL type. Can you show the table creation code? Or, if you can access the
database through a terminal in psql, show the output of:

\d supplier_master

You should only override the default sequence name for Postgres in Cake if
you created and named it yourself when you created the table, rather than
use the default name given when declaring a column of type SERIAL. Given
your table and column name, it will, in fact be called
supplier_master_id_seq. If your model doesn't reflect the actual sequence
name you're sure to have problems.

Did you create the DB schema with Cake?

One other thing, though: Cake expects table names to be pluralised
(supplier_masters or, if this is a join table, masters_suppliers).

On Tue, Nov 25, 2008 at 5:35 AM, ReFeeL <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I read from many posts about cakephp and postgresql sequence.  Most of
> them seems implying that the sequence will be used automatically.  One
> can override the default sequence name by declaring var $sequence =
> "new_sequence"; in the model class.
>
> However, I'm using postgres 8.3 with the latest cakephp rc3.  I got
> error null value in column "id".  As I've check the query shown on the
> page, I found that the code try to insert without calling sequence.
> It expects the server will generate id automatically.
>
> I've also try to remove the cache, regenerating model, etc. but still
> not work.  I'm quite new to postgresql.  The table is look simple.
>
> table name : supplier_master
> field : id=integer, supplier_name=charvarying.
>
> sequence name : supplier_master_id_seq
>
> Can anybody give me a clue?
>
>
> Thanks in Advance
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to