Subject: | Constraints handling in PostgreSQL parser |
I have been using the postgres parser on some of my schemas and discovered that it was not showing all the constraints correctly. It appears to find them all without trouble but it is not storing any that are marked 'not null'. After some investigation I believe I have tracked down a solution and a patch is attached. This patch does result in all my constraints showing up but I have no way of testing whether it is correct for anything more than my own schemas, obviously, so I'm not sure it is the correct solution.
I also noticed that when a field is marked as a primary key, the data structure for the field still shows it as nullable, which isn't really true. I thus suggest changing this to not-nullable (also in the patch).
One final, minor, thing, is that each field constraint has an attribute called 'deferreable' which is a spelling mistake of 'deferrable', not sure if you can change that now as it would effectively be an API change.
Thanks,
Stephen Quinney
--- PostgreSQL.pm.orig 2003-08-08 14:45:49.000000000 +0100
+++ PostgreSQL.pm 2003-08-08 14:47:51.000000000 +0100
@@ -278,9 +278,9 @@
}
elsif ( $meta->{'type'} eq 'not_null' ) {
$null = 0;
- next;
}
elsif ( $meta->{'type'} eq 'primary_key' ) {
+ $null = 0;
$is_pk = 1;
}