Is there a maximum length when storing into PostgreSQL TEXT

后端 未结 2 1017
时光取名叫无心
时光取名叫无心 2021-01-03 23:59

I have a sequence of string that vary a lot in length: from 30 to 282420 chars . I want to store each string into a postgres database using jdbc.

     Strin         


        
相关标签:
2条回答
  • 2021-01-04 00:20

    According to the Postgres character type documentation, text is variable unlimited length.
    And further down:

    ... PostgreSQL provides the text type, which stores strings of any length.

    However

    According to the Postgres Wiki, there is a hard limit of 1GB for a single column value, so the practical limit for the "unlimited" length text value is limited to 1GB by the architecture.

    0 讨论(0)
  • 2021-01-04 00:36

    There were some justified remarks about the lack of examples. While playing with the examples I stumbled upon some remarkable behavior of pgAdmin: it does not display the information which is present. Just select some rows in the output from the pgAdmin data editor which is shown in the original question and paste it in an editor. It then does display the information which is not visible in the data display of pgAdmin, see below.

    3;0;"Appingedam";"GM";2014;53.3172;6.84957;"53.345131 6.885408  53.344925 6.885422  ...
    5;0;"Bedum";"GM";2014;53.2949;6.59717;"53.255638 6.587573  53.255646 6.587514  53.25...
    7;0;"Bellingwedde";"GM";2014;53.0986;7.12118;"53.097076 7.038233  53.097099 7.038254...
    9;0;"Ten Boer";"GM";2014;53.2788;6.69145;"53.312183 6.740470  53.312176 6.740486  53...
    10;0;"Delfzijl";"GM";2014;53.3227;7.09945;"53.322491 7.100943  53.322414 7.100940  5...
    14;0;"Groningen";"GM";2014;53.2222;6.5634;"53.198223 6.515755  53.198238 6.515728  5...
    15;0;"Grootegast";"GM";2014;53.2086;6.27322;"53.203838 6.318381  53.203819 6.318180 ...
    17;0;"Haren";"GM";2014;53.1545;6.63106;"53.165165 6.560897  53.165207 6.560884  53.1...
    18;0;"Hoogezand-Sappemeer";"GM";2014;53.1473;6.7468;"53.116516 6.743022  53.116371 6...
    22;0;"Leek";"GM";2014;53.1633;6.36926;"53.211250 6.362241  53.211262 6.362327  53.21...
    

    So it seems that pgAdmin behaves like what you don't see is what you don't get. Java, jdbc and Postgres behave as expected, pgAdmin does not.

    0 讨论(0)
提交回复
热议问题