PetaPoco
                                
                                 PetaPoco copied to clipboard
                                
                                    PetaPoco copied to clipboard
                            
                            
                            
                        PostGreSqlSchemaReader fails if two tables with the same name exists in multiple schemas in the same database
It tried to do a SingleOrDefault on the columns to find the PK but if I have a table in both schemas with the aame column name then the Sequence has multiple elements.
const string COLUMN_SQL=@" SELECT column_name, is_nullable, udt_name, column_default FROM information_schema.columns WHERE table_name=@tableName ";
I've solved this by filtering additionally by table_schema eg: "and table_schema = @tableSchema;"
and adding that the parameter to the LoadColumns method.
I can fork, fix and do a pull request if that's more helpful.
A PR would be great. There's also integration tests for all the support DBs. Could you please add one to prove it's broken and it's fixed.
The integration tests don't seemt o be for the T4 template that I modified. Should I just create a test that mimics the T4 code that threw the error? For now i've submitted a pull request with the fix and some sample SQL for a test: https://github.com/CollaboratingPlatypus/PetaPoco/pull/366