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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Show comment
Hide comment
@pkge

pkge May 22, 2014

Thanks!

pkge commented May 22, 2014

Thanks!

@pkge pkge closed this May 22, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 23, 2014

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jun 9, 2014

Member

Released in 3.4.0

Member

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