From 6fa548e4277d568a301979e7f0ebd6e42efd4828 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Sat, 4 Feb 2012 12:45:13 +0800 Subject: [PATCH] fix syntax for psql backend - PostgreSQL doesn't allow double quotes for values. Double quotes are used for surrounding table names that contain spaces. Single quotes should be used for values. - DELETE in a JOIN is not permitted in SQL-99 (see http://drupal.org/node/555562) so we use USING with WHERE instead --- ...0120202190701_remove_public_share_visibilities.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/migrate/20120202190701_remove_public_share_visibilities.rb b/db/migrate/20120202190701_remove_public_share_visibilities.rb index db3bcfb48..a884c8825 100644 --- a/db/migrate/20120202190701_remove_public_share_visibilities.rb +++ b/db/migrate/20120202190701_remove_public_share_visibilities.rb @@ -24,13 +24,13 @@ class RemovePublicShareVisibilities < ActiveRecord::Migration while index < shareable_size + 100 do sql = <<-SQL - DELETE sv + DELETE FROM share_visibilities AS sv - INNER JOIN #{table_name} - ON sv.shareable_id = #{table_name}.id - WHERE sv.shareable_type = "#{type}" - AND #{table_name}.public IS TRUE - AND #{table_name}.id < #{index}; + USING #{table_name} as p + WHERE sv.shareable_id = p.id + AND sv.shareable_type = '#{type}' + AND p.public IS TRUE + AND p.id < #{index}; SQL puts "deleted public share vis up to #{index} of #{type}"