Received: from mail.bungeecode.com (aniyogi-5.mylinuxisp.com [216.39.203.94]) by postgresql.org (Postfix) with ESMTP id 36C8F474E4E for ; Fri, 26 Apr 2002 18:05:19 -0400 (EDT) Received: from cs666899-134.austin.rr.com ([66.68.99.134] helo=bungeecode.com) by mail.bungeecode.com with esmtp (Exim 3.33 #1) id 171Drh-0004Gb-00; Fri, 26 Apr 2002 17:06:53 -0500 Message-ID: <3CC9CF26.2090004@bungeecode.com> Date: Fri, 26 Apr 2002 17:05:26 -0500 From: Surojit Niyogi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9+) Gecko/20020424 X-Accept-Language: en-us, en MIME-Version: 1.0 To: angelo.rigo@globo.com Cc: pgsql-php@postgresql.org Subject: Re: id field error References: <3CC7A89800004414@nplex.globo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Archive-Number: 200204/95 X-Sequence-Number: 1119 You can either use the datatype "SERIAL" or if you have a way of generating unique IDs based off of microtimes, you can get away with putting a unique value into field "id" as it is right now. Roj Niyogi pgHoster PostgreSQL web hosting angelo.rigo@globo.com wrote: >Hi ! >I“m doing my first publishing system for a last aquired boooks for a library. > >the problem begin in the id field, wich i choose to be primary key and unique. >i could just insert data one time the others give me this error: > > Cannot insert a duplicate key into unique index biblioteca_pkey > >i use this piece of code below to insert the data: > >$query = "INSERT INTO biblioteca (id, autor, titulo, editora) values ('$id', >'$autor', '$titulo', '$editora')"; >$result = pg_exec($db, $query); > >may i can alter the id collumn and the query to insert the data anybody >knows what exactly to do ? > >Thank“s > >Āngelo > > > > >________________________________________ >A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br. > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > > > >