Thread

Commits

  1. Fix possible omission of variable storage markers in ECPG.

  1. [BUG] Storage declaration in ECPG

    Andrey Sokolov <a.sokolov@arenadata.io> — 2022-09-04T10:49:53Z

      
        Hi,
      
      
         
      
      
        The ECPG preprocessor converts the code
      
      
        "static VARCHAR str1[10], str2[20], str3[30];"
      
      
        into
      
      
        "static  struct varchar_1  { int len; char arr[ 10 ]; }  str1 ;
      
      
                 struct varchar_2  { int len; char arr[ 20 ]; }  str2 ;
      
      
                 struct varchar_3  { int len; char arr[ 30 ]; }  str3 ;".
      
      
        Storage declaration applies only to the first structure.
      
      
         
      
      
        The patch in the attachment fixes the bug. Storage declaration will be repeated before each structure.
      
      
        The patch is on github too: https://github.com/andr-sokolov/postgresql/commit/c8f8fc7a211938569e7d46c91a428d8cb25b6f9c
      
      
         
      
      
        --
      
      
        Andrey Sokolov
      
      
        Arenadata            https://arenadata.tech/
      
    
    
  2. Re: [BUG] Storage declaration in ECPG

    Kyotaro Horiguchi <horikyota.ntt@gmail.com> — 2022-09-05T08:12:10Z

    At Sun, 04 Sep 2022 13:49:53 +0300, Andrey Sokolov <a.sokolov@arenadata.io> wrote in 
    > Hi,
    > 
    > The ECPG preprocessor converts the code
    > "static VARCHAR str1[10], str2[20], str3[30];"
    > into
    > "static  struct varchar_1  { int len; char arr[ 10 ]; }  str1 ;
    >          struct varchar_2  { int len; char arr[ 20 ]; }  str2 ;
    >          struct varchar_3  { int len; char arr[ 30 ]; }  str3 ;".
    > Storage declaration applies only to the first structure.
    
    Good catch!
    
    > The patch in the attachment fixes the bug. Storage declaration will be
    > repeated before each structure.
    > The patch is on github too:
    > https://github.com/andr-sokolov/postgresql/commit/c8f8fc7a211938569e7d46c91a428d8cb25b6f9c
    
    And the code looks good to me.
    
    About the test, don't we need the test for non-varchar/bytea static
    variables like "static int inta, intb, intc;"?
    
    regards.
    
    -- 
    Kyotaro Horiguchi
    NTT Open Source Software Center
    
    
    
    
  3. Re: [BUG] Storage declaration in ECPG

    Andrey Sokolov <a.sokolov@arenadata.io> — 2022-09-07T20:57:47Z

      05.09.2022, 11:12, "Kyotaro Horiguchi" <horikyota.ntt@gmail.com>:
    
    
       
      
    
        About the test, don't we need the test for non-varchar/bytea static
    
        variables like "static int inta, intb, intc;"?
      
    
    
      Good idea, thanks. I have added tests for static int and bytea. The new patch is in the attachment and here https://github.com/andr-sokolov/postgresql/commit/5a4adc1b5a2a0adfc152debcaf825e7a95a47450
    
    
  4. Re: [BUG] Storage declaration in ECPG

    Tom Lane <tgl@sss.pgh.pa.us> — 2022-09-09T19:36:38Z

    Andrey Sokolov <a.sokolov@arenadata.io> writes:
    > [ v2-0001-Fix-storage-declaration-in-ECPG.patch ]
    
    Pushed.  I didn't think a whole new test case was appropriate,
    either from the patch-footprint or test-runtime standpoint,
    so I just added a couple of declarations to preproc/variable.pgc.
    
    			regards, tom lane