Skip to content
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

Inter-table update queries losing table names #767

Closed
pkge opened this issue May 22, 2014 · 3 comments
Closed

Inter-table update queries losing table names #767

pkge opened this issue May 22, 2014 · 3 comments
Labels
bug
Milestone

Comments

@pkge
Copy link

@pkge pkge commented May 22, 2014

This issue is similar to #762. The following query isn't using the name of the table being updated in the WHERE condition:

QSa1Region region = new QSa1Region("r");
QVehicleProfile profiles = new QVehicleProfile("v");
QVehicleSummary summary = new QVehicleSummary("s");
SQLUpdateClause query = update(summary).set(
            summary.clearanceTime,
            new SQLSubQuery()
                    .from(profiles, region)
                    .where(summary.vehicleId.eq(profiles.vehicleId),
                            profiles.geom.intersects(region.geom))
                    .unique(profiles.time.max()));

This produces:

update public.vehicle_summary set clearance_time = (select max(v.time)
from public.vehicle_profile v, public.sa1_region r
where vehicle_id = v.vehicle_id and ST_Intersects(v.geom, r.geom))

which doesn't give the desired result. It should be more like:

update public.vehicle_summary set clearance_time = (select max(v.time)
from public.vehicle_profile v, public.sa1_region r
where vehicle_summary.vehicle_id = v.vehicle_id and ST_Intersects(v.geom, r.geom))
@timowest timowest added the bug label May 22, 2014
@timowest timowest added this to the 3.4.0 milestone May 22, 2014
@pkge
Copy link
Author

@pkge pkge commented May 22, 2014

Thanks!

@pkge pkge closed this May 22, 2014
@timowest
Copy link
Member

@timowest timowest commented May 23, 2014

I'll close it when it's merged and released.

@timowest timowest reopened this May 23, 2014
@timowest timowest added the fixed label May 23, 2014
@timowest
Copy link
Member

@timowest timowest commented Jun 9, 2014

Released in 3.4.0

@timowest timowest closed this Jun 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.