- Member | 1
Hello, I have read pretty much everyhing everywhere, so the last resort is to ask..
I am doing very simple insert to the database:
$params = array( 'my_pid' => 'abcde', // THIS IS PRIMARY KEY 'name' => 'ppp' ... );
SQL command knows that my_pid is PRI.
SHOW FULL COLUMNS FROM sd_service;
Anyways, the problem is that, once I do the insert, Nette somehow tries to get a primary id, which is always expected to be called “id”.
This is what happens in the background after running insert.
INSERT INTO `my_table` (`my_pid`, `name`) VALUES (?, ?), SELECT * FROM `my_table` WHERE (`my_table`.`id` = '0'), # this was being generated by Nette
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'my_table.id' in 'where clause'
I am using
Apache/2.4.35 (Win64) PHP/5.6.38, Nette 2.3.10, Mysql 5.7.23
Either I don't want to execute those selects getting primary keys or tell Nette my PK is different than id.
PS: I have tried restarting Apache, clearing cache for far.
PS2: My PK could not be renamed to different name.
Thanks for any help.
Last edited by gfeep (2019-01-25 14:28)
- Member | 166
@gfeep A quick look to source code reveals that there is a difference
in primary key handling in
insert() between versions 2.3 and
2.4. And since 2.3 has been EOL'd 2 years ago, I would suggest upgrading to
2.4 – it might just solve this problem for you.
Last edited by nightfish (2019-01-25 14:45)