Обсуждение: RE: [INTERFACES] Foreign Keys

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

RE: [INTERFACES] Foreign Keys

От
Michael Davis
Дата:
I have created the following trigger on the parent/master table (orders):

CREATE TRIGGER Orderlines_fkey
    BEFORE DELETE OR UPDATE ON Orders FOR EACH ROW
    EXECUTE PROCEDURE check_foreign_key ();

check_foreign_key() actually deletes rows from the orderlines table when
every a row is deleted from orders.  This triggers works great.  Access,
however, is still not recognizing the foreign key relationship between
orders and orderlines.  Any other suggestions?

Thanks, Michael


    -----Original Message-----
    From:    Byron Nikolaidis [SMTP:byronn@insightdist.com]
    Sent:    Thursday, February 25, 1999 8:38 AM
    To:    Michael Davis
    Cc:    'pgsql-interfaces@postgreSQL.org'; pgsql postgres;
pgsql-hackers@postgreSQL.org
    Subject:    Re: [INTERFACES] Foreign Keys



    Michael Davis wrote:

    > What is the possibility of recording foreign keys (a partial
foreign key
    > implementation) in the database such that the ODBC interface can
correctly
    > report them to client applications?  This would require an
enhancement to
    > Postgres and to the ODBC driver for Postgres.  I have a problem
with Access
    > 97 not working properly with forms that contain sub forms
representing
    > parent/child or master/detail tables.  For example: orders and
orderlines.
    > I think this is caused by the lack of foreign key support.  I am
basing this
    >

    The driver does support SQLForeignKeys.  It does say it supports
this function
    in SQLFunctions.

    However, the current implementation is based on the SPI/trigger
stuff from the
    pg_trigger table.  If you don't have any trigger info, then
SQLForeignKeys will
    not report anything.  This is most likely the problem.

    Byron

Re: [INTERFACES] Foreign Keys

От
Byron Nikolaidis
Дата:

Michael Davis wrote:

> I have created the following trigger on the parent/master table (orders):
>
> CREATE TRIGGER Orderlines_fkey
>     BEFORE DELETE OR UPDATE ON Orders FOR EACH ROW
>     EXECUTE PROCEDURE check_foreign_key ();
>
> check_foreign_key() actually deletes rows from the orderlines table when
> every a row is deleted from orders.  This triggers works great.  Access,
> however, is still not recognizing the foreign key relationship between
> orders and orderlines.  Any other suggestions?
>
> Thanks, Michael
>

Yeah, there is more we can try.  First of all, we need to verify that Access
is actually calling SQLForeignKeys.   Can you get a "trace" log of the
session?  This would be the "sql.log" file which contains all api calls to
odbc.  Make sure the file is clear beforehand.  Then run the test.  Quit
Access, turn tracing off and there's your logfile.  You can send it to me.

It might also be helpful to have the commlog file (produced by the
driver)...usually "psqlodbc.log".   It may have a process id number appended
to the filename so make sure you get the right one.

Byron