LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - parser.pgc (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 100.0 % 20 20
Test Date: 2026-07-25 11:15:46 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 56.2 % 32 18

             Branch data     Line data    Source code
       1                 :             : #include <stdio.h>
       2                 :             : #include <stdlib.h>
       3                 :             : #include <string.h>
       4                 :             : 
       5                 :             : /* test parser addition that merges two tokens into one */
       6                 :             : EXEC SQL INCLUDE ../regression;
       7                 :             : 
       8                 :           2 : int main(void) {
       9                 :             :   EXEC SQL BEGIN DECLARE SECTION;
      10                 :             :     int item[3], ind[3], i;
      11                 :             :   EXEC SQL END DECLARE SECTION;
      12                 :             : 
      13                 :           2 :   ECPGdebug(1, stderr);
      14                 :           2 :   EXEC SQL CONNECT TO REGRESSDB1;
      15                 :             : 
      16                 :           2 :   EXEC SQL SET AUTOCOMMIT TO ON;
      17                 :             :   EXEC SQL WHENEVER SQLWARNING SQLPRINT;
      18                 :             :   EXEC SQL WHENEVER SQLERROR SQLPRINT;
      19                 :             : 
      20                 :           2 :   EXEC SQL CREATE TABLE T ( Item1 int, Item2 int );
      21   [ -  +  -  + ]:           2 : 
      22                 :           2 :   EXEC SQL INSERT INTO t
      23                 :             :            SELECT 1,nullif(y-1,0)
      24                 :             :              FROM generate_series(1,3) WITH ORDINALITY AS series(x,y);
      25   [ -  +  -  + ]:           2 : 
      26                 :           2 :   EXEC SQL SELECT Item2 INTO :item:ind FROM T ORDER BY Item2 NULLS LAST;
      27   [ -  +  -  + ]:           2 : 
      28         [ +  + ]:           8 :   for (i=0; i<3; i++)
      29         [ +  + ]:           6 :     printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
      30                 :             : 
      31                 :           2 :   EXEC SQL ALTER TABLE T ALTER Item1 TYPE bigint;
      32   [ -  +  -  + ]:           2 :   EXEC SQL ALTER TABLE T ALTER COLUMN Item2 SET DATA TYPE smallint;
      33   [ -  +  -  + ]:           2 : 
      34                 :           2 :   EXEC SQL DROP TABLE T;
      35   [ -  +  -  + ]:           2 : 
      36                 :           2 :   EXEC SQL DISCONNECT ALL;
      37   [ -  +  -  + ]:           2 : 
      38                 :           2 :   return 0;
      39                 :             : }
        

Generated by: LCOV version 2.0-1