<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/connections/postgresql_connection.rb</filename>
    </added>
    <added>
      <filename>spec/schemas/postgresql_schema.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -17,7 +17,7 @@ Spec::Rake::SpecTask.new(:coverage) do |t|
 end
 
 namespace :spec do
-  for adapter in %w[mysql sqlite3]
+  for adapter in %w[mysql sqlite3 postgresql]
     desc &quot;Run specs with the #{adapter} database adapter&quot;
     Spec::Rake::SpecTask.new(adapter) do |t|
       t.spec_files =
@@ -29,7 +29,7 @@ namespace :spec do
 end
 
 desc &quot;Run specs with mysql and sqlite3 database adapters (default)&quot;
-task :spec =&gt; [&quot;spec:sqlite3&quot;, &quot;spec:mysql&quot;]
+task :spec =&gt; [&quot;spec:sqlite3&quot;, &quot;spec:mysql&quot;, &quot;spec:postgresql&quot;]
 
 desc &quot;Default task is to run specs&quot;
 task :default =&gt; :spec</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,11 @@ module Arel
               sql.should be_like(%Q{(`users`.`id` &lt;=&gt; 1 OR `users`.`name` &lt;=&gt; 'name')})
             end
 
-            adapter_is_not :mysql do
+            adapter_is :postgresql do
+              sql.should be_like(%Q{(&quot;users&quot;.&quot;id&quot; &lt;=&gt; 1 OR &quot;users&quot;.&quot;name&quot; &lt;=&gt; E'name')})
+            end
+
+            adapter_is :sqlite3 do
               sql.should be_like(%Q{(&quot;users&quot;.&quot;id&quot; &lt;=&gt; 1 OR &quot;users&quot;.&quot;name&quot; &lt;=&gt; 'name')})
             end
           end
@@ -44,9 +48,13 @@ module Arel
               sql.should be_like(%Q{(`users`.`id` &lt;=&gt; 1 AND `users`.`name` &lt;=&gt; 'name')})
             end
 
-            adapter_is_not :mysql do
+            adapter_is :sqlite3 do
               sql.should be_like(%Q{(&quot;users&quot;.&quot;id&quot; &lt;=&gt; 1 AND &quot;users&quot;.&quot;name&quot; &lt;=&gt; 'name')})
             end
+
+            adapter_is :postgresql do
+              sql.should be_like(%Q{(&quot;users&quot;.&quot;id&quot; &lt;=&gt; 1 AND &quot;users&quot;.&quot;name&quot; &lt;=&gt; E'name')})
+            end
           end
         end
       end
@@ -94,9 +102,13 @@ module Arel
               sql.should be_like(%Q{`users`.`name` &lt;=&gt; '1-asdf'})
             end
 
-            adapter_is_not :mysql do
+            adapter_is :sqlite3 do
               sql.should be_like(%Q{&quot;users&quot;.&quot;name&quot; &lt;=&gt; '1-asdf'})
             end
+
+            adapter_is :postgresql do
+              sql.should be_like(%Q{&quot;users&quot;.&quot;name&quot; &lt;=&gt; E'1-asdf'})
+            end
           end
         end
       end</diff>
      <filename>spec/arel/engines/sql/unit/predicates/binary_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,14 @@ module Arel
     describe '#to_sql' do
       it &quot;appropriately quotes the value&quot; do
         Value.new(1, @relation).to_sql.should be_like('1')
-        Value.new('asdf', @relation).to_sql.should be_like(&quot;'asdf'&quot;)
+        
+        adapter_is_not :postgresql do
+          Value.new('asdf', @relation).to_sql.should be_like(&quot;'asdf'&quot;)
+        end
+        
+        adapter_is :postgresql do
+          Value.new('asdf', @relation).to_sql.should be_like(&quot;E'asdf'&quot;)
+        end
       end
     end
 </diff>
      <filename>spec/arel/engines/sql/unit/primitives/value_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,13 +30,21 @@ module Arel
           })
         end
 
-        adapter_is_not :mysql do
+        adapter_is :sqlite3 do
           @insertion.to_sql.should be_like(%Q{
             INSERT
             INTO &quot;users&quot;
             (&quot;id&quot;, &quot;name&quot;) VALUES (1, 'nick')
           })
         end
+
+        adapter_is :postgresql do
+          @insertion.to_sql.should be_like(%Q{
+            INSERT
+            INTO &quot;users&quot;
+            (&quot;id&quot;, &quot;name&quot;) VALUES (1, E'nick')
+          })
+        end
       end
 
       describe 'when given values whose types correspond to the types of the attributes' do
@@ -53,13 +61,21 @@ module Arel
             })
           end
 
-          adapter_is_not :mysql do
+          adapter_is :sqlite3 do
             @insertion.to_sql.should be_like(%Q{
               INSERT
               INTO &quot;users&quot;
               (&quot;name&quot;) VALUES ('nick')
             })
           end
+
+          adapter_is :postgresql do
+            @insertion.to_sql.should be_like(%Q{
+              INSERT
+              INTO &quot;users&quot;
+              (&quot;name&quot;) VALUES (E'nick')
+            })
+          end
         end
       end
 </diff>
      <filename>spec/arel/engines/sql/unit/relations/insert_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,12 +17,19 @@ module Arel
           })
         end
 
-        adapter_is_not :mysql do
+        adapter_is :sqlite3 do
           sql.should be_like(%Q{
             UPDATE &quot;users&quot;
             SET &quot;id&quot; = 1, &quot;name&quot; = 'nick'
           })
         end
+
+        adapter_is :postgresql do
+          sql.should be_like(%Q{
+            UPDATE &quot;users&quot;
+            SET &quot;id&quot; = 1, &quot;name&quot; = E'nick'
+          })
+        end
       end
 
       it &quot;manufactures sql updating attributes when given a ranged relation&quot; do
@@ -36,13 +43,21 @@ module Arel
           })
         end
 
-        adapter_is_not :mysql do
+        adapter_is :sqlite3 do
           sql.should be_like(%Q{
             UPDATE &quot;users&quot;
             SET &quot;name&quot; = 'nick'
             LIMIT 1
           })
         end
+
+        adapter_is :postgresql do
+          sql.should be_like(%Q{
+            UPDATE &quot;users&quot;
+            SET &quot;name&quot; = E'nick'
+            LIMIT 1
+          })
+        end
       end
 
       describe 'when given values whose types correspond to the types of the attributes' do
@@ -58,12 +73,19 @@ module Arel
             })
           end
 
-          adapter_is_not :mysql do
+          adapter_is :sqlite3 do
             @update.to_sql.should be_like(%Q{
               UPDATE &quot;users&quot;
               SET &quot;name&quot; = 'nick'
             })
           end
+
+          adapter_is :postgresql do
+            @update.to_sql.should be_like(%Q{
+              UPDATE &quot;users&quot;
+              SET &quot;name&quot; = E'nick'
+            })
+          end
         end
       end
 
@@ -106,13 +128,21 @@ module Arel
             })
           end
 
-          adapter_is_not :mysql do
+          adapter_is :sqlite3 do
             @update.to_sql.should be_like(%Q{
               UPDATE &quot;users&quot;
               SET &quot;name&quot; = 'nick'
               WHERE &quot;users&quot;.&quot;id&quot; = 1
             })
           end
+
+          adapter_is :postgresql do
+            @update.to_sql.should be_like(%Q{
+              UPDATE &quot;users&quot;
+              SET &quot;name&quot; = E'nick'
+              WHERE &quot;users&quot;.&quot;id&quot; = 1
+            })
+          end
         end
       end
     end</diff>
      <filename>spec/arel/engines/sql/unit/relations/update_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,11 +21,17 @@ module Arel
             })
           end
 
-          adapter_is_not :mysql do
+          adapter_is :sqlite3 do
             sql.should be_like(%Q{
               (&quot;users&quot;.&quot;id&quot; = 1 AND &quot;users&quot;.&quot;name&quot; = 'name')
             })
           end
+
+          adapter_is :postgresql do
+            sql.should be_like(%Q{
+              (&quot;users&quot;.&quot;id&quot; = 1 AND &quot;users&quot;.&quot;name&quot; = E'name')
+            })
+          end
         end
       end
     end
@@ -41,11 +47,17 @@ module Arel
             })
           end
 
-          adapter_is_not :mysql do
+          adapter_is :sqlite3 do
             sql.should be_like(%Q{
               (&quot;users&quot;.&quot;id&quot; = 1 OR &quot;users&quot;.&quot;name&quot; = 'name')
             })
           end
+
+          adapter_is :postgresql do
+            sql.should be_like(%Q{
+              (&quot;users&quot;.&quot;id&quot; = 1 OR &quot;users&quot;.&quot;name&quot; = E'name')
+            })
+          end
         end
       end
     end</diff>
      <filename>spec/arel/unit/predicates/predicates_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,15 +13,27 @@ end
 
 module AdapterGuards
   def adapter_is(name)
+    verify_adapter_name(name)
     yield if name.to_s == adapter_name
   end
 
   def adapter_is_not(name)
+    verify_adapter_name(name)
     yield if name.to_s != adapter_name
   end
 
   def adapter_name
-    Arel::Table.engine.connection.class.name.underscore.split(&quot;/&quot;).last.gsub(/_adapter/, '')
+    name = ActiveRecord::Base.configurations[&quot;unit&quot;][:adapter]
+    verify_adapter_name(name)
+    name
+  end
+
+  def verify_adapter_name(name)
+    raise &quot;Invalid adapter name: #{name}&quot; unless valid_adapters.include?(name.to_s)
+  end
+
+  def valid_adapters
+    %w[mysql postgresql sqlite3]
   end
 end
 </diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7fc820501ce7b997da43c47ec189aaa0d40645e1</id>
    </parent>
  </parents>
  <author>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </author>
  <url>http://github.com/nkallen/arel/commit/d2988420fc6dd91ca751d96ed648fd1ed52ce342</url>
  <id>d2988420fc6dd91ca751d96ed648fd1ed52ce342</id>
  <committed-date>2009-05-17T14:53:40-07:00</committed-date>
  <authored-date>2009-05-17T14:53:40-07:00</authored-date>
  <message>Added PostgreSQL to build</message>
  <tree>e817b2dcc2b8d018181fd676feb1648786d23de3</tree>
  <committer>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </committer>
</commit>
