Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » convert_parent_id_to_child_id
Re: convert_parent_id_to_child_id [message #7261 is a reply to message #7257] Thu, 07 February 2019 08:35 Go to previous messageGo to previous message
pdv is currently offline  pdv
Messages: 15
Registered: January 2019
Junior Member
Tony,

I have a simple one-to-many relationship like department(id,...) <-->> employee(id,department_id,...).
I inserted a button on the department(list1) to list the employee(list2).

So far so good but this returned nothing, although there are matching rows. When looking at the query:

SET search_path TO 'public';
SELECT count(*) FROM employee
LEFT JOIN department ON (department.id=employee.department_id)
WHERE employee.id= '1' AND employee.department_id= '1'

I conclude that the first employee.id in the WHERE clause should have been department.id and then both clauses are redundant.
By debugging the code I've found that in convert_parent_id_to_child_id a comparison was made between 'department' and "='department'". The latter contains the operator because where2array(....,false) was called.
With where2array(...,true) the proper WHERE clause is returned and it works.

Regards,

Patrick
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multi servers and PostgreSQL
Next Topic: Check for empty $schema in dml.psql.class.inc
Goto Forum:
  


Current Time: Sun Oct 06 07:20:09 EDT 2024

Total time taken to generate the page: 0.01105 seconds