SVN Commit by andreas: r4857 - in trunk/pgadmin3: . src/frm
SVN Commit by andreas: r4857 - in trunk/pgadmin3: . src/frm
От:
svn@pgadmin.org
Дата:
Author: andreas Date: 2005-12-26 14:39:11 +0000 (Mon, 26 Dec 2005) New Revision: 4857 Modified: trunk/pgadmin3/CHANGELOG.txt trunk/pgadmin3/src/frm/frmEditGrid.cpp Log: Fix PK detection in EditGrid Modified: trunk/pgadmin3/CHANGELOG.txt =================================================================== --- trunk/pgadmin3/CHANGELOG.txt 2005-12-26 12:33:57 UTC (rev 4856) +++ trunk/pgadmin3/CHANGELOG.txt 2005-12-26 14:39:11 UTC (rev 4857) @@ -18,6 +18,7 @@
-
+
- 2005-12-26 AP 1.4.2 Fix PK detection in EditGrid [Andrus Moor]
- 2005-12-26 AP 1.4.2 Fix Bitmap Index explain [Alexander Kirpa]
- 2005-12-23 DP 1.4.2 Use ELSIF not ELSEIF in pgagent.sql for compatibility with 7.x servers [Glen Sasek]
- 2005-12-22 HS dlgLanguage name+comment, dlgDatabase comment Modified: trunk/pgadmin3/src/frm/frmEditGrid.cpp =================================================================== --- trunk/pgadmin3/src/frm/frmEditGrid.cpp 2005-12-26 12:33:57 UTC (rev 4856) +++ trunk/pgadmin3/src/frm/frmEditGrid.cpp 2005-12-26 14:39:11 UTC (rev 4857) @@ -1158,7 +1158,7 @@ pgSet *colSet=connection->ExecuteSet( wxT("SELECT n.nspname AS nspname, relname, t.typname, nt.nspname AS typnspname, ") - wxT("attname, COALESCE(b.oid, t.oid) AS basetype, atthasdef, adsrc,\n") + wxT("attname, attnum, COALESCE(b.oid, t.oid) AS basetype, atthasdef, adsrc,\n") wxT(" CASE WHEN t.typbasetype::oid=0 THEN att.atttypmod else t.typtypmod END AS typmod,\n") wxT(" CASE WHEN t.typbasetype::oid=0 THEN att.attlen else t.typlen END AS typlen\n") wxT(" FROM pg_attribute att\n") @@ -1279,23 +1279,20 @@ if (!columns[i].attr->IsReadOnly()) canInsert=true; - colSet->MoveNext(); - } - delete colSet; - - if (!hasOids) - { wxStringTokenizer collist(primaryKeyColNumbers, wxT(",")); - long cn; - int pkcolcount=0; + long cn=0; + long attnum=colSet->GetLong(wxT("attnum")); - while (collist.HasMoreTokens()) + while (cn < attnum && collist.HasMoreTokens()) { - pkcolcount++; cn=StrToLong(collist.GetNextToken()); - columns[cn-1].isPrimaryKey = true; + if (cn == attnum) + columns[i].isPrimaryKey = true; } + + colSet->MoveNext(); } + delete colSet; } else {