Rails: weird queries after migration - ruby-on-rails
It's been a while, but I only take care of this now.
In Rails 3.2, each time I run a migration (rake db:migrate), after the normal SQL logs for making the migration, I get a bunch of very confusing queries executed.
Here they are:
(0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ('20150623124632')
(5.6ms) COMMIT
(1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
(5.9ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'addresses'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(4.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'authentications'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.3ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'balancing_transactions'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.6ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'billing_informations'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.4ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'bills'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.1ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'checkins'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'converters'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'copass_transactions'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'copasser_preferences'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'copassers'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_comments'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.0ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_copasser_interactions'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.1ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_event_type_associations'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_pictures'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.1ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_recommends'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.1ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_tag_votes'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.3ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_transaction_templates'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_type_associations'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.1ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospace_wishlists'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.1ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'cospaces'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'countries'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'coupons'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.4ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'currency_accounts'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(6.9ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'delayed_jobs'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.4ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'event_types'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'external_transactions'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.3ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'faqs'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.5ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'finances'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.4ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'friend_suggestions'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'friendship_notifications'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(9.0ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'friendships'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.4ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'group_copassers'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(6.9ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'groups'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname
(5.2ms)
SELECT t2.relname AS to_table
, a1.attname AS column
, a2.attname AS primary_key
, c.conname AS name
, c.confdeltype AS dependency
, c.confupdtype AS update_dependency
, c.condeferrable AS deferrable
, c.condeferred AS deferred
, c.convalidated AS valid
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
AND t1.relname = 'in_progress_transactions'
AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.
# [TRUNKED BECAUSE OF Stackoverflow LIMITATION]
It never break anything since those are only SELECTs, but they are very ugly and prevent me from easily checking that everything went fine.
Any idea where this comes from?
This just looks like Rails crawling the schema to figure out the structure of your models. db:migrate is generally quiet, so the output may be due to the rails_12factor gem if you're using that (usually with Heroku). If that's it, you can use this question's solution and just wrap that gem in a :production block, since it doesn't need to run in development.
group :production do
gem 'rails_12factor'
end
Related
Error while running hive join query
SELECT A.* , B.* FROM (SELECT ID,DATE FROM APPLE) A INNER JOIN (SELECT ID,MAX(DATE) AS MAXDATE FROM APPLE GROUP BY ID) A1 ON A.ID = A.ID AND A.DATE = A1.MAXDATE WHERE A.DATE > CURRENT_DATE LEFT OUTER JOIN ( SELECT ID,NAME FROM BANANA) B ON A.ID = B.ID WHERE B.NAME IN ('USA','GBR') LIMIT 10; Error: Error while compiling statement: FAILED: ParseException line 22:0 missing EOF at 'LEFT' near 'CURRENT_DATE' (state=42000,code=40000)
Your problem is that you have a WHERE clause in the middle of your SQL statement. you can either move it into the nested query for A, or add it to the WHERE clause at the end. You also probably want to move the filtering on the B table inside the nested query, because you are essentially making the left join into an inner join by putting it in a WHERE clause at the end of the statement. either SELECT A.* , B.* FROM (SELECT ID,DATE FROM APPLE WHERE DATE > CURRENT_DATE) A INNER JOIN (SELECT ID,MAX(DATE) AS MAXDATE FROM APPLE GROUP BY ID) A1 ON A.ID = A.ID AND A.DATE = A1.MAXDATE LEFT OUTER JOIN ( SELECT ID,NAME FROM BANANA WHERE NAME IN ('USA','GBR') ) B ON A.ID = B.ID LIMIT 10; or SELECT A.* , B.* FROM (SELECT ID,DATE FROM APPLE) A INNER JOIN (SELECT ID,MAX(DATE) AS MAXDATE FROM APPLE GROUP BY ID) A1 ON A.ID = A.ID AND A.DATE = A1.MAXDATE LEFT OUTER JOIN ( SELECT ID,NAME FROM BANANA WHERE NAME IN ('USA','GBR') ) B ON A.ID = B.ID WHERE A.DATE > CURRENT_DATE LIMIT 10;
The WHERE clause i.e. A.DATE > CURRENT_DATE should be inside the first select.Also note that you have a condition A.ID = A.ID and instead of A.ID = A1.ID SELECT A.* , B.* FROM (SELECT ID,DATE FROM APPLE WHERE DATE > CURRENTDATE) A INNER JOIN (SELECT ID,MAX(DATE) AS MAXDATE FROM APPLE GROUP BY ID) A1 ON A.ID = A1.ID AND A1.DATE = A1.MAXDATE LEFT OUTER JOIN (SELECT ID,NAME FROM BANANA) B ON A.ID = B.ID WHERE B.NAME IN ('USA','GBR') LIMIT 10;
uniqueidentifier is incompatible with int error
This is my Select statement in my stored procedure, i am trying to get all cases based on just the begin date as entered by the user. I keep getting ' uniqueidentifier is incompatible with int'. Not sure how to go about that. ( SELECT COUNT(DISTINCT C.CaseID) FROM [Case] C INNER JOIN CaseOffice COD ON C.CaseId = COD.CaseId INNER JOIN Office OD ON COD.OfficeId = OD.OfficeId WHERE C.DateCreated <= #BeginDate AND OD.OfficeId = O.OfficeId AND C.CaseId NOT IN ( SELECT CaseId FROM CaseStatusChange CSC WHERE CSC.DateClosed < #BeginDate ) UNION SELECT ReOpened.CaseId FROM ( SELECT C.CaseId, MAX(CSC.DateReopened) AS DateReOpened FROM [Case] C INNER JOIN [CaseStatusChange] CSC ON C.CaseId = CSC.CaseId WHERE CSC.DateReopened <= #BeginDate GROUP BY C.CaseId ) ReOpened WHERE ReOpened.CaseId NOT IN -- Wasn't reopened and closed ( SELECT CaseId FROM CaseStatusChange WHERE CaseId = ReOpened.CaseId AND CaseStatusChange.DateClosed BETWEEN ReOpened.DateReopened AND #BeginDate ) )AS OpenBeginCases
CaseID is uniqueidentifier and you UNION this with COUNT(DISTINCT C.CaseID) which will be int ... SELECT COUNT(DISTINCT C.CaseID) --int ... UNION ... SELECT ReOpened.CaseId --uniqueidentifier ... So this error would be expected. Do you need the COUNT in the first clause?
UNION in Stored Procedure COUNT
I am creating a stored procedure which will return the results of open cases based on an entered time - i want to return the count of the cases but based on different offices. After editing my code i will also re-state my question different - which way is best to return a count instead of the actual results which i am getting now. The Following is my stored procedure: SELECT C.CaseId FROM [Case] C WHERE C.DateCreated <= #BeginDate AND C.CaseId NOT IN (SELECT CaseId FROM CaseStatusChange CSC WHERE CSC.DateClosed < #BeginDate) UNION -- Also need the cases that reopened and are currently open SELECT ReOpened.CaseId FROM ( SELECT C.CaseId, MAX(CSC.DateReopened) AS DateReOpened FROM [Case] C INNER JOIN [CaseStatusChange] CSC ON C.CaseId = CSC.CaseId WHERE CSC.DateReopened <= #BeginDate GROUP BY C.CaseId ) ReOpened WHERE ReOpened.CaseId NOT IN ( SELECT CaseId FROM CaseStatusChange WHERE CaseId = ReOpened.CaseId AND CaseStatusChange.DateClosed BETWEEN ReOpened.DateReopened AND #BeginDate )
It means that the number of columns in the SELECT lists must match. And their data types too. Like this: select col1, col2, col3 from t1 union select col1, col2, col3 from t2 In your particular case, you need to add the OfficeID and the count in the second SELECT list.
Update: To Include OfficeId as requested: SELECT OfficeId, SUM(CaseCount) FROM ( SELECT COUNT(C.CaseId) AS CaseCount, C.OfficeId FROM [Case] C WHERE C.DateCreated <= #BeginDate AND C.CaseId NOT IN (SELECT CaseId FROM CaseStatusChange CSC WHERE CSC.DateClosed < #BeginDate) GROUP BY C.OfficeId UNION ALL -- Also need the cases that reopened and are currently open SELECT COUNT(ReOpened.CaseId) As CaseCount, ReOpened.OfficeID FROM ( SELECT C.CaseId, MAX(CSC.DateReopened) AS DateReOpened, C.OfficeId FROM [Case] C INNER JOIN [CaseStatusChange] CSC ON C.CaseId = CSC.CaseId WHERE CSC.DateReopened <= #BeginDate GROUP BY C.CaseId, C.OfficeID ) ReOpened WHERE ReOpened.CaseId NOT IN ( SELECT CaseId FROM CaseStatusChange WHERE CaseId = ReOpened.CaseId AND CaseStatusChange.DateClosed BETWEEN ReOpened.DateReopened AND #BeginDate ) GROUP BY OfficeID ) AS OpenCasesCount GROUP BY OfficeId You need to wrap your whole Query in an inner Query as shown below: SELECT SUM(CaseCount) FROM ( SELECT COUNT(C.CaseId) AS CaseCount FROM [Case] C WHERE C.DateCreated <= #BeginDate AND C.CaseId NOT IN (SELECT CaseId FROM CaseStatusChange CSC WHERE CSC.DateClosed < #BeginDate) UNION ALL -- Also need the cases that reopened and are currently open SELECT COUNT(ReOpened.CaseId) As CaseCount FROM ( SELECT C.CaseId, MAX(CSC.DateReopened) AS DateReOpened FROM [Case] C INNER JOIN [CaseStatusChange] CSC ON C.CaseId = CSC.CaseId WHERE CSC.DateReopened <= #BeginDate GROUP BY C.CaseId ) ReOpened WHERE ReOpened.CaseId NOT IN ( SELECT CaseId FROM CaseStatusChange WHERE CaseId = ReOpened.CaseId AND CaseStatusChange.DateClosed BETWEEN ReOpened.DateReopened AND #BeginDate ) ) AS OpenCasesCount
nested select statement help
I am having trouble displaying the number of opencases that are found in my stored procedure, I am not sure if that select statement is placed properly. BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT C.CaseNumber , O.OfficeName , CT.Description AS CaseType, C.DateOpened AS DateOpened, CR.Description AS Court FROM ( SELECT C.CaseId, O.OfficeId FROM [Case] C INNER JOIN [Appointment] A ON C.CaseId = A.CaseId INNER JOIN [Office] O ON A.OfficeId = O.OfficeId, ( SELECT COUNT(DISTINCT CD.CaseId) FROM [Case] CD INNER JOIN CaseOffice COD ON CD.CaseId = COD.CaseId INNER JOIN Office OD ON COD.OfficeId = OD.OfficeId LEFT OUTER JOIN CaseStatusChange CSC ON CD.CaseId = CSC.CaseId WHERE OD.OfficeId = O.OfficeId AND ( CD.DateOpened BETWEEN #BeginDate AND #EndDate OR CSC.DateReopened BETWEEN #BeginDate AND #EndDate ) )AS OpenCases WHERE -- Case was open (or reopened) during the date range C.DateOpened BETWEEN #beginDate AND #endDate OR C.CaseId IN (SELECT CaseId FROM CaseStatusChange WHERE DateReopened BETWEEN #beginDate AND #endDate) AND -- Office had an appointment sometime during the date range A.DateOn < #endDate AND (A.DateOff IS NULL OR A.DateOff BETWEEN #beginDate AND #endDate) GROUP BY C.CaseId, O.OfficeId ) CaseOfficeAppointment INNER JOIN [Case] C ON CaseOfficeAppointment.CaseId = C.CaseId INNER JOIN [Office] O ON CaseOfficeAppointment.OfficeId = O.OfficeId INNER JOIN [CaseType] CT ON C.CaseTypeId = CT.CaseTypeId INNER JOIN [Court] CR ON C.CourtId = CR.CourtId
OpenCases should occur before the Join statements as OpenCases is a data Column BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT C.CaseNumber, O.OfficeName, CT.Description AS CaseType, DATEADD(dd, 0, DATEDIFF(dd, 0, C.DateOpened)) AS DateOpened, CR.Description AS Court, CaseOfficeAppointment.OpenCases FROM ( SELECT C.CaseId, O.OfficeId, ( SELECT COUNT(DISTINCT CD.CaseId) FROM [Case] CD INNER JOIN CaseOffice COD ON CD.CaseId = COD.CaseId INNER JOIN Office OD ON COD.OfficeId = OD.OfficeId LEFT OUTER JOIN CaseStatusChange CSC ON CD.CaseId = CSC.CaseId WHERE OD.OfficeId = O.OfficeId AND ( CD.DateOpened BETWEEN #BeginDate AND #EndDate OR CSC.DateReopened BETWEEN #BeginDate AND #EndDate ) )AS OpenCases FROM [Case] C INNER JOIN [Appointment] A ON C.CaseId = A.CaseId INNER JOIN [Office] O ON A.OfficeId = O.OfficeId WHERE -- Case was open (or reopened) during the date range C.DateOpened BETWEEN #beginDate AND #endDate OR C.CaseId IN (SELECT CaseId FROM CaseStatusChange WHERE DateReopened BETWEEN #beginDate AND #endDate) AND -- Office had an appointment sometime during the date range A.DateOn < #endDate AND (A.DateOff IS NULL OR A.DateOff BETWEEN #beginDate AND #endDate) GROUP BY C.CaseId, O.OfficeId ) CaseOfficeAppointment INNER JOIN [Case] C ON CaseOfficeAppointment.CaseId = C.CaseId INNER JOIN [Office] O ON CaseOfficeAppointment.OfficeId = O.OfficeId INNER JOIN [CaseType] CT ON C.CaseTypeId = CT.CaseTypeId INNER JOIN [Court] CR ON C.CourtId = CR.CourtId
Running Heroku rake db:migrate on Heroku not migrating the database
so when I run heroku rake db:migrate, after pushing my latest code Heroku doesn't alter the tables. However, when I try on my pc(where I also use Postgresql) and run rake db:migrate, it migrates the database and adds the necessary tables and fields to existing tables. However, from heroku, I don't get any errors, this is the response I get. SQL (2.4ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'flow_elements' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (2.2ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"flows"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.7ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"flows"'::regclass SQL (2.7ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'flows' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (2.3ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"images"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.3ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"images"'::regclass SQL (2.3ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'images' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (2.2ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"login_histories"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.8ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"login_histories"'::regclass SQL (2.7ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'login_histories' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (2.1ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"projects"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.2ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"projects"'::regclass SQL (2.6ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'projects' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (2.3ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"projects_users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.5ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"projects_users"'::regclass SQL (2.4ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'projects_users' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (2.2ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"questions"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.2ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"questions"'::regclass SQL (2.4ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'questions' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname Columns for index questions_fts_idx on questions (1.8ms) SELECT a.attnum, a. attname FROM pg_attribute a WHERE a.attrelid = 48972 AND a.attnum IN (0) SQL (2.1ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"screens"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (4.3ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"screens"'::regclass SQL (2.4ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'screens' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname SQL (3.0ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum PK and serial sequence (3.6ms) SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"users"'::regclass SQL (2.4ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid FROM pg_class t, pg_class i, pg_index d WHERE i.relkind = 'i' AND d.indexrelid = i.oid AND d.indisprimary = 'f' AND t.oid = d.indrelid AND t.relname = 'users' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"' ,'public') ) ORDER BY i.relname Any ideas ?
You need to restart the heroku servers using "heroku restart".