Thread: Delete function disabled

Delete function disabled

From
Nick Rogers
Date:
I use pgAdmin v1.14.0 multiple databases stored on multiple servers. I am able to use the GUI to insert rows and edit existing rows. But when it comes to deleting rows, I am forced to manually type in the SQL to delete the rows because the "Delete" toolbar button is disabled as well as the "Delete" item in the "Edit" menu. This is the case for all of the servers I connect to, including localhost. Why is this happening?

Thanks!

Re: Delete function disabled

From
Dave Page
Date:
On Thu, Nov 24, 2011 at 8:52 AM, Nick Rogers <nrogers64@hotmail.com> wrote:
> I use pgAdmin v1.14.0 multiple databases stored on multiple servers. I am
> able to use the GUI to insert rows and edit existing rows. But when it comes
> to deleting rows, I am forced to manually type in the SQL to delete the rows
> because the "Delete" toolbar button is disabled as well as the "Delete" item
> in the "Edit" menu. This is the case for all of the servers I connect to,
> including localhost. Why is this happening?
> Thanks!

Are you selecting the whole rows, or just the contents? Make sure you
select using the row headers on the left of the actual data.


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Delete function disabled

From
Colin Beckingham
Date:

On 11/24/2011 03:52 AM, Nick Rogers wrote:
> I use pgAdmin v1.14.0 multiple databases stored on multiple servers. I
> am able to use the GUI to insert rows and edit existing rows. But when
> it comes to deleting rows, I am forced to manually type in the SQL to
> delete the rows because the "Delete" toolbar button is disabled as well
> as the "Delete" item in the "Edit" menu. This is the case for all of the
> servers I connect to, including localhost. Why is this happening?
>
> Thanks!

I get this as well. However if the table has OIDs then the delete button 
activates no problem.

-- 
---
Colin Beckingham


Re: Delete function disabled

From
Dave Page
Date:
On Thu, Nov 24, 2011 at 9:53 AM, Colin Beckingham <colbec@start.ca> wrote:
>
>
> On 11/24/2011 03:52 AM, Nick Rogers wrote:
>>
>> I use pgAdmin v1.14.0 multiple databases stored on multiple servers. I
>> am able to use the GUI to insert rows and edit existing rows. But when
>> it comes to deleting rows, I am forced to manually type in the SQL to
>> delete the rows because the "Delete" toolbar button is disabled as well
>> as the "Delete" item in the "Edit" menu. This is the case for all of the
>> servers I connect to, including localhost. Why is this happening?
>>
>> Thanks!
>
> I get this as well. However if the table has OIDs then the delete button
> activates no problem.

It needs either a primary key or OIDs to allow deletes. By default,
you'll get a guru hint warning you that you need one of them when you
first open a table without, but it's possible to suppress that hint
and then forget about it 12 months later :-)

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Delete function disabled

From
Colin Beckingham
Date:

On 11/24/2011 04:59 AM, Dave Page wrote:
> On Thu, Nov 24, 2011 at 9:53 AM, Colin Beckingham<colbec@start.ca>  wrote:
>>
>>
>> On 11/24/2011 03:52 AM, Nick Rogers wrote:
>>>
>>> I use pgAdmin v1.14.0 multiple databases stored on multiple servers. I
>>> am able to use the GUI to insert rows and edit existing rows. But when
>>> it comes to deleting rows, I am forced to manually type in the SQL to
>>> delete the rows because the "Delete" toolbar button is disabled as well
>>> as the "Delete" item in the "Edit" menu. This is the case for all of the
>>> servers I connect to, including localhost. Why is this happening?
>>>
>>> Thanks!
>>
>> I get this as well. However if the table has OIDs then the delete button
>> activates no problem.
>
> It needs either a primary key or OIDs to allow deletes. By default,
> you'll get a guru hint warning you that you need one of them when you
> first open a table without, but it's possible to suppress that hint
> and then forget about it 12 months later :-)
>

Correctamundo. Thanks for the reminder.

It seems a bit strict... Presumably lots of thinking went into this - 
without a unique key, any delete statement might delete multiple 
duplicate rows without a limit statement, which might or might not be 
what the user intended.

-- 
---
Colin Beckingham


Re: Delete function disabled

From
Dave Page
Date:
On Thu, Nov 24, 2011 at 11:02 AM, Colin Beckingham <colbec@start.ca> wrote:
>
>
> On 11/24/2011 04:59 AM, Dave Page wrote:
>>
>> On Thu, Nov 24, 2011 at 9:53 AM, Colin Beckingham<colbec@start.ca>  wrote:
>>>
>>>
>>> On 11/24/2011 03:52 AM, Nick Rogers wrote:
>>>>
>>>> I use pgAdmin v1.14.0 multiple databases stored on multiple servers. I
>>>> am able to use the GUI to insert rows and edit existing rows. But when
>>>> it comes to deleting rows, I am forced to manually type in the SQL to
>>>> delete the rows because the "Delete" toolbar button is disabled as well
>>>> as the "Delete" item in the "Edit" menu. This is the case for all of the
>>>> servers I connect to, including localhost. Why is this happening?
>>>>
>>>> Thanks!
>>>
>>> I get this as well. However if the table has OIDs then the delete button
>>> activates no problem.
>>
>> It needs either a primary key or OIDs to allow deletes. By default,
>> you'll get a guru hint warning you that you need one of them when you
>> first open a table without, but it's possible to suppress that hint
>> and then forget about it 12 months later :-)
>>
>
> Correctamundo. Thanks for the reminder.
>
> It seems a bit strict... Presumably lots of thinking went into this -
> without a unique key, any delete statement might delete multiple duplicate
> rows without a limit statement, which might or might not be what the user
> intended.

Right - a unique key with not-null on every attribute is required to
avoid potential disaster. We currently just use a pkey (or OIDs), but
the code could potentially be enhanced to support individual
constraints that can guarantee uniqueness. That's not trivial though,
and frankly it's good practice to define a pkey anyway.


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company