Note that there are some explanatory texts on larger screens.

plurals
  1. POSequel default example fails when switched to postgres adapter
    primarykey
    data
    text
    <p>I'm trying to run the Sequel example from <a href="http://sequel.rubyforge.org/" rel="nofollow">http://sequel.rubyforge.org/</a>. Everything works fine on sqlite, but fails when I switch to postgres.</p> <p>This is the connection code:</p> <pre><code>DB = Sequel.connect(:adapter=&gt;'postgres', :host=&gt;'localhost', :database=&gt;'testing', :user=&gt;'postgres', :default_schema=&gt;'sequel') </code></pre> <p>This is the error I get:</p> <pre><code>postgres.rb:145:in `async_exec': PG::Error: ERROR: relation "items" does not exist (Sequel::DatabaseError) LINE 1: INSERT INTO "items" ("price", "name") VALUES (12.45377636338... </code></pre> <p>I'm suspecting that the issue is Sequel trying to execute INSERT INTO <em>"items"</em> instead <em>"sequel.items"</em>, even though :default_schema is correctly set.</p> <p>Anyone have any idea what i'm doing wrong? Thanks in advance.</p> <p>Edit - this is the code used:</p> <pre><code>require "rubygems" require "sequel" # connect to an in-memory database #DB = Sequel.sqlite DB = Sequel.connect(:adapter=&gt;'postgres', :host=&gt;'localhost', :database=&gt;'testing', :user=&gt;'postgres', :default_schema=&gt;'sequel') # create an items table DB.create_table :items do primary_key :id String :name Float :price end # create a dataset from the items table items = DB[:items] # populate the table items.insert(:name =&gt; 'abc', :price =&gt; rand * 100) items.insert(:name =&gt; 'def', :price =&gt; rand * 100) items.insert(:name =&gt; 'ghi', :price =&gt; rand * 100) # print out the number of records puts "Item count: #{items.count}" </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload