Menu

#335 Postgres regression (Bin binding)

7.3-alfa
closed
nobody
None
2019-03-14
2019-03-12
Pavel Mash
No

PostgreSQ regression wile switch 7.2->7.3
In case actual (from prepared stmt) parameter type is non-binary (string for example) but actual parameter is binded as binary type (Int for example) AV occures inside pglib. In this case binding should fallback to non-binary, but it doesn't.

Fix:

--- a/src/dbc/ZDbcPostgreSqlStatement.pas
+++ b/src/dbc/ZDbcPostgreSqlStatement.pas
@@ -1759,7 +1759,7 @@ var PGSQLType: TZSQLType;
 procedure SetAsRaw; begin SetRawByteString(Index{$IFNDEF GENERIC_INDEX}+1{$ENDIF}, IntToRaw(Value)); end;
 begin
   PGSQLType := OIDToSQLType(Index, SQLType);

-  if (Ord(PGSQLType) < Ord(stGUID)) then begin
+  if (Ord(PGSQLType) < Ord(stGUID)) and (PGSQLType <> stUnknown) then begin
     if (FPQparamValues[Index] = nil) or (BindList[Index].SQLType <> PGSQLType) then
       if ZSQLType2PGBindSizes[PGSQLType] <= 4 then begin
         BindList.Put(Index, PGSQLType, P4Bytes(@Value));

Related

Bugs: #336

Discussion

  • Pavel Mash

    Pavel Mash - 2019-03-12
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -3,7 +3,7 @@
    
     Fix:
    
    -[code]
    +```
     --- a/src/dbc/ZDbcPostgreSqlStatement.pas
     +++ b/src/dbc/ZDbcPostgreSqlStatement.pas
     @@ -1759,7 +1759,7 @@ var PGSQLType: TZSQLType;
    @@ -15,4 +15,4 @@
          if (FPQparamValues[Index] = nil) or (BindList[Index].SQLType <> PGSQLType) then
            if ZSQLType2PGBindSizes[PGSQLType] <= 4 then begin
              BindList.Put(Index, PGSQLType, P4Bytes(@Value));
    -[/code]
    +```
    
     
  • EgonHugeist

    EgonHugeist - 2019-03-13

    Applied with some more lines which may couse same error.
    R5513 testing-7.3 (SVN).
    Thank you. Please close if OK.

     

    Last edit: EgonHugeist 2019-03-13
  • Pavel Mash

    Pavel Mash - 2019-03-13

    I can't verify it until "unofficial" git reository will be synced, because my CI depends on git submodules (Zeos is one of submodule). As far as it syncs my CI verify it on both windows anf linux

     

    Last edit: Pavel Mash 2019-03-13
  • Pavel Mash

    Pavel Mash - 2019-03-14
    • status: open --> closed
     
  • Pavel Mash

    Pavel Mash - 2019-03-14

    Verified and closed

     

Log in to post a comment.

MongoDB Logo MongoDB