Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT

Lists: pgadmin-hackers
From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-16 11:33:38
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi All,

Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE &
CONNECTION LIMIT.

Changed the following files:
* include/schema/pgDatabase.h
- Declarations of variables & functions for collate, ctype & connection
limit
* include/dlg/dlgDatabase.h
- Declaration of the event handlers to take care the auto-completion of
ctlComboBox for collate & ctype
* schema/pgDatabase.cpp
- Made modifications in GetSql function for reverse engineering of the query
- Made modifications in CreateObjects for fetching ctype, collate and
connection limit details from pg_database catalog for existing
databases, saved as datctype, datcollate, datconnlimit respectively.
* dlg/dlgDatabase.cpp
- Defined the following variables:
+ cbCollate as ctlComboBox
+ cbCType as ctlComboBox
+ spConnLimit as wxSpinCtrl
- Defined event-handlers for auto-completion operation for cbCollate &
cbCType
- COLLATE & CTYPE takes locale as input value.
Currently, we don't have any way to get the supported server-locale on
client side. :(
Hence, I have kept the values fetched from the already used locale
values earlier along with C & POSIX.
- Made modification for Create a new database & editing existing
database (properties).
* ui/dlgDatabase.xrc
- Increased the height of the property dialog by 10
- Added controls for collate, ctype & connection limit

You may need to run embed-xrc.

I have followed this link to implement this.
http://developer.postgresql.org/pgdocs/postgres/sql-createdatabase.html

Range for the Connection limit is set to -1 to 1000.

Regards,
Ashesh

Attachment Content-Type Size
COLLATE_CTYPE_CONN_LIMIT.patch text/x-patch 14.5 KB

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-16 19:40:24
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Ashesh Vashi a écrit :
> [...]
> Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE &
> CONNECTION LIMIT.
>

Some comments :
* the new properties are not displayed in the Properties tab.
* the Comment field is really too small; you should make the dialog
bigger.
* CTYPE is not recognized by the syntax highlighting handler (it
appears in black).

And a question: why do you limit the connection limit to 1000?

Thanks for your patch.

Regards.

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com


From: Ashesh D Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-17 05:49:00
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi Guillaume Lelarge,

Thanks for the comments.

Guillaume Lelarge wrote:
> Ashesh Vashi a écrit :
>
>> [...]
>> Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE &
>> CONNECTION LIMIT.
>>
>>
>
> Some comments :
> * the new properties are not displayed in the Properties tab.
>
If you want, I can make it visible for all the version of PostgreSQL and
make it disabled for not supported version of PostgreSQL.
* COLLATE & CTYPE should visible for PostgreSQL 8.4.
* CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later.
(I may forget to ask you to use embed-xrc.bat on windows. :( )
If not, I will have to look into the patch. :(
> * the Comment field is really too small; you should make the dialog
> bigger.
>
Will do.
> * CTYPE is not recognized by the syntax highlighting handler (it
> appears in black).
Oh.. I missed out.
> And a question: why do you limit the connection limit to 1000?
>
Nobody asked to me to limit it to 1000.
For sack of it, I have done it, actully I was looking for input from you
all.
What do you say?

Thanks for reviewing the patch.
Will send the updated patch as soon as possible.

Regards,
Ashesh
> Thanks for your patch.
>
> Regards.
>
>
>


From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: "Ashesh D Vashi" <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: "Guillaume Lelarge" <guillaume(at)lelarge(dot)info>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-17 08:34:42
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

On Mon, Nov 17, 2008 at 5:49 AM, Ashesh D Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:

> If you want, I can make it visible for all the version of PostgreSQL and
> make it disabled for not supported version of PostgreSQL.
> * COLLATE & CTYPE should visible for PostgreSQL 8.4.
> * CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later.
> (I may forget to ask you to use embed-xrc.bat on windows. :( )
> If not, I will have to look into the patch. :(

Yup, as a general rule we disable controls for versions of Postgres
that doesn't support them - we don't make the invisible. There are two
reasons for this - to make the presentation of dialogues to the user
consistent (some could change quite considerably otherwise), and to
avoid layout issues caused by having multiple possible designs.

> And a question: why do you limit the connection limit to 1000?
>
>
> Nobody asked to me to limit it to 1000.
> For sack of it, I have done it, actully I was looking for input from you
> all.
> What do you say?

Yeah, I'd set the limit to the bounds of the datatype used in the
catalogs, or that PostgreSQL will accept if thats a lower value
(despite the fact that may seem ridiculously high).

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


From: Ashesh D Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-17 08:40:12
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi Dave Page,

Thanks for the inputs.
I will send the updated patch.

Regards,
Ashesh

Dave Page wrote:
> On Mon, Nov 17, 2008 at 5:49 AM, Ashesh D Vashi
> <ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>
>
>> If you want, I can make it visible for all the version of PostgreSQL and
>> make it disabled for not supported version of PostgreSQL.
>> * COLLATE & CTYPE should visible for PostgreSQL 8.4.
>> * CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later.
>> (I may forget to ask you to use embed-xrc.bat on windows. :( )
>> If not, I will have to look into the patch. :(
>>
>
> Yup, as a general rule we disable controls for versions of Postgres
> that doesn't support them - we don't make the invisible. There are two
> reasons for this - to make the presentation of dialogues to the user
> consistent (some could change quite considerably otherwise), and to
> avoid layout issues caused by having multiple possible designs.
>
>
>> And a question: why do you limit the connection limit to 1000?
>>
>>
>> Nobody asked to me to limit it to 1000.
>> For sack of it, I have done it, actully I was looking for input from you
>> all.
>> What do you say?
>>
>
> Yeah, I'd set the limit to the bounds of the datatype used in the
> catalogs, or that PostgreSQL will accept if thats a lower value
> (despite the fact that may seem ridiculously high).
>
>
>


From: Ashesh D Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-17 12:56:28
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi All,

Please find the attached updated patch.

Patch contains following changes:
* Added "ctype" in keyword list as RESERVED
* Added support for COLLATE, CTYPE & CONNECTION LIMIT in pgDatabase
* Added reverse engineering support for SQL generation from existing schema
* Added these variable in properties list.
(Made them disabled for the not-supported versions of PostgreSQL)
* Added them in property list (forgot to add it in the previous patch)
* Used wxTextCtrl instead of wxSpinCtrl for connection limit control in
properties dialog, as we don't want to put any restriction on the maximum
limit for it.

Regards,
Ashesh

Attachment Content-Type Size
COLLATE_CTYPE_CONN_LIMIT-v2.patch text/x-patch 18.6 KB

From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: "Ashesh D Vashi" <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: "Guillaume Lelarge" <guillaume(at)lelarge(dot)info>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-17 17:11:24
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi

On Mon, Nov 17, 2008 at 12:56 PM, Ashesh D Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> Hi All,
>
> Please find the attached updated patch.
>
> Patch contains following changes:
> * Added "ctype" in keyword list as RESERVED
> * Added support for COLLATE, CTYPE & CONNECTION LIMIT in pgDatabase
> * Added reverse engineering support for SQL generation from existing schema
> * Added these variable in properties list.
> (Made them disabled for the not-supported versions of PostgreSQL)
> * Added them in property list (forgot to add it in the previous patch)
> * Used wxTextCtrl instead of wxSpinCtrl for connection limit control in
> properties dialog, as we don't want to put any restriction on the maximum
> limit for it.

Some thoughts (all minor), in no particular order:

- Let's use 'Collation' and 'Character type' in both the properties
list view and on the dialog for the labels - it'll look much nicer
than COLLATE and CTYPE I think.

- dlgDatabase needs to have it's sizing fixed - the cell holding the
CTYPE controls is stretching, but it should be the comment cell that
stretches (<growablerows> needs to change to 11 perhaps?).

- Entering a new connection limit, and clicking the SQL tab doesn't
show me an SQL statement if the value entered is too large, but does
enable the OK button The easiest fix is probably to limit the number
of characters the control will access. That should still allow a huge
number to entered.

- Entering a connection limit of -<anything but 1> is silently
converted to 1. We should just ignore anything that isn't 1, rather
than trying to correct it for the user.

- 'Connection Limit' in the properties list should not have a capital L.

- This code in dlgDatabase may be uneeded now?

+ // As some of the controls has been made hidden,
+ // Update() will help to rearrange all the other controls properly.
+ this->Update();

- The COLLATE and CTYPE options should be omitted from the CREATE
DATBASE SQL generated by dlgDatabase, if the user hasn't specified
values.

- The CONNECTION LIMIT option seems to have an additional space in the indent:

CREATE DATABASE foobar
WITH ENCODING='UTF8'
COLLATE=''
CTYPE=''
CONNECTION LIMIT=99;

Looks pretty good though in general :-)

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com


From: Ashesh D Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-18 10:57:43
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi,

Please find the updated patch.
>
> Some thoughts (all minor), in no particular order:
>
> - Let's use 'Collation' and 'Character type' in both the properties
> list view and on the dialog for the labels - it'll look much nicer
> than COLLATE and CTYPE I think.
Done.
>
> - dlgDatabase needs to have it's sizing fixed - the cell holding the
> CTYPE controls is stretching, but it should be the comment cell that
> stretches (<growablerows> needs to change to 11 perhaps?).
Changed <growablerows> to 11.
>
> - Entering a new connection limit, and clicking the SQL tab doesn't
> show me an SQL statement if the value entered is too large, but does
> enable the OK button The easiest fix is probably to limit the number
> of characters the control will access. That should still allow a huge
> number to entered.
Maximum number allowed will be 2147483647.
Datatype for the datconnlimit is integer.
>
> - Entering a connection limit of -<anything but 1> is silently
> converted to 1. We should just ignore anything that isn't 1, rather
> than trying to correct it for the user.
Done.
>
> - 'Connection Limit' in the properties list should not have a capital L.
Done.
>
> - This code in dlgDatabase may be uneeded now?
>
> + // As some of the controls has been made hidden,
> + // Update() will help to rearrange all the other controls properly.
> + this->Update();
Done.
>
> - The COLLATE and CTYPE options should be omitted from the CREATE
> DATBASE SQL generated by dlgDatabase, if the user hasn't specified
> values.
Done.
>
> - The CONNECTION LIMIT option seems to have an additional space in the indent:
>
> CREATE DATABASE foobar
> WITH ENCODING='UTF8'
> COLLATE=''
> CTYPE=''
> CONNECTION LIMIT=99;
Done.

Regards,
Ashesh

Attachment Content-Type Size
COLLATE_CTYPE_CONN_LIMIT-v3.patch text/x-patch 18.9 KB

From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: "Ashesh D Vashi" <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: "Guillaume Lelarge" <guillaume(at)lelarge(dot)info>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Date: 2008-11-18 13:12:16
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgadmin-hackers

Hi

On Tue, Nov 18, 2008 at 10:57 AM, Ashesh D Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> Hi,
>
> Please find the updated patch.

Thanks - committed with minor changes:

- Change 'Collate' to 'Collation'
- There were still a couple of places in the code which changed the
connection limit to -1 if it was less than that. I've removed those -
so we can rely on the server to catch errors there (the behaviour is
more consistent this way).

Note that I did find that the server will accept connection limits of
< -1 anyway - I've reported this as a PG bug.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com