http://pastie.org/1082451

I've made a pastie which demonstrates the behavior I'm seeing.

I realize overriding quote_table_schema is a bad idea, but I just need
to figure out how to get this to work, then can fix it later.

I've overridden it, as you can see in the pastie. But... something
like quote_schema_table still seems to be happening in the insert.
Any idea where to look?

Thanks,

Rolf

http://pastie.org/1082451

On Thu, Aug 5, 2010 at 8:06 PM, Rolf Hanson <[email protected]> wrote:
> You're right... but, it definitely does not work with the JDBC driver.
> I will investigate further.
>
> On Thu, Aug 5, 2010 at 7:38 PM, Jeremy Evans <[email protected]> wrote:
>> On Aug 5, 2:40 pm, Rolf Hanson <[email protected]> wrote:
>>> quote_schema_table seems to make Sequel want to do things with schemas
>>> and tables that look like this:
>>>
>>> "RAW_SCHEMA"."USERS"
>>>
>>> this doesn't seem to be valid in postgres. What I want is just
>>> "RAW_SCHEMA.USERS".
>>
>> Um, that's not a schema qualified table.  That's a regular table name
>> with an embedded period.  The way Sequel quotes schemas on PostgreSQL
>> (quoting the schema and table name separately) is correct:
>>
>> $ psql -U postgres sequel_test
>> sequel_test=# CREATE TABLE "public.foo" (a integer);
>> CREATE TABLE
>> sequel_test=# CREATE TABLE "public"."foo" (a integer);
>> CREATE TABLE
>> sequel_test=# INSERT INTO "public.foo" VALUES (1);
>> INSERT 0 1
>> sequel_test=# INSERT INTO "public"."foo" VALUES (2);
>> INSERT 0 1
>> sequel_test=# INSERT INTO "foo" VALUES (3);
>> INSERT 0 1
>> sequel_test=# SELECT * FROM "foo";
>>  a
>> ---
>>  2
>>  3
>> (2 rows)
>>
>> sequel_test=# SELECT * FROM "public"."foo";
>>  a
>> ---
>>  2
>>  3
>> (2 rows)
>>
>> sequel_test=# SELECT * FROM "public.foo";
>>  a
>> ---
>>  1
>> (1 row)
>>
>> sequel_test=# SELECT * FROM public.foo;
>>  a
>> ---
>>  2
>>  3
>> (2 rows)
>>
>> sequel_test=# SELECT * FROM "public"."public.foo";
>>  a
>> ---
>>  1
>> (1 row)
>>
>>> I've overridden this in my own Database class for creating tables:
>>>
>>> class Database
>>>   def quote_schema_table(table)
>>>       schema, table = schema_and_table(table)
>>>       "#{"#{schema}." if schema}#{table}"
>>>     end
>>> end
>>>
>>> However, sequel is still trying to do inserts into "RAW_SCHEMA"."USERS"
>>>
>>> is there another place I need to override quote_schema_table?  Or is
>>> there another function I need to change?
>>
>> quote_schema_table is a dataset method, not a database method, so you
>> would need to override in the dataset class for your adapter.  Not
>> that you would actually want to do this.
>>
>> Jeremy
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sequel-talk" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/sequel-talk?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to