Thread: psqlodbc - SysTAble Prefixes issue

psqlodbc - SysTAble Prefixes issue

From
brajmohan saxena
Date:
Hi,

While using the Windows psqlodbc driver, I found there is one ODBC
configuration parameter "SysTable Prefixes" set by default to "dd_".

So when I try to use SQLTables ODBC call to get the user defined tables
which is created with prefixed "dd_" I am able to get the tables with
psqlodbc-9.3.4 but this is not the case if I use the psqlodbc-9.5.4 Driver.
If i remove "dd_" from SysTable Prefixes config parameter it gives me the
tables which are prefixed with "dd_"  for psqlodbc-9.5.4.

So could you please let me know if this behaviour is expected or is there
any issue with the latest psqlodbc drivers.

Thanks in advance,


Thanks
Braj

Re: psqlodbc - SysTAble Prefixes issue

From
Heikki Linnakangas
Date:
On 10/10/2016 01:12 PM, brajmohan saxena wrote:
> Hi,
>
> While using the Windows psqlodbc driver, I found there is one ODBC
> configuration parameter *"SysTable Prefixes"* set by default to "dd_".
>
> So when I try to use *SQLTables* ODBC call to get the user defined tables
> which is created with prefixed "dd_" I am able to get the tables with
> psqlodbc-9.3.4 but this is not the case if I use the psqlodbc-9.5.4 Driver.
> If i remove "dd_" from SysTable Prefixes config parameter it gives me the
> tables which are prefixed with "dd_"  for psqlodbc-9.5.4.

The default systable prefix is indeed "dd_". Why? I don't know. Looking
at the git history, that goes all the way back to the first commit that
added the very first version of the driver, in 1998.

In the beginning, the code looked like this:

/*     These prefixes denote system tables */
#define INSIGHT_SYS_PREFIX     "dd_"
#define POSTGRES_SYS_PREFIX    "pg_"
#define KEYS_TABLE                     "dd_fkey"

Back in the day, the driver was overhauled and maintained by a company
called Insight Distribution Systems (now defunct, AFAIK). So I'm
guessing that the early versions of the driver added some tables or
views, and they had the prefix "dd_".

I think we should remove the dd_ prefix from the default. Whatever it
was originally used for, it's clearly obsolete at this point.

Meanwhile, you can just remove it from your ODBC configuration.

- Heikki



Re: psqlodbc - SysTAble Prefixes issue

From
"Tsunakawa, Takayuki"
Date:
From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Heikki Linnakangas
> I think we should remove the dd_ prefix from the default. Whatever it was
> originally used for, it's clearly obsolete at this point.

Stepping further, why don't we remove the ExtraSysTablePrefixes parameter?  I think we should simplify the driver usage
forusers by reducing the number of parameters, as well as reduce the code for psqlODBC developers.  I can understand
theconcern for incompatibility, but it's not sound to retain things of no good use.
 

I wonder whether EnterpriseDB uses this parameter for Oracle compatibility.

Regards
Takayuki Tsunakawa



Re: psqlodbc - SysTAble Prefixes issue

From
brajmohan saxena
Date:
I feel this is introduces to consider some default ExtraSysTablePrefixes I am not sure in which case it will be used. As for as i understand there will be no User specific system table considered in Postgres prefixing with "dd_". So there is no point to keep this extra psqlODBC config parameter in future.

I can find it only at the following two places in the psqlodbc branch 


1) in dlg_specific.h

          #define DEFAULT_EXTRASYSTABLEPREFIXES   "dd_"

2) In dlg_specific.c 

      /* Extra Systable prefixes */

        /*
         * Use @@@ to distinguish between blank extra prefixes and no key
         * entry
         */
        SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@",
                                                           temp, sizeof(temp), filename);
        if (strcmp(temp, "@@@"))
                strcpy(comval->extra_systable_prefixes, temp);
        else if (inst_position)
                strcpy(comval->extra_systable_prefixes, DEFAULT_EXTRASYSTABLEPREFIXES);

        mylog("ci=%p globals.extra_systable_prefixes = '%s'\n", ci, comval->extra_systable_prefixes);




On Wed, Oct 19, 2016 at 1:48 PM, Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com> wrote:
From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Heikki Linnakangas
> I think we should remove the dd_ prefix from the default. Whatever it was
> originally used for, it's clearly obsolete at this point.

Stepping further, why don't we remove the ExtraSysTablePrefixes parameter?  I think we should simplify the driver usage for users by reducing the number of parameters, as well as reduce the code for psqlODBC developers.  I can understand the concern for incompatibility, but it's not sound to retain things of no good use.

I wonder whether EnterpriseDB uses this parameter for Oracle compatibility.

Regards
Takayuki Tsunakawa



Re: psqlodbc - SysTAble Prefixes issue

From
Heikki Linnakangas
Date:
On 11/15/2016 10:21 AM, brajmohan saxena wrote:
> I feel this is introduces to consider some default *ExtraSysTablePrefixes *I
> am not sure in which case it will be used. As for as i understand there
> will be no User specific system table considered in Postgres prefixing with
> "dd_". So there is no point to keep this extra psqlODBC config parameter in
> future.

The driver itself certainly doesn't need it for anything. I can see it
being useful for forks or extensions, that introduce "system" tables,
with a different prefix. Takayuki-san mentioned EnterpriseDB, and I know
Greenplum has some tables with the gp_* prefix, for which this might be
useful. I don't think either of those actually uses this feature, but it
might come handy.

So, I removed the "dd_*" from the default, but left the option in place.
Thanks!

- Heikki



Re: [ODBC] psqlodbc - SysTAble Prefixes issue

From
"Tsunakawa, Takayuki"
Date:
From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Heikki Linnakangas
> On 11/15/2016 10:21 AM, brajmohan saxena wrote:
> > I feel this is introduces to consider some default
> > *ExtraSysTablePrefixes *I am not sure in which case it will be used.
> > As for as i understand there will be no User specific system table
> > considered in Postgres prefixing with "dd_". So there is no point to
> > keep this extra psqlODBC config parameter in future.
> 
> The driver itself certainly doesn't need it for anything. I can see it being
> useful for forks or extensions, that introduce "system" tables, with a
> different prefix. Takayuki-san mentioned EnterpriseDB, and I know Greenplum
> has some tables with the gp_* prefix, for which this might be useful. I
> don't think either of those actually uses this feature, but it might come
> handy.
> 
> So, I removed the "dd_*" from the default, but left the option in place.

+1

Regards
Takayuki Tsunakawa