incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ward Vandewege (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HERALDRY-4) the Ruby Heraldry OpenID server does not support a PostgreSQL backend out of the box
Date Fri, 15 Jun 2007 17:03:27 GMT

    [ https://issues.apache.org/jira/browse/HERALDRY-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505307
] 

Ward Vandewege commented on HERALDRY-4:
---------------------------------------

Ugh, the bugtracker ate half of my message. Here's a better version of my
reply:

You said:
Looks like the first two patches add quotes around the number 1. I'm assuming
this is due to Postgres treating the number as a string and thus requiring
quotes.?.

I said: 
Correct.

You said:
I'm also a bit at a loss as to the last patch. What does the SELECT setval do
for Postgres?

I said:
It sets the sequence value. Postgres won't let you use currval on a sequence
before the sequence has been used in the current session. Hence the use of
setval to set the sequence to a sane value. Another way to do this would be
to insert a row.

Thanks,
Ward.

-- 
Pong.be         -(  There are only 10 kinds of people in the world. Those  )-
Virtual hosting -(   who understand binary, and those who don't. -- Bear   )-
http://pong.be  -(                                                         )-
GnuPG public key: http://gpg.dtype.org


> the Ruby Heraldry OpenID server does not support a PostgreSQL backend out of the box
> ------------------------------------------------------------------------------------
>
>                 Key: HERALDRY-4
>                 URL: https://issues.apache.org/jira/browse/HERALDRY-4
>             Project: Heraldry
>          Issue Type: Improvement
>            Reporter: Ward Vandewege
>
> The Ruby Heraldry OpenID server does not support a PostgreSQL backend out of the box.
These two patches are simple fixes that will not affect MySQL:
> --- app/models/property_type.rb (revision 508264)
> +++ app/models/property_type.rb (working copy)
> @@ -52,7 +52,7 @@
>      # ====Parameters
>      # user:: The User for whom we're finding PropertyTypes.
>      def roots_global_or_owned_by(user)
> -      find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= 1 OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at ASC')
> +      find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= \'1\' OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at
ASC')
>      end
>    end
> --- db/migrate/026_reorder_personal_property_types.rb   (revision 508264)
> +++ db/migrate/026_reorder_personal_property_types.rb   (working copy)
> @@ -43,7 +43,7 @@
>        end
>  
>        def roots_global_or_owned_by(user)
> -        find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= 1 OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at ASC')
> +        find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= \'1\' OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at
ASC')
>        end
>      end
>  
> Finally, this patch is also necessary, but it needs a bit of work:
> --- db/migrate/022_globalize_migration.rb       (revision 508264)
> +++ db/migrate/022_globalize_migration.rb       (working copy)
> @@ -65,6 +65,13 @@
>        t.column :scope, :string, :limit => 1
>      end
>  
> +    # Added for PostgresSQL
> +    tables = ['globalize_countries', 'globalize_translations', 'globalize_languages']
> +      tables.each do |table|
> +      sql = "SELECT setval('#{table}_id_seq', 1)" 
> +      ActiveRecord::Base.connection.execute(sql)
> +    end
> +
>      add_index :globalize_languages, :iso_639_1
>      add_index :globalize_languages, :iso_639_2  
>      add_index :globalize_languages, :iso_639_3  
> The problem is that the rake db:migrate command fails because PostgreSQL does not allow
using currval on a sequence that has not been used in the current session. This patch fixes
this, but it will break MySQL support. A detection of the database backend needs to be added
to it before it goes into the svn tree.
> Any questions, please feel free to contact me.
> Thanks,
> Ward.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message