Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Update Of All Fields Not Allowed

forums forums SQLyog SQLyog: Bugs / Feature Requests Update Of All Fields Not Allowed

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #10193

      Hi

      I have following change request:

      If I update only one data field directly in “Table Data”, it tries to update all fields.

      This can cause problems if you are only allowed to update some (and not all) fields of a table.

      Example:

      I createded following table:

      CREATE TABLE `test_table` (

      `name` varchar(30) default NULL,

      `age` int(3) default NULL,

      `ID` int(11) NOT NULL auto_increment,

      PRIMARY KEY (`ID`)

      ) ENGINE=InnoDB DEFAULT CHARSET=latin1

      I inserted some data:

      insert into `test_table`(`name`,`age`,`ID`) values ( 'John','20',NULL);

      insert into `test_table`(`name`,`age`,`ID`) values ( 'Jane','25',NULL);

      Then I updated the name 'John' to 'Peter' directly in the “Table Data”, the generated update statement looks like:

      update `test_table` set `name`='Peter',`age`='20',`ID`='1' where `ID`='1'

      The problem ist, that the age and ID get updated too!

      If I don't have only privileges to update name, this will cause following error:

      Error No. 1143

      UPDATE command denied to user 'ah'@'localhost' for column 'ID' in table 'test_table'

      Solution: Only updated fields should be updated:

      update `test_table` set `name`='Peter' where `ID`='1'

      Armin

    • #23444
      peterlaursen
      Participant

      I do not think you will find any GRID based client for nay database server doing this.  They read from the GRID as SQLyog do (with the the 'smart' keywords and functions as a special featue of SQLyog).

      You should start doing a

      SELECT allthefieldswhereyouhaveprivilege FROM …..

      Now a RESULT tab will open showing only those fields and the update statement will only use these fields in the SQL statement

Viewing 1 reply thread
  • You must be logged in to reply to this topic.