help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] ROE and domains-table


From: Stefan Schmiedl
Subject: Re: [Help-smalltalk] ROE and domains-table
Date: Tue, 25 Jan 2011 20:03:34 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Paolo Bonzini (24.01. 22:32):

> On 01/24/2011 10:03 PM, Stefan Schmiedl wrote:
> > Looks like it's somehow getting one of postgresql's system tables
> > instead of my public.domains.
> 
> I suggest you start from the query in dbd-postgresql/Table.st:
> 
> select column_name, data_type, character_maximum_length,
>               numeric_precision, numeric_precision_radix, numeric_scale,
>               is_nullable, ordinal_position
>               from information_schema.columns
>               where table_name = 'domains' and table_catalog = 'vmail'
>               order by ordinal_position
> 
> fix it :) and see what needs to be changed.

If I didn't mess up, this diff should be against the current (as of 5 min ago)
master branch of the git repo.

diff --git a/packages/dbd-postgresql/Table.st b/packages/dbd-postgresql/Table.st
index f892fae..14f3f83 100644
--- a/packages/dbd-postgresql/Table.st
+++ b/packages/dbd-postgresql/Table.st
@@ -44,15 +44,15 @@ Table subclass: PGTable [
        | query resultSet |
        columnsArray isNil ifTrue: [
            query := 'select column_name, data_type, character_maximum_length,
                numeric_precision, numeric_precision_radix, numeric_scale,
                is_nullable, ordinal_position
                from information_schema.columns
-               where table_name = %1 and table_catalog = %2
+               where table_schema = current_schema and table_name = %1 and 
table_catalog = %2
                order by ordinal_position' % {
                    self name printString. self connection database printString 
}.
            resultSet := self connection select: query.
            columnsArray := resultSet rows
                collect: [ :row | PGTableColumnInfo from: row ] ].
        ^columnsArray
     ]
 ]


Running this modified query shows only the two columns that I expect.

Fascinating stuff you can find in postgres. A bit non-obvious, but
fascinating :-)

Does anybody use different schemata in whatever kind of database application
they are building? Making this stuff work with multiple schemata would be
a nice job for somebody with some spare time.

Thanks,
s.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]