<commit_before>/*-------------------------------------------------------------------------
 *
 * parsenodes.h--
 *    definitions for parse tree nodes
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: parsenodes.h,v 1.18 1997/08/20 01:12:38 vadim Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef	PARSENODES_H
#define	PARSENODES_H

#include <utils/tqual.h>
#include <nodes/primnodes.h>

/*****************************************************************************
 *  Query Tree 
 *****************************************************************************/

/*
 * Query -
 *    all statments are turned into a Query tree (via transformStmt)
 *    for further processing by the optimizer
 *    utility statements (i.e. non-optimizable statements)
 *    have the *utilityStmt field set.
 *
 * we need the isPortal flag because portal names can be null too; can
 * get rid of it if we support CURSOR as a commandType.
 *
 */
typedef struct Query {
    NodeTag 	type;
    
    CmdType 	commandType;	/* select|insert|update|delete|utility */
    
    Node  	*utilityStmt;   /* non-null if this is a non-optimizable
				   statement */
    
    int		resultRelation;	/* target relation (index to rtable) */
    char	*into;		/* portal (cursor) name */
    bool	isPortal;	/* is this a retrieve into portal? */
    bool	isBinary;	/* binary portal? */
    
    char  	*uniqueFlag;	/* NULL, '*', or Unique attribute name */
    List	*sortClause;	/* a list of SortClause's */
    
    List	*rtable;	/* list of range table entries */
    List	*targetList;	/* target list (of TargetEntry) */
    Node	*qual;		/* qualifications */

    List	*groupClause;	/* list of columns to specified in GROUP BY */
    Node	*havingQual;	/* qualification of each group */

    int		qry_numAgg;	/* number of aggregates in the target list */
    Aggreg	**qry_aggs;	/* the aggregates */
    
    /* internal to planner */
    List *base_relation_list_;	/* base relation list */
    List *join_relation_list_;	/* list of relations generated by joins */
    bool  query_is_archival_;	/* archival query flag */
} Query;


/*****************************************************************************
 *	Other Statements (no optimizations required)
 *
 *      Some of them require a little bit of transformation (which is also
 *      done by transformStmt). The whole structure is then passed on to
 *      ProcessUtility (by-passing the optimization step) as the utilityStmt
 *      field in Query.
 *****************************************************************************/

/* ----------------------
 *	Add Column Statement
 * ----------------------
 */
typedef struct AddAttrStmt {
    NodeTag		type;
    char		*relname;	/* the relation to add attr */
    bool		inh;		/* add recursively to children? */
    struct ColumnDef	*colDef;	/* the attribute definition */
} AddAttrStmt;

/* ----------------------
 *	Change ACL Statement
 * ----------------------
 */
typedef struct ChangeACLStmt {
    NodeTag		type;
    struct AclItem	*aclitem;
    unsigned		modechg;
    List		*relNames;
} ChangeACLStmt;

/* ----------------------
 *	Close Portal Statement
 * ----------------------
 */
typedef struct ClosePortalStmt {
    NodeTag		type;
    char		*portalname;	/* name of the portal (cursor) */
} ClosePortalStmt;

/* ----------------------
 *	Copy Statement
 * ----------------------
 */
typedef struct CopyStmt {
    NodeTag		type;
    bool		binary;		/* is a binary copy? */
    char		*relname;	/* the relation to copy */
    bool		oids;		/* copy oid's? */
    int			direction;	/* TO or FROM */
    char		*filename;	/* if NULL, use stdin/stdout */
    char                *delimiter;     /* delimiter character, \t by default*/
} CopyStmt;

/* ----------------------
 *	Create Table Statement
 * ----------------------
 */
typedef enum ArchType {
    ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY	/* archive mode */
} ArchType;

typedef struct CreateStmt {
    NodeTag		type;
    char		*relname;	/* the relation to create */
    List		*tableElts;	/* column definitions
					   list of ColumnDef */
    List		*inhRelnames;	/* relations to inherit from
					   list of Value (string) */
    ArchType		archiveType;	/* archive mode (ARCH_NONE if none */
    int			location;	/* smgrid (-1 if none) */
    int			archiveLoc;	/* smgrid (-1 if none) */
    List		*check;		/* list of CHECK constr */
} CreateStmt;

/* ----------------------
 *	Create SEQUENCE Statement
 * ----------------------
 */

typedef struct CreateSeqStmt {
    NodeTag		type;
    char		*seqname;	/* the relation to create */
    List		*options;
} CreateSeqStmt;

/* ----------------------
 *	Create Version Statement<commit_msg>+ struct ConstaintDef - for constraints.<commit_after>/*-------------------------------------------------------------------------
 *
 * parsenodes.h--
 *    definitions for parse tree nodes
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: parsenodes.h,v 1.19 1997/08/21 01:39:25 vadim Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef	PARSENODES_H
#define	PARSENODES_H

#include <utils/tqual.h>
#include <nodes/primnodes.h>

/*****************************************************************************
 *  Query Tree 
 *****************************************************************************/

/*
 * Query -
 *    all statments are turned into a Query tree (via transformStmt)
 *    for further processing by the optimizer
 *    utility statements (i.e. non-optimizable statements)
 *    have the *utilityStmt field set.
 *
 * we need the isPortal flag because portal names can be null too; can
 * get rid of it if we support CURSOR as a commandType.
 *
 */
typedef struct Query {
    NodeTag 	type;
    
    CmdType 	commandType;	/* select|insert|update|delete|utility */
    
    Node  	*utilityStmt;   /* non-null if this is a non-optimizable
				   statement */
    
    int		resultRelation;	/* target relation (index to rtable) */
    char	*into;		/* portal (cursor) name */
    bool	isPortal;	/* is this a retrieve into portal? */
    bool	isBinary;	/* binary portal? */
    
    char  	*uniqueFlag;	/* NULL, '*', or Unique attribute name */
    List	*sortClause;	/* a list of SortClause's */
    
    List	*rtable;	/* list of range table entries */
    List	*targetList;	/* target list (of TargetEntry) */
    Node	*qual;		/* qualifications */

    List	*groupClause;	/* list of columns to specified in GROUP BY */
    Node	*havingQual;	/* qualification of each group */

    int		qry_numAgg;	/* number of aggregates in the target list */
    Aggreg	**qry_aggs;	/* the aggregates */
    
    /* internal to planner */
    List *base_relation_list_;	/* base relation list */
    List *join_relation_list_;	/* list of relations generated by joins */
    bool  query_is_archival_;	/* archival query flag */
} Query;


/*****************************************************************************
 *	Other Statements (no optimizations required)
 *
 *      Some of them require a little bit of transformation (which is also
 *      done by transformStmt). The whole structure is then passed on to
 *      ProcessUtility (by-passing the optimization step) as the utilityStmt
 *      field in Query.
 *****************************************************************************/

/* ----------------------
 *	Add Column Statement
 * ----------------------
 */
typedef struct AddAttrStmt {
    NodeTag		type;
    char		*relname;	/* the relation to add attr */
    bool		inh;		/* add recursively to children? */
    struct ColumnDef	*colDef;	/* the attribute definition */
} AddAttrStmt;

/* ----------------------
 *	Change ACL Statement
 * ----------------------
 */
typedef struct ChangeACLStmt {
    NodeTag		type;
    struct AclItem	*aclitem;
    unsigned		modechg;
    List		*relNames;
} ChangeACLStmt;

/* ----------------------
 *	Close Portal Statement
 * ----------------------
 */
typedef struct ClosePortalStmt {
    NodeTag		type;
    char		*portalname;	/* name of the portal (cursor) */
} ClosePortalStmt;

/* ----------------------
 *	Copy Statement
 * ----------------------
 */
typedef struct CopyStmt {
    NodeTag		type;
    bool		binary;		/* is a binary copy? */
    char		*relname;	/* the relation to copy */
    bool		oids;		/* copy oid's? */
    int			direction;	/* TO or FROM */
    char		*filename;	/* if NULL, use stdin/stdout */
    char                *delimiter;     /* delimiter character, \t by default*/
} CopyStmt;

/* ----------------------
 *	Create Table Statement
 * ----------------------
 */
typedef enum ArchType {
    ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY	/* archive mode */
} ArchType;

typedef struct CreateStmt {
    NodeTag		type;
    char		*relname;	/* the relation to create */
    List		*tableElts;	/* column definitions
					   list of ColumnDef */
    List		*inhRelnames;	/* relations to inherit from
					   list of Value (string) */
    ArchType		archiveType;	/* archive mode (ARCH_NONE if none */
    int			location;	/* smgrid (-1 if none) */
    int			archiveLoc;	/* smgrid (-1 if none) */
    List		*constraints;	/* list of constraints (ConstaintDef) */
} CreateStmt;

typedef enum ConstrType {
    CONSTR_NONE, CONSTR_CHECK		/* type of constaints */
} ConstrType;

typedef struct ConstaintDef {
    ConstrType		type;
    char		*name;		/* name */
    char		*expr;		/*  */
} ConstaintDef;

/* ----------------------
 *	Create SEQUENCE Statement
 * ----------------------
 */

typedef struct CreateSeqStmt {
    NodeTag		type;
    char		*seqname;	/* the relation to create */
    List		*options;
} CreateSeqStmt;

/* ----------------------
 *	Create Version Statement
{'fraction_non_alphanumeric': 0.2412695152013147, 'fraction_numerical': 0.004724732949876746, 'mean_word_length': 2.040911930043723, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7462598', 'n_tokens_mistral': 2888, 'n_tokens_neox': 2757, 'n_words': 887}