Pg 'v' Mysql & primary_key_info() & foreign_key_info()



Hi Folks

At http://savage.net.au/Perl/list-indexes.pl you can download a demo program.

Comments within the code are:
# Set DBI_DSN=dbi:mysql:name-of-db
# or DBI_DSN=dbi:Pg:dbname=name-of-db
# Set DBI_USER=a-name
# Set DBI_PASS=a-password

Give the program 1 table name of an existing database on the command line, where
there are other tables with foreign keys pointing to the primary key of that
table.

Here are my results:
OS: GNU/Linux 2.4.21
Perl: 5.8.0
DBI 1.48
Postgres: 7.4.7
DBD::Pg: 1.42
Primary keys found: 1 (correct)
Foreign keys found: 4 (correct)

OS: WinXP
Perl: 5.8.6
DBI: 1.48
MySQL: 4.1.10
DBD::mysql: 2.9007
Primary keys found: 0 (wrong)
Foreign keys found: 0 (wrong)

Where exactly is the error? I assume in my code (hope not) or in DBD::mysql.

Could readers please run this code on their systems, and post their results
here?

TIA.
--
Cheers
Ron Savage, ron@xxxxxxxxxxxxx on 22/06/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company


.



Relevant Pages

  • Re: Table Quandry
    ... Heres what I have.....They are all Primary Keys escept the last 2 fields.... ... Its main purpose should be to provide a value identifying the record so that you can use that same value in other Tables (as Foreign Keys) to refer to this record. ... the matching record is supposed to be, ... I usually link them by specifying Lookup properties in foreign-key ...
    (microsoft.public.access.gettingstarted)
  • Re: conditional join?
    ... Thanks for the lead Chris, ... No primary keys or foreign keys were shown. ... The primary keyfor the photo table are siteNum, siteCode, ...
    (microsoft.public.access.queries)
  • Do we always have to update or insert? Why cant we just relate?
    ... Many times when dealing with database updates I find myself ... writing something like this: ... Should there be a command that does both. ... In the ideal case that there were no foreign keys ...
    (comp.databases.theory)
  • Re: ADO AddNew Method creates TWO Records
    ... The first command is the command that is created if you add a command ... opened the table to get the Primary Key for the last entry for use as ... foreign keys in other tables. ... ' Get the primary key of the record just added ...
    (microsoft.public.access.modulesdaovba)
  • Re: Table Quandry
    ... Well, one suggestion I have is to get rid of all the Primary Keys except one, and that one I suggest hiding in Table Datasheet View so that you don't see it. ... Its main purpose should be to provide a value identifying the record so that you can use that same value in other Tables (as Foreign Keys) to refer to this record. ... They won't automatically match up. ... I usually link them by specifying Lookup properties in foreign-key ...
    (microsoft.public.access.gettingstarted)