Menu

#2900 (ok 3.2.2) Cannot edit row with no PK and a BIT field

fixed
1
2013-06-11
2009-07-19
Regan
No

When trying to edit a row in a many-to-many table with no primary key defined and a binary value, I receive this message:

"MySQL returned an empty result set (i.e. zero rows)."

The problem is related to the binary field and the way it is received from the web browser. Here is the table structure with some data:

--
-- Table structure for table `clients_addresses`
--

CREATE TABLE IF NOT EXISTS `clients_addresses` (
`client_id` int(11) NOT NULL,
`address_id` int(11) NOT NULL,
`primary_address` bit(1) NOT NULL DEFAULT '>',
KEY `client_id` (`client_id`),
KEY `address_id` (`address_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `clients_addresses` (`client_id`, `address_id`, `primary_address`) VALUES
(2001, 1, '>'),
(2002, 2, '>'),
(2003, 3, '>'),
(2004, 4, '>'),
(2005, 5, '>')

As you can see in the attached screen shot of the address bar, this is what shows up. If I change the binary box in the address bar to 0001 everything works just fine. I am unsure if this is a browser or phpMyAdmin problem.

Regan

Discussion

  • Regan

    Regan - 2009-07-19

    Screenshot of Address Bar

     
  • Marc Delisle

    Marc Delisle - 2009-07-20

    Cannot create your example table, I receive:
    #1067 - Invalid default value for 'primary_address'

    under MySQL 5.1.34

     
  • Regan

    Regan - 2009-07-20

    Sorry, I forgot to mention that where you see the > in the INSERT field, that should be a binary 1 (00000001).

     
  • Marc Delisle

    Marc Delisle - 2009-07-20

    Moved to bugs.

     
  • Marc Delisle

    Marc Delisle - 2009-07-20
    • labels: 509108 --> Data insertion/extraction/manipulation
     
  • Marc Delisle

    Marc Delisle - 2009-07-23
    • summary: "MySQL returned an empty result set" when trying to edit row --> Cannot edit row with no PK and a BIT field
     
  • Marc Delisle

    Marc Delisle - 2009-08-16
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2009-08-16

    Fixed in subversion, thanks for reporting.

     
  • Marc Delisle

    Marc Delisle - 2009-08-16
    • priority: 5 --> 1
    • summary: Cannot edit row with no PK and a BIT field --> (ok 3.2.2) Cannot edit row with no PK and a BIT field
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2009-09-13
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed
     
MongoDB Logo MongoDB