Bug #58

Nullable columns not detected correctly.

Added by Justin Bailey 260 days ago. Updated 1 day ago.

Status :Closed Start :03/18/2008
Priority :Normal Due date :
Assigned to :- % Done :

100%

Category :-
Target version :-
Resolution :

Fixed


Description

The logic to detect null columns in postgresql does not work. It is backwards and incorrect.

The following darcs patch fixes the problem. I'm not able to install git at this time, otherwise I'd submit a real patch.

>darcs whatsnew {
hunk ./Database/HDBC/PostgreSQL/Connection.hsc 44
+import Data.Char (toLower)
hunk ./Database/HDBC/PostgreSQL/Connection.hsc 131
- colDescForPGAttr (fromSql atttypid) (fromSql attlen) (fromSql formattedtype) (fromSql attnotnull == 'f'))
+ colDescForPGAttr (fromSql atttypid) (fromSql attlen) (fromSql formattedtype) (notnullable $ fromSql attnotnull))
hunk ./Database/HDBC/PostgreSQL/Connection.hsc 134
- [_$_]
+ notnullable ('f':_) = False
+ notnullable ('F':_) = False
+ notnullable _ = True
hunk ./Database/HDBC/PostgreSQL/PTypeConv.hsc 44
- colNullable = Just attnotnull }
+ colNullable = Just (not attnotnull) }

0001-Fixing-Nullable-sensing.patch (1 KB) Alson Kemp, 11/26/2008 12:32 PM

Associated revisions

Revision fcfce0db34d4189a81b93295108164f0c3ad4b6a
Added by John Goerzen 1 day ago

Fix nullable detection in PostgreSQL
Patch from Alson Kemp
Fixes #58

History

03/18/2008 01:05 PM - Justin Bailey

Formatting the patch correctly.

hunk ./Database/HDBC/PostgreSQL/Connection.hsc 44
+import Data.Char (toLower)
hunk ./Database/HDBC/PostgreSQL/Connection.hsc 131
-           colDescForPGAttr (fromSql atttypid) (fromSql attlen) (fromSql formattedtype) (fromSql attnotnull == 'f'))
+           colDescForPGAttr (fromSql atttypid) (fromSql attlen) (fromSql formattedtype) (notnullable $ fromSql attnotnull))
hunk ./Database/HDBC/PostgreSQL/Connection.hsc 134
-         [_$_]
+      notnullable ('f':_) = False
+      notnullable ('F':_) = False
+      notnullable _ = True
hunk ./Database/HDBC/PostgreSQL/PTypeConv.hsc 44
-                   colNullable = Just attnotnull }
+                   colNullable = Just (not attnotnull) }

03/18/2008 01:13 PM - John Goerzen

Hi Jeff,

Do you think you could attach a regular diff for me? (darcs diff -u style)

Thanks,

-- John

03/18/2008 01:14 PM - John Goerzen

Incidentally, there should be a box where you can attach a file directly below the text entry area (so you don't have to worry about formatting it inline). If not, let me know.

11/26/2008 12:32 PM - Alson Kemp

John, attached is an alternate take on how to fix the nullable sensing thing. - Alson

12/02/2008 09:23 AM - John Goerzen

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Also available in: Atom PDF