View Issue Details

IDProjectCategoryView StatusLast Update
0035880FPCPackagespublic2019-08-26 20:50
ReporterDomenico MammolaAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0035880: Add support for "citext" field type In postgresql SQLdb connection class
DescriptionHi,
this is just a suggestion:

as Postgresql supports "citext" field type (https://www.postgresql.org/docs/9.1/citext.html) that is a case insesitive character string type, much similar to "text" field type and useful to allow comparison against text field in a case insensitive manner as it happens, as default behaviour, in other db engines like MySQL or Microsoft SQLServer or Oracle.

It could be really useful to support it in the postgresql sqldb connection class.

I have tryed to patch the pqconnection unit to add citext support and made some tests against Postgresql 11 and it seems to work fine.
Enclosed the patch file, I hope it could be useful.

Domenico
TagsNo tags attached.
Fixed in Revision42832
FPCOldBugId
FPCTarget3.2.0
Attached Files
  • pqconnection.diff (817 bytes)
    36c36
    <   TExtendedFieldType = (eftNone,eftEnum);
    ---
    >   TExtendedFieldType = (eftNone,eftEnum,eftCitext);
    369,371c369,371
    <       while (J>=0) and (Bindings[j].TypeOID<>toid) do
    <         Dec(J);
    <       if (J>=0) then
    ---
    >       while (J>= 0) do
    >       begin
    >         if (Bindings[j].TypeOID=toid) then
    373,376c373,376
    <         Bindings[j].TypeName:=TN;
    <         Case tt of
    <           'e': // Enum
    <             Bindings[j].ExtendedFieldType:=eftEnum;
    ---
    >           if tt = 'e' then // Enum
    >             Bindings[j].ExtendedFieldType:=eftEnum
    >           else if tn = 'citext' then
    >             Bindings[j].ExtendedFieldType:=eftCitext;
    377a378
    >         Dec(J);
    1154a1156,1159
    >             end;
    >           eftCitext:
    >             begin
    >             FD.DataType:=ftMemo;
    
    pqconnection.diff (817 bytes)

Activities

Domenico Mammola

2019-07-24 12:23

reporter  

pqconnection.diff (817 bytes)
36c36
<   TExtendedFieldType = (eftNone,eftEnum);
---
>   TExtendedFieldType = (eftNone,eftEnum,eftCitext);
369,371c369,371
<       while (J>=0) and (Bindings[j].TypeOID<>toid) do
<         Dec(J);
<       if (J>=0) then
---
>       while (J>= 0) do
>       begin
>         if (Bindings[j].TypeOID=toid) then
373,376c373,376
<         Bindings[j].TypeName:=TN;
<         Case tt of
<           'e': // Enum
<             Bindings[j].ExtendedFieldType:=eftEnum;
---
>           if tt = 'e' then // Enum
>             Bindings[j].ExtendedFieldType:=eftEnum
>           else if tn = 'citext' then
>             Bindings[j].ExtendedFieldType:=eftCitext;
377a378
>         Dec(J);
1154a1156,1159
>             end;
>           eftCitext:
>             begin
>             FD.DataType:=ftMemo;
pqconnection.diff (817 bytes)

Michael Van Canneyt

2019-08-26 20:50

administrator   ~0117851

Applied with small change. Thanks for the patch, this is useful !

Issue History

Date Modified Username Field Change
2019-07-24 12:23 Domenico Mammola New Issue
2019-07-24 12:23 Domenico Mammola File Added: pqconnection.diff
2019-07-24 13:07 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-07-24 13:07 Michael Van Canneyt Status new => assigned
2019-08-26 20:50 Michael Van Canneyt Status assigned => resolved
2019-08-26 20:50 Michael Van Canneyt Resolution open => fixed
2019-08-26 20:50 Michael Van Canneyt Fixed in Version => 3.3.1
2019-08-26 20:50 Michael Van Canneyt Fixed in Revision => 42832
2019-08-26 20:50 Michael Van Canneyt FPCTarget => 3.2.0
2019-08-26 20:50 Michael Van Canneyt Note Added: 0117851