Обсуждение: psqlodbc

Поиск
Список
Период
Сортировка

psqlodbc

От
"Jose' Soares"
Дата:
Hi David and Byron,

I have another problem with psqlodbc using m$access.
I have the following query:

SELECT azienda, attivita, specifica, inizio_attivita, fine_attivita
FROM ATTIVITA WHERE attivita<='10'
UNION ALL
SELECT azienda, attivita, specifica, inizio_attivita, fine_attivita
FROM figure
INNER JOIN attivita ON figure.codice_figura = attivita.azienda
WHERE figure.tipo='A';

Seems that psqlodbc translate it in a wrong way because it enclose
SELECTS between () and PostgreSQL doesn't understands (SELECT ....):
Here the log file:
-------------------------------------------------------------------
STATEMENT ERROR: func=SC_execute, desc='', errnum=1, errmsg='Error while
executi
ng the query'

------------------------------------------------------------
                 hdbc=54067320, stmt=54081812, result=0
                 manual_result=0, prepare=0, internal=0
                 bindings=0, bindings_allocated=0
                 parameters=0, parameters_allocated=0
                 statement_type=-1, statement='(SELECT "azienda"
,"attivita" ,"s
pecifica" ,"inizio_attivita" ,"fine_attivita"  FROM "attivita" WHERE
("attivita"
 <= '10' ) ) UNION ALL (SELECT "attivita"."azienda"
,"attivita"."attivita" ,"att
ivita"."specifica" ,"attivita"."inizio_attivita"
,"attivita"."fine_attivita"  FR
OM "figure","attivita" WHERE (("figure"."tipo" = 'A' ) AND
("figure"."codice_fig
ura" = "attivita"."azienda" ) ) )'
                 stmt_with_params=''
                 data_at_exec=-1, current_exec_param=-1, put_data=0
                 currTuple=-1, current_col=-1, lobj_fd=-1
                 maxRows=0, rowset_size=1, keyset_size=0, cursor_type=0,
scroll_
concurrency=1
                 cursor_name='SQL_CUR03393914'
-----------------------------------------------------------------------

Thanks for any help

-Jose'-

Re: [INTERFACES] psqlodbc

От
David Hartwig
Дата:
The driver does not rewrite queries.    This would be the wisdom of the MS
Jet Engine.  My guess is, that the backend should handle this statement:

    daveh=> (select 1) union all (select 2);
    ERROR:  parser: parse error at or near "("

In the meantime, can you construct this as a pass-through query?

Jose' Soares wrote:

> Hi David and Byron,
>
> I have another problem with psqlodbc using m$access.
> I have the following query:
>
> SELECT azienda, attivita, specifica, inizio_attivita, fine_attivita
> FROM ATTIVITA WHERE attivita<='10'
> UNION ALL
> SELECT azienda, attivita, specifica, inizio_attivita, fine_attivita
> FROM figure
> INNER JOIN attivita ON figure.codice_figura = attivita.azienda
> WHERE figure.tipo='A';
>
> Seems that psqlodbc translate it in a wrong way because it enclose
> SELECTS between () and PostgreSQL doesn't understands (SELECT ....):
> Here the log file:
> -------------------------------------------------------------------
> STATEMENT ERROR: func=SC_execute, desc='', errnum=1, errmsg='Error while
> executi
> ng the query'
>
> ------------------------------------------------------------
>                  hdbc=54067320, stmt=54081812, result=0
>                  manual_result=0, prepare=0, internal=0
>                  bindings=0, bindings_allocated=0
>                  parameters=0, parameters_allocated=0
>                  statement_type=-1, statement='(SELECT "azienda"
> ,"attivita" ,"s
> pecifica" ,"inizio_attivita" ,"fine_attivita"  FROM "attivita" WHERE
> ("attivita"
>  <= '10' ) ) UNION ALL (SELECT "attivita"."azienda"
> ,"attivita"."attivita" ,"att
> ivita"."specifica" ,"attivita"."inizio_attivita"
> ,"attivita"."fine_attivita"  FR
> OM "figure","attivita" WHERE (("figure"."tipo" = 'A' ) AND
> ("figure"."codice_fig
> ura" = "attivita"."azienda" ) ) )'
>                  stmt_with_params=''
>                  data_at_exec=-1, current_exec_param=-1, put_data=0
>                  currTuple=-1, current_col=-1, lobj_fd=-1
>                  maxRows=0, rowset_size=1, keyset_size=0, cursor_type=0,
> scroll_
> concurrency=1
>                  cursor_name='SQL_CUR03393914'
> -----------------------------------------------------------------------
>
> Thanks for any help
>
> -Jose'-