Re: [pgadmin-hackers] pgAdmin III commit: Database Designer (milestone 1 of GSoC 2011)
On Sat, Jul 2, 2011 at 2:09 PM, Guillaume Lelarge wrote: > On Thu, 2011-06-30 at 09:32 +0100, Dave Page wrote: >> On Thu, Jun 30, 2011 at 9:08 AM, Guillaume Lelarge >> wrote: >> > >> > Could be the next thing I do. Last time we talked about it, I had done >> > some work on sphynx. IIRC, I had two main things to do: >> > >> > * try to build on Windows, and Mac >> > * change the build chain so that it buils automatically the manual >> > >> > Did I forgot something? >> >> No, I think that's it. >> > > OK, I've done some work on this. > > Linux prep steps > > * install Python (with your distro package manager) > * install the python easy_install module > * install Sphinx (should be as easy as "easy_install -U Sphinx) > > Windows prop steps > > * download http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi > * install python-2.7.2.msi > * download > http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe#md5=57e1e64f6b7c7f1d2eddfc9746bbaf20 > * install setuptools-0.6c11.win32-py2.7.exe > * include C:\Python27\Scripts in %path% > * in cmd, type "easy_install.exe -U Sphinx" > > Mac OS X prep steps > > I already had Python and the easy_install module, so I just had to > install Sphinx with the usual command ("easy_install -U Sphinx") > > Windows Visual Studio project changes > > It should be quite simple. We simply need to change the Docs project so > that it launches the "make html" command instead of the "builddocs.bat". > We'll also have to add all the rst files in this project. > > Linux, and Mac OS X Makefile > > This should also be quite simple. We only need to change the Makefile so > that it calls the Make in the docs directory. > > If it seems good enough for you, I'll update the rst filess with the new > changes. I'll update the build system. And creates one big patch for all > of this. OK? OK. > The remaining question is: what style do we want? do we keep the default > theme? should we code one? any idea on what that should be? If we code one, it should probably roughly follow the websites style. Speaking of which, we'd need to figure out how we'd automate the publishing of the docs on the website -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
[pgadmin-hackers] pgAdmin III commit: New maintenance action: CLUSTER
New maintenance action: CLUSTER Available for databases, tables, indexes, and some constraints. Branch -- master Details --- http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=b40e8f9f1cda5aaffc40f85a93d7fe85b80e8ec4 Author: Thom Brown Modified Files -- CHANGELOG |2 +- pgadmin/frm/frmMaintenance.cpp | 35 ++- pgadmin/ui/frmMaintenance.xrc |1 + pgadmin/ui/xrcDialogs.cpp | 871 4 files changed, 650 insertions(+), 259 deletions(-) -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
Re: [pgadmin-hackers] pgAdmin III commit: Update CHANGELOG and make style.
On Sun, 2011-07-03 at 01:00 +0100, Thom Brown wrote: > On 2 July 2011 23:17, Guillaume Lelarge wrote: > > Update CHANGELOG and make style. > > > > Branch > > -- > > master > > > > Details > > --- > > http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=ac158b076d598748d8d9bac4afc1ae028b05d28a > > > > Modified Files > > -- > > CHANGELOG |5 - > > .../dditems/utilities/ddPrecisionScaleDialog.cpp |2 +- > > pgadmin/dd/dditems/utilities/ddTableNameDialog.cpp |4 ++-- > > .../dd/dditems/utilities/ddPrecisionScaleDialog.h |2 +- > > .../dd/dditems/utilities/ddTableNameDialog.h |2 +- > > 5 files changed, 9 insertions(+), 6 deletions(-) > > You appear to have added an entry for the fill factor patch twice. > Yeah, it's now fixed. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
Re: [pgadmin-hackers] [FEATURE] OIDs check box to enable OIDs
On 2 July 2011 21:26, Thom Brown wrote: > On 2 July 2011 20:20, Guillaume Lelarge wrote: >> Great patch. It even helped me find a bug. Anyway, commited and pushed. >> Thank you. > > Thanks for committing it. :) > >>> I personally prefer the ones with newlines, especially since I've been >>> experimenting with tables having very long names, and some of the >>> above statements require lots of horizontal scrolling on the SQL tab >>> to see what the action will be. Could we harmonise these? >> >> Yes, we should. Could you provide a patch? > > Sure, I'll take a look at it. Okay, patch attached to wrap lines at various places. -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company diff --git a/pgadmin/dlg/dlgCheck.cpp b/pgadmin/dlg/dlgCheck.cpp index 268b571..c388ef9 100644 --- a/pgadmin/dlg/dlgCheck.cpp +++ b/pgadmin/dlg/dlgCheck.cpp @@ -109,9 +109,9 @@ wxString dlgCheck::GetSql() if (!check) { sql = wxT("ALTER TABLE ") + table->GetQuotedFullIdentifier() - + wxT(" ADD"); + + wxT("\n ADD"); AppendIfFilled(sql, wxT(" CONSTRAINT "), qtIdent(name)); - sql += wxT(" CHECK ") + GetDefinition() + sql += wxT("\n CHECK ") + GetDefinition() + wxT(";\n"); } if (!name.IsEmpty()) diff --git a/pgadmin/dlg/dlgDatabase.cpp b/pgadmin/dlg/dlgDatabase.cpp index 54db208..195ea55 100644 --- a/pgadmin/dlg/dlgDatabase.cpp +++ b/pgadmin/dlg/dlgDatabase.cpp @@ -673,7 +673,7 @@ wxString dlgDatabase::GetSql() if (cbTablespace->GetCurrentSelection() > 0 && cbTablespace->GetOIDKey() > 0 && cbTablespace->GetOIDKey() != database->GetTablespaceOid()) sql += wxT("ALTER DATABASE ") + qtIdent(name) - + wxT(" SET TABLESPACE ") + qtIdent(cbTablespace->GetValue()) + + wxT("\n SET TABLESPACE ") + qtIdent(cbTablespace->GetValue()) + wxT(";\n"); } if (connection->BackendMinimumVersion(8, 1)) @@ -690,7 +690,7 @@ wxString dlgDatabase::GetSql() wxString strConnLimit; strConnLimit << connLimit; sql += wxT("ALTER DATABASE ") + qtIdent(name) - + wxT(" WITH CONNECTION LIMIT = ") + + wxT("\n WITH CONNECTION LIMIT = ") + strConnLimit + wxT(";\n"); } @@ -749,9 +749,9 @@ wxString dlgDatabase::GetSql() sql += wxT("ALTER ROLE ") + newUsr + wxT(" IN DATABASE ") + qtIdent(name); if (newVar != wxT("search_path") && newVar != wxT("temp_tablespaces")) - sql += wxT(" SET ") + newVar + wxT("='") + newVal + wxT("';\n"); + sql += wxT("\n SET ") + newVar + wxT("='") + newVal + wxT("';\n"); else - sql += wxT(" SET ") + newVar + wxT("=") + newVal + wxT(";\n"); + sql += wxT("\n SET ") + newVar + wxT("=") + newVal + wxT(";\n"); } } @@ -769,13 +769,13 @@ wxString dlgDatabase::GetSql() if (username.Length() == 0) { sql += wxT("ALTER DATABASE ") + qtIdent(name) - + wxT(" RESET ") + varname + + wxT("\n RESET ") + varname + wxT(";\n"); } else { sql += wxT("ALTER ROLE ") + username + wxT(" IN DATABASE ") + qtIdent(name) - + wxT(" RESET ") + varname + wxT(";\n"); + + wxT("\n RESET ") + varname + wxT(";\n"); } } @@ -845,9 +845,9 @@ wxString dlgDatabase::GetSql2() sql += wxT("ALTER ROLE ") + newUsr + wxT(" IN DATABASE ") + qtIdent(name); if (newVar != wxT("search_path") && newVar != wxT("temp_tablespaces")) -sql += wxT(" SET ") + newVar + wxT("='") + newVal + wxT("';\n"); +sql += wxT("\n SET ") + newVar + wxT("='") + newVal + wxT("';\n"); else -sql += wxT(" SET ") + newVar + wxT("=") + newVal + wxT(";\n"); +sql += wxT("\n SET ") + newVar + wxT("=") + newVal + wxT(";\n"); } } diff --git a/pgadmin/dlg/dlgDomain.cpp b/pgadmin/dlg/dlgDomain.cpp index 1538018..94150a1 100644 --- a/pgadmin/dlg/dlgDomain.cpp +++ b/pgadmin/dlg/dlgDomain.cpp @@ -199,17 +199,17 @@ wxString dlgDomain::GetSql() { sql += wxT("ALTER DOMAIN ") + domain->GetQuotedFullIdentifier(); if (chkNotNull->GetValue()) -sql += wxT(" SET NOT NULL;\n"); +sql += wxT("\n SET NOT NULL;\n"); else -sql += wxT(" DROP NOT NULL;\n"); +sql += wxT("\n DROP NOT NULL;\n"); } if (txtDefault->GetValue() != domain->GetDefault()) { sql += wxT("ALTER DOMAIN ") + domain->GetQuotedFullIdentifier(); if (txtDefault->GetValue().IsEmpty()) -sql += wxT(" DROP DEFAULT;\n"); +sql += wxT("\n DROP DEFAULT;\n"); else -sql += wxT(" SET DEFAULT ") + txtDefault->GetValue() + wxT(";\n"); +sql += wxT("\n SET DEFAULT ") + txtDefault->GetValue() + wxT(";\n"); } AppendOwnerChange(sql, wxT("DOMAIN ") + domain->GetQuotedFullIdentifier()); } diff --git a/pgadmin/dlg/dlgExtension.cpp b/pgadmin/dlg/dlgExtension.cpp index 2dc5191..3beeb0f 100644 --- a/pgadmin/dlg/dlgExtension.cpp +++ b/pgadmin/dlg/dlgExtension.cpp @@ -182,10 +
[pgadmin-hackers] [BUG] Index operator class + collation = bad SQL
Hi, I noticed that when using PostgreSQL 9.1 and PgAdmin III 1.14 beta 2, the operator class, sort order and whether nulls are first or last appears before collation on a column when showing the index definition in the SQL pane, but this is invalid syntax. Test case: CREATE TABLE dictionary (word text); CREATE INDEX idx_test ON dictionary USING btree (word COLLATE pg_catalog."zh_CN.utf8" text_pattern_ops DESC NULLS LAST); Look at the SQL pane for that index and it will produce the following invalid syntax: CREATE INDEX idx_test ON dictionary USING btree (word text_pattern_ops DESC NULLS LAST COLLATE pg_catalog."zh_CN.utf8"); Attached a patch to fix. -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company diff --git a/pgadmin/schema/pgIndex.cpp b/pgadmin/schema/pgIndex.cpp index c770242..1c02b26 100644 --- a/pgadmin/schema/pgIndex.cpp +++ b/pgadmin/schema/pgIndex.cpp @@ -188,7 +188,7 @@ void pgIndexBase::ReadColumnDetails() quotedColumns += wxT(", "); } -wxString options, coldef; +wxString options, coldef, opcname; if (GetConnection()->BackendMinimumVersion(8, 3)) options = wxT(" i.indoption[") + NumToStr((long)(i - 1)) + wxT("] AS options,\n"); @@ -198,12 +198,9 @@ void pgIndexBase::ReadColumnDetails() if (GetConnection()->BackendMinimumVersion(9, 0)) { query = wxT("SELECT\n") + options + - wxT(" CASE WHEN (o.opcdefault = FALSE) THEN\n") - wxT("pg_get_indexdef(i.indexrelid, ") + NumToStr(i) + GetDatabase()->GetPrettyOption() + wxT(") || ' ' || o.opcname\n") + - wxT(" ELSE\n") + - wxT("pg_get_indexdef(i.indexrelid, ") + NumToStr(i) + GetDatabase()->GetPrettyOption() + wxT(")\n") + - wxT(" END AS coldef,\n") + - wxT(" op.oprname\n"); + wxT(" pg_get_indexdef(i.indexrelid, ") + NumToStr(i) + GetDatabase()->GetPrettyOption() + wxT(") AS coldef,\n") + + wxT(" op.oprname,\n") + + wxT(" CASE WHEN (o.opcdefault = FALSE) THEN o.opcname ELSE null END AS opcname\n"); if (GetConnection()->BackendMinimumVersion(9, 1)) query += wxT(",\n coll.collname, nspc.nspname as collnspname\n"); query += wxT("FROM pg_index i\n") @@ -219,11 +216,8 @@ void pgIndexBase::ReadColumnDetails() else { query = wxT("SELECT\n") + options + - wxT(" CASE WHEN (o.opcdefault = FALSE) THEN\n") - wxT("pg_get_indexdef(i.indexrelid, ") + NumToStr(i) + GetDatabase()->GetPrettyOption() + wxT(") || ' ' || o.opcname\n") + - wxT(" ELSE\n") + - wxT("pg_get_indexdef(i.indexrelid, ") + NumToStr(i) + GetDatabase()->GetPrettyOption() + wxT(")\n") + - wxT(" END AS coldef\n") + + wxT(" pg_get_indexdef(i.indexrelid, ") + NumToStr(i) + GetDatabase()->GetPrettyOption() + wxT(") AS coldef,\n") + + wxT(" CASE WHEN (o.opcdefault = FALSE) THEN o.opcname ELSE null END AS opcname\n") + wxT("FROM pg_index i\n") + wxT("JOIN pg_attribute a ON (a.attrelid = i.indexrelid AND attnum = ") + NumToStr(i) + wxT(")\n") + wxT("LEFT OUTER JOIN pg_opclass o ON (o.oid = i.indclass[") + NumToStr((long)(i - 1)) + wxT("])\n") + @@ -236,6 +230,20 @@ void pgIndexBase::ReadColumnDetails() { coldef = res->GetVal(wxT("coldef")); + if (GetConnection()->BackendMinimumVersion(9, 1) && !indexconstraint) + { + wxString collation = wxEmptyString; + if (!res->GetVal(wxT("collname")).IsEmpty()) + { + collation = qtIdent(res->GetVal(wxT("collnspname"))) + wxT(".") + qtIdent(res->GetVal(wxT("collname"))); + coldef += wxT(" COLLATE ") + collation; + } + collationsArray.Add(collation); + } + + opcname = res->GetVal(wxT("opcname")); + coldef += wxT(" ") + opcname; + // Get the column options if (GetConnection()->BackendMinimumVersion(8, 3)) { @@ -260,21 +268,9 @@ void pgIndexBase::ReadColumnDetails() { coldef += wxT(" WITH ") + res->GetVal(wxT("oprname")); } - columns += coldef; quotedColumns += coldef; columnList.Add(coldef); - -if (GetConnection()->BackendMinimumVersion(9, 1) && !indexconstraint) -{ - wxString collation = wxEmptyString; - if (!res->GetVal(wxT("collname")).IsEmpty()) - { - collation = qtIdent(res->GetVal(wxT("collnspname"))) + wxT(".") + qtIdent(res->GetVal(wxT("collname"))); - quotedColumns += wxT(" COLLATE ") + collation; - } - collationsArray.Add(collation); -} } } else -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
[pgadmin-hackers] Updated sequence syntax
Hi, I noticed that altering sequences still uses the old ALTER TABLE syntax. While that's required for older versions, it's not anymore. Attached a patch to use most up-to-date syntax for each version. This is based on the previous newline patch having already been applied. Obviously this won't enable anything to work that didn't previously, but just thought it would be nice to use more suitable syntax. -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company diff --git a/pgadmin/dlg/dlgSequence.cpp b/pgadmin/dlg/dlgSequence.cpp index 39319ca..d5ae231 100644 --- a/pgadmin/dlg/dlgSequence.cpp +++ b/pgadmin/dlg/dlgSequence.cpp @@ -248,13 +248,37 @@ wxString dlgSequence::GetSql() if (GetName() != sequence->GetName()) { - sql += wxT("ALTER TABLE ") + sequence->GetQuotedFullIdentifier() - + wxT("\n RENAME TO ") + qtIdent(name) + wxT(";\n"); + if (connection->BackendMinimumVersion(8, 3)) + { +sql += wxT("ALTER SEQUENCE ") + sequence->GetQuotedFullIdentifier() + + wxT("\n RENAME TO ") + qtIdent(name) + wxT(";\n"); + } + else + { +sql += wxT("ALTER TABLE ") + sequence->GetQuotedFullIdentifier() + + wxT("\n RENAME TO ") + qtIdent(name) + wxT(";\n"); + } } if (sequence->GetOwner() != cbOwner->GetValue()) { - sql += wxT("ALTER TABLE ") + schema->GetQuotedPrefix() + qtIdent(name) - + wxT("\n OWNER TO ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); + if (connection->BackendMinimumVersion(8, 2)) + { +sql += wxT("ALTER SEQUENCE ") + schema->GetQuotedPrefix() + qtIdent(name); + +if (connection->BackendMinimumVersion(8, 4)) +{ + sql += wxT("\n OWNER TO ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); +} +else +{ + sql += wxT("\n OWNED BY ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); +} + } + else + { +sql += wxT("ALTER TABLE ") + schema->GetQuotedPrefix() + qtIdent(name) + + wxT("\n OWNER TO ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); + } } // This is where things get hairy. Per some thought by Horvath Gabor, @@ -341,8 +365,24 @@ wxString dlgSequence::GetSql() sql += wxT(";\n"); if (cbOwner->GetGuessedSelection() > 0) { - sql += wxT("ALTER TABLE ") + schema->GetQuotedPrefix() + qtIdent(name) - + wxT("\n OWNER TO ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); + if (connection->BackendMinimumVersion(8, 2)) + { +sql += wxT("ALTER SEQUENCE ") + schema->GetQuotedPrefix() + qtIdent(name); + +if (connection->BackendMinimumVersion(8, 4)) +{ + sql += wxT("\n OWNER TO ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); +} +else +{ + sql += wxT("\n OWNED BY ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); +} + } + else + { +sql += wxT("ALTER TABLE ") + schema->GetQuotedPrefix() + qtIdent(name) + + wxT("\n OWNER TO ") + qtIdent(cbOwner->GetValue()) + wxT(";\n"); + } } } -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
[pgadmin-hackers] pgAdmin III commit: Wrap SQL lines for ALTER commands
Wrap SQL lines for ALTER commands Branch -- master Details --- http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=ad38180640dff0a9f0969964bc26d8df03f7eef7 Author: Thom Brown Modified Files -- pgadmin/dlg/dlgCheck.cpp |4 ++-- pgadmin/dlg/dlgDatabase.cpp| 16 pgadmin/dlg/dlgDomain.cpp |8 pgadmin/dlg/dlgExtension.cpp |4 ++-- pgadmin/dlg/dlgForeignKey.cpp |6 +++--- pgadmin/dlg/dlgForeignServer.cpp |4 ++-- pgadmin/dlg/dlgForeignTable.cpp|6 +++--- pgadmin/dlg/dlgFunction.cpp| 12 ++-- pgadmin/dlg/dlgGroup.cpp |4 ++-- pgadmin/dlg/dlgIndex.cpp | 10 +- pgadmin/dlg/dlgIndexConstraint.cpp |4 ++-- pgadmin/dlg/dlgLanguage.cpp|2 +- pgadmin/dlg/dlgOperator.cpp|2 +- pgadmin/dlg/dlgProperty.cpp|8 pgadmin/dlg/dlgRole.cpp|6 +++--- pgadmin/dlg/dlgSequence.cpp|6 +++--- pgadmin/dlg/dlgTable.cpp | 22 +++--- pgadmin/dlg/dlgTablespace.cpp | 10 +- pgadmin/dlg/dlgTrigger.cpp |2 +- pgadmin/dlg/dlgType.cpp|6 +++--- pgadmin/dlg/dlgUser.cpp| 12 ++-- pgadmin/dlg/dlgUserMapping.cpp |2 +- pgadmin/dlg/dlgView.cpp|2 +- 23 files changed, 79 insertions(+), 79 deletions(-) -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
Re: [pgadmin-hackers] [FEATURE] OIDs check box to enable OIDs
On Sun, 2011-07-03 at 12:34 +0100, Thom Brown wrote: > On 2 July 2011 21:26, Thom Brown wrote: > > On 2 July 2011 20:20, Guillaume Lelarge wrote: > >> Great patch. It even helped me find a bug. Anyway, commited and pushed. > >> Thank you. > > > > Thanks for committing it. :) > > > >>> I personally prefer the ones with newlines, especially since I've been > >>> experimenting with tables having very long names, and some of the > >>> above statements require lots of horizontal scrolling on the SQL tab > >>> to see what the action will be. Could we harmonise these? > >> > >> Yes, we should. Could you provide a patch? > > > > Sure, I'll take a look at it. > > Okay, patch attached to wrap lines at various places. > Commited, and pushed. Thank you. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
Re: [pgadmin-hackers] Updated sequence syntax
On Sun, 2011-07-03 at 19:23 +0100, Thom Brown wrote: > [...] > I noticed that altering sequences still uses the old ALTER TABLE > syntax. While that's required for older versions, it's not anymore. > Attached a patch to use most up-to-date syntax for each version. This > is based on the previous newline patch having already been applied. > > Obviously this won't enable anything to work that didn't previously, > but just thought it would be nice to use more suitable syntax. > Sure. But there is one big misunderstanding in your patch: OWNED BY and OWNER TO are quite different beasts. The "OWNER TO" changes the ownership of the sequence. IOW, a user is affected as owner of the object. "OWNED BY" creates a link between a sequence and a table's column. This is automatically done when you use the serial datatype. It's quite important because it tells PostgreSQL to drop the sequence when you want to drop the table. Anyway, the patch in itself is interesting. I wasn't willing to write it, but as you gave it to us, I commited it with some changes :) Thanks again. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
[pgadmin-hackers] pgAdmin III commit: Use the new syntax for sequence when possible
Use the new syntax for sequence when possible In 8.4, the ALTER SEQUENCE can be used to rename a sequence, and to change the owner of a sequence. First patch from Thom Brown, few changes by me. Branch -- master Details --- http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=2705867fbd700698df9f73a7fe15961c81010d00 Modified Files -- pgadmin/dlg/dlgSequence.cpp | 38 +++--- 1 files changed, 31 insertions(+), 7 deletions(-) -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers
Re: [pgadmin-hackers] Updated sequence syntax
On 3 July 2011 22:40, Guillaume Lelarge wrote: > On Sun, 2011-07-03 at 19:23 +0100, Thom Brown wrote: >> [...] >> I noticed that altering sequences still uses the old ALTER TABLE >> syntax. While that's required for older versions, it's not anymore. >> Attached a patch to use most up-to-date syntax for each version. This >> is based on the previous newline patch having already been applied. >> >> Obviously this won't enable anything to work that didn't previously, >> but just thought it would be nice to use more suitable syntax. >> > > Sure. But there is one big misunderstanding in your patch: OWNED BY and > OWNER TO are quite different beasts. The "OWNER TO" changes the > ownership of the sequence. IOW, a user is affected as owner of the > object. "OWNED BY" creates a link between a sequence and a table's > column. This is automatically done when you use the serial datatype. > It's quite important because it tells PostgreSQL to drop the sequence > when you want to drop the table. > > Anyway, the patch in itself is interesting. I wasn't willing to write > it, but as you gave it to us, I commited it with some changes :) The moment you mentioned there being a distinction between OWNED BY and OWNER to, I immediately knew what you meant. Thanks. :) -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers