-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Problem with RawValue('default') on composite primary key #1534
Comments
Didn't understand your meaning, Can you write an example? $robot = new Robots();
$robot->id = RawValue('default'); |
Well, I have the following table, where 'id' and 'language' are both part of the PRIMARY KEY:
If I do something like...
... the value of 'language' is literally set as "default", not as the actual default value (which is "bb"). Notice all other default values are set correct, no matter whether they are NULL, INT or VARCHAR. |
Confirmed. This is the query Phalcon executes: INSERT INTO `issue_1534` (`language`, `name`, `slug`, `brand`, `sort`) VALUES (?, ?, ?, default, default)
|
This is what is passed to db::insert():
|
I am afraid this is not going to work: when you call And this query generates an error in MySQL: SELECT COUNT(*) "rowcount" FROM `issue_1534` WHERE `id` = 1 AND `language` = DEFAULT; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 |
Workaround is to use |
Can this one be closed now? |
Hello, i have a table on MySQL where i have a composite Primary Key. The first column of te PK is a auto_increment BIGINT and the second is a VARCHAR, that has a default value.
The problem is, when i try to define the corresponding model property as RawValue('default') the value "default" is written literally in that column. It works fine on every other column.
I tried to do the same thing directly on MySQL using phpMyAdmin and it works without any problem.
Sorry if this is not a bug, but i couldn't find any explanation for that behavior.
The text was updated successfully, but these errors were encountered: