Thread: Bug: Foreign Data Table DDL SQL is mangled

Bug: Foreign Data Table DDL SQL is mangled

From
"Paragon Corporation"
Date:
I'm testing on Windows 2008 64-bit pgAdmin 1.14.2

I used the odbc_fdw based foreign data table that I created with this
statement:

CREATE FOREIGN TABLE my_tables
(table_catalog character varying(128) ,
table_schema character varying(128) ,
table_name character varying(128) ,
table_type character varying(128) )
SERVER localsql2005
OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
varchar(128)) As table_catalog
, CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
varchar(128)) As table_name
, CAST(TABLE_TYPE As varchar(128)) As table_type
FROM information_schema.tables', sql_count 'select count(TABLE_NAME) from
information_schema.tables');


When I use pgAdmin to regenerate the SQL ddl for it, it generates this
malformed thing that can't be run:


CREATE FOREIGN TABLE my_tables
(table_catalog character varying(128) ,
table_schema character varying(128) ,
table_name character varying(128) ,
table_type character varying(128) )
SERVER localsql2005
OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
varchar(128)) As table_catalog
, CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
varchar(128)) As table_name
, CAST(TABLE_TYPE As varchar(128)) As table_type
FROM information_schema.tables', ,"sql_count 'select count(TABLE_NAME) from
information_schema.tables"');
Thanks,
Regina




Re: Bug: Foreign Data Table DDL SQL is mangled

From
Guillaume Lelarge
Date:
On Mon, 2012-04-16 at 09:12 -0400, Paragon Corporation wrote:
> I'm testing on Windows 2008 64-bit pgAdmin 1.14.2
> 
> I used the odbc_fdw based foreign data table that I created with this
> statement:
> 
> CREATE FOREIGN TABLE my_tables
> (table_catalog character varying(128) ,
> table_schema character varying(128) ,
> table_name character varying(128) ,
> table_type character varying(128) )
> SERVER localsql2005
> OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
> varchar(128)) As table_catalog
> , CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
> varchar(128)) As table_name
> , CAST(TABLE_TYPE As varchar(128)) As table_type
> FROM information_schema.tables', sql_count 'select count(TABLE_NAME) from
> information_schema.tables');
> 
> 
> When I use pgAdmin to regenerate the SQL ddl for it, it generates this
> malformed thing that can't be run:
> 
> 
> CREATE FOREIGN TABLE my_tables
> (table_catalog character varying(128) ,
> table_schema character varying(128) ,
> table_name character varying(128) ,
> table_type character varying(128) )
> SERVER localsql2005
> OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
> varchar(128)) As table_catalog
> , CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
> varchar(128)) As table_name
> , CAST(TABLE_TYPE As varchar(128)) As table_type
> FROM information_schema.tables', ,"sql_count 'select count(TABLE_NAME) from
> information_schema.tables"');
>  

I reproduce your issue. I'll work on that tomorrow evening.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Bug: Foreign Data Table DDL SQL is mangled

From
Guillaume Lelarge
Date:
On Mon, 2012-04-16 at 23:59 +0200, Guillaume Lelarge wrote:
> On Mon, 2012-04-16 at 09:12 -0400, Paragon Corporation wrote:
> > I'm testing on Windows 2008 64-bit pgAdmin 1.14.2
> > 
> > I used the odbc_fdw based foreign data table that I created with this
> > statement:
> > 
> > CREATE FOREIGN TABLE my_tables
> > (table_catalog character varying(128) ,
> > table_schema character varying(128) ,
> > table_name character varying(128) ,
> > table_type character varying(128) )
> > SERVER localsql2005
> > OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
> > varchar(128)) As table_catalog
> > , CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
> > varchar(128)) As table_name
> > , CAST(TABLE_TYPE As varchar(128)) As table_type
> > FROM information_schema.tables', sql_count 'select count(TABLE_NAME) from
> > information_schema.tables');
> > 
> > 
> > When I use pgAdmin to regenerate the SQL ddl for it, it generates this
> > malformed thing that can't be run:
> > 
> > 
> > CREATE FOREIGN TABLE my_tables
> > (table_catalog character varying(128) ,
> > table_schema character varying(128) ,
> > table_name character varying(128) ,
> > table_type character varying(128) )
> > SERVER localsql2005
> > OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
> > varchar(128)) As table_catalog
> > , CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
> > varchar(128)) As table_name
> > , CAST(TABLE_TYPE As varchar(128)) As table_type
> > FROM information_schema.tables', ,"sql_count 'select count(TABLE_NAME) from
> > information_schema.tables"');
> >  
> 
> I reproduce your issue. I'll work on that tomorrow evening.
> 

Fixed.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Bug: Foreign Data Table DDL SQL is mangled

From
Guillaume Lelarge
Date:
On Tue, 2012-04-17 at 23:39 +0200, Guillaume Lelarge wrote:
> On Mon, 2012-04-16 at 23:59 +0200, Guillaume Lelarge wrote:
> > On Mon, 2012-04-16 at 09:12 -0400, Paragon Corporation wrote:
> > > I'm testing on Windows 2008 64-bit pgAdmin 1.14.2
> > > 
> > > I used the odbc_fdw based foreign data table that I created with this
> > > statement:
> > > 
> > > CREATE FOREIGN TABLE my_tables
> > > (table_catalog character varying(128) ,
> > > table_schema character varying(128) ,
> > > table_name character varying(128) ,
> > > table_type character varying(128) )
> > > SERVER localsql2005
> > > OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
> > > varchar(128)) As table_catalog
> > > , CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
> > > varchar(128)) As table_name
> > > , CAST(TABLE_TYPE As varchar(128)) As table_type
> > > FROM information_schema.tables', sql_count 'select count(TABLE_NAME) from
> > > information_schema.tables');
> > > 
> > > 
> > > When I use pgAdmin to regenerate the SQL ddl for it, it generates this
> > > malformed thing that can't be run:
> > > 
> > > 
> > > CREATE FOREIGN TABLE my_tables
> > > (table_catalog character varying(128) ,
> > > table_schema character varying(128) ,
> > > table_name character varying(128) ,
> > > table_type character varying(128) )
> > > SERVER localsql2005
> > > OPTIONS (database 'myserver2005', sql_query 'SELECT CAST(TABLE_CATALOG As
> > > varchar(128)) As table_catalog
> > > , CAST(TABLE_SCHEMA As varchar(128)) As table_schema, CAST(TABLE_NAME As
> > > varchar(128)) As table_name
> > > , CAST(TABLE_TYPE As varchar(128)) As table_type
> > > FROM information_schema.tables', ,"sql_count 'select count(TABLE_NAME) from
> > > information_schema.tables"');
> > >  
> > 
> > I reproduce your issue. I'll work on that tomorrow evening.
> > 
> 
> Fixed.
> 

And, BTW, thanks for your report.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com