<html>
<head>
<title></title>
<meta content="MSHTML 6.00.2900.5764" name="GENERATOR"></meta>
</head>
<body>
<div>as said earlier it's really not that hard to add a colunm with the datatype serial wich means it will get a unique new value as default.</div>
<div>And if you have a textbased primary key or any other reason for not wanting to cunstruct a new primary key qgis will be satisfied with a unique value. So just do</div>
<div>alter table theTable add column uniqueID serial UNIQUE ;</div>
<div> </div>
<div>then you acn add and remove records without caring about your unique value-field</div>
<div> </div>
<div>Hope that helps</div>
<div> </div>
<div>Nicklas</div>
<div><br />
<br />
2009-05-08 Ben Madin wrote:<br />
<br />
Juan,<br />
><br />
>Agreed that this can be annoying (especially in light of some other <br />
>GIS packages which don't seem to care at all, or for instance <br />
>shapefiles.<br />
><br />
>I have had the same frustration when constructing geometries in a <br />
>query or for a view, or any type of aggregate query really. This is <br />
>also a problem for querymaps in MapServer.<br />
><br />
>The alternative I settled with was creating a false key - for instance <br />
>if the view was a makeline from points, making an id that was the gid <br />
>of the first * 100000 + the gid of the second.<br />
><br />
>That may help. It may not - but there are better minds than mine <br />
>hovering nearby, so I look forward to their suggestions.<br />
><br />
>cheers<br />
><br />
>Ben<br />
><br />
><br />
>On 08/05/2009, at 7:36 PM, Andreas Neumann wrote:<br />
><br />
>> hm - what's wrong with having a primary key in every table? Good DB- <br />
>> Design<br />
>> requires primary keys. Other tools will refuse to work with your <br />
>> data if<br />
>> you don't use primary keys as well. As an example, pgadmin3 requires a<br />
>> primary key if you want to edit the data in the grid view.<br />
>><br />
>> If you use the datatype "serial" or a sequence it is not complicated <br />
>> at<br />
>> all to use primary keys.<br />
>><br />
>> Andreas<br />
>><br />
>> On Fri, May 8, 2009 1:18 pm, Juan Pedro Pérez Alcántara wrote:<br />
>>> Hello,<br />
>>><br />
>>> perhaps this is a silly one, but I'm having a hard time dealing with<br />
>>> primary keys restrictions in Quantum GIS. Not always is possible or<br />
>>> desirable to put a, sometimes, artificial int4 PK in some tables <br />
>>> only to<br />
>>> be able to load them in QGIS. Those restrictions are very <br />
>>> frustrating.<br />
>>><br />
>>> I have been messing around for a solution, and I have experimented <br />
>>> with<br />
>>> OIDS. This seems to be enough for QGIS, but I fear the behavior of <br />
>>> OIDS.<br />
>>> I don't like the idea of non-controlled PK in my tables. So my <br />
>>> question<br />
>>> is simple: does creating a table WITH OIDS means that the OIDS will <br />
>>> be<br />
>>> part of the PK of the table like you it or not, or you have to <br />
>>> specify<br />
>>> that the OIDS are part of the PK in the ADD CONSTRAINT statement?<br />
>>><br />
>>> My hope is that PostgreSQL uses internally OIDS without interfering <br />
>>> with<br />
>>> the true PK of the table, while QGIS is happy by having them around.<br />
>>> OIDS will not play any role in my model other than that.<br />
>>><br />
>>> Greetings,<br />
>>><br />
>>> Juan Pedro Pérez Alcántara<br />
>>><br />
>>><br />
>>> _______________________________________________<br />
>>> postgis-users mailing list<br />
>>> postgis-users@postgis.refractions.net<br />
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users<br />
>>><br />
>><br />
>><br />
>> -- <br />
>> Andreas Neumann<br />
>> http://www.carto.net/neumann/<br />
>> http://www.svgopen.org/<br />
>><br />
>> _______________________________________________<br />
>> postgis-users mailing list<br />
>> postgis-users@postgis.refractions.net<br />
>> http://postgis.refractions.net/mailman/listinfo/postgis-users<br />
><br />
>-- <br />
><br />
>Ben Madin<br />
>REMOTE INFORMATION<br />
><br />
>t : +61 8 9192 5455<br />
>f : +61 8 9192 5535<br />
>m : 0448 887 220<br />
>Broome WA 6725<br />
><br />
>ben@remoteinformation.com.au<br />
><br />
><br />
><br />
> Out here, it pays to know...<br />
><br />
><br />
>_______________________________________________<br />
>postgis-users mailing list<br />
>postgis-users@postgis.refractions.net<br />
>http://postgis.refractions.net/mailman/listinfo/postgis-users<br />
><br />
></div>
</body>
</html>