hssqlppp 0.1.0 → 0.6.2
raw patch · 150 files changed
Files
- Database/HsSqlPpp/Ast/Annotation.lhs +0/−20
- Database/HsSqlPpp/Ast/Ast.lhs +0/−95
- Database/HsSqlPpp/Ast/Environment.lhs +0/−60
- Database/HsSqlPpp/Ast/SqlTypes.lhs +0/−24
- Database/HsSqlPpp/Ast/TypeChecker.lhs +0/−42
- Database/HsSqlPpp/AstInternals/AnnotationUtils.lhs +0/−27
- Database/HsSqlPpp/AstInternals/AstAnnotation.lhs +0/−219
- Database/HsSqlPpp/AstInternals/AstInternal.ag +0/−782
- Database/HsSqlPpp/AstInternals/AstInternal.hs +0/−15988
- Database/HsSqlPpp/AstInternals/Environment/DefaultTemplate1Environment.lhs +0/−29027
- Database/HsSqlPpp/AstInternals/Environment/EnvironmentInternal.lhs +0/−465
- Database/HsSqlPpp/AstInternals/Environment/EnvironmentReader.lhs +0/−258
- Database/HsSqlPpp/AstInternals/Environment/LocalIdentifierBindings.lhs +0/−240
- Database/HsSqlPpp/AstInternals/TypeChecking/CreateFunction.ag +0/−135
- Database/HsSqlPpp/AstInternals/TypeChecking/CreateTable.ag +0/−101
- Database/HsSqlPpp/AstInternals/TypeChecking/Dml.ag +0/−208
- Database/HsSqlPpp/AstInternals/TypeChecking/Drops.ag +0/−31
- Database/HsSqlPpp/AstInternals/TypeChecking/ErrorUtils.lhs +0/−59
- Database/HsSqlPpp/AstInternals/TypeChecking/Expressions.ag +0/−310
- Database/HsSqlPpp/AstInternals/TypeChecking/Misc.ag +0/−109
- Database/HsSqlPpp/AstInternals/TypeChecking/MiscCreates.ag +0/−71
- Database/HsSqlPpp/AstInternals/TypeChecking/Plpgsql.ag +0/−87
- Database/HsSqlPpp/AstInternals/TypeChecking/SelectLists.ag +0/−184
- Database/HsSqlPpp/AstInternals/TypeChecking/SelectStatement.ag +0/−191
- Database/HsSqlPpp/AstInternals/TypeChecking/Statements.ag +0/−122
- Database/HsSqlPpp/AstInternals/TypeChecking/TableRefs.ag +0/−270
- Database/HsSqlPpp/AstInternals/TypeChecking/TypeChecking.ag +0/−213
- Database/HsSqlPpp/AstInternals/TypeChecking/TypeConversion.lhs +0/−571
- Database/HsSqlPpp/AstInternals/TypeType.lhs +0/−380
- Database/HsSqlPpp/Commands/CommandComponents.lhs +0/−420
- Database/HsSqlPpp/Dbms/DBAccess.lhs +0/−59
- Database/HsSqlPpp/Dbms/DatabaseLoader.lhs +0/−220
- Database/HsSqlPpp/Dbms/WrapLib.lhs +0/−16
- Database/HsSqlPpp/Dbms/WrapperGen.lhs +0/−173
- Database/HsSqlPpp/Extensions/ChaosExtensions.lhs +0/−489
- Database/HsSqlPpp/Here.lhs +0/−15
- Database/HsSqlPpp/HsText/Commands.lhs +0/−46
- Database/HsSqlPpp/HsText/HsText.lhs +0/−72
- Database/HsSqlPpp/Parsing/Lexer.lhs +0/−300
- Database/HsSqlPpp/Parsing/ParseErrors.lhs +0/−77
- Database/HsSqlPpp/Parsing/Parser.lhs +0/−1510
- Database/HsSqlPpp/PrettyPrinter/AnnotateSource.lhs +0/−125
- Database/HsSqlPpp/PrettyPrinter/PrettyPrinter.lhs +0/−684
- Database/HsSqlPpp/Tests/DatabaseLoaderTests.lhs +0/−33
- Database/HsSqlPpp/Tests/ExtensionTests.lhs +0/−182
- Database/HsSqlPpp/Tests/ParameterizedStatementTests.lhs +0/−76
- Database/HsSqlPpp/Tests/ParserTests.lhs +0/−1260
- Database/HsSqlPpp/Tests/RoundtripTests.lhs +0/−53
- Database/HsSqlPpp/Tests/TypeCheckTests.lhs +0/−1104
- Database/HsSqlPpp/Utils.lhs +0/−80
- Database/HsSqlPpp/Wrapper/WrapperTemplate.lhs +0/−45
- HsSqlSystem.lhs +0/−555
- LICENSE +1/−1
- README +11/−88
- docs/Introduction.txt +0/−154
- docs/TODO +0/−670
- docs/changelog +0/−60
- docs/development +0/−150
- docs/recordtests.sql +0/−370
- docs/status +0/−87
- docs/usage +0/−145
- hssqlppp.cabal +178/−224
- sqltestfiles/client.sql +0/−1721
- sqltestfiles/server.sql +0/−4645
- sqltestfiles/system.sql +0/−1310
- src/Database/HsSqlPpp/Annotation.lhs +24/−0
- src/Database/HsSqlPpp/Catalog.lhs +63/−0
- src/Database/HsSqlPpp/Dialect.lhs +21/−0
- src/Database/HsSqlPpp/Dialects/Ansi.lhs +259/−0
- src/Database/HsSqlPpp/Dialects/BaseCatalog.lhs +114/−0
- src/Database/HsSqlPpp/Dialects/GeneratedPostgres.lhs +6042/−0
- src/Database/HsSqlPpp/Dialects/OdbcCatalog.lhs +629/−0
- src/Database/HsSqlPpp/Dialects/Oracle.lhs +47/−0
- src/Database/HsSqlPpp/Dialects/Postgres.lhs +83/−0
- src/Database/HsSqlPpp/Dialects/SqlServer.lhs +161/−0
- src/Database/HsSqlPpp/Internals/AstInternal.hs +30152/−0
- src/Database/HsSqlPpp/Internals/Catalog/CatalogBuilder.lhs +151/−0
- src/Database/HsSqlPpp/Internals/Catalog/CatalogInternal.lhs +249/−0
- src/Database/HsSqlPpp/Internals/Catalog/CatalogNew.lhs +978/−0
- src/Database/HsSqlPpp/Internals/Catalog/CatalogTypes.lhs +192/−0
- src/Database/HsSqlPpp/Internals/Catalog/CatalogUtils.lhs +71/−0
- src/Database/HsSqlPpp/Internals/Dialect.lhs +174/−0
- src/Database/HsSqlPpp/Internals/LexInternal.lhs +552/−0
- src/Database/HsSqlPpp/Internals/ParseErrors.lhs +71/−0
- src/Database/HsSqlPpp/Internals/ParseInternal.lhs +2728/−0
- src/Database/HsSqlPpp/Internals/PrettyInternal.lhs +1271/−0
- src/Database/HsSqlPpp/Internals/TypeChecking/Environment.lhs +427/−0
- src/Database/HsSqlPpp/Internals/TypeChecking/OldTediousTypeUtils.lhs +60/−0
- src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/OldTypeConversion.lhs +742/−0
- src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/SqlTypeConversion.lhs +77/−0
- src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/TypeConversion.lhs +662/−0
- src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/TypeConversion2.lhs +550/−0
- src/Database/HsSqlPpp/Internals/TypesInternal.lhs +273/−0
- src/Database/HsSqlPpp/Internals/Utils.lhs +81/−0
- src/Database/HsSqlPpp/Lex.lhs +15/−0
- src/Database/HsSqlPpp/Parse.lhs +31/−0
- src/Database/HsSqlPpp/Pretty.lhs +21/−0
- src/Database/HsSqlPpp/Syntax.lhs +120/−0
- src/Database/HsSqlPpp/TypeCheck.lhs +35/−0
- src/Database/HsSqlPpp/Types.lhs +21/−0
- src/Database/HsSqlPpp/Utility.lhs +80/−0
- tests/Database/HsSqlPpp/Tests/Parsing/CombineQueryExprs.lhs +65/−0
- tests/Database/HsSqlPpp/Tests/Parsing/CreateTable.lhs +364/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Dml.lhs +154/−0
- tests/Database/HsSqlPpp/Tests/Parsing/FunctionsDdl.lhs +150/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Joins.lhs +108/−0
- tests/Database/HsSqlPpp/Tests/Parsing/LexerTests.lhs +98/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Misc.lhs +63/−0
- tests/Database/HsSqlPpp/Tests/Parsing/MiscDdl.lhs +114/−0
- tests/Database/HsSqlPpp/Tests/Parsing/MiscQueryExprs.lhs +91/−0
- tests/Database/HsSqlPpp/Tests/Parsing/OdbcParsing.lhs +178/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Oracle.lhs +45/−0
- tests/Database/HsSqlPpp/Tests/Parsing/ParserTests.lhs +77/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Plpgsql.lhs +161/−0
- tests/Database/HsSqlPpp/Tests/Parsing/ScalarExprs.lhs +262/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Schemas.lhs +91/−0
- tests/Database/HsSqlPpp/Tests/Parsing/SelectLists.lhs +117/−0
- tests/Database/HsSqlPpp/Tests/Parsing/SqlServer.lhs +195/−0
- tests/Database/HsSqlPpp/Tests/Parsing/TableRefs.lhs +46/−0
- tests/Database/HsSqlPpp/Tests/Parsing/Utils.lhs +163/−0
- tests/Database/HsSqlPpp/Tests/TestTypes.lhs +83/−0
- tests/Database/HsSqlPpp/Tests/TestUtils.lhs +426/−0
- tests/Database/HsSqlPpp/Tests/Tests.lhs +15/−0
- tests/Database/HsSqlPpp/Tests/TpchData.lhs +975/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Aggregates.lhs +51/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/AnsiScalarExprs.lhs +365/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/CaseExpressions.lhs +62/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Catalog.lhs +137/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/DDL.lhs +40/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/ImplicitCasts.lhs +27/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/InsertQueryExprs.lhs +84/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Issues.lhs +63/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Joins.lhs +103/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/OdbcTypechecking.lhs +116/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/PrecisionAndNullable.lhs +209/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/QueryExprs.lhs +116/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Rewrites.lhs +119/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/ScalarExprs.lhs +46/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/SimpleQueryExprs.lhs +119/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/TSQL.lhs +138/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Tpch.lhs +136/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/TrefIdentifiers.lhs +114/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/TrefSchemas.lhs +61/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/TypeCheckTests.lhs +56/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/TypeConversion.lhs +114/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Updates.lhs +241/−0
- tests/Database/HsSqlPpp/Tests/TypeChecking/Utils.lhs +11/−0
- tests/Database/HsSqlPpp/Utils/GroomUtils.lhs +48/−0
- tests/Database/HsSqlPpp/Utils/Here.lhs +12/−0
- tests/Tests.lhs +28/−0
− Database/HsSqlPpp/Ast/Annotation.lhs
@@ -1,20 +0,0 @@-Copyright 2009 Jake Wheat--This is the public module to the annotation data types and support-functions (not including those that depend on the ast data types).--> {- | Contains the annotation data types and a few auxiliary functions.-> -}--> module Database.HsSqlPpp.Ast.Annotation-> (-> -- * Annotation data types-> Annotation-> ,AnnotationElement(..)-> ,StatementType(..)-> ,stripAnnotations-> ,updateAnnotation-> ,getAnnotation-> ) where--> import Database.HsSqlPpp.AstInternals.AstAnnotation
− Database/HsSqlPpp/Ast/Ast.lhs
@@ -1,95 +0,0 @@-Copyright 2009 Jake Wheat--This is the public module for the ast nodes.--> {- | This module contains the ast node data types. They are very-> permissive, in that they allow a lot of invalid SQL to be-> represented. The type checking process should catch all invalid-> trees, but doesn't quite manage at the moment. Sorry about all-> the seemingly pointless type synonyms below, they are an-> artefact of using UUAGC. You can see labels for the fields by-> looking at the ag source here:-> <http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head:/Database/HsSqlPpp/AstInternals/AstInternal.ag>-> -}--> module Database.HsSqlPpp.Ast.Ast-> (-> -- * Main nodes-> StatementList-> ,Statement (..)-> ,Expression (..)-> ,SelectExpression (..)-> -- * Components-> -- ** Selects-> ,SelectList (..)-> ,SelectItem (..)-> ,TableRef (..)-> ,TableAlias(..)-> ,JoinExpression (..)-> ,JoinType (..)-> ,Natural (..)-> ,CombineType (..)-> ,Direction (..)-> ,Distinct (..)-> ,InList (..)-> ,LiftFlavour (..)-> ,FrameClause(..)-> -- ** dml-> ,SetClause (..)-> ,CopySource (..)-> ,RestartIdentity (..)-> -- ** ddl-> ,AttributeDef (..)-> ,RowConstraint (..)-> ,Constraint (..)-> ,AlterTableAction(..)-> ,TypeAttributeDef (..)-> ,TypeName (..)-> ,DropType (..)-> ,IfExists (..)-> ,Cascade (..)-> ,TriggerWhen(..)-> ,TriggerEvent(..)-> ,TriggerFire(..)-> -- ** functions-> ,FnBody (..)-> ,ParamDef (..)-> ,VarDef (..)-> ,RaiseType (..)-> ,Volatility (..)-> ,Language (..)-> -- ** misc-> ,SetValue(..)-> -- ** typedefs-> ,ExpressionListStatementListPairList-> ,ExpressionListStatementListPair-> ,ExpressionList-> ,MaybeSelectList-> ,StringList-> ,ParamDefList-> ,AttributeDefList-> ,ConstraintList-> ,TypeAttributeDefList-> ,TypeNameList-> ,StringTypeNameListPair-> ,StringTypeNameListPairList-> ,ExpressionStatementListPairList-> ,SetClauseList-> ,CaseExpressionListExpressionPairList-> ,MaybeExpression-> ,MaybeBoolExpression-> ,TableRefList-> ,ExpressionListList-> ,SelectItemList-> ,OnExpr-> ,RowConstraintList-> ,VarDefList-> ,ExpressionStatementListPair-> ,CaseExpressionListExpressionPair-> ,CaseExpressionList-> ,ExpressionDirectionPair-> ,ExpressionDirectionPairList-> ) where--> import Database.HsSqlPpp.AstInternals.AstInternal-
− Database/HsSqlPpp/Ast/Environment.lhs
@@ -1,60 +0,0 @@-Copyright 2009 Jake Wheat--This is the public api to the environment data type, it just forwards-the public part of EnvironmentInternal, which is the module used by-the type checking code.--> {- | This module contains the database catalog data types and helper functions.->-> The environment data type (which should really be called catalog)-> serves the following purposes:->-> * Contains all the catalog information needed to type check against-> an existing database.->-> * A copy of the catalog information from a default template1-> database is included - 'defaultTemplate1Environment'.->-> * It is used internally to keep track of updates to the catalog-> whilst running an annotation process (e.g. so that a select can-> type check against a create table given in the same source). It-> is also used to track other identifier types, such as attribute-> references in select expressions, and argument and variable-> types inside create function statements.->-> You can see what kind of stuff is contained in the Environment type-> by looking at the 'EnvironmentUpdate' type.->-> -}--> module Database.HsSqlPpp.Ast.Environment-> (-> -- * Data types-> Environment-> -- ** Updates-> ,EnvironmentUpdate(..)-> ,ppEnvUpdate-> -- ** bits and pieces-> ,CastContext(..)-> ,CompositeFlavour(..)-> ,CompositeDef-> ,FunctionPrototype-> ,DomainDefinition-> ,FunFlav(..)-> -- * 'Environment' values-> ,emptyEnvironment-> ,defaultEnvironment-> ,defaultTemplate1Environment-> -- * Functions-> ,readEnvironmentFromDatabase-> ,updateEnvironment-> ,deconstructEnvironment-> -- * operator utils-> ,OperatorType(..)-> ,getOperatorType-> ,isOperatorName-> ) where--> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal-> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentReader-> import Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment
− Database/HsSqlPpp/Ast/SqlTypes.lhs
@@ -1,24 +0,0 @@-Copyright 2009 Jake Wheat--This is the public module to the SQL data types, mainly from TypeType.---> {- | Contains the SQL data types, type errors, and a few supporting-> functions.-> -}--> module Database.HsSqlPpp.Ast.SqlTypes-> (-> -- * SQL types-> Type (..)-> ,PseudoType (..)-> -- * type aliases-> -- | aliases for all the sql types with multiple names-> -- these give you the canonical names-> ,typeSmallInt,typeBigInt,typeInt,typeNumeric,typeFloat4-> ,typeFloat8,typeVarChar,typeChar,typeBool-> -- * Type errors-> ,TypeError (..)-> ) where--> import Database.HsSqlPpp.AstInternals.TypeType
− Database/HsSqlPpp/Ast/TypeChecker.lhs
@@ -1,42 +0,0 @@-Copyright 2009 Jake Wheat--This is the public module for the type checking functionality.--> {- | Contains the data types and functions for annotating-> an ast and working with annotated trees, including the-> representations of SQL data types.->-> Annotations:->-> * are attached to most of the ast node data types, but not quite all of them;->-> * types annotations are attached to most nodes during type checking;->-> * type errors are attached to the lowest down node that the type error is detected at;->-> * nodes who fail the type check or whose type depends on a node with a type error are-> given the type 'TypeCheckFailed';->-> * each statement has an additional 'StatementInfo' annotation attached to it;->-> * the parser fills in the source position annotation in every annotatable ast node.->-> -}-> module Database.HsSqlPpp.Ast.TypeChecker-> (-> -- * typechecking/ annotation functions-> typeCheck-> ,typeCheckPS-> ,typeCheckExpression-> -- * Annotated tree utils-> ,getTopLevelTypes-> ,getTopLevelInfos-> ,getTopLevelEnvUpdates-> ,getTypeErrors-> ,getStatementAnnotations-> ) where--> import Database.HsSqlPpp.AstInternals.AstInternal-> import Database.HsSqlPpp.AstInternals.AstAnnotation-> import Database.HsSqlPpp.AstInternals.AnnotationUtils-
− Database/HsSqlPpp/AstInternals/AnnotationUtils.lhs
@@ -1,27 +0,0 @@-Copyright 2009 Jake Wheat--This module contains some utilities and generic code for working with-asts and annotations which depend on the ast types.--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.AnnotationUtils-> (-> getStatementAnnotations-> ) where--> import Data.Generics--> import Database.HsSqlPpp.AstInternals.AstInternal-> import Database.HsSqlPpp.AstInternals.AstAnnotation--> -- | Run through the ast and return all the annotations attached to-> -- a Statement node.-> getStatementAnnotations :: Data a => a -> [Annotation]-> getStatementAnnotations st =-> everything (++) (mkQ [] ga) st-> where-> ga :: Statement -> [Annotation]-> ga s = [getAnnotation s]--
− Database/HsSqlPpp/AstInternals/AstAnnotation.lhs
@@ -1,219 +0,0 @@-Copyright 2009 Jake Wheat--The annotation data types and utilities for working with them.--Annotations are used to store source positions, types, errors,-warnings, environment deltas, information, and other stuff a client might-want to use when looking at an ast. Internal annotations which are-used in the type-checking/ annotation process use the attribute-grammar code and aren't exposed.--> {-# LANGUAGE ExistentialQuantification, DeriveDataTypeable,ScopedTypeVariables,-> RankNTypes,FlexibleContexts #-}-> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.AstAnnotation-> (-> Annotation-> ,AnnotationElement(..)-> --,stripAnnotations-> ,getTopLevelTypes-> ,getTopLevelInfos-> ,getTopLevelEnvUpdates-> ,getTypeAnnotation-> ,getTypeErrors-> ,stripAnnotations-> ,filterAnnotations-> ,updateAnnotation-> ,getAnnotation-> ,getAnnotations-> --,getTypeErrors-> --,pack-> ,StatementType(..)-> ,getSIAnnotation-> ) where--> import Data.Generics-> import Data.Maybe-> import Control.Arrow--> import Database.HsSqlPpp.AstInternals.TypeType-> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal--> -- | Annotation type - one of these is attached to most of the-> -- data types used in the ast.-> type Annotation = [AnnotationElement]--> -- | the elements of an annotation. Source positions are generated by-> -- the parser, the rest come from the separate ast annotation process.-> data AnnotationElement = SourcePos String Int Int-> | TypeAnnotation Type-> | TypeErrorA TypeError-> | StatementTypeA StatementType-> | EnvUpdates [EnvironmentUpdate]-> deriving (Eq, Show,Typeable,Data)--Use syb to pull annotation values from an ast.--I like to cut and paste code from the internet which I don't-understand, then keep changing it till it compiles and passes the tests.---> -- | run through the ast, and pull the type annotation from each-> -- of the top level items.-> getTopLevelTypes :: Data a => [a] -> [Type]-> getTopLevelTypes st =-> getTopLevelXs typeAnnot st-> where-> typeAnnot :: Annotation -> [Type]-> typeAnnot (x:xs) = case x of-> TypeAnnotation t -> [t]-> _ -> typeAnnot xs-> typeAnnot [] = [TypeCheckFailed] -- error "couldn't find type annotation"--> getTopLevelXs :: forall a b a1.-> (Data a1, Typeable b) =>-> (b -> [a]) -> a1 -> [a]-> getTopLevelXs st = everythingOne (++) $ mkQ [] st---> getTypeAnnotation :: Data a => a -> Type-> getTypeAnnotation st =-> case getTopLevelX typeAnnot st of-> x:_ -> x-> [] -> TypeCheckFailed-> where-> typeAnnot :: Annotation -> [Type]-> typeAnnot (x:xs) = case x of-> TypeAnnotation t -> [t]-> _ -> typeAnnot xs-> typeAnnot [] = [TypeCheckFailed]--> getTopLevelX :: forall a b a1.-> (Data a1, Typeable b) =>-> (b -> [a]) -> a1 -> [a]-> getTopLevelX p = everythingOne (++) (mkQ [] p)--- > everythingTwo :: (r -> r -> r) -> GenericQ r -> GenericQ r- > everythingTwo k f x- > = foldl k (f x) (gmapQ (everythingOne k f) x)--> everythingZero :: (r -> r -> r) -> GenericQ r -> GenericQ r-> everythingZero k f x-> = foldl k (f x) (gmapQ f x)--> everythingOne :: (r -> r -> r) -> GenericQ r -> GenericQ r-> everythingOne k f x-> = foldl k (f x) (gmapQ (everythingZero k f) x)--> getSIAnnotation :: Annotation -> [Maybe StatementType]-> getSIAnnotation (x:xs) = case x of-> StatementTypeA t -> [Just t]-> _ -> getSIAnnotation xs-> getSIAnnotation [] = [Nothing]--> getEuAnnotation :: Annotation -> [[EnvironmentUpdate]]-> getEuAnnotation (x:xs) = case x of-> EnvUpdates t -> t:getEuAnnotation xs-> _ -> getEuAnnotation xs-> getEuAnnotation [] = []---> -- | Run through the ast given and return a list of statementtypes-> -- from the top level items.-> getTopLevelInfos :: Data a => [a] -> [Maybe StatementType]-> getTopLevelInfos = getTopLevelXs getSIAnnotation--> getTopLevelEnvUpdates :: Data a => [a] -> [[EnvironmentUpdate]]-> getTopLevelEnvUpdates = getTopLevelXs getEuAnnotation--> data StatementType = StatementType [Type] [(String,Type)]-> deriving (Eq,Show,Typeable,Data)--todo:-add environment deltas to statementtype (??)--question:-if a node has no source position e.g. the all in select all or select- distinct may correspond to a token or may be synthesized as the- default if neither all or distinct is present. Should this have the- source position of where the token would have appeared, should it- inherit it from its parent, should there be a separate ctor to- represent a fake node with no source position?---hack job, often not interested in the source positions when testing-the asts produced, so this function will reset all the source-positions to empty ("", 0, 0) so we can compare them for equality, etc.-without having to get the positions correct.--> -- | strip all the annotations from a tree. E.g. can be used to compare-> -- two asts are the same, ignoring any source position annotation differences.-> stripAnnotations :: (Data a) => a -> a-> stripAnnotations = filterAnnotations (const False)-- >> everywhere (mkT stripAn)- > where- > stripAn :: [AnnotationElement] -> [AnnotationElement]- > stripAn _ = []---> filterAnnotations :: (Data a) => (AnnotationElement -> Bool) -> a -> a-> filterAnnotations f =-> everywhere (mkT filterAnn)-> where-> filterAnn :: [AnnotationElement] -> [AnnotationElement]-> filterAnn = filter f---> -- | runs through the ast given and returns a list of all the type errors-> -- in the ast. Recurses into all ast nodes to find type errors.-> -- This is the function to use to see if an ast has passed the type checking process.-> -- Returns a Maybe SourcePos and the list of type errors for each node which has one or-> -- more type errors.-> getTypeErrors :: (Data a) => a -> [(Maybe AnnotationElement,[TypeError])]-> getTypeErrors sts =-> filter (\(_,te) -> not $ null te) $ map (gtsp &&& gte) $ getAnnotations sts-> where-> gte (a:as) = case a of-> TypeErrorA e -> e:gte as-> _ -> gte as-> gte _ = []--> gtsp (a:as) = case a of-> s@(SourcePos _ _ _) -> Just s-> _ -> gtsp as-> gtsp _ = Nothing----> -- | Update all the annotations in a tree using the function supplied-> updateAnnotation :: forall a.(Data a) =>-> (Annotation -> Annotation) -> a -> a-> updateAnnotation f = oneLevel (mkT f)--> oneLevel :: (forall a.Data a => a -> a)-> -> (forall a.Data a => a -> a)-> oneLevel f = gmapT f--> -- | get the annotation for the root of the tree passed-> getAnnotation :: forall a.(Data a) => a -> Annotation-> getAnnotation a =-> case oneLevelQ (mkQ [] f) a of-> an:_ -> an-> [] -> []-> where-> f :: Annotation -> Annotation-> f = id--> oneLevelQ :: forall a.Data a => forall u. (forall d. (Data d) => d -> u) -> a -> [u]-> oneLevelQ = gmapQ---> getAnnotations :: forall a.(Data a) =>-> a -> [Annotation]-> getAnnotations = listifyWholeLists (\(_::Annotation) -> True)--> listifyWholeLists :: Typeable b => ([b] -> Bool) -> GenericQ [[b]]-> listifyWholeLists blp = flip (synthesize id (.) (mkQ id (\bl _ -> if blp bl then (bl:) else id))) []
− Database/HsSqlPpp/AstInternals/AstInternal.ag
@@ -1,782 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the ast nodes, and the api functions to pass an ast-and get back type information.--It uses the Utrecht University Attribute Grammar system:--http://www.cs.uu.nl/wiki/bin/view/HUT/AttributeGrammarSystem-http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue4/Why_Attribute_Grammars_Matter--The attr and sem definitions are in TypeChecking.ag, which is included-into this file.--These ast nodes are both used as the result of successful parsing, and-as the input to the type checker (and the output from the type-checker), and the pretty printer.--= compiling--use--uuagc -dcfwsp --cycle --genlinepragmas AstInternal.ag--to generate a new AstInternal.hs from this file (cycle will check for-cycles - it's bad if you get any of these, and genlinepragmas mean-that you'll be able to view the original source ag positions when-there are errors or warnings compiling the generated hs file, which-you want much more often than not).--(install uuagc with-cabal install uuagc-)---}-MODULE {Database.HsSqlPpp.AstInternals.AstInternal}-{- -- {-# LANGUAGE DeriveDataTypeable,RankNTypes,ScopedTypeVariables #-}- -- {-# OPTIONS_HADDOCK hide #-}- --from the ag files:- --ast nodes- Statement (..)- ,SelectExpression (..)- ,FnBody (..)- ,SetClause (..)- ,TableRef (..)- ,TableAlias(..)- ,JoinExpression (..)- ,JoinType (..)- ,SelectList (..)- ,SelectItem (..)- ,CopySource (..)- ,AttributeDef (..)- ,RowConstraint (..)- ,AlterTableAction(..)- ,Constraint (..)- ,TypeAttributeDef (..)- ,ParamDef (..)- ,VarDef (..)- ,RaiseType (..)- ,CombineType (..)- ,Volatility (..)- ,Language (..)- ,TypeName (..)- ,DropType (..)- ,Cascade (..)- ,Direction (..)- ,Distinct (..)- ,Natural (..)- ,IfExists (..)- ,RestartIdentity (..)- ,Expression (..)- ,FrameClause(..)- ,InList (..)- ,LiftFlavour(..)- ,TriggerWhen(..)- ,TriggerEvent(..)- ,TriggerFire(..)- ,StatementList- ,ExpressionListStatementListPairList- ,ExpressionListStatementListPair- ,ExpressionList- ,StringList- ,ParamDefList- ,AttributeDefList- ,ConstraintList- ,TypeAttributeDefList- ,TypeNameList- ,StringTypeNameListPair- ,StringTypeNameListPairList- ,ExpressionStatementListPairList- ,SetClauseList- ,CaseExpressionListExpressionPairList- ,MaybeExpression- ,TableRefList- ,ExpressionListList- ,SelectItemList- ,OnExpr- ,RowConstraintList- ,VarDefList- ,ExpressionStatementListPair- ,CaseExpressionListExpressionPair- ,CaseExpressionList- ,ExpressionDirectionPair- ,ExpressionDirectionPairList- ,MaybeBoolExpression- ,MaybeSelectList- ,SetValue(..)- -- typechecking- ,typeCheck- ,typeCheckPS- ,typeCheckExpression-}--{-import Data.Maybe-import Data.List-import Debug.Trace-import Control.Monad.Error-import Control.Arrow-import Data.Either-import Control.Applicative-import Data.Generics-import Data.Char--import Database.HsSqlPpp.AstInternals.TypeType-import Database.HsSqlPpp.AstInternals.TypeChecking.TypeConversion-import Database.HsSqlPpp.AstInternals.TypeChecking.ErrorUtils-import Database.HsSqlPpp.AstInternals.AstAnnotation-import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal-import Database.HsSqlPpp.AstInternals.Environment.LocalIdentifierBindings-import Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment-import Database.HsSqlPpp.Utils-import Data.Generics.PlateData--}--{--================================================================================--SQL top level statements--everything is chucked in here: dml, ddl, plpgsql statements---}--DATA Statement----queries-- | SelectStatement ann:Annotation ex:SelectExpression---- dml-- --table targetcolumns insertdata(values or select statement) returning- | Insert ann:Annotation- table : String- targetCols : StringList- insData : SelectExpression- returning : MaybeSelectList- --tablename setitems where returning- | Update ann:Annotation- table : String- assigns : SetClauseList- whr : MaybeBoolExpression- returning : MaybeSelectList- --tablename, where, returning- | Delete ann:Annotation- table : String- whr : MaybeBoolExpression- returning : MaybeSelectList- --tablename column names, from- | Copy ann:Annotation- table : String- targetCols : StringList- source : CopySource- --represents inline data for copy statement- | CopyData ann:Annotation insData : String- | Truncate ann:Annotation- tables: StringList- restartIdentity : RestartIdentity- cascade : Cascade---- ddl-- | CreateTable ann:Annotation- name : String- atts : AttributeDefList- cons : ConstraintList- | AlterTable ann:Annotation- name : String- actions : {[AlterTableAction]}- | CreateSequence ann:Annotation- name:String- incr:Integer- min:Integer- max:Integer- start:Integer- cache:Integer- | AlterSequence ann:Annotation- name:String- ownedBy: String- | CreateTableAs ann:Annotation- name : String- expr : SelectExpression- | CreateView ann:Annotation- name : String- expr : SelectExpression- | CreateType ann:Annotation- name : String- atts : TypeAttributeDefList- -- language name args rettype bodyquoteused body vol- | CreateFunction ann:Annotation- name : String- params : ParamDefList- rettype : TypeName- lang : Language- bodyQuote : String- body : FnBody- vol : Volatility- -- name type checkexpression- | CreateDomain ann:Annotation- name : String- typ : TypeName- checkName: String- check : MaybeBoolExpression- | CreateLanguage ann:Annotation- name:String- | CreateTrigger ann:Annotation- name:String- wh : TriggerWhen- events: {[TriggerEvent]}- tbl : String- firing : TriggerFire- fnName : String- fnArgs : {[Expression]}- -- ifexists (name,argtypes)* cascadeorrestrict- | DropFunction ann:Annotation- ifE : IfExists- sigs : StringTypeNameListPairList- cascade : Cascade- -- ifexists names cascadeorrestrict- | DropSomething ann:Annotation- dropType : DropType- ifE : IfExists- names : StringList- cascade : Cascade- | Assignment ann:Annotation- target : String- value : Expression- | Return ann:Annotation- value : (MaybeExpression)- | ReturnNext ann:Annotation- expr : Expression- | ReturnQuery ann:Annotation- sel : SelectExpression- | Raise ann:Annotation- level : RaiseType- message : String- args : ExpressionList- | NullStatement ann:Annotation- | Perform ann:Annotation- expr : Expression- | Execute ann:Annotation- expr : Expression- | ExecuteInto ann:Annotation- expr : Expression- targets : StringList- | ForSelectStatement ann:Annotation- var : String- sel : SelectExpression- sts : StatementList- | ForIntegerStatement ann:Annotation- var : String- from : Expression- to : Expression- sts : StatementList- | WhileStatement ann:Annotation- expr : Expression- sts : StatementList- | ContinueStatement ann:Annotation- --variable, list of when parts, else part- | CaseStatement ann:Annotation- val : Expression- cases : ExpressionListStatementListPairList- els : StatementList- --list is- --first if (condition, statements):elseifs(condition, statements)- --last bit is else statements- | If ann:Annotation- cases : ExpressionStatementListPairList- els : StatementList----misc-- | Set ann:Annotation name:String values:{[SetValue]}- | Notify ann:Annotation name:String---- =============================================================================----Statement components---- maybe this should be called relation valued expression?-DATA SelectExpression- | Select ann:Annotation- selDistinct : Distinct- selSelectList : SelectList- selTref : TableRefList- selWhere : MaybeBoolExpression- selGroupBy : ExpressionList- selHaving : MaybeBoolExpression- selOrderBy : ExpressionDirectionPairList- selLimit : MaybeExpression- selOffset : MaybeExpression- | CombineSelect ann:Annotation- ctype : CombineType- sel1 : SelectExpression- sel2 : SelectExpression- | Values ann:Annotation- vll:ExpressionListList--TYPE TableRefList = [TableRef]-TYPE MaybeExpression = MAYBE Expression-TYPE MaybeBoolExpression = MAYBE Expression--DATA FnBody | SqlFnBody ann:Annotation sts : StatementList- | PlpgsqlFnBody ann:Annotation vars:VarDefList sts : StatementList--DATA SetClause | SetClause ann:Annotation att:String val:Expression- | RowSetClause ann:Annotation atts:StringList vals:ExpressionList--DATA TableRef | Tref ann:Annotation- tbl:String- alias : TableAlias- | JoinedTref ann:Annotation- tbl : TableRef- nat : Natural- joinType : JoinType- tbl1 : TableRef- onExpr : OnExpr- alias : TableAlias- | SubTref ann:Annotation- sel : SelectExpression- alias : TableAlias- | TrefFun ann:Annotation- fn:Expression- alias : TableAlias--DATA TableAlias | NoAlias- | TableAlias alias:String- | FullAlias alias:String cols:{[String]}--TYPE OnExpr = MAYBE JoinExpression--DATA JoinExpression | JoinOn ann:Annotation Expression- | JoinUsing ann:Annotation StringList--DATA JoinType | Inner | LeftOuter| RightOuter | FullOuter | Cross---- select columns, into columns--DATA SelectList | SelectList ann:Annotation items:SelectItemList into:StringList---TYPE MaybeSelectList = MAYBE SelectList--DATA SelectItem | SelExp ann:Annotation ex:Expression- | SelectItem ann:Annotation ex:Expression name:String--DATA CopySource | CopyFilename String- | Stdin----name type default null constraint--DATA AttributeDef | AttributeDef ann:Annotation- name : String- typ : TypeName- def: MaybeExpression- cons : RowConstraintList----Constraints which appear attached to an individual field--DATA RowConstraint | NullConstraint ann:Annotation name:String- | NotNullConstraint ann:Annotation name:String- | RowCheckConstraint ann:Annotation name:String Expression- | RowUniqueConstraint ann:Annotation name:String- | RowPrimaryKeyConstraint ann:Annotation name:String- | RowReferenceConstraint ann:Annotation name:String- table : String- att : (Maybe String)- onUpdate : Cascade- onDelete : Cascade----constraints which appear on a separate row in the create table--DATA Constraint | UniqueConstraint ann:Annotation name:String StringList- | PrimaryKeyConstraint ann:Annotation name:String StringList- | CheckConstraint ann:Annotation name:String Expression- -- sourcecols targettable targetcols ondelete onupdate- | ReferenceConstraint ann:Annotation- name:String- atts : StringList- table : String- tableAtts : StringList- onUpdate : Cascade- onDelete : Cascade--DATA TypeAttributeDef | TypeAttDef ann:Annotation- name : String- typ : TypeName--DATA AlterTableAction | AlterColumnDefault ann:Annotation- nm : String- def : Expression- | AddConstraint ann:Annotation- con: Constraint-DATA SetValue- | SetStr ann:Annotation String- | SetId ann:Annotation String- | SetNum ann:Annotation Double--DATA TriggerWhen | TriggerBefore | TriggerAfter-DATA TriggerEvent | TInsert| TUpdate | TDelete-DATA TriggerFire | EachRow | EachStatement--DATA ParamDef | ParamDef ann:Annotation name:String typ:TypeName- | ParamDefTp ann:Annotation typ:TypeName--DATA VarDef | VarDef ann:Annotation- name : String- typ : TypeName- value : (Maybe Expression)--DATA RaiseType | RNotice | RException | RError--DATA CombineType | Except | Union | Intersect | UnionAll--DATA Volatility | Volatile | Stable | Immutable--DATA Language | Sql | Plpgsql--DATA TypeName | SimpleTypeName ann:Annotation tn:String- | PrecTypeName ann:Annotation tn:String prec:Integer- | ArrayTypeName ann:Annotation typ:TypeName- | SetOfTypeName ann:Annotation typ:TypeName--DATA DropType | Table- | Domain- | View- | Type--DATA Cascade | Cascade | Restrict--DATA Direction | Asc | Desc--DATA Distinct | Distinct | Dupes--DATA Natural | Natural | Unnatural--DATA IfExists | Require | IfExists--DATA RestartIdentity | RestartIdentity | ContinueIdentity--{--================================================================================--Expressions--Similarly to the statement type, all expressions are chucked into one-even though there are many restrictions on which expressions can-appear in different places. Maybe this should be called scalar-expression?---}-DATA Expression | IntegerLit ann:Annotation i:Integer- | FloatLit ann:Annotation d:Double- | StringLit ann:Annotation- quote : String- value : String- | NullLit ann:Annotation- | BooleanLit ann:Annotation b:Bool- | PositionalArg ann:Annotation p:Integer- | Placeholder ann:Annotation -- represents a '?'- | Cast ann:Annotation- expr:Expression- tn:TypeName- | Identifier ann:Annotation- i:String- | Case ann:Annotation- cases : CaseExpressionListExpressionPairList- els : MaybeExpression- | CaseSimple ann:Annotation- value : Expression- cases : CaseExpressionListExpressionPairList- els : MaybeExpression- | Exists ann:Annotation- sel : SelectExpression- | FunCall ann:Annotation- funName:String- args:ExpressionList- | InPredicate ann:Annotation- expr:Expression- i:Bool- list:InList- | WindowFn ann:Annotation- fn : Expression- partitionBy : ExpressionList- orderBy : ExpressionList- dir : Direction- frm : FrameClause- | ScalarSubQuery ann:Annotation- sel : SelectExpression- | LiftOperator ann:Annotation- oper:String- flav:LiftFlavour- args:ExpressionList--DATA LiftFlavour | LiftAny | LiftAll----todo: use liftoperator to implement inlist?-DATA InList | InList ann:Annotation exprs : ExpressionList- | InSelect ann:Annotation sel : SelectExpression---DATA FrameClause | FrameUnboundedPreceding- | FrameUnboundedFull- | FrameRowsUnboundedPreceding-{---list of expression flavours from postgresql with the equivalents in this ast-pg here--- -----constant/literal integerlit, floatlit, unknownstringlit, nulllit, boollit-column reference identifier-positional parameter reference positionalarg-subscripted expression funcall-field selection expression identifier-operator invocation funcall-function call funcall-aggregate expression funcall-window function call windowfn-type cast cast-scalar subquery scalarsubquery-array constructor funcall-row constructor funall--Anything that is represented in the ast as some sort of name plus a-list of expressions as arguments is treated as the same type of node:-FunCall.--This includes-symbol operators-regular function calls-keyword operators e.g. and, like (ones which can be parsed as normal- syntactic operators)-unusual syntax operators, e.g. between-unusual syntax function calls e.g. substring(x from 5 for 3)-arrayctors e.g. array[3,5,6]-rowctors e.g. ROW (2,4,6)-array subscripting--list of keyword operators (regular prefix, infix and postfix):-and, or, not-is null, is not null, isnull, notnull-is distinct from, is not distinct from-is true, is not true,is false, is not false, is unknown, is not unknown-like, not like, ilike, not ilike-similar to, not similar to-in, not in (don't include these here since the argument isn't always an expr)--unusual syntax operators and fn calls-between, not between, between symmetric-overlay, substring, trim-any, some, all--Most of unusual syntax forms and keywords operators are not yet-supported, so this is mainly a todo list.--Keyword operators are encoded with the function name as a ! followed-by a string-e.g.-operator 'and' -> FunCall "!and" ...-see keywordOperatorTypes value in AstUtils.lhs for the list of-currently supported keyword operators.---}---- some list nodes, not sure if all of these are needed as separately--- named node types--TYPE ExpressionList = [Expression]-TYPE ExpressionListList = [ExpressionList]-TYPE StringList = [String]-TYPE SetClauseList = [SetClause]-TYPE AttributeDefList = [AttributeDef]-TYPE ConstraintList = [Constraint]-TYPE TypeAttributeDefList = [TypeAttributeDef]-TYPE ParamDefList = [ParamDef]-TYPE TypeNameList = [TypeName]-TYPE StringTypeNameListPair = (String, TypeNameList)-TYPE StringTypeNameListPairList = [StringTypeNameListPair]-TYPE ExpressionListStatementListPair = (ExpressionList,StatementList)-TYPE ExpressionListStatementListPairList = [ExpressionListStatementListPair]-TYPE ExpressionStatementListPair = (Expression, StatementList)-TYPE ExpressionStatementListPairList = [ExpressionStatementListPair]-TYPE VarDefList = [VarDef]-TYPE SelectItemList = [SelectItem]-TYPE RowConstraintList = [RowConstraint]-TYPE CaseExpressionListExpressionPair = (CaseExpressionList,Expression)-TYPE CaseExpressionList = [Expression]-TYPE CaseExpressionListExpressionPairList = [CaseExpressionListExpressionPair]-TYPE StatementList = [Statement]-TYPE ExpressionDirectionPair = (Expression,Direction)-TYPE ExpressionDirectionPairList = [ExpressionDirectionPair]---- Add a root data type so we can put initial values for inherited--- attributes in the section which defines and uses those attributes--- rather than in the sem_ calls--DATA Root | Root statements:StatementList-DERIVING Root: Show---- use an expression root also to support type checking,--- etc., individual expressions--DATA ExpressionRoot | ExpressionRoot expr:Expression-DERIVING ExpressionRoot: Show--{--================================================================================--=some basic bookkeeping--attributes which every node has--}--SET AllNodes = Statement SelectExpression FnBody SetClause TableRef- JoinExpression JoinType- SelectList SelectItem CopySource AttributeDef RowConstraint- Constraint TypeAttributeDef ParamDef VarDef RaiseType- CombineType Volatility Language TypeName DropType Cascade- Direction Distinct Natural IfExists RestartIdentity- Expression InList MaybeExpression MaybeBoolExpression- ExpressionList ExpressionListList StringList SetClauseList- AttributeDefList ConstraintList TypeAttributeDefList- ParamDefList TypeNameList StringTypeNameListPair- StringTypeNameListPairList- StatementList ExpressionListStatementListPair- ExpressionListStatementListPairList ExpressionStatementListPair- ExpressionStatementListPairList VarDefList SelectItemList- RowConstraintList CaseExpressionListExpressionPair- CaseExpressionListExpressionPairList CaseExpressionList- TableRefList TableRef OnExpr LiftFlavour MaybeSelectList- SetValue TableAlias FrameClause AlterTableAction- TriggerWhen TriggerEvent TriggerFire ExpressionDirectionPair- ExpressionDirectionPairList---DERIVING AllNodes: Show,Eq,Typeable,Data---INCLUDE "TypeChecking/TypeChecking.ag"--{---================================================================================--used to use record syntax to try to insulate code from field changes,-and not have to write out loads of nothings and [] for simple selects,-but don't know how to create haskell named records from uuagc DATA-things--makeSelect :: Statement-makeSelect = Select Dupes (SelectList [SelExp (Identifier "*")] [])- Nothing Nothing [] Nothing [] Asc Nothing Nothing---================================================================================--= annotation functions---}-{-{---- | Type check multiple asts, allowing type checking references in--- later files to definitions in earlier files. This is probably--- more straightforward if you parse the files then concatenate the--- statementlists together before type checking rather than using--- this function-typeCheckMany :: Environment -> [StatementList] -> [StatementList]-typeCheckMany env sts =- annInt env sts []- where- annInt e (s:ss) ress =- let (e1,res) = typeCheck e s- in annInt e1 ss (res:ress)- annInt _ [] ress = reverse ress--}---- | Takes an ast, checks against catalog passed, and adds--- annotations, including types, type errors, and statement info.--- Returns the updated catalog as well as the annotated ast.-typeCheck :: Environment -> StatementList -> (Environment,StatementList)-typeCheck env sts =- let t = sem_Root (Root (fixupImplicitJoins sts))- ta = wrap_Root t Inh_Root {env_Inh_Root = env- ,lib_Inh_Root = emptyBindings}- tl = annotatedTree_Syn_Root ta- env1 = producedEnv_Syn_Root ta- in case tl of- Root r -> (env1,r)---- | Unfinished version of type check which can type check an--- individual statement with ? or positional arg placeholders in--- it. Will error if the statement isn't select, update, insert or--- delete. For use in type checking embedded parameterized--- statements. Does all typechecking and annotation that the regular--- typecheck does.-typeCheckPS :: Environment -> Statement -> Either String Statement-typeCheckPS env st =- case st of- SelectStatement _ _ -> tc- Insert _ _ _ _ _ -> tc- Update _ _ _ _ _ -> tc- Delete _ _ _ _ -> tc- _ -> Left "requires select, update, insert or delete statement"- where- tc = let t = sem_Root (Root (fixupImplicitJoins [st]))- ta = wrap_Root t Inh_Root {env_Inh_Root = env- ,lib_Inh_Root = emptyBindings}- tl = annotatedTree_Syn_Root ta- env1 = producedEnv_Syn_Root ta- in case tl of- Root [st1] -> Right st1- _ -> error "impossible happened in typeCheckPS!"----- | Testing utility, mainly used to check an expression for type errors--- or to get its type.-typeCheckExpression :: Environment -> Expression -> Expression-typeCheckExpression env ex =- let t = sem_ExpressionRoot (ExpressionRoot (fixupImplicitJoins ex))- rt = (annotatedTree_Syn_ExpressionRoot- (wrap_ExpressionRoot t Inh_ExpressionRoot {env_Inh_ExpressionRoot = env- ,lib_Inh_ExpressionRoot = emptyBindings}))- in case rt of- ExpressionRoot e -> e--{--bit of a hack, to avoid rewriting the tableref type checking to be-able to do implicit joins, we just convert them in to the equivalent-explicit join--}--fixupImplicitJoins :: Data a => a -> a-fixupImplicitJoins =- transformBi $ \x ->- case x of- -- alter asts to change implicit joins into explicit joins- Select an dis sl trs@(_:_:_) whr grp hav ord lim off- -> Select an dis sl [convTrefs trs] whr grp hav ord lim off- x1 -> x1- where- convTrefs (tr:tr1:trs) = JoinedTref [] tr Unnatural Cross (convTrefs (tr1:trs)) Nothing NoAlias- convTrefs (tr:[]) = tr- convTrefs _ = error "failed doing implicit join fixup hack"-}--{---Future plans:--Investigate how much mileage can get out of making these nodes the-parse tree nodes, and using a separate ast. Hinges on how much extra-value can get from making the types more restrictive for the ast nodes-compared to the parse tree. Starting to think this won't be worth it.--Would like to turn this back into regular Haskell file, maybe could-use AspectAG instead of uuagc to make this happen?----}
− Database/HsSqlPpp/AstInternals/AstInternal.hs
@@ -1,15988 +0,0 @@----- UUAGC 0.9.11 (AstInternal.ag)-module Database.HsSqlPpp.AstInternals.AstInternal(- -- {-# LANGUAGE DeriveDataTypeable,RankNTypes,ScopedTypeVariables #-}- -- {-# OPTIONS_HADDOCK hide #-}- --from the ag files:- --ast nodes- Statement (..)- ,SelectExpression (..)- ,FnBody (..)- ,SetClause (..)- ,TableRef (..)- ,TableAlias(..)- ,JoinExpression (..)- ,JoinType (..)- ,SelectList (..)- ,SelectItem (..)- ,CopySource (..)- ,AttributeDef (..)- ,RowConstraint (..)- ,AlterTableAction(..)- ,Constraint (..)- ,TypeAttributeDef (..)- ,ParamDef (..)- ,VarDef (..)- ,RaiseType (..)- ,CombineType (..)- ,Volatility (..)- ,Language (..)- ,TypeName (..)- ,DropType (..)- ,Cascade (..)- ,Direction (..)- ,Distinct (..)- ,Natural (..)- ,IfExists (..)- ,RestartIdentity (..)- ,Expression (..)- ,FrameClause(..)- ,InList (..)- ,LiftFlavour(..)- ,TriggerWhen(..)- ,TriggerEvent(..)- ,TriggerFire(..)- ,StatementList- ,ExpressionListStatementListPairList- ,ExpressionListStatementListPair- ,ExpressionList- ,StringList- ,ParamDefList- ,AttributeDefList- ,ConstraintList- ,TypeAttributeDefList- ,TypeNameList- ,StringTypeNameListPair- ,StringTypeNameListPairList- ,ExpressionStatementListPairList- ,SetClauseList- ,CaseExpressionListExpressionPairList- ,MaybeExpression- ,TableRefList- ,ExpressionListList- ,SelectItemList- ,OnExpr- ,RowConstraintList- ,VarDefList- ,ExpressionStatementListPair- ,CaseExpressionListExpressionPair- ,CaseExpressionList- ,ExpressionDirectionPair- ,ExpressionDirectionPairList- ,MaybeBoolExpression- ,MaybeSelectList- ,SetValue(..)- -- typechecking- ,typeCheck- ,typeCheckPS- ,typeCheckExpression-) where--import Data.Maybe-import Data.List-import Debug.Trace-import Control.Monad.Error-import Control.Arrow-import Data.Either-import Control.Applicative-import Data.Generics-import Data.Char--import Database.HsSqlPpp.AstInternals.TypeType-import Database.HsSqlPpp.AstInternals.TypeChecking.TypeConversion-import Database.HsSqlPpp.AstInternals.TypeChecking.ErrorUtils-import Database.HsSqlPpp.AstInternals.AstAnnotation-import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal-import Database.HsSqlPpp.AstInternals.Environment.LocalIdentifierBindings-import Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment-import Database.HsSqlPpp.Utils-import Data.Generics.PlateData---{-# LINE 683 "AstInternal.ag" #-}--{---- | Type check multiple asts, allowing type checking references in--- later files to definitions in earlier files. This is probably--- more straightforward if you parse the files then concatenate the--- statementlists together before type checking rather than using--- this function-typeCheckMany :: Environment -> [StatementList] -> [StatementList]-typeCheckMany env sts =- annInt env sts []- where- annInt e (s:ss) ress =- let (e1,res) = typeCheck e s- in annInt e1 ss (res:ress)- annInt _ [] ress = reverse ress--}---- | Takes an ast, checks against catalog passed, and adds--- annotations, including types, type errors, and statement info.--- Returns the updated catalog as well as the annotated ast.-typeCheck :: Environment -> StatementList -> (Environment,StatementList)-typeCheck env sts =- let t = sem_Root (Root (fixupImplicitJoins sts))- ta = wrap_Root t Inh_Root {env_Inh_Root = env- ,lib_Inh_Root = emptyBindings}- tl = annotatedTree_Syn_Root ta- env1 = producedEnv_Syn_Root ta- in case tl of- Root r -> (env1,r)---- | Unfinished version of type check which can type check an--- individual statement with ? or positional arg placeholders in--- it. Will error if the statement isn't select, update, insert or--- delete. For use in type checking embedded parameterized--- statements. Does all typechecking and annotation that the regular--- typecheck does.-typeCheckPS :: Environment -> Statement -> Either String Statement-typeCheckPS env st =- case st of- SelectStatement _ _ -> tc- Insert _ _ _ _ _ -> tc- Update _ _ _ _ _ -> tc- Delete _ _ _ _ -> tc- _ -> Left "requires select, update, insert or delete statement"- where- tc = let t = sem_Root (Root (fixupImplicitJoins [st]))- ta = wrap_Root t Inh_Root {env_Inh_Root = env- ,lib_Inh_Root = emptyBindings}- tl = annotatedTree_Syn_Root ta- env1 = producedEnv_Syn_Root ta- in case tl of- Root [st1] -> Right st1- _ -> error "impossible happened in typeCheckPS!"----- | Testing utility, mainly used to check an expression for type errors--- or to get its type.-typeCheckExpression :: Environment -> Expression -> Expression-typeCheckExpression env ex =- let t = sem_ExpressionRoot (ExpressionRoot (fixupImplicitJoins ex))- rt = (annotatedTree_Syn_ExpressionRoot- (wrap_ExpressionRoot t Inh_ExpressionRoot {env_Inh_ExpressionRoot = env- ,lib_Inh_ExpressionRoot = emptyBindings}))- in case rt of- ExpressionRoot e -> e--{--bit of a hack, to avoid rewriting the tableref type checking to be-able to do implicit joins, we just convert them in to the equivalent-explicit join--}--fixupImplicitJoins :: Data a => a -> a-fixupImplicitJoins =- transformBi $ \x ->- case x of- -- alter asts to change implicit joins into explicit joins- Select an dis sl trs@(_:_:_) whr grp hav ord lim off- -> Select an dis sl [convTrefs trs] whr grp hav ord lim off- x1 -> x1- where- convTrefs (tr:tr1:trs) = JoinedTref [] tr Unnatural Cross (convTrefs (tr1:trs)) Nothing NoAlias- convTrefs (tr:[]) = tr- convTrefs _ = error "failed doing implicit join fixup hack"-{-# LINE 189 "AstInternal.hs" #-}--{-# LINE 81 "./TypeChecking/Misc.ag" #-}--{--================================================================================--= couple of small utils--I think this should be alright, an identifier referenced in an-expression can only have zero or one dot in it.--}--splitIdentifier :: String -> (String,String)-splitIdentifier s = let (a,b) = span (/= '.') s- in if b == ""- then ("", a)- else (a,tail b)--{--helper to make adding annotations a bit easier--}--annTypesAndErrors :: Data a => a -> Type -> [TypeError]- -> Maybe [AnnotationElement] -> a-annTypesAndErrors item nt errs add =- updateAnnotation modifier item- where- modifier = (([TypeAnnotation nt] ++ fromMaybe [] add ++- map TypeErrorA errs) ++)--{-# LINE 220 "AstInternal.hs" #-}--{-# LINE 78 "./TypeChecking/Expressions.ag" #-}--{---small shim in front of findCallMatch in the type conversion code, to-handle some special cases.--Some of the special cases will no longer be needed when variadic-support is added.--between, greatest and least are treated as syntactic sugar so we-delegate the function lookups to the <=/>= operators.--the row comparison should be more general than this, since it supports-any operator satisfying some properties---TODO: move all of this into find call match. Don't know why it's separate--}-typeCheckFunCall :: Environment -> String -> [Type] -> Either [TypeError] Type-typeCheckFunCall env fnName' argsType =- {-trace ("typecheckfncall " ++ fnName' ++ show argsType) $-}- dependsOnRTpe argsType $- case fnName of- "count" -> -- not quite sure how this is suppose to work,- -- the counts in the pg catalog accept either- -- no args, or one arg of type any, but you can call- -- count with multiple arguments?- return typeBigInt- "!between" -> do- f1 <- lookupFn ">=" [argsType !! 0, argsType !! 1]- f2 <- lookupFn "<=" [argsType !! 0, argsType !! 2]- lookupFn "!and" [f1,f2]- --"coalesce" -> resolveResultSetType env argsType- "greatest" -> do- t <- lookupFn fnName argsType -- t <- resolveResultSetType env argsType- lookupFn ">=" [t,t]- return t- "least" -> do- t <- lookupFn fnName argsType -- resolveResultSetType env argsType- lookupFn "<=" [t,t]- return t- "!rowctor" -> return $ AnonymousRecordType argsType- -- special case the row comparison ops- -- this needs to be fixed: we want to match- -- any implicit casts to functions on composite types- -- first, then we can use the anonymous record type on- -- any composite- _ | fnName `elem` ["=", "<>", "<=", ">=", "<", ">"]- && length argsType == 2- && all isCompositeOrSetOfCompositeType argsType- && compositesCompatible env (head argsType) (head $ tail argsType) -> Right typeBool- --checked for all special cases, so run general case now- s -> lookupFn s argsType- where- lookupFn :: String -> [Type] -> Either [TypeError] Type- lookupFn s1 args = do- (_,_,r,_) <- findCallMatch env- (if s1 == "u-" then "-" else s1) args- return r- checkRowTypesMatch (AnonymousRecordType t1s) (AnonymousRecordType t2s) = do- when (length t1s /= length t2s) $ Left [ValuesListsMustBeSameLength]- let errs = map (resolveResultSetType env . (\(a,b) -> [a,b])) $- zip t1s t2s- liftErrors $ concat $ lefts errs- return typeBool- checkRowTypesMatch x y =- error $ "internal error: checkRowTypesMatch called with " ++- show x ++ "," ++ show y- fnName = map toLower fnName'-{-# LINE 292 "AstInternal.hs" #-}--{-# LINE 141 "./TypeChecking/SelectStatement.ag" #-}---typeCheckValuesExpr :: Environment -> [[Type]] -> Either [TypeError] Type-typeCheckValuesExpr env rowsTs =- let colNames = zipWith (++)- (repeat "column")- (map show [1..length $ head rowsTs])- in unionRelTypes env rowsTs colNames---typeCheckCombineSelect :: Environment -> Type -> Type -> Either [TypeError] Type-typeCheckCombineSelect env v1 v2 = do- u1 <- unwrapSetOfComposite v1- let colNames = map fst u1- u2 <- unwrapSetOfComposite v2- let colTypes1 = map snd u1- let colTypes2 = map snd u2- unionRelTypes env [colTypes1,colTypes2] colNames--unionRelTypes :: Environment -> [[Type]] -> [String] -> Either [TypeError] Type-unionRelTypes env rowsTs colNames =- let lengths = map length rowsTs- in case () of- _ | null rowsTs ->- Left [NoRowsGivenForValues]- | not (all (==head lengths) lengths) ->- Left [ValuesListsMustBeSameLength]- | otherwise ->- --i don't think this propagates all the errors, just the first set- mapM (resolveResultSetType env) (transpose rowsTs) >>=- (return . SetOfType . CompositeType . zip colNames)--{-# LINE 327 "AstInternal.hs" #-}--{-# LINE 180 "./TypeChecking/SelectStatement.ag" #-}--getPlaceholders :: Data a => a -> [Expression]-getPlaceholders st =- filter isPlaceholder $ everything (++) (mkQ [] ga) st- where- ga :: Expression -> [Expression]- ga s = [s]- isPlaceholder e = case e of- PositionalArg _ _ -> True- Placeholder _ -> True- _ -> False-{-# LINE 341 "AstInternal.hs" #-}--{-# LINE 200 "./TypeChecking/TableRefs.ag" #-}--{--convert a function call into a [String,[(string,type)]] list for use-in a tableref context-first consideration is the alias: if there is an alias in the select,-e.g. select * from generate_series(1,2) x; (alias is x)-we use that, otherwise we use the name of the function-second consideration is the attributes coming out, roughly speaking-we have to convert an arbitrary type to a relation type-if we have a relation valued function, we don't need to do anything-if we have a setof non composite, we lift the single type to an-attribute, using the function name for the attribute name-if we have a non setof, we lift the single type to an attribute and-then relation, using the function name for the attribute name-need to check to see what should happen with arrayof---}-funIdens :: Environment -> String -> Expression -> Either [TypeError] (String,[(String,Type)])-funIdens env alias fnVal = do- errorWhen (case fnVal of- FunCall _ _ _ -> False- _ -> True)- [ContextError "FunCall"]- let (FunCall _ fnName _) = fnVal- correlationName = if alias /= ""- then alias- else fnName- attrs <- do- case getTypeAnnotation fnVal of- SetOfType (NamedCompositeType t) -> envCompositePublicAttrs env [] t- SetOfType x -> return [(correlationName,x)]- y -> return [(correlationName,y)]- return (correlationName, attrs)--getAlias :: String -> TableAlias -> String-getAlias def alias =- case alias of- NoAlias -> def- TableAlias t -> t- FullAlias t _ -> t--{-# LINE 385 "AstInternal.hs" #-}--{-# LINE 92 "./TypeChecking/SelectLists.ag" #-}--expandStar :: LocalIdentifierBindings- -> String- -> Type- -> [(String,Type)]- -> [(String,Type)]-expandStar env colName colType types =- fromRight types $ do- let (correlationName,iden) = splitIdentifier colName- newCols <- if iden == "*"- then libExpandStar env correlationName- else return [(iden, colType)]- return $ newCols ++ types--fixStar :: Expression -> Expression-fixStar =- everywhere (mkT fixStar')- where- fixStar' :: Annotation -> Annotation- fixStar' a =- if TypeAnnotation TypeCheckFailed `elem` a- && any (\an ->- case an of- TypeErrorA (UnrecognisedIdentifier x) |- let (_,iden) = splitIdentifier x- in iden == "*" -> True- _ -> False) a- then filter (\an -> case an of- TypeAnnotation TypeCheckFailed -> False- TypeErrorA (UnrecognisedIdentifier _) -> False- _ -> True) a- else a-{-# LINE 420 "AstInternal.hs" #-}--{-# LINE 136 "./TypeChecking/Dml.ag" #-}--getRowTypes :: [Type] -> [Type]-getRowTypes [AnonymousRecordType ts] = ts-getRowTypes ts = ts-{-# LINE 427 "AstInternal.hs" #-}--{-# LINE 174 "./TypeChecking/Dml.ag" #-}-----small shortcut to help produce better errors?-checkRelationExists :: Environment -> String -> Either [TypeError] ()-checkRelationExists env tbl =- envCompositeDef env relationComposites tbl >>- return ()----used by both insert and update-checkColumnConsistency :: Environment -> String -> [String] -> [(String,Type)]- -> Either [TypeError] [(String,Type)]-checkColumnConsistency env tbl cols' insNameTypePairs = do- ttcols <- lowerize <$> envCompositePublicAttrs env [] tbl- let cols = if null cols'- then map fst ttcols- else map (map toLower) cols'- errorWhen (length insNameTypePairs /= length cols) [WrongNumberOfColumns]- let nonMatchingColumns = cols \\ map fst ttcols- errorWhen (not $ null nonMatchingColumns) $- map UnrecognisedIdentifier nonMatchingColumns- let targetNameTypePairs = map (\l -> (l,fromJust $ lookup l ttcols)) cols- --check the types of the insdata match the column targets- --name datatype columntype- typeTriples = map (\((a,b),c) -> (a,b,c)) $- zip targetNameTypePairs $- map snd insNameTypePairs- errs :: [TypeError]- errs = concat $ lefts $- map (\(_,b,c) -> checkAssignmentValid env c b) typeTriples- liftErrors errs- return targetNameTypePairs- where- lowerize = map (\(a,b) -> (map toLower a,b))--{-# LINE 464 "AstInternal.hs" #-}--{-# LINE 40 "./TypeChecking/CreateTable.ag" #-}--defaultSystemColumns :: [(String,Type)]-defaultSystemColumns = [("tableoid", ScalarType "oid")- ,("cmax", ScalarType "cid")- ,("xmax", ScalarType "xid")- ,("cmin", ScalarType "cid")- ,("xmin", ScalarType "xid")- ,("ctid", ScalarType "tid")]-{-# LINE 475 "AstInternal.hs" #-}--- AlterTableAction ---------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative AddConstraint:- child ann : {Annotation}- child con : Constraint - visit 0:- local annotatedTree : _- local originalTree : _- alternative AlterColumnDefault:- child ann : {Annotation}- child nm : {String}- child def : Expression - visit 0:- local annotatedTree : _- local originalTree : _--}-data AlterTableAction = AddConstraint (Annotation) (Constraint) - | AlterColumnDefault (Annotation) (String) (Expression) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_AlterTableAction :: AlterTableAction ->- T_AlterTableAction -sem_AlterTableAction (AddConstraint _ann _con ) =- (sem_AlterTableAction_AddConstraint _ann (sem_Constraint _con ) )-sem_AlterTableAction (AlterColumnDefault _ann _nm _def ) =- (sem_AlterTableAction_AlterColumnDefault _ann _nm (sem_Expression _def ) )--- semantic domain-type T_AlterTableAction = Environment ->- LocalIdentifierBindings ->- ( AlterTableAction,AlterTableAction)-data Inh_AlterTableAction = Inh_AlterTableAction {env_Inh_AlterTableAction :: Environment,lib_Inh_AlterTableAction :: LocalIdentifierBindings}-data Syn_AlterTableAction = Syn_AlterTableAction {annotatedTree_Syn_AlterTableAction :: AlterTableAction,originalTree_Syn_AlterTableAction :: AlterTableAction}-wrap_AlterTableAction :: T_AlterTableAction ->- Inh_AlterTableAction ->- Syn_AlterTableAction -wrap_AlterTableAction sem (Inh_AlterTableAction _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_AlterTableAction _lhsOannotatedTree _lhsOoriginalTree ))-sem_AlterTableAction_AddConstraint :: Annotation ->- T_Constraint ->- T_AlterTableAction -sem_AlterTableAction_AddConstraint ann_ con_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: AlterTableAction- _lhsOoriginalTree :: AlterTableAction- _conOenv :: Environment- _conOlib :: LocalIdentifierBindings- _conIannotatedTree :: Constraint- _conIoriginalTree :: Constraint- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- AddConstraint ann_ _conIannotatedTree- {-# LINE 539 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- AddConstraint ann_ _conIoriginalTree- {-# LINE 544 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 549 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 554 "AstInternal.hs" #-}- -- copy rule (down)- _conOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 559 "AstInternal.hs" #-}- -- copy rule (down)- _conOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 564 "AstInternal.hs" #-}- ( _conIannotatedTree,_conIoriginalTree) =- (con_ _conOenv _conOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_AlterTableAction_AlterColumnDefault :: Annotation ->- String ->- T_Expression ->- T_AlterTableAction -sem_AlterTableAction_AlterColumnDefault ann_ nm_ def_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: AlterTableAction- _lhsOoriginalTree :: AlterTableAction- _defOenv :: Environment- _defOlib :: LocalIdentifierBindings- _defIannotatedTree :: Expression- _defIliftedColumnName :: String- _defIoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- AlterColumnDefault ann_ nm_ _defIannotatedTree- {-# LINE 586 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- AlterColumnDefault ann_ nm_ _defIoriginalTree- {-# LINE 591 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 596 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 601 "AstInternal.hs" #-}- -- copy rule (down)- _defOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 606 "AstInternal.hs" #-}- -- copy rule (down)- _defOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 611 "AstInternal.hs" #-}- ( _defIannotatedTree,_defIliftedColumnName,_defIoriginalTree) =- (def_ _defOenv _defOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- AttributeDef -------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - attrName : String- namedType : Type- originalTree : SELF - alternatives:- alternative AttributeDef:- child ann : {Annotation}- child name : {String}- child typ : TypeName - child def : MaybeExpression - child cons : RowConstraintList - visit 0:- local annotatedTree : _- local originalTree : _--}-data AttributeDef = AttributeDef (Annotation) (String) (TypeName) (MaybeExpression) (RowConstraintList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_AttributeDef :: AttributeDef ->- T_AttributeDef -sem_AttributeDef (AttributeDef _ann _name _typ _def _cons ) =- (sem_AttributeDef_AttributeDef _ann _name (sem_TypeName _typ ) (sem_MaybeExpression _def ) (sem_RowConstraintList _cons ) )--- semantic domain-type T_AttributeDef = Environment ->- LocalIdentifierBindings ->- ( AttributeDef,String,Type,AttributeDef)-data Inh_AttributeDef = Inh_AttributeDef {env_Inh_AttributeDef :: Environment,lib_Inh_AttributeDef :: LocalIdentifierBindings}-data Syn_AttributeDef = Syn_AttributeDef {annotatedTree_Syn_AttributeDef :: AttributeDef,attrName_Syn_AttributeDef :: String,namedType_Syn_AttributeDef :: Type,originalTree_Syn_AttributeDef :: AttributeDef}-wrap_AttributeDef :: T_AttributeDef ->- Inh_AttributeDef ->- Syn_AttributeDef -wrap_AttributeDef sem (Inh_AttributeDef _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_AttributeDef _lhsOannotatedTree _lhsOattrName _lhsOnamedType _lhsOoriginalTree ))-sem_AttributeDef_AttributeDef :: Annotation ->- String ->- T_TypeName ->- T_MaybeExpression ->- T_RowConstraintList ->- T_AttributeDef -sem_AttributeDef_AttributeDef ann_ name_ typ_ def_ cons_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOattrName :: String- _lhsOnamedType :: Type- _consOlib :: LocalIdentifierBindings- _lhsOannotatedTree :: AttributeDef- _lhsOoriginalTree :: AttributeDef- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _defOenv :: Environment- _defOlib :: LocalIdentifierBindings- _consOenv :: Environment- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- _defIannotatedTree :: MaybeExpression- _defIoriginalTree :: MaybeExpression- _consIannotatedTree :: RowConstraintList- _consIoriginalTree :: RowConstraintList- -- "./TypeChecking/CreateTable.ag"(line 79, column 9)- _lhsOattrName =- {-# LINE 79 "./TypeChecking/CreateTable.ag" #-}- map toLower name_- {-# LINE 687 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 80, column 9)- _lhsOnamedType =- {-# LINE 80 "./TypeChecking/CreateTable.ag" #-}- _typInamedType- {-# LINE 692 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 95, column 9)- _consOlib =- {-# LINE 95 "./TypeChecking/CreateTable.ag" #-}- case updateBindings _lhsIlib _lhsIenv- [LibStackIDs [("", [(name_, _typInamedType)])]] of- Left x -> error $ show x- Right e -> e- {-# LINE 700 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- AttributeDef ann_ name_ _typIannotatedTree _defIannotatedTree _consIannotatedTree- {-# LINE 705 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- AttributeDef ann_ name_ _typIoriginalTree _defIoriginalTree _consIoriginalTree- {-# LINE 710 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 715 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 720 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 725 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 730 "AstInternal.hs" #-}- -- copy rule (down)- _defOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 735 "AstInternal.hs" #-}- -- copy rule (down)- _defOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 740 "AstInternal.hs" #-}- -- copy rule (down)- _consOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 745 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- ( _defIannotatedTree,_defIoriginalTree) =- (def_ _defOenv _defOlib )- ( _consIannotatedTree,_consIoriginalTree) =- (cons_ _consOenv _consOlib )- in ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType,_lhsOoriginalTree)))--- AttributeDefList ---------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - attrs : [(String, Type)]- originalTree : SELF - alternatives:- alternative Cons:- child hd : AttributeDef - child tl : AttributeDefList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type AttributeDefList = [(AttributeDef)]--- cata-sem_AttributeDefList :: AttributeDefList ->- T_AttributeDefList -sem_AttributeDefList list =- (Prelude.foldr sem_AttributeDefList_Cons sem_AttributeDefList_Nil (Prelude.map sem_AttributeDef list) )--- semantic domain-type T_AttributeDefList = Environment ->- LocalIdentifierBindings ->- ( AttributeDefList,([(String, Type)]),AttributeDefList)-data Inh_AttributeDefList = Inh_AttributeDefList {env_Inh_AttributeDefList :: Environment,lib_Inh_AttributeDefList :: LocalIdentifierBindings}-data Syn_AttributeDefList = Syn_AttributeDefList {annotatedTree_Syn_AttributeDefList :: AttributeDefList,attrs_Syn_AttributeDefList :: [(String, Type)],originalTree_Syn_AttributeDefList :: AttributeDefList}-wrap_AttributeDefList :: T_AttributeDefList ->- Inh_AttributeDefList ->- Syn_AttributeDefList -wrap_AttributeDefList sem (Inh_AttributeDefList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOattrs,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_AttributeDefList _lhsOannotatedTree _lhsOattrs _lhsOoriginalTree ))-sem_AttributeDefList_Cons :: T_AttributeDef ->- T_AttributeDefList ->- T_AttributeDefList -sem_AttributeDefList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOattrs :: ([(String, Type)])- _lhsOannotatedTree :: AttributeDefList- _lhsOoriginalTree :: AttributeDefList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: AttributeDef- _hdIattrName :: String- _hdInamedType :: Type- _hdIoriginalTree :: AttributeDef- _tlIannotatedTree :: AttributeDefList- _tlIattrs :: ([(String, Type)])- _tlIoriginalTree :: AttributeDefList- -- "./TypeChecking/CreateTable.ag"(line 85, column 12)- _lhsOattrs =- {-# LINE 85 "./TypeChecking/CreateTable.ag" #-}- (_hdIattrName, _hdInamedType) : _tlIattrs- {-# LINE 818 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 823 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 828 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 833 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 838 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 843 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 848 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 853 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 858 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIattrName,_hdInamedType,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIattrs,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOattrs,_lhsOoriginalTree)))-sem_AttributeDefList_Nil :: T_AttributeDefList -sem_AttributeDefList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOattrs :: ([(String, Type)])- _lhsOannotatedTree :: AttributeDefList- _lhsOoriginalTree :: AttributeDefList- -- "./TypeChecking/CreateTable.ag"(line 86, column 11)- _lhsOattrs =- {-# LINE 86 "./TypeChecking/CreateTable.ag" #-}- []- {-# LINE 875 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 880 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 885 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 890 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 895 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOattrs,_lhsOoriginalTree)))--- Cascade ------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cascade:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Restrict:- visit 0:- local annotatedTree : _- local originalTree : _--}-data Cascade = Cascade - | Restrict - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Cascade :: Cascade ->- T_Cascade -sem_Cascade (Cascade ) =- (sem_Cascade_Cascade )-sem_Cascade (Restrict ) =- (sem_Cascade_Restrict )--- semantic domain-type T_Cascade = Environment ->- LocalIdentifierBindings ->- ( Cascade,Cascade)-data Inh_Cascade = Inh_Cascade {env_Inh_Cascade :: Environment,lib_Inh_Cascade :: LocalIdentifierBindings}-data Syn_Cascade = Syn_Cascade {annotatedTree_Syn_Cascade :: Cascade,originalTree_Syn_Cascade :: Cascade}-wrap_Cascade :: T_Cascade ->- Inh_Cascade ->- Syn_Cascade -wrap_Cascade sem (Inh_Cascade _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Cascade _lhsOannotatedTree _lhsOoriginalTree ))-sem_Cascade_Cascade :: T_Cascade -sem_Cascade_Cascade =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Cascade- _lhsOoriginalTree :: Cascade- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Cascade- {-# LINE 949 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Cascade- {-# LINE 954 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 959 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 964 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Cascade_Restrict :: T_Cascade -sem_Cascade_Restrict =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Cascade- _lhsOoriginalTree :: Cascade- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Restrict- {-# LINE 976 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Restrict- {-# LINE 981 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 986 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 991 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- CaseExpressionList -------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : Expression - child tl : CaseExpressionList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type CaseExpressionList = [(Expression)]--- cata-sem_CaseExpressionList :: CaseExpressionList ->- T_CaseExpressionList -sem_CaseExpressionList list =- (Prelude.foldr sem_CaseExpressionList_Cons sem_CaseExpressionList_Nil (Prelude.map sem_Expression list) )--- semantic domain-type T_CaseExpressionList = Environment ->- LocalIdentifierBindings ->- ( CaseExpressionList,CaseExpressionList)-data Inh_CaseExpressionList = Inh_CaseExpressionList {env_Inh_CaseExpressionList :: Environment,lib_Inh_CaseExpressionList :: LocalIdentifierBindings}-data Syn_CaseExpressionList = Syn_CaseExpressionList {annotatedTree_Syn_CaseExpressionList :: CaseExpressionList,originalTree_Syn_CaseExpressionList :: CaseExpressionList}-wrap_CaseExpressionList :: T_CaseExpressionList ->- Inh_CaseExpressionList ->- Syn_CaseExpressionList -wrap_CaseExpressionList sem (Inh_CaseExpressionList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_CaseExpressionList _lhsOannotatedTree _lhsOoriginalTree ))-sem_CaseExpressionList_Cons :: T_Expression ->- T_CaseExpressionList ->- T_CaseExpressionList -sem_CaseExpressionList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CaseExpressionList- _lhsOoriginalTree :: CaseExpressionList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: Expression- _hdIliftedColumnName :: String- _hdIoriginalTree :: Expression- _tlIannotatedTree :: CaseExpressionList- _tlIoriginalTree :: CaseExpressionList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 1054 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 1059 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1064 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1069 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1074 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1079 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1084 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1089 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIliftedColumnName,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_CaseExpressionList_Nil :: T_CaseExpressionList -sem_CaseExpressionList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CaseExpressionList- _lhsOoriginalTree :: CaseExpressionList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 1105 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 1110 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1115 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1120 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- CaseExpressionListExpressionPair -----------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Tuple:- child x1 : CaseExpressionList - child x2 : Expression - visit 0:- local annotatedTree : _- local originalTree : _--}-type CaseExpressionListExpressionPair = ( (CaseExpressionList),(Expression))--- cata-sem_CaseExpressionListExpressionPair :: CaseExpressionListExpressionPair ->- T_CaseExpressionListExpressionPair -sem_CaseExpressionListExpressionPair ( x1,x2) =- (sem_CaseExpressionListExpressionPair_Tuple (sem_CaseExpressionList x1 ) (sem_Expression x2 ) )--- semantic domain-type T_CaseExpressionListExpressionPair = Environment ->- LocalIdentifierBindings ->- ( CaseExpressionListExpressionPair,CaseExpressionListExpressionPair)-data Inh_CaseExpressionListExpressionPair = Inh_CaseExpressionListExpressionPair {env_Inh_CaseExpressionListExpressionPair :: Environment,lib_Inh_CaseExpressionListExpressionPair :: LocalIdentifierBindings}-data Syn_CaseExpressionListExpressionPair = Syn_CaseExpressionListExpressionPair {annotatedTree_Syn_CaseExpressionListExpressionPair :: CaseExpressionListExpressionPair,originalTree_Syn_CaseExpressionListExpressionPair :: CaseExpressionListExpressionPair}-wrap_CaseExpressionListExpressionPair :: T_CaseExpressionListExpressionPair ->- Inh_CaseExpressionListExpressionPair ->- Syn_CaseExpressionListExpressionPair -wrap_CaseExpressionListExpressionPair sem (Inh_CaseExpressionListExpressionPair _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_CaseExpressionListExpressionPair _lhsOannotatedTree _lhsOoriginalTree ))-sem_CaseExpressionListExpressionPair_Tuple :: T_CaseExpressionList ->- T_Expression ->- T_CaseExpressionListExpressionPair -sem_CaseExpressionListExpressionPair_Tuple x1_ x2_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CaseExpressionListExpressionPair- _lhsOoriginalTree :: CaseExpressionListExpressionPair- _x1Oenv :: Environment- _x1Olib :: LocalIdentifierBindings- _x2Oenv :: Environment- _x2Olib :: LocalIdentifierBindings- _x1IannotatedTree :: CaseExpressionList- _x1IoriginalTree :: CaseExpressionList- _x2IannotatedTree :: Expression- _x2IliftedColumnName :: String- _x2IoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (_x1IannotatedTree,_x2IannotatedTree)- {-# LINE 1179 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (_x1IoriginalTree,_x2IoriginalTree)- {-# LINE 1184 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1189 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1194 "AstInternal.hs" #-}- -- copy rule (down)- _x1Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1199 "AstInternal.hs" #-}- -- copy rule (down)- _x1Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1204 "AstInternal.hs" #-}- -- copy rule (down)- _x2Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1209 "AstInternal.hs" #-}- -- copy rule (down)- _x2Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1214 "AstInternal.hs" #-}- ( _x1IannotatedTree,_x1IoriginalTree) =- (x1_ _x1Oenv _x1Olib )- ( _x2IannotatedTree,_x2IliftedColumnName,_x2IoriginalTree) =- (x2_ _x2Oenv _x2Olib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- CaseExpressionListExpressionPairList -------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : CaseExpressionListExpressionPair - child tl : CaseExpressionListExpressionPairList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type CaseExpressionListExpressionPairList = [(CaseExpressionListExpressionPair)]--- cata-sem_CaseExpressionListExpressionPairList :: CaseExpressionListExpressionPairList ->- T_CaseExpressionListExpressionPairList -sem_CaseExpressionListExpressionPairList list =- (Prelude.foldr sem_CaseExpressionListExpressionPairList_Cons sem_CaseExpressionListExpressionPairList_Nil (Prelude.map sem_CaseExpressionListExpressionPair list) )--- semantic domain-type T_CaseExpressionListExpressionPairList = Environment ->- LocalIdentifierBindings ->- ( CaseExpressionListExpressionPairList,CaseExpressionListExpressionPairList)-data Inh_CaseExpressionListExpressionPairList = Inh_CaseExpressionListExpressionPairList {env_Inh_CaseExpressionListExpressionPairList :: Environment,lib_Inh_CaseExpressionListExpressionPairList :: LocalIdentifierBindings}-data Syn_CaseExpressionListExpressionPairList = Syn_CaseExpressionListExpressionPairList {annotatedTree_Syn_CaseExpressionListExpressionPairList :: CaseExpressionListExpressionPairList,originalTree_Syn_CaseExpressionListExpressionPairList :: CaseExpressionListExpressionPairList}-wrap_CaseExpressionListExpressionPairList :: T_CaseExpressionListExpressionPairList ->- Inh_CaseExpressionListExpressionPairList ->- Syn_CaseExpressionListExpressionPairList -wrap_CaseExpressionListExpressionPairList sem (Inh_CaseExpressionListExpressionPairList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_CaseExpressionListExpressionPairList _lhsOannotatedTree _lhsOoriginalTree ))-sem_CaseExpressionListExpressionPairList_Cons :: T_CaseExpressionListExpressionPair ->- T_CaseExpressionListExpressionPairList ->- T_CaseExpressionListExpressionPairList -sem_CaseExpressionListExpressionPairList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CaseExpressionListExpressionPairList- _lhsOoriginalTree :: CaseExpressionListExpressionPairList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: CaseExpressionListExpressionPair- _hdIoriginalTree :: CaseExpressionListExpressionPair- _tlIannotatedTree :: CaseExpressionListExpressionPairList- _tlIoriginalTree :: CaseExpressionListExpressionPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 1280 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 1285 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1290 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1295 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1300 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1305 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1310 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1315 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_CaseExpressionListExpressionPairList_Nil :: T_CaseExpressionListExpressionPairList -sem_CaseExpressionListExpressionPairList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CaseExpressionListExpressionPairList- _lhsOoriginalTree :: CaseExpressionListExpressionPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 1331 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 1336 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1341 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1346 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- CombineType --------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Except:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Intersect:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Union:- visit 0:- local annotatedTree : _- local originalTree : _- alternative UnionAll:- visit 0:- local annotatedTree : _- local originalTree : _--}-data CombineType = Except - | Intersect - | Union - | UnionAll - deriving ( Data,Eq,Show,Typeable)--- cata-sem_CombineType :: CombineType ->- T_CombineType -sem_CombineType (Except ) =- (sem_CombineType_Except )-sem_CombineType (Intersect ) =- (sem_CombineType_Intersect )-sem_CombineType (Union ) =- (sem_CombineType_Union )-sem_CombineType (UnionAll ) =- (sem_CombineType_UnionAll )--- semantic domain-type T_CombineType = Environment ->- LocalIdentifierBindings ->- ( CombineType,CombineType)-data Inh_CombineType = Inh_CombineType {env_Inh_CombineType :: Environment,lib_Inh_CombineType :: LocalIdentifierBindings}-data Syn_CombineType = Syn_CombineType {annotatedTree_Syn_CombineType :: CombineType,originalTree_Syn_CombineType :: CombineType}-wrap_CombineType :: T_CombineType ->- Inh_CombineType ->- Syn_CombineType -wrap_CombineType sem (Inh_CombineType _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_CombineType _lhsOannotatedTree _lhsOoriginalTree ))-sem_CombineType_Except :: T_CombineType -sem_CombineType_Except =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CombineType- _lhsOoriginalTree :: CombineType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Except- {-# LINE 1414 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Except- {-# LINE 1419 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1424 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1429 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_CombineType_Intersect :: T_CombineType -sem_CombineType_Intersect =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CombineType- _lhsOoriginalTree :: CombineType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Intersect- {-# LINE 1441 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Intersect- {-# LINE 1446 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1451 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1456 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_CombineType_Union :: T_CombineType -sem_CombineType_Union =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CombineType- _lhsOoriginalTree :: CombineType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Union- {-# LINE 1468 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Union- {-# LINE 1473 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1478 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1483 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_CombineType_UnionAll :: T_CombineType -sem_CombineType_UnionAll =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CombineType- _lhsOoriginalTree :: CombineType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- UnionAll- {-# LINE 1495 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- UnionAll- {-# LINE 1500 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1505 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1510 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Constraint ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative CheckConstraint:- child ann : {Annotation}- child name : {String}- child expression : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative PrimaryKeyConstraint:- child ann : {Annotation}- child name : {String}- child stringList : StringList - visit 0:- local annotatedTree : _- local originalTree : _- alternative ReferenceConstraint:- child ann : {Annotation}- child name : {String}- child atts : StringList - child table : {String}- child tableAtts : StringList - child onUpdate : Cascade - child onDelete : Cascade - visit 0:- local annotatedTree : _- local originalTree : _- alternative UniqueConstraint:- child ann : {Annotation}- child name : {String}- child stringList : StringList - visit 0:- local annotatedTree : _- local originalTree : _--}-data Constraint = CheckConstraint (Annotation) (String) (Expression) - | PrimaryKeyConstraint (Annotation) (String) (StringList) - | ReferenceConstraint (Annotation) (String) (StringList) (String) (StringList) (Cascade) (Cascade) - | UniqueConstraint (Annotation) (String) (StringList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Constraint :: Constraint ->- T_Constraint -sem_Constraint (CheckConstraint _ann _name _expression ) =- (sem_Constraint_CheckConstraint _ann _name (sem_Expression _expression ) )-sem_Constraint (PrimaryKeyConstraint _ann _name _stringList ) =- (sem_Constraint_PrimaryKeyConstraint _ann _name (sem_StringList _stringList ) )-sem_Constraint (ReferenceConstraint _ann _name _atts _table _tableAtts _onUpdate _onDelete ) =- (sem_Constraint_ReferenceConstraint _ann _name (sem_StringList _atts ) _table (sem_StringList _tableAtts ) (sem_Cascade _onUpdate ) (sem_Cascade _onDelete ) )-sem_Constraint (UniqueConstraint _ann _name _stringList ) =- (sem_Constraint_UniqueConstraint _ann _name (sem_StringList _stringList ) )--- semantic domain-type T_Constraint = Environment ->- LocalIdentifierBindings ->- ( Constraint,Constraint)-data Inh_Constraint = Inh_Constraint {env_Inh_Constraint :: Environment,lib_Inh_Constraint :: LocalIdentifierBindings}-data Syn_Constraint = Syn_Constraint {annotatedTree_Syn_Constraint :: Constraint,originalTree_Syn_Constraint :: Constraint}-wrap_Constraint :: T_Constraint ->- Inh_Constraint ->- Syn_Constraint -wrap_Constraint sem (Inh_Constraint _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Constraint _lhsOannotatedTree _lhsOoriginalTree ))-sem_Constraint_CheckConstraint :: Annotation ->- String ->- T_Expression ->- T_Constraint -sem_Constraint_CheckConstraint ann_ name_ expression_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Constraint- _lhsOoriginalTree :: Constraint- _expressionOenv :: Environment- _expressionOlib :: LocalIdentifierBindings- _expressionIannotatedTree :: Expression- _expressionIliftedColumnName :: String- _expressionIoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CheckConstraint ann_ name_ _expressionIannotatedTree- {-# LINE 1602 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CheckConstraint ann_ name_ _expressionIoriginalTree- {-# LINE 1607 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1612 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1617 "AstInternal.hs" #-}- -- copy rule (down)- _expressionOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1622 "AstInternal.hs" #-}- -- copy rule (down)- _expressionOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1627 "AstInternal.hs" #-}- ( _expressionIannotatedTree,_expressionIliftedColumnName,_expressionIoriginalTree) =- (expression_ _expressionOenv _expressionOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Constraint_PrimaryKeyConstraint :: Annotation ->- String ->- T_StringList ->- T_Constraint -sem_Constraint_PrimaryKeyConstraint ann_ name_ stringList_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Constraint- _lhsOoriginalTree :: Constraint- _stringListOenv :: Environment- _stringListOlib :: LocalIdentifierBindings- _stringListIannotatedTree :: StringList- _stringListIoriginalTree :: StringList- _stringListIstrings :: ([String])- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- PrimaryKeyConstraint ann_ name_ _stringListIannotatedTree- {-# LINE 1649 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- PrimaryKeyConstraint ann_ name_ _stringListIoriginalTree- {-# LINE 1654 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1659 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1664 "AstInternal.hs" #-}- -- copy rule (down)- _stringListOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1669 "AstInternal.hs" #-}- -- copy rule (down)- _stringListOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1674 "AstInternal.hs" #-}- ( _stringListIannotatedTree,_stringListIoriginalTree,_stringListIstrings) =- (stringList_ _stringListOenv _stringListOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Constraint_ReferenceConstraint :: Annotation ->- String ->- T_StringList ->- String ->- T_StringList ->- T_Cascade ->- T_Cascade ->- T_Constraint -sem_Constraint_ReferenceConstraint ann_ name_ atts_ table_ tableAtts_ onUpdate_ onDelete_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Constraint- _lhsOoriginalTree :: Constraint- _attsOenv :: Environment- _attsOlib :: LocalIdentifierBindings- _tableAttsOenv :: Environment- _tableAttsOlib :: LocalIdentifierBindings- _onUpdateOenv :: Environment- _onUpdateOlib :: LocalIdentifierBindings- _onDeleteOenv :: Environment- _onDeleteOlib :: LocalIdentifierBindings- _attsIannotatedTree :: StringList- _attsIoriginalTree :: StringList- _attsIstrings :: ([String])- _tableAttsIannotatedTree :: StringList- _tableAttsIoriginalTree :: StringList- _tableAttsIstrings :: ([String])- _onUpdateIannotatedTree :: Cascade- _onUpdateIoriginalTree :: Cascade- _onDeleteIannotatedTree :: Cascade- _onDeleteIoriginalTree :: Cascade- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ReferenceConstraint ann_ name_ _attsIannotatedTree table_ _tableAttsIannotatedTree _onUpdateIannotatedTree _onDeleteIannotatedTree- {-# LINE 1713 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ReferenceConstraint ann_ name_ _attsIoriginalTree table_ _tableAttsIoriginalTree _onUpdateIoriginalTree _onDeleteIoriginalTree- {-# LINE 1718 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1723 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1728 "AstInternal.hs" #-}- -- copy rule (down)- _attsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1733 "AstInternal.hs" #-}- -- copy rule (down)- _attsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1738 "AstInternal.hs" #-}- -- copy rule (down)- _tableAttsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1743 "AstInternal.hs" #-}- -- copy rule (down)- _tableAttsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1748 "AstInternal.hs" #-}- -- copy rule (down)- _onUpdateOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1753 "AstInternal.hs" #-}- -- copy rule (down)- _onUpdateOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1758 "AstInternal.hs" #-}- -- copy rule (down)- _onDeleteOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1763 "AstInternal.hs" #-}- -- copy rule (down)- _onDeleteOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1768 "AstInternal.hs" #-}- ( _attsIannotatedTree,_attsIoriginalTree,_attsIstrings) =- (atts_ _attsOenv _attsOlib )- ( _tableAttsIannotatedTree,_tableAttsIoriginalTree,_tableAttsIstrings) =- (tableAtts_ _tableAttsOenv _tableAttsOlib )- ( _onUpdateIannotatedTree,_onUpdateIoriginalTree) =- (onUpdate_ _onUpdateOenv _onUpdateOlib )- ( _onDeleteIannotatedTree,_onDeleteIoriginalTree) =- (onDelete_ _onDeleteOenv _onDeleteOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Constraint_UniqueConstraint :: Annotation ->- String ->- T_StringList ->- T_Constraint -sem_Constraint_UniqueConstraint ann_ name_ stringList_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Constraint- _lhsOoriginalTree :: Constraint- _stringListOenv :: Environment- _stringListOlib :: LocalIdentifierBindings- _stringListIannotatedTree :: StringList- _stringListIoriginalTree :: StringList- _stringListIstrings :: ([String])- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- UniqueConstraint ann_ name_ _stringListIannotatedTree- {-# LINE 1796 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- UniqueConstraint ann_ name_ _stringListIoriginalTree- {-# LINE 1801 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1806 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1811 "AstInternal.hs" #-}- -- copy rule (down)- _stringListOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1816 "AstInternal.hs" #-}- -- copy rule (down)- _stringListOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1821 "AstInternal.hs" #-}- ( _stringListIannotatedTree,_stringListIoriginalTree,_stringListIstrings) =- (stringList_ _stringListOenv _stringListOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ConstraintList -----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : Constraint - child tl : ConstraintList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ConstraintList = [(Constraint)]--- cata-sem_ConstraintList :: ConstraintList ->- T_ConstraintList -sem_ConstraintList list =- (Prelude.foldr sem_ConstraintList_Cons sem_ConstraintList_Nil (Prelude.map sem_Constraint list) )--- semantic domain-type T_ConstraintList = Environment ->- LocalIdentifierBindings ->- ( ConstraintList,ConstraintList)-data Inh_ConstraintList = Inh_ConstraintList {env_Inh_ConstraintList :: Environment,lib_Inh_ConstraintList :: LocalIdentifierBindings}-data Syn_ConstraintList = Syn_ConstraintList {annotatedTree_Syn_ConstraintList :: ConstraintList,originalTree_Syn_ConstraintList :: ConstraintList}-wrap_ConstraintList :: T_ConstraintList ->- Inh_ConstraintList ->- Syn_ConstraintList -wrap_ConstraintList sem (Inh_ConstraintList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ConstraintList _lhsOannotatedTree _lhsOoriginalTree ))-sem_ConstraintList_Cons :: T_Constraint ->- T_ConstraintList ->- T_ConstraintList -sem_ConstraintList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ConstraintList- _lhsOoriginalTree :: ConstraintList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: Constraint- _hdIoriginalTree :: Constraint- _tlIannotatedTree :: ConstraintList- _tlIoriginalTree :: ConstraintList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 1885 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 1890 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1895 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1900 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1905 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1910 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 1915 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 1920 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_ConstraintList_Nil :: T_ConstraintList -sem_ConstraintList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ConstraintList- _lhsOoriginalTree :: ConstraintList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 1936 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 1941 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 1946 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 1951 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- CopySource ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative CopyFilename:- child string : {String}- visit 0:- local annotatedTree : _- local originalTree : _- alternative Stdin:- visit 0:- local annotatedTree : _- local originalTree : _--}-data CopySource = CopyFilename (String) - | Stdin - deriving ( Data,Eq,Show,Typeable)--- cata-sem_CopySource :: CopySource ->- T_CopySource -sem_CopySource (CopyFilename _string ) =- (sem_CopySource_CopyFilename _string )-sem_CopySource (Stdin ) =- (sem_CopySource_Stdin )--- semantic domain-type T_CopySource = Environment ->- LocalIdentifierBindings ->- ( CopySource,CopySource)-data Inh_CopySource = Inh_CopySource {env_Inh_CopySource :: Environment,lib_Inh_CopySource :: LocalIdentifierBindings}-data Syn_CopySource = Syn_CopySource {annotatedTree_Syn_CopySource :: CopySource,originalTree_Syn_CopySource :: CopySource}-wrap_CopySource :: T_CopySource ->- Inh_CopySource ->- Syn_CopySource -wrap_CopySource sem (Inh_CopySource _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_CopySource _lhsOannotatedTree _lhsOoriginalTree ))-sem_CopySource_CopyFilename :: String ->- T_CopySource -sem_CopySource_CopyFilename string_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CopySource- _lhsOoriginalTree :: CopySource- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CopyFilename string_- {-# LINE 2007 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CopyFilename string_- {-# LINE 2012 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2017 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2022 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_CopySource_Stdin :: T_CopySource -sem_CopySource_Stdin =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: CopySource- _lhsOoriginalTree :: CopySource- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Stdin- {-# LINE 2034 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Stdin- {-# LINE 2039 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2044 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2049 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Direction ----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Asc:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Desc:- visit 0:- local annotatedTree : _- local originalTree : _--}-data Direction = Asc - | Desc - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Direction :: Direction ->- T_Direction -sem_Direction (Asc ) =- (sem_Direction_Asc )-sem_Direction (Desc ) =- (sem_Direction_Desc )--- semantic domain-type T_Direction = Environment ->- LocalIdentifierBindings ->- ( Direction,Direction)-data Inh_Direction = Inh_Direction {env_Inh_Direction :: Environment,lib_Inh_Direction :: LocalIdentifierBindings}-data Syn_Direction = Syn_Direction {annotatedTree_Syn_Direction :: Direction,originalTree_Syn_Direction :: Direction}-wrap_Direction :: T_Direction ->- Inh_Direction ->- Syn_Direction -wrap_Direction sem (Inh_Direction _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Direction _lhsOannotatedTree _lhsOoriginalTree ))-sem_Direction_Asc :: T_Direction -sem_Direction_Asc =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Direction- _lhsOoriginalTree :: Direction- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Asc- {-# LINE 2103 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Asc- {-# LINE 2108 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2113 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2118 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Direction_Desc :: T_Direction -sem_Direction_Desc =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Direction- _lhsOoriginalTree :: Direction- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Desc- {-# LINE 2130 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Desc- {-# LINE 2135 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2140 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2145 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Distinct -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Distinct:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Dupes:- visit 0:- local annotatedTree : _- local originalTree : _--}-data Distinct = Distinct - | Dupes - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Distinct :: Distinct ->- T_Distinct -sem_Distinct (Distinct ) =- (sem_Distinct_Distinct )-sem_Distinct (Dupes ) =- (sem_Distinct_Dupes )--- semantic domain-type T_Distinct = Environment ->- LocalIdentifierBindings ->- ( Distinct,Distinct)-data Inh_Distinct = Inh_Distinct {env_Inh_Distinct :: Environment,lib_Inh_Distinct :: LocalIdentifierBindings}-data Syn_Distinct = Syn_Distinct {annotatedTree_Syn_Distinct :: Distinct,originalTree_Syn_Distinct :: Distinct}-wrap_Distinct :: T_Distinct ->- Inh_Distinct ->- Syn_Distinct -wrap_Distinct sem (Inh_Distinct _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Distinct _lhsOannotatedTree _lhsOoriginalTree ))-sem_Distinct_Distinct :: T_Distinct -sem_Distinct_Distinct =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Distinct- _lhsOoriginalTree :: Distinct- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Distinct- {-# LINE 2199 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Distinct- {-# LINE 2204 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2209 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2214 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Distinct_Dupes :: T_Distinct -sem_Distinct_Dupes =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Distinct- _lhsOoriginalTree :: Distinct- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Dupes- {-# LINE 2226 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Dupes- {-# LINE 2231 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2236 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2241 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- DropType -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Domain:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Table:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Type:- visit 0:- local annotatedTree : _- local originalTree : _- alternative View:- visit 0:- local annotatedTree : _- local originalTree : _--}-data DropType = Domain - | Table - | Type - | View - deriving ( Data,Eq,Show,Typeable)--- cata-sem_DropType :: DropType ->- T_DropType -sem_DropType (Domain ) =- (sem_DropType_Domain )-sem_DropType (Table ) =- (sem_DropType_Table )-sem_DropType (Type ) =- (sem_DropType_Type )-sem_DropType (View ) =- (sem_DropType_View )--- semantic domain-type T_DropType = Environment ->- LocalIdentifierBindings ->- ( DropType,DropType)-data Inh_DropType = Inh_DropType {env_Inh_DropType :: Environment,lib_Inh_DropType :: LocalIdentifierBindings}-data Syn_DropType = Syn_DropType {annotatedTree_Syn_DropType :: DropType,originalTree_Syn_DropType :: DropType}-wrap_DropType :: T_DropType ->- Inh_DropType ->- Syn_DropType -wrap_DropType sem (Inh_DropType _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_DropType _lhsOannotatedTree _lhsOoriginalTree ))-sem_DropType_Domain :: T_DropType -sem_DropType_Domain =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: DropType- _lhsOoriginalTree :: DropType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Domain- {-# LINE 2309 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Domain- {-# LINE 2314 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2319 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2324 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_DropType_Table :: T_DropType -sem_DropType_Table =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: DropType- _lhsOoriginalTree :: DropType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Table- {-# LINE 2336 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Table- {-# LINE 2341 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2346 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2351 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_DropType_Type :: T_DropType -sem_DropType_Type =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: DropType- _lhsOoriginalTree :: DropType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Type- {-# LINE 2363 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Type- {-# LINE 2368 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2373 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2378 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_DropType_View :: T_DropType -sem_DropType_View =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: DropType- _lhsOoriginalTree :: DropType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- View- {-# LINE 2390 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- View- {-# LINE 2395 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 2400 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2405 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Expression ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - liftedColumnName : String- originalTree : SELF - alternatives:- alternative BooleanLit:- child ann : {Annotation}- child b : {Bool}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Case:- child ann : {Annotation}- child cases : CaseExpressionListExpressionPairList - child els : MaybeExpression - visit 0:- local whenTypes : _- local thenTypes : _- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative CaseSimple:- child ann : {Annotation}- child value : Expression - child cases : CaseExpressionListExpressionPairList - child els : MaybeExpression - visit 0:- local whenTypes : _- local thenTypes : _- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Cast:- child ann : {Annotation}- child expr : Expression - child tn : TypeName - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Exists:- child ann : {Annotation}- child sel : SelectExpression - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative FloatLit:- child ann : {Annotation}- child d : {Double}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative FunCall:- child ann : {Annotation}- child funName : {String}- child args : ExpressionList - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Identifier:- child ann : {Annotation}- child i : {String}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative InPredicate:- child ann : {Annotation}- child expr : Expression - child i : {Bool}- child list : InList - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative IntegerLit:- child ann : {Annotation}- child i : {Integer}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative LiftOperator:- child ann : {Annotation}- child oper : {String}- child flav : LiftFlavour - child args : ExpressionList - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative NullLit:- child ann : {Annotation}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Placeholder:- child ann : {Annotation}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative PositionalArg:- child ann : {Annotation}- child p : {Integer}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative ScalarSubQuery:- child ann : {Annotation}- child sel : SelectExpression - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative StringLit:- child ann : {Annotation}- child quote : {String}- child value : {String}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative WindowFn:- child ann : {Annotation}- child fn : Expression - child partitionBy : ExpressionList - child orderBy : ExpressionList - child dir : Direction - child frm : FrameClause - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _--}-data Expression = BooleanLit (Annotation) (Bool) - | Case (Annotation) (CaseExpressionListExpressionPairList) (MaybeExpression) - | CaseSimple (Annotation) (Expression) (CaseExpressionListExpressionPairList) (MaybeExpression) - | Cast (Annotation) (Expression) (TypeName) - | Exists (Annotation) (SelectExpression) - | FloatLit (Annotation) (Double) - | FunCall (Annotation) (String) (ExpressionList) - | Identifier (Annotation) (String) - | InPredicate (Annotation) (Expression) (Bool) (InList) - | IntegerLit (Annotation) (Integer) - | LiftOperator (Annotation) (String) (LiftFlavour) (ExpressionList) - | NullLit (Annotation) - | Placeholder (Annotation) - | PositionalArg (Annotation) (Integer) - | ScalarSubQuery (Annotation) (SelectExpression) - | StringLit (Annotation) (String) (String) - | WindowFn (Annotation) (Expression) (ExpressionList) (ExpressionList) (Direction) (FrameClause) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Expression :: Expression ->- T_Expression -sem_Expression (BooleanLit _ann _b ) =- (sem_Expression_BooleanLit _ann _b )-sem_Expression (Case _ann _cases _els ) =- (sem_Expression_Case _ann (sem_CaseExpressionListExpressionPairList _cases ) (sem_MaybeExpression _els ) )-sem_Expression (CaseSimple _ann _value _cases _els ) =- (sem_Expression_CaseSimple _ann (sem_Expression _value ) (sem_CaseExpressionListExpressionPairList _cases ) (sem_MaybeExpression _els ) )-sem_Expression (Cast _ann _expr _tn ) =- (sem_Expression_Cast _ann (sem_Expression _expr ) (sem_TypeName _tn ) )-sem_Expression (Exists _ann _sel ) =- (sem_Expression_Exists _ann (sem_SelectExpression _sel ) )-sem_Expression (FloatLit _ann _d ) =- (sem_Expression_FloatLit _ann _d )-sem_Expression (FunCall _ann _funName _args ) =- (sem_Expression_FunCall _ann _funName (sem_ExpressionList _args ) )-sem_Expression (Identifier _ann _i ) =- (sem_Expression_Identifier _ann _i )-sem_Expression (InPredicate _ann _expr _i _list ) =- (sem_Expression_InPredicate _ann (sem_Expression _expr ) _i (sem_InList _list ) )-sem_Expression (IntegerLit _ann _i ) =- (sem_Expression_IntegerLit _ann _i )-sem_Expression (LiftOperator _ann _oper _flav _args ) =- (sem_Expression_LiftOperator _ann _oper (sem_LiftFlavour _flav ) (sem_ExpressionList _args ) )-sem_Expression (NullLit _ann ) =- (sem_Expression_NullLit _ann )-sem_Expression (Placeholder _ann ) =- (sem_Expression_Placeholder _ann )-sem_Expression (PositionalArg _ann _p ) =- (sem_Expression_PositionalArg _ann _p )-sem_Expression (ScalarSubQuery _ann _sel ) =- (sem_Expression_ScalarSubQuery _ann (sem_SelectExpression _sel ) )-sem_Expression (StringLit _ann _quote _value ) =- (sem_Expression_StringLit _ann _quote _value )-sem_Expression (WindowFn _ann _fn _partitionBy _orderBy _dir _frm ) =- (sem_Expression_WindowFn _ann (sem_Expression _fn ) (sem_ExpressionList _partitionBy ) (sem_ExpressionList _orderBy ) (sem_Direction _dir ) (sem_FrameClause _frm ) )--- semantic domain-type T_Expression = Environment ->- LocalIdentifierBindings ->- ( Expression,String,Expression)-data Inh_Expression = Inh_Expression {env_Inh_Expression :: Environment,lib_Inh_Expression :: LocalIdentifierBindings}-data Syn_Expression = Syn_Expression {annotatedTree_Syn_Expression :: Expression,liftedColumnName_Syn_Expression :: String,originalTree_Syn_Expression :: Expression}-wrap_Expression :: T_Expression ->- Inh_Expression ->- Syn_Expression -wrap_Expression sem (Inh_Expression _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Expression _lhsOannotatedTree _lhsOliftedColumnName _lhsOoriginalTree ))-sem_Expression_BooleanLit :: Annotation ->- Bool ->- T_Expression -sem_Expression_BooleanLit ann_ b_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 2655 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 29, column 19)- _tpe =- {-# LINE 29 "./TypeChecking/Expressions.ag" #-}- Right typeBool- {-# LINE 2660 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 41, column 9)- _backTree =- {-# LINE 41 "./TypeChecking/Expressions.ag" #-}- BooleanLit ann_ b_- {-# LINE 2665 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 2670 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- BooleanLit ann_ b_- {-# LINE 2675 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- BooleanLit ann_ b_- {-# LINE 2680 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2685 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_Case :: Annotation ->- T_CaseExpressionListExpressionPairList ->- T_MaybeExpression ->- T_Expression -sem_Expression_Case ann_ cases_ els_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- _casesOenv :: Environment- _casesOlib :: LocalIdentifierBindings- _elsOenv :: Environment- _elsOlib :: LocalIdentifierBindings- _casesIannotatedTree :: CaseExpressionListExpressionPairList- _casesIoriginalTree :: CaseExpressionListExpressionPairList- _elsIannotatedTree :: MaybeExpression- _elsIoriginalTree :: MaybeExpression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 2712 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 196, column 9)- _whenTypes =- {-# LINE 196 "./TypeChecking/Expressions.ag" #-}- map getTypeAnnotation $ concatMap fst $- _casesIannotatedTree- {-# LINE 2718 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 198, column 9)- _thenTypes =- {-# LINE 198 "./TypeChecking/Expressions.ag" #-}- map getTypeAnnotation $- (map snd $ _casesIannotatedTree) ++- maybeToList _elsIannotatedTree- {-# LINE 2725 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 204, column 9)- _tpe =- {-# LINE 204 "./TypeChecking/Expressions.ag" #-}- dependsOnRTpe _whenTypes $ do- errorWhen (any (/= typeBool) _whenTypes ) $- [WrongTypes typeBool _whenTypes ]- dependsOnRTpe _thenTypes $- resolveResultSetType _lhsIenv _thenTypes- {-# LINE 2734 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 210, column 9)- _backTree =- {-# LINE 210 "./TypeChecking/Expressions.ag" #-}- Case ann_ _casesIannotatedTree _elsIannotatedTree- {-# LINE 2739 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 2744 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Case ann_ _casesIannotatedTree _elsIannotatedTree- {-# LINE 2749 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Case ann_ _casesIoriginalTree _elsIoriginalTree- {-# LINE 2754 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2759 "AstInternal.hs" #-}- -- copy rule (down)- _casesOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2764 "AstInternal.hs" #-}- -- copy rule (down)- _casesOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2769 "AstInternal.hs" #-}- -- copy rule (down)- _elsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2774 "AstInternal.hs" #-}- -- copy rule (down)- _elsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2779 "AstInternal.hs" #-}- ( _casesIannotatedTree,_casesIoriginalTree) =- (cases_ _casesOenv _casesOlib )- ( _elsIannotatedTree,_elsIoriginalTree) =- (els_ _elsOenv _elsOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_CaseSimple :: Annotation ->- T_Expression ->- T_CaseExpressionListExpressionPairList ->- T_MaybeExpression ->- T_Expression -sem_Expression_CaseSimple ann_ value_ cases_ els_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOoriginalTree :: Expression- _lhsOliftedColumnName :: String- _valueOenv :: Environment- _valueOlib :: LocalIdentifierBindings- _casesOenv :: Environment- _casesOlib :: LocalIdentifierBindings- _elsOenv :: Environment- _elsOlib :: LocalIdentifierBindings- _valueIannotatedTree :: Expression- _valueIliftedColumnName :: String- _valueIoriginalTree :: Expression- _casesIannotatedTree :: CaseExpressionListExpressionPairList- _casesIoriginalTree :: CaseExpressionListExpressionPairList- _elsIannotatedTree :: MaybeExpression- _elsIoriginalTree :: MaybeExpression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 2816 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 196, column 9)- _whenTypes =- {-# LINE 196 "./TypeChecking/Expressions.ag" #-}- map getTypeAnnotation $ concatMap fst $- _casesIannotatedTree- {-# LINE 2822 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 198, column 9)- _thenTypes =- {-# LINE 198 "./TypeChecking/Expressions.ag" #-}- map getTypeAnnotation $- (map snd $ _casesIannotatedTree) ++- maybeToList _elsIannotatedTree- {-# LINE 2829 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 215, column 9)- _tpe =- {-# LINE 215 "./TypeChecking/Expressions.ag" #-}- dependsOnRTpe _whenTypes $ do- let valueType = getTypeAnnotation _valueIannotatedTree- checkWhenTypes <-- resolveResultSetType _lhsIenv (valueType : _whenTypes )- dependsOnRTpe _thenTypes $- resolveResultSetType _lhsIenv _thenTypes- {-# LINE 2839 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 222, column 9)- _backTree =- {-# LINE 222 "./TypeChecking/Expressions.ag" #-}- CaseSimple ann_- _valueIannotatedTree- _casesIannotatedTree- _elsIannotatedTree- {-# LINE 2847 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CaseSimple ann_ _valueIannotatedTree _casesIannotatedTree _elsIannotatedTree- {-# LINE 2852 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CaseSimple ann_ _valueIoriginalTree _casesIoriginalTree _elsIoriginalTree- {-# LINE 2857 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2862 "AstInternal.hs" #-}- -- copy rule (up)- _lhsOliftedColumnName =- {-# LINE 161 "./TypeChecking/SelectLists.ag" #-}- _valueIliftedColumnName- {-# LINE 2867 "AstInternal.hs" #-}- -- copy rule (down)- _valueOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2872 "AstInternal.hs" #-}- -- copy rule (down)- _valueOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2877 "AstInternal.hs" #-}- -- copy rule (down)- _casesOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2882 "AstInternal.hs" #-}- -- copy rule (down)- _casesOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2887 "AstInternal.hs" #-}- -- copy rule (down)- _elsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2892 "AstInternal.hs" #-}- -- copy rule (down)- _elsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2897 "AstInternal.hs" #-}- ( _valueIannotatedTree,_valueIliftedColumnName,_valueIoriginalTree) =- (value_ _valueOenv _valueOlib )- ( _casesIannotatedTree,_casesIoriginalTree) =- (cases_ _casesOenv _casesOlib )- ( _elsIannotatedTree,_elsIoriginalTree) =- (els_ _elsOenv _elsOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_Cast :: Annotation ->- T_Expression ->- T_TypeName ->- T_Expression -sem_Expression_Cast ann_ expr_ tn_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _tnOenv :: Environment- _tnOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- _tnIannotatedTree :: TypeName- _tnInamedType :: Type- _tnIoriginalTree :: TypeName- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 2932 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 54, column 12)- _tpe =- {-# LINE 54 "./TypeChecking/Expressions.ag" #-}- Right $ _tnInamedType- {-# LINE 2937 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 55, column 12)- _backTree =- {-# LINE 55 "./TypeChecking/Expressions.ag" #-}- Cast ann_ _exprIannotatedTree _tnIannotatedTree- {-# LINE 2942 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 169, column 10)- _lhsOliftedColumnName =- {-# LINE 169 "./TypeChecking/SelectLists.ag" #-}- case _tnIannotatedTree of- SimpleTypeName _ tn -> tn- _ -> ""- {-# LINE 2949 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Cast ann_ _exprIannotatedTree _tnIannotatedTree- {-# LINE 2954 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Cast ann_ _exprIoriginalTree _tnIoriginalTree- {-# LINE 2959 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 2964 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2969 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2974 "AstInternal.hs" #-}- -- copy rule (down)- _tnOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 2979 "AstInternal.hs" #-}- -- copy rule (down)- _tnOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 2984 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- ( _tnIannotatedTree,_tnInamedType,_tnIoriginalTree) =- (tn_ _tnOenv _tnOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_Exists :: Annotation ->- T_SelectExpression ->- T_Expression -sem_Expression_Exists ann_ sel_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- _selOenv :: Environment- _selOlib :: LocalIdentifierBindings- _selIannotatedTree :: SelectExpression- _selIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selIoriginalTree :: SelectExpression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3011 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 253, column 9)- _tpe =- {-# LINE 253 "./TypeChecking/Expressions.ag" #-}- Right typeBool- {-# LINE 3016 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 254, column 9)- _backTree =- {-# LINE 254 "./TypeChecking/Expressions.ag" #-}- Exists ann_ _selIannotatedTree- {-# LINE 3021 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3026 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Exists ann_ _selIannotatedTree- {-# LINE 3031 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Exists ann_ _selIoriginalTree- {-# LINE 3036 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3041 "AstInternal.hs" #-}- -- copy rule (down)- _selOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3046 "AstInternal.hs" #-}- -- copy rule (down)- _selOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3051 "AstInternal.hs" #-}- ( _selIannotatedTree,_selIlibUpdates,_selIoriginalTree) =- (sel_ _selOenv _selOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_FloatLit :: Annotation ->- Double ->- T_Expression -sem_Expression_FloatLit ann_ d_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3071 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 28, column 17)- _tpe =- {-# LINE 28 "./TypeChecking/Expressions.ag" #-}- Right typeNumeric- {-# LINE 3076 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 39, column 9)- _backTree =- {-# LINE 39 "./TypeChecking/Expressions.ag" #-}- FloatLit ann_ d_- {-# LINE 3081 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3086 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FloatLit ann_ d_- {-# LINE 3091 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FloatLit ann_ d_- {-# LINE 3096 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3101 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_FunCall :: Annotation ->- String ->- T_ExpressionList ->- T_Expression -sem_Expression_FunCall ann_ funName_ args_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- _argsOenv :: Environment- _argsOlib :: LocalIdentifierBindings- _argsIannotatedTree :: ExpressionList- _argsIoriginalTree :: ExpressionList- _argsItypeList :: ([Type])- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3125 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 62, column 9)- _tpe =- {-# LINE 62 "./TypeChecking/Expressions.ag" #-}- dependsOnRTpe _argsItypeList $- typeCheckFunCall- _lhsIenv- funName_- _argsItypeList- {-# LINE 3134 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 67, column 9)- _backTree =- {-# LINE 67 "./TypeChecking/Expressions.ag" #-}- FunCall ann_ funName_ _argsIannotatedTree- {-# LINE 3139 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 165, column 13)- _lhsOliftedColumnName =- {-# LINE 165 "./TypeChecking/SelectLists.ag" #-}- if isOperatorName funName_- then ""- else funName_- {-# LINE 3146 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FunCall ann_ funName_ _argsIannotatedTree- {-# LINE 3151 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FunCall ann_ funName_ _argsIoriginalTree- {-# LINE 3156 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3161 "AstInternal.hs" #-}- -- copy rule (down)- _argsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3166 "AstInternal.hs" #-}- -- copy rule (down)- _argsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3171 "AstInternal.hs" #-}- ( _argsIannotatedTree,_argsIoriginalTree,_argsItypeList) =- (args_ _argsOenv _argsOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_Identifier :: Annotation ->- String ->- T_Expression -sem_Expression_Identifier ann_ i_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3191 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 235, column 9)- _tpe =- {-# LINE 235 "./TypeChecking/Expressions.ag" #-}- libLookupID _lhsIlib i_- {-# LINE 3196 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 236, column 9)- _backTree =- {-# LINE 236 "./TypeChecking/Expressions.ag" #-}- Identifier ann_ i_- {-# LINE 3201 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 164, column 16)- _lhsOliftedColumnName =- {-# LINE 164 "./TypeChecking/SelectLists.ag" #-}- i_- {-# LINE 3206 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Identifier ann_ i_- {-# LINE 3211 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Identifier ann_ i_- {-# LINE 3216 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3221 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_InPredicate :: Annotation ->- T_Expression ->- Bool ->- T_InList ->- T_Expression -sem_Expression_InPredicate ann_ expr_ i_ list_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOoriginalTree :: Expression- _lhsOliftedColumnName :: String- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _listOenv :: Environment- _listOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- _listIannotatedTree :: InList- _listIlistType :: (Either [TypeError] Type)- _listIoriginalTree :: InList- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3251 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 283, column 9)- _tpe =- {-# LINE 283 "./TypeChecking/Expressions.ag" #-}- do- lt <- _listIlistType- ty <- resolveResultSetType- _lhsIenv- [getTypeAnnotation _exprIannotatedTree, lt]- return typeBool- {-# LINE 3261 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 289, column 9)- _backTree =- {-# LINE 289 "./TypeChecking/Expressions.ag" #-}- InPredicate ann_- _exprIannotatedTree- i_- _listIannotatedTree- {-# LINE 3269 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- InPredicate ann_ _exprIannotatedTree i_ _listIannotatedTree- {-# LINE 3274 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- InPredicate ann_ _exprIoriginalTree i_ _listIoriginalTree- {-# LINE 3279 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3284 "AstInternal.hs" #-}- -- copy rule (up)- _lhsOliftedColumnName =- {-# LINE 161 "./TypeChecking/SelectLists.ag" #-}- _exprIliftedColumnName- {-# LINE 3289 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3294 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3299 "AstInternal.hs" #-}- -- copy rule (down)- _listOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3304 "AstInternal.hs" #-}- -- copy rule (down)- _listOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3309 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- ( _listIannotatedTree,_listIlistType,_listIoriginalTree) =- (list_ _listOenv _listOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_IntegerLit :: Annotation ->- Integer ->- T_Expression -sem_Expression_IntegerLit ann_ i_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3331 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 26, column 19)- _tpe =- {-# LINE 26 "./TypeChecking/Expressions.ag" #-}- Right typeInt- {-# LINE 3336 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 35, column 9)- _backTree =- {-# LINE 35 "./TypeChecking/Expressions.ag" #-}- IntegerLit ann_ i_- {-# LINE 3341 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3346 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- IntegerLit ann_ i_- {-# LINE 3351 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- IntegerLit ann_ i_- {-# LINE 3356 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3361 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_LiftOperator :: Annotation ->- String ->- T_LiftFlavour ->- T_ExpressionList ->- T_Expression -sem_Expression_LiftOperator ann_ oper_ flav_ args_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- _flavOenv :: Environment- _flavOlib :: LocalIdentifierBindings- _argsOenv :: Environment- _argsOlib :: LocalIdentifierBindings- _flavIannotatedTree :: LiftFlavour- _flavIoriginalTree :: LiftFlavour- _argsIannotatedTree :: ExpressionList- _argsIoriginalTree :: ExpressionList- _argsItypeList :: ([Type])- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3390 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 161, column 9)- _tpe =- {-# LINE 161 "./TypeChecking/Expressions.ag" #-}- dependsOnRTpe _argsItypeList $ do- let args = _argsIannotatedTree- errorWhen (length args /= 2)- [AnyAllError $ "must have two args, got " ++ show args]- let [a,b] = args- aType = getTypeAnnotation a- bType = getTypeAnnotation b- dependsOnRTpe [aType,bType] $ do- errorWhen (not $ isArrayType bType)- [AnyAllError $ "second arg must be array, got " ++ show args]- elemType <- unwrapArray $ bType- resType <- typeCheckFunCall- _lhsIenv- oper_- [aType,elemType]- errorWhen (resType /= typeBool)- [AnyAllError $ "operator must have bool return, got " ++ show resType]- return resType- {-# LINE 3412 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 179, column 9)- _backTree =- {-# LINE 179 "./TypeChecking/Expressions.ag" #-}- LiftOperator ann_ oper_ _flavIannotatedTree _argsIannotatedTree- {-# LINE 3417 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3422 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- LiftOperator ann_ oper_ _flavIannotatedTree _argsIannotatedTree- {-# LINE 3427 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- LiftOperator ann_ oper_ _flavIoriginalTree _argsIoriginalTree- {-# LINE 3432 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3437 "AstInternal.hs" #-}- -- copy rule (down)- _flavOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3442 "AstInternal.hs" #-}- -- copy rule (down)- _flavOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3447 "AstInternal.hs" #-}- -- copy rule (down)- _argsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3452 "AstInternal.hs" #-}- -- copy rule (down)- _argsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3457 "AstInternal.hs" #-}- ( _flavIannotatedTree,_flavIoriginalTree) =- (flav_ _flavOenv _flavOlib )- ( _argsIannotatedTree,_argsIoriginalTree,_argsItypeList) =- (args_ _argsOenv _argsOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_NullLit :: Annotation ->- T_Expression -sem_Expression_NullLit ann_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3478 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 31, column 16)- _tpe =- {-# LINE 31 "./TypeChecking/Expressions.ag" #-}- Right UnknownType- {-# LINE 3483 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 43, column 9)- _backTree =- {-# LINE 43 "./TypeChecking/Expressions.ag" #-}- NullLit ann_- {-# LINE 3488 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3493 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- NullLit ann_- {-# LINE 3498 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- NullLit ann_- {-# LINE 3503 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3508 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_Placeholder :: Annotation ->- T_Expression -sem_Expression_Placeholder ann_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3525 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 247, column 9)- _tpe =- {-# LINE 247 "./TypeChecking/Expressions.ag" #-}- Right UnknownType- {-# LINE 3530 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 248, column 9)- _backTree =- {-# LINE 248 "./TypeChecking/Expressions.ag" #-}- Placeholder ann_- {-# LINE 3535 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3540 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Placeholder ann_- {-# LINE 3545 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Placeholder ann_- {-# LINE 3550 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3555 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_PositionalArg :: Annotation ->- Integer ->- T_Expression -sem_Expression_PositionalArg ann_ p_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3573 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 241, column 9)- _tpe =- {-# LINE 241 "./TypeChecking/Expressions.ag" #-}- libLookupID _lhsIlib ('$':show p_)- {-# LINE 3578 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 242, column 9)- _backTree =- {-# LINE 242 "./TypeChecking/Expressions.ag" #-}- PositionalArg ann_ p_- {-# LINE 3583 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3588 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- PositionalArg ann_ p_- {-# LINE 3593 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- PositionalArg ann_ p_- {-# LINE 3598 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3603 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_ScalarSubQuery :: Annotation ->- T_SelectExpression ->- T_Expression -sem_Expression_ScalarSubQuery ann_ sel_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- _selOenv :: Environment- _selOlib :: LocalIdentifierBindings- _selIannotatedTree :: SelectExpression- _selIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selIoriginalTree :: SelectExpression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3626 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 265, column 9)- _tpe =- {-# LINE 265 "./TypeChecking/Expressions.ag" #-}- do- let selType = getTypeAnnotation _selIannotatedTree- dependsOnRTpe [selType] $ do- f <- map snd <$> unwrapSetOfComposite selType- case length f of- 0 -> Left [InternalError "no columns in scalar subquery?"]- 1 -> Right $ head f- _ -> Right $ AnonymousRecordType f- {-# LINE 3638 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 275, column 9)- _backTree =- {-# LINE 275 "./TypeChecking/Expressions.ag" #-}- ScalarSubQuery ann_ _selIannotatedTree- {-# LINE 3643 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3648 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ScalarSubQuery ann_ _selIannotatedTree- {-# LINE 3653 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ScalarSubQuery ann_ _selIoriginalTree- {-# LINE 3658 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3663 "AstInternal.hs" #-}- -- copy rule (down)- _selOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3668 "AstInternal.hs" #-}- -- copy rule (down)- _selOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3673 "AstInternal.hs" #-}- ( _selIannotatedTree,_selIlibUpdates,_selIoriginalTree) =- (sel_ _selOenv _selOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_StringLit :: Annotation ->- String ->- String ->- T_Expression -sem_Expression_StringLit ann_ quote_ value_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOliftedColumnName :: String- _lhsOoriginalTree :: Expression- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3694 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 27, column 18)- _tpe =- {-# LINE 27 "./TypeChecking/Expressions.ag" #-}- Right UnknownType- {-# LINE 3699 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 37, column 9)- _backTree =- {-# LINE 37 "./TypeChecking/Expressions.ag" #-}- StringLit ann_ quote_ value_- {-# LINE 3704 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 177, column 7)- _lhsOliftedColumnName =- {-# LINE 177 "./TypeChecking/SelectLists.ag" #-}- ""- {-# LINE 3709 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- StringLit ann_ quote_ value_- {-# LINE 3714 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- StringLit ann_ quote_ value_- {-# LINE 3719 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3724 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))-sem_Expression_WindowFn :: Annotation ->- T_Expression ->- T_ExpressionList ->- T_ExpressionList ->- T_Direction ->- T_FrameClause ->- T_Expression -sem_Expression_WindowFn ann_ fn_ partitionBy_ orderBy_ dir_ frm_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Expression- _lhsOoriginalTree :: Expression- _lhsOliftedColumnName :: String- _fnOenv :: Environment- _fnOlib :: LocalIdentifierBindings- _partitionByOenv :: Environment- _partitionByOlib :: LocalIdentifierBindings- _orderByOenv :: Environment- _orderByOlib :: LocalIdentifierBindings- _dirOenv :: Environment- _dirOlib :: LocalIdentifierBindings- _frmOenv :: Environment- _frmOlib :: LocalIdentifierBindings- _fnIannotatedTree :: Expression- _fnIliftedColumnName :: String- _fnIoriginalTree :: Expression- _partitionByIannotatedTree :: ExpressionList- _partitionByIoriginalTree :: ExpressionList- _partitionByItypeList :: ([Type])- _orderByIannotatedTree :: ExpressionList- _orderByIoriginalTree :: ExpressionList- _orderByItypeList :: ([Type])- _dirIannotatedTree :: Direction- _dirIoriginalTree :: Direction- _frmIannotatedTree :: FrameClause- _frmIoriginalTree :: FrameClause- -- "./TypeChecking/Expressions.ag"(line 14, column 9)- _lhsOannotatedTree =- {-# LINE 14 "./TypeChecking/Expressions.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 3769 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 71, column 9)- _tpe =- {-# LINE 71 "./TypeChecking/Expressions.ag" #-}- Right (getTypeAnnotation _fnIannotatedTree)- {-# LINE 3774 "AstInternal.hs" #-}- -- "./TypeChecking/Expressions.ag"(line 72, column 9)- _backTree =- {-# LINE 72 "./TypeChecking/Expressions.ag" #-}- WindowFn ann_- _fnIannotatedTree- _partitionByIannotatedTree- _orderByIannotatedTree- _dirIannotatedTree- _frmIannotatedTree- {-# LINE 3784 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- WindowFn ann_ _fnIannotatedTree _partitionByIannotatedTree _orderByIannotatedTree _dirIannotatedTree _frmIannotatedTree- {-# LINE 3789 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- WindowFn ann_ _fnIoriginalTree _partitionByIoriginalTree _orderByIoriginalTree _dirIoriginalTree _frmIoriginalTree- {-# LINE 3794 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3799 "AstInternal.hs" #-}- -- copy rule (up)- _lhsOliftedColumnName =- {-# LINE 161 "./TypeChecking/SelectLists.ag" #-}- _fnIliftedColumnName- {-# LINE 3804 "AstInternal.hs" #-}- -- copy rule (down)- _fnOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3809 "AstInternal.hs" #-}- -- copy rule (down)- _fnOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3814 "AstInternal.hs" #-}- -- copy rule (down)- _partitionByOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3819 "AstInternal.hs" #-}- -- copy rule (down)- _partitionByOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3824 "AstInternal.hs" #-}- -- copy rule (down)- _orderByOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3829 "AstInternal.hs" #-}- -- copy rule (down)- _orderByOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3834 "AstInternal.hs" #-}- -- copy rule (down)- _dirOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3839 "AstInternal.hs" #-}- -- copy rule (down)- _dirOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3844 "AstInternal.hs" #-}- -- copy rule (down)- _frmOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3849 "AstInternal.hs" #-}- -- copy rule (down)- _frmOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3854 "AstInternal.hs" #-}- ( _fnIannotatedTree,_fnIliftedColumnName,_fnIoriginalTree) =- (fn_ _fnOenv _fnOlib )- ( _partitionByIannotatedTree,_partitionByIoriginalTree,_partitionByItypeList) =- (partitionBy_ _partitionByOenv _partitionByOlib )- ( _orderByIannotatedTree,_orderByIoriginalTree,_orderByItypeList) =- (orderBy_ _orderByOenv _orderByOlib )- ( _dirIannotatedTree,_dirIoriginalTree) =- (dir_ _dirOenv _dirOlib )- ( _frmIannotatedTree,_frmIoriginalTree) =- (frm_ _frmOenv _frmOlib )- in ( _lhsOannotatedTree,_lhsOliftedColumnName,_lhsOoriginalTree)))--- ExpressionDirectionPair --------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Tuple:- child x1 : Expression - child x2 : Direction - visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionDirectionPair = ( (Expression),(Direction))--- cata-sem_ExpressionDirectionPair :: ExpressionDirectionPair ->- T_ExpressionDirectionPair -sem_ExpressionDirectionPair ( x1,x2) =- (sem_ExpressionDirectionPair_Tuple (sem_Expression x1 ) (sem_Direction x2 ) )--- semantic domain-type T_ExpressionDirectionPair = Environment ->- LocalIdentifierBindings ->- ( ExpressionDirectionPair,ExpressionDirectionPair)-data Inh_ExpressionDirectionPair = Inh_ExpressionDirectionPair {env_Inh_ExpressionDirectionPair :: Environment,lib_Inh_ExpressionDirectionPair :: LocalIdentifierBindings}-data Syn_ExpressionDirectionPair = Syn_ExpressionDirectionPair {annotatedTree_Syn_ExpressionDirectionPair :: ExpressionDirectionPair,originalTree_Syn_ExpressionDirectionPair :: ExpressionDirectionPair}-wrap_ExpressionDirectionPair :: T_ExpressionDirectionPair ->- Inh_ExpressionDirectionPair ->- Syn_ExpressionDirectionPair -wrap_ExpressionDirectionPair sem (Inh_ExpressionDirectionPair _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionDirectionPair _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionDirectionPair_Tuple :: T_Expression ->- T_Direction ->- T_ExpressionDirectionPair -sem_ExpressionDirectionPair_Tuple x1_ x2_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionDirectionPair- _lhsOoriginalTree :: ExpressionDirectionPair- _x1Oenv :: Environment- _x1Olib :: LocalIdentifierBindings- _x2Oenv :: Environment- _x2Olib :: LocalIdentifierBindings- _x1IannotatedTree :: Expression- _x1IliftedColumnName :: String- _x1IoriginalTree :: Expression- _x2IannotatedTree :: Direction- _x2IoriginalTree :: Direction- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (_x1IannotatedTree,_x2IannotatedTree)- {-# LINE 3923 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (_x1IoriginalTree,_x2IoriginalTree)- {-# LINE 3928 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 3933 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 3938 "AstInternal.hs" #-}- -- copy rule (down)- _x1Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3943 "AstInternal.hs" #-}- -- copy rule (down)- _x1Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3948 "AstInternal.hs" #-}- -- copy rule (down)- _x2Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 3953 "AstInternal.hs" #-}- -- copy rule (down)- _x2Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 3958 "AstInternal.hs" #-}- ( _x1IannotatedTree,_x1IliftedColumnName,_x1IoriginalTree) =- (x1_ _x1Oenv _x1Olib )- ( _x2IannotatedTree,_x2IoriginalTree) =- (x2_ _x2Oenv _x2Olib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ExpressionDirectionPairList ----------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : ExpressionDirectionPair - child tl : ExpressionDirectionPairList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionDirectionPairList = [(ExpressionDirectionPair)]--- cata-sem_ExpressionDirectionPairList :: ExpressionDirectionPairList ->- T_ExpressionDirectionPairList -sem_ExpressionDirectionPairList list =- (Prelude.foldr sem_ExpressionDirectionPairList_Cons sem_ExpressionDirectionPairList_Nil (Prelude.map sem_ExpressionDirectionPair list) )--- semantic domain-type T_ExpressionDirectionPairList = Environment ->- LocalIdentifierBindings ->- ( ExpressionDirectionPairList,ExpressionDirectionPairList)-data Inh_ExpressionDirectionPairList = Inh_ExpressionDirectionPairList {env_Inh_ExpressionDirectionPairList :: Environment,lib_Inh_ExpressionDirectionPairList :: LocalIdentifierBindings}-data Syn_ExpressionDirectionPairList = Syn_ExpressionDirectionPairList {annotatedTree_Syn_ExpressionDirectionPairList :: ExpressionDirectionPairList,originalTree_Syn_ExpressionDirectionPairList :: ExpressionDirectionPairList}-wrap_ExpressionDirectionPairList :: T_ExpressionDirectionPairList ->- Inh_ExpressionDirectionPairList ->- Syn_ExpressionDirectionPairList -wrap_ExpressionDirectionPairList sem (Inh_ExpressionDirectionPairList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionDirectionPairList _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionDirectionPairList_Cons :: T_ExpressionDirectionPair ->- T_ExpressionDirectionPairList ->- T_ExpressionDirectionPairList -sem_ExpressionDirectionPairList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionDirectionPairList- _lhsOoriginalTree :: ExpressionDirectionPairList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: ExpressionDirectionPair- _hdIoriginalTree :: ExpressionDirectionPair- _tlIannotatedTree :: ExpressionDirectionPairList- _tlIoriginalTree :: ExpressionDirectionPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 4024 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 4029 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4034 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4039 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4044 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4049 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4054 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4059 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_ExpressionDirectionPairList_Nil :: T_ExpressionDirectionPairList -sem_ExpressionDirectionPairList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionDirectionPairList- _lhsOoriginalTree :: ExpressionDirectionPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4075 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4080 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4085 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4090 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ExpressionList -----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - typeList : [Type]- alternatives:- alternative Cons:- child hd : Expression - child tl : ExpressionList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionList = [(Expression)]--- cata-sem_ExpressionList :: ExpressionList ->- T_ExpressionList -sem_ExpressionList list =- (Prelude.foldr sem_ExpressionList_Cons sem_ExpressionList_Nil (Prelude.map sem_Expression list) )--- semantic domain-type T_ExpressionList = Environment ->- LocalIdentifierBindings ->- ( ExpressionList,ExpressionList,([Type]))-data Inh_ExpressionList = Inh_ExpressionList {env_Inh_ExpressionList :: Environment,lib_Inh_ExpressionList :: LocalIdentifierBindings}-data Syn_ExpressionList = Syn_ExpressionList {annotatedTree_Syn_ExpressionList :: ExpressionList,originalTree_Syn_ExpressionList :: ExpressionList,typeList_Syn_ExpressionList :: [Type]}-wrap_ExpressionList :: T_ExpressionList ->- Inh_ExpressionList ->- Syn_ExpressionList -wrap_ExpressionList sem (Inh_ExpressionList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOtypeList) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionList _lhsOannotatedTree _lhsOoriginalTree _lhsOtypeList ))-sem_ExpressionList_Cons :: T_Expression ->- T_ExpressionList ->- T_ExpressionList -sem_ExpressionList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOtypeList :: ([Type])- _lhsOannotatedTree :: ExpressionList- _lhsOoriginalTree :: ExpressionList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: Expression- _hdIliftedColumnName :: String- _hdIoriginalTree :: Expression- _tlIannotatedTree :: ExpressionList- _tlIoriginalTree :: ExpressionList- _tlItypeList :: ([Type])- -- "./TypeChecking/Misc.ag"(line 52, column 12)- _lhsOtypeList =- {-# LINE 52 "./TypeChecking/Misc.ag" #-}- getTypeAnnotation _hdIannotatedTree : _tlItypeList- {-# LINE 4156 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 4161 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 4166 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4171 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4176 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4181 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4186 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4191 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4196 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIliftedColumnName,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree,_tlItypeList) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOtypeList)))-sem_ExpressionList_Nil :: T_ExpressionList -sem_ExpressionList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOtypeList :: ([Type])- _lhsOannotatedTree :: ExpressionList- _lhsOoriginalTree :: ExpressionList- -- "./TypeChecking/Misc.ag"(line 53, column 11)- _lhsOtypeList =- {-# LINE 53 "./TypeChecking/Misc.ag" #-}- []- {-# LINE 4213 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4218 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4223 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4228 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4233 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOtypeList)))--- ExpressionListList -------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - typeListList : [[Type]]- alternatives:- alternative Cons:- child hd : ExpressionList - child tl : ExpressionListList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionListList = [(ExpressionList)]--- cata-sem_ExpressionListList :: ExpressionListList ->- T_ExpressionListList -sem_ExpressionListList list =- (Prelude.foldr sem_ExpressionListList_Cons sem_ExpressionListList_Nil (Prelude.map sem_ExpressionList list) )--- semantic domain-type T_ExpressionListList = Environment ->- LocalIdentifierBindings ->- ( ExpressionListList,ExpressionListList,([[Type]]))-data Inh_ExpressionListList = Inh_ExpressionListList {env_Inh_ExpressionListList :: Environment,lib_Inh_ExpressionListList :: LocalIdentifierBindings}-data Syn_ExpressionListList = Syn_ExpressionListList {annotatedTree_Syn_ExpressionListList :: ExpressionListList,originalTree_Syn_ExpressionListList :: ExpressionListList,typeListList_Syn_ExpressionListList :: [[Type]]}-wrap_ExpressionListList :: T_ExpressionListList ->- Inh_ExpressionListList ->- Syn_ExpressionListList -wrap_ExpressionListList sem (Inh_ExpressionListList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOtypeListList) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionListList _lhsOannotatedTree _lhsOoriginalTree _lhsOtypeListList ))-sem_ExpressionListList_Cons :: T_ExpressionList ->- T_ExpressionListList ->- T_ExpressionListList -sem_ExpressionListList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOtypeListList :: ([[Type]])- _lhsOannotatedTree :: ExpressionListList- _lhsOoriginalTree :: ExpressionListList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: ExpressionList- _hdIoriginalTree :: ExpressionList- _hdItypeList :: ([Type])- _tlIannotatedTree :: ExpressionListList- _tlIoriginalTree :: ExpressionListList- _tlItypeListList :: ([[Type]])- -- "./TypeChecking/Misc.ag"(line 59, column 12)- _lhsOtypeListList =- {-# LINE 59 "./TypeChecking/Misc.ag" #-}- _hdItypeList : _tlItypeListList- {-# LINE 4299 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 4304 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 4309 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4314 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4319 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4324 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4329 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4334 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4339 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree,_hdItypeList) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree,_tlItypeListList) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOtypeListList)))-sem_ExpressionListList_Nil :: T_ExpressionListList -sem_ExpressionListList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOtypeListList :: ([[Type]])- _lhsOannotatedTree :: ExpressionListList- _lhsOoriginalTree :: ExpressionListList- -- "./TypeChecking/Misc.ag"(line 60, column 11)- _lhsOtypeListList =- {-# LINE 60 "./TypeChecking/Misc.ag" #-}- []- {-# LINE 4356 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4361 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4366 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4371 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4376 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOtypeListList)))--- ExpressionListStatementListPair ------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Tuple:- child x1 : ExpressionList - child x2 : StatementList - visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionListStatementListPair = ( (ExpressionList),(StatementList))--- cata-sem_ExpressionListStatementListPair :: ExpressionListStatementListPair ->- T_ExpressionListStatementListPair -sem_ExpressionListStatementListPair ( x1,x2) =- (sem_ExpressionListStatementListPair_Tuple (sem_ExpressionList x1 ) (sem_StatementList x2 ) )--- semantic domain-type T_ExpressionListStatementListPair = Environment ->- LocalIdentifierBindings ->- ( ExpressionListStatementListPair,ExpressionListStatementListPair)-data Inh_ExpressionListStatementListPair = Inh_ExpressionListStatementListPair {env_Inh_ExpressionListStatementListPair :: Environment,lib_Inh_ExpressionListStatementListPair :: LocalIdentifierBindings}-data Syn_ExpressionListStatementListPair = Syn_ExpressionListStatementListPair {annotatedTree_Syn_ExpressionListStatementListPair :: ExpressionListStatementListPair,originalTree_Syn_ExpressionListStatementListPair :: ExpressionListStatementListPair}-wrap_ExpressionListStatementListPair :: T_ExpressionListStatementListPair ->- Inh_ExpressionListStatementListPair ->- Syn_ExpressionListStatementListPair -wrap_ExpressionListStatementListPair sem (Inh_ExpressionListStatementListPair _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionListStatementListPair _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionListStatementListPair_Tuple :: T_ExpressionList ->- T_StatementList ->- T_ExpressionListStatementListPair -sem_ExpressionListStatementListPair_Tuple x1_ x2_ =- (\ _lhsIenv- _lhsIlib ->- (let _x2OenvUpdates :: ([EnvironmentUpdate])- _x2OlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: ExpressionListStatementListPair- _lhsOoriginalTree :: ExpressionListStatementListPair- _x1Oenv :: Environment- _x1Olib :: LocalIdentifierBindings- _x2Oenv :: Environment- _x2Olib :: LocalIdentifierBindings- _x1IannotatedTree :: ExpressionList- _x1IoriginalTree :: ExpressionList- _x1ItypeList :: ([Type])- _x2IannotatedTree :: StatementList- _x2IoriginalTree :: StatementList- _x2IproducedEnv :: Environment- _x2IproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 94, column 9)- _x2OenvUpdates =- {-# LINE 94 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 4439 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 95, column 9)- _x2OlibUpdates =- {-# LINE 95 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 4444 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (_x1IannotatedTree,_x2IannotatedTree)- {-# LINE 4449 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (_x1IoriginalTree,_x2IoriginalTree)- {-# LINE 4454 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4459 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4464 "AstInternal.hs" #-}- -- copy rule (down)- _x1Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4469 "AstInternal.hs" #-}- -- copy rule (down)- _x1Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4474 "AstInternal.hs" #-}- -- copy rule (down)- _x2Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4479 "AstInternal.hs" #-}- -- copy rule (down)- _x2Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4484 "AstInternal.hs" #-}- ( _x1IannotatedTree,_x1IoriginalTree,_x1ItypeList) =- (x1_ _x1Oenv _x1Olib )- ( _x2IannotatedTree,_x2IoriginalTree,_x2IproducedEnv,_x2IproducedLib) =- (x2_ _x2Oenv _x2OenvUpdates _x2Olib _x2OlibUpdates )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ExpressionListStatementListPairList --------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : ExpressionListStatementListPair - child tl : ExpressionListStatementListPairList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionListStatementListPairList = [(ExpressionListStatementListPair)]--- cata-sem_ExpressionListStatementListPairList :: ExpressionListStatementListPairList ->- T_ExpressionListStatementListPairList -sem_ExpressionListStatementListPairList list =- (Prelude.foldr sem_ExpressionListStatementListPairList_Cons sem_ExpressionListStatementListPairList_Nil (Prelude.map sem_ExpressionListStatementListPair list) )--- semantic domain-type T_ExpressionListStatementListPairList = Environment ->- LocalIdentifierBindings ->- ( ExpressionListStatementListPairList,ExpressionListStatementListPairList)-data Inh_ExpressionListStatementListPairList = Inh_ExpressionListStatementListPairList {env_Inh_ExpressionListStatementListPairList :: Environment,lib_Inh_ExpressionListStatementListPairList :: LocalIdentifierBindings}-data Syn_ExpressionListStatementListPairList = Syn_ExpressionListStatementListPairList {annotatedTree_Syn_ExpressionListStatementListPairList :: ExpressionListStatementListPairList,originalTree_Syn_ExpressionListStatementListPairList :: ExpressionListStatementListPairList}-wrap_ExpressionListStatementListPairList :: T_ExpressionListStatementListPairList ->- Inh_ExpressionListStatementListPairList ->- Syn_ExpressionListStatementListPairList -wrap_ExpressionListStatementListPairList sem (Inh_ExpressionListStatementListPairList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionListStatementListPairList _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionListStatementListPairList_Cons :: T_ExpressionListStatementListPair ->- T_ExpressionListStatementListPairList ->- T_ExpressionListStatementListPairList -sem_ExpressionListStatementListPairList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionListStatementListPairList- _lhsOoriginalTree :: ExpressionListStatementListPairList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: ExpressionListStatementListPair- _hdIoriginalTree :: ExpressionListStatementListPair- _tlIannotatedTree :: ExpressionListStatementListPairList- _tlIoriginalTree :: ExpressionListStatementListPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 4550 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 4555 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4560 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4565 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4570 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4575 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4580 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4585 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_ExpressionListStatementListPairList_Nil :: T_ExpressionListStatementListPairList -sem_ExpressionListStatementListPairList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionListStatementListPairList- _lhsOoriginalTree :: ExpressionListStatementListPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4601 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4606 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4611 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4616 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ExpressionRoot -----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative ExpressionRoot:- child expr : Expression - visit 0:- local annotatedTree : _- local originalTree : _--}-data ExpressionRoot = ExpressionRoot (Expression) - deriving ( Show)--- cata-sem_ExpressionRoot :: ExpressionRoot ->- T_ExpressionRoot -sem_ExpressionRoot (ExpressionRoot _expr ) =- (sem_ExpressionRoot_ExpressionRoot (sem_Expression _expr ) )--- semantic domain-type T_ExpressionRoot = Environment ->- LocalIdentifierBindings ->- ( ExpressionRoot,ExpressionRoot)-data Inh_ExpressionRoot = Inh_ExpressionRoot {env_Inh_ExpressionRoot :: Environment,lib_Inh_ExpressionRoot :: LocalIdentifierBindings}-data Syn_ExpressionRoot = Syn_ExpressionRoot {annotatedTree_Syn_ExpressionRoot :: ExpressionRoot,originalTree_Syn_ExpressionRoot :: ExpressionRoot}-wrap_ExpressionRoot :: T_ExpressionRoot ->- Inh_ExpressionRoot ->- Syn_ExpressionRoot -wrap_ExpressionRoot sem (Inh_ExpressionRoot _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionRoot _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionRoot_ExpressionRoot :: T_Expression ->- T_ExpressionRoot -sem_ExpressionRoot_ExpressionRoot expr_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionRoot- _lhsOoriginalTree :: ExpressionRoot- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ExpressionRoot _exprIannotatedTree- {-# LINE 4670 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ExpressionRoot _exprIoriginalTree- {-# LINE 4675 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4680 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4685 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4690 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4695 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ExpressionStatementListPair ----------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Tuple:- child x1 : Expression - child x2 : StatementList - visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionStatementListPair = ( (Expression),(StatementList))--- cata-sem_ExpressionStatementListPair :: ExpressionStatementListPair ->- T_ExpressionStatementListPair -sem_ExpressionStatementListPair ( x1,x2) =- (sem_ExpressionStatementListPair_Tuple (sem_Expression x1 ) (sem_StatementList x2 ) )--- semantic domain-type T_ExpressionStatementListPair = Environment ->- LocalIdentifierBindings ->- ( ExpressionStatementListPair,ExpressionStatementListPair)-data Inh_ExpressionStatementListPair = Inh_ExpressionStatementListPair {env_Inh_ExpressionStatementListPair :: Environment,lib_Inh_ExpressionStatementListPair :: LocalIdentifierBindings}-data Syn_ExpressionStatementListPair = Syn_ExpressionStatementListPair {annotatedTree_Syn_ExpressionStatementListPair :: ExpressionStatementListPair,originalTree_Syn_ExpressionStatementListPair :: ExpressionStatementListPair}-wrap_ExpressionStatementListPair :: T_ExpressionStatementListPair ->- Inh_ExpressionStatementListPair ->- Syn_ExpressionStatementListPair -wrap_ExpressionStatementListPair sem (Inh_ExpressionStatementListPair _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionStatementListPair _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionStatementListPair_Tuple :: T_Expression ->- T_StatementList ->- T_ExpressionStatementListPair -sem_ExpressionStatementListPair_Tuple x1_ x2_ =- (\ _lhsIenv- _lhsIlib ->- (let _x2OenvUpdates :: ([EnvironmentUpdate])- _x2OlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: ExpressionStatementListPair- _lhsOoriginalTree :: ExpressionStatementListPair- _x1Oenv :: Environment- _x1Olib :: LocalIdentifierBindings- _x2Oenv :: Environment- _x2Olib :: LocalIdentifierBindings- _x1IannotatedTree :: Expression- _x1IliftedColumnName :: String- _x1IoriginalTree :: Expression- _x2IannotatedTree :: StatementList- _x2IoriginalTree :: StatementList- _x2IproducedEnv :: Environment- _x2IproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 98, column 9)- _x2OenvUpdates =- {-# LINE 98 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 4760 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 99, column 9)- _x2OlibUpdates =- {-# LINE 99 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 4765 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (_x1IannotatedTree,_x2IannotatedTree)- {-# LINE 4770 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (_x1IoriginalTree,_x2IoriginalTree)- {-# LINE 4775 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4780 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4785 "AstInternal.hs" #-}- -- copy rule (down)- _x1Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4790 "AstInternal.hs" #-}- -- copy rule (down)- _x1Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4795 "AstInternal.hs" #-}- -- copy rule (down)- _x2Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4800 "AstInternal.hs" #-}- -- copy rule (down)- _x2Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4805 "AstInternal.hs" #-}- ( _x1IannotatedTree,_x1IliftedColumnName,_x1IoriginalTree) =- (x1_ _x1Oenv _x1Olib )- ( _x2IannotatedTree,_x2IoriginalTree,_x2IproducedEnv,_x2IproducedLib) =- (x2_ _x2Oenv _x2OenvUpdates _x2Olib _x2OlibUpdates )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ExpressionStatementListPairList ------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : ExpressionStatementListPair - child tl : ExpressionStatementListPairList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ExpressionStatementListPairList = [(ExpressionStatementListPair)]--- cata-sem_ExpressionStatementListPairList :: ExpressionStatementListPairList ->- T_ExpressionStatementListPairList -sem_ExpressionStatementListPairList list =- (Prelude.foldr sem_ExpressionStatementListPairList_Cons sem_ExpressionStatementListPairList_Nil (Prelude.map sem_ExpressionStatementListPair list) )--- semantic domain-type T_ExpressionStatementListPairList = Environment ->- LocalIdentifierBindings ->- ( ExpressionStatementListPairList,ExpressionStatementListPairList)-data Inh_ExpressionStatementListPairList = Inh_ExpressionStatementListPairList {env_Inh_ExpressionStatementListPairList :: Environment,lib_Inh_ExpressionStatementListPairList :: LocalIdentifierBindings}-data Syn_ExpressionStatementListPairList = Syn_ExpressionStatementListPairList {annotatedTree_Syn_ExpressionStatementListPairList :: ExpressionStatementListPairList,originalTree_Syn_ExpressionStatementListPairList :: ExpressionStatementListPairList}-wrap_ExpressionStatementListPairList :: T_ExpressionStatementListPairList ->- Inh_ExpressionStatementListPairList ->- Syn_ExpressionStatementListPairList -wrap_ExpressionStatementListPairList sem (Inh_ExpressionStatementListPairList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_ExpressionStatementListPairList _lhsOannotatedTree _lhsOoriginalTree ))-sem_ExpressionStatementListPairList_Cons :: T_ExpressionStatementListPair ->- T_ExpressionStatementListPairList ->- T_ExpressionStatementListPairList -sem_ExpressionStatementListPairList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionStatementListPairList- _lhsOoriginalTree :: ExpressionStatementListPairList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: ExpressionStatementListPair- _hdIoriginalTree :: ExpressionStatementListPair- _tlIannotatedTree :: ExpressionStatementListPairList- _tlIoriginalTree :: ExpressionStatementListPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 4871 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 4876 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4881 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4886 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4891 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4896 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 4901 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 4906 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_ExpressionStatementListPairList_Nil :: T_ExpressionStatementListPairList -sem_ExpressionStatementListPairList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: ExpressionStatementListPairList- _lhsOoriginalTree :: ExpressionStatementListPairList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4922 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 4927 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 4932 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 4937 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- FnBody -------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative PlpgsqlFnBody:- child ann : {Annotation}- child vars : VarDefList - child sts : StatementList - visit 0:- local annotatedTree : _- local originalTree : _- alternative SqlFnBody:- child ann : {Annotation}- child sts : StatementList - visit 0:- local annotatedTree : _- local originalTree : _--}-data FnBody = PlpgsqlFnBody (Annotation) (VarDefList) (StatementList) - | SqlFnBody (Annotation) (StatementList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_FnBody :: FnBody ->- T_FnBody -sem_FnBody (PlpgsqlFnBody _ann _vars _sts ) =- (sem_FnBody_PlpgsqlFnBody _ann (sem_VarDefList _vars ) (sem_StatementList _sts ) )-sem_FnBody (SqlFnBody _ann _sts ) =- (sem_FnBody_SqlFnBody _ann (sem_StatementList _sts ) )--- semantic domain-type T_FnBody = Environment ->- LocalIdentifierBindings ->- ( FnBody,FnBody)-data Inh_FnBody = Inh_FnBody {env_Inh_FnBody :: Environment,lib_Inh_FnBody :: LocalIdentifierBindings}-data Syn_FnBody = Syn_FnBody {annotatedTree_Syn_FnBody :: FnBody,originalTree_Syn_FnBody :: FnBody}-wrap_FnBody :: T_FnBody ->- Inh_FnBody ->- Syn_FnBody -wrap_FnBody sem (Inh_FnBody _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_FnBody _lhsOannotatedTree _lhsOoriginalTree ))-sem_FnBody_PlpgsqlFnBody :: Annotation ->- T_VarDefList ->- T_StatementList ->- T_FnBody -sem_FnBody_PlpgsqlFnBody ann_ vars_ sts_ =- (\ _lhsIenv- _lhsIlib ->- (let _stsOenvUpdates :: ([EnvironmentUpdate])- _stsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _stsOlib :: LocalIdentifierBindings- _lhsOannotatedTree :: FnBody- _lhsOoriginalTree :: FnBody- _varsOenv :: Environment- _varsOlib :: LocalIdentifierBindings- _stsOenv :: Environment- _varsIannotatedTree :: VarDefList- _varsIdefs :: ([(String,Type)])- _varsIoriginalTree :: VarDefList- _stsIannotatedTree :: StatementList- _stsIoriginalTree :: StatementList- _stsIproducedEnv :: Environment- _stsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 102, column 9)- _stsOenvUpdates =- {-# LINE 102 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 5012 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 103, column 9)- _stsOlibUpdates =- {-# LINE 103 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 5017 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 121, column 9)- _stsOlib =- {-# LINE 121 "./TypeChecking/CreateFunction.ag" #-}- fromRight _lhsIlib $- updateBindings _lhsIlib _lhsIenv- [LibStackIDs [("", _varsIdefs)]]- {-# LINE 5024 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- PlpgsqlFnBody ann_ _varsIannotatedTree _stsIannotatedTree- {-# LINE 5029 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- PlpgsqlFnBody ann_ _varsIoriginalTree _stsIoriginalTree- {-# LINE 5034 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5039 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5044 "AstInternal.hs" #-}- -- copy rule (down)- _varsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5049 "AstInternal.hs" #-}- -- copy rule (down)- _varsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 5054 "AstInternal.hs" #-}- -- copy rule (down)- _stsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5059 "AstInternal.hs" #-}- ( _varsIannotatedTree,_varsIdefs,_varsIoriginalTree) =- (vars_ _varsOenv _varsOlib )- ( _stsIannotatedTree,_stsIoriginalTree,_stsIproducedEnv,_stsIproducedLib) =- (sts_ _stsOenv _stsOenvUpdates _stsOlib _stsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_FnBody_SqlFnBody :: Annotation ->- T_StatementList ->- T_FnBody -sem_FnBody_SqlFnBody ann_ sts_ =- (\ _lhsIenv- _lhsIlib ->- (let _stsOenvUpdates :: ([EnvironmentUpdate])- _stsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: FnBody- _lhsOoriginalTree :: FnBody- _stsOenv :: Environment- _stsOlib :: LocalIdentifierBindings- _stsIannotatedTree :: StatementList- _stsIoriginalTree :: StatementList- _stsIproducedEnv :: Environment- _stsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 102, column 9)- _stsOenvUpdates =- {-# LINE 102 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 5085 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 103, column 9)- _stsOlibUpdates =- {-# LINE 103 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 5090 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SqlFnBody ann_ _stsIannotatedTree- {-# LINE 5095 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SqlFnBody ann_ _stsIoriginalTree- {-# LINE 5100 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5105 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5110 "AstInternal.hs" #-}- -- copy rule (down)- _stsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5115 "AstInternal.hs" #-}- -- copy rule (down)- _stsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 5120 "AstInternal.hs" #-}- ( _stsIannotatedTree,_stsIoriginalTree,_stsIproducedEnv,_stsIproducedLib) =- (sts_ _stsOenv _stsOenvUpdates _stsOlib _stsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- FrameClause --------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative FrameRowsUnboundedPreceding:- visit 0:- local annotatedTree : _- local originalTree : _- alternative FrameUnboundedFull:- visit 0:- local annotatedTree : _- local originalTree : _- alternative FrameUnboundedPreceding:- visit 0:- local annotatedTree : _- local originalTree : _--}-data FrameClause = FrameRowsUnboundedPreceding - | FrameUnboundedFull - | FrameUnboundedPreceding - deriving ( Data,Eq,Show,Typeable)--- cata-sem_FrameClause :: FrameClause ->- T_FrameClause -sem_FrameClause (FrameRowsUnboundedPreceding ) =- (sem_FrameClause_FrameRowsUnboundedPreceding )-sem_FrameClause (FrameUnboundedFull ) =- (sem_FrameClause_FrameUnboundedFull )-sem_FrameClause (FrameUnboundedPreceding ) =- (sem_FrameClause_FrameUnboundedPreceding )--- semantic domain-type T_FrameClause = Environment ->- LocalIdentifierBindings ->- ( FrameClause,FrameClause)-data Inh_FrameClause = Inh_FrameClause {env_Inh_FrameClause :: Environment,lib_Inh_FrameClause :: LocalIdentifierBindings}-data Syn_FrameClause = Syn_FrameClause {annotatedTree_Syn_FrameClause :: FrameClause,originalTree_Syn_FrameClause :: FrameClause}-wrap_FrameClause :: T_FrameClause ->- Inh_FrameClause ->- Syn_FrameClause -wrap_FrameClause sem (Inh_FrameClause _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_FrameClause _lhsOannotatedTree _lhsOoriginalTree ))-sem_FrameClause_FrameRowsUnboundedPreceding :: T_FrameClause -sem_FrameClause_FrameRowsUnboundedPreceding =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: FrameClause- _lhsOoriginalTree :: FrameClause- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FrameRowsUnboundedPreceding- {-# LINE 5183 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FrameRowsUnboundedPreceding- {-# LINE 5188 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5193 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5198 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_FrameClause_FrameUnboundedFull :: T_FrameClause -sem_FrameClause_FrameUnboundedFull =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: FrameClause- _lhsOoriginalTree :: FrameClause- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FrameUnboundedFull- {-# LINE 5210 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FrameUnboundedFull- {-# LINE 5215 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5220 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5225 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_FrameClause_FrameUnboundedPreceding :: T_FrameClause -sem_FrameClause_FrameUnboundedPreceding =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: FrameClause- _lhsOoriginalTree :: FrameClause- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FrameUnboundedPreceding- {-# LINE 5237 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FrameUnboundedPreceding- {-# LINE 5242 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5247 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5252 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- IfExists -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative IfExists:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Require:- visit 0:- local annotatedTree : _- local originalTree : _--}-data IfExists = IfExists - | Require - deriving ( Data,Eq,Show,Typeable)--- cata-sem_IfExists :: IfExists ->- T_IfExists -sem_IfExists (IfExists ) =- (sem_IfExists_IfExists )-sem_IfExists (Require ) =- (sem_IfExists_Require )--- semantic domain-type T_IfExists = Environment ->- LocalIdentifierBindings ->- ( IfExists,IfExists)-data Inh_IfExists = Inh_IfExists {env_Inh_IfExists :: Environment,lib_Inh_IfExists :: LocalIdentifierBindings}-data Syn_IfExists = Syn_IfExists {annotatedTree_Syn_IfExists :: IfExists,originalTree_Syn_IfExists :: IfExists}-wrap_IfExists :: T_IfExists ->- Inh_IfExists ->- Syn_IfExists -wrap_IfExists sem (Inh_IfExists _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_IfExists _lhsOannotatedTree _lhsOoriginalTree ))-sem_IfExists_IfExists :: T_IfExists -sem_IfExists_IfExists =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: IfExists- _lhsOoriginalTree :: IfExists- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- IfExists- {-# LINE 5306 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- IfExists- {-# LINE 5311 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5316 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5321 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_IfExists_Require :: T_IfExists -sem_IfExists_Require =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: IfExists- _lhsOoriginalTree :: IfExists- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Require- {-# LINE 5333 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Require- {-# LINE 5338 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5343 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5348 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- InList -------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - listType : Either [TypeError] Type- originalTree : SELF - alternatives:- alternative InList:- child ann : {Annotation}- child exprs : ExpressionList - visit 0:- local annotatedTree : _- local originalTree : _- alternative InSelect:- child ann : {Annotation}- child sel : SelectExpression - visit 0:- local annotatedTree : _- local originalTree : _--}-data InList = InList (Annotation) (ExpressionList) - | InSelect (Annotation) (SelectExpression) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_InList :: InList ->- T_InList -sem_InList (InList _ann _exprs ) =- (sem_InList_InList _ann (sem_ExpressionList _exprs ) )-sem_InList (InSelect _ann _sel ) =- (sem_InList_InSelect _ann (sem_SelectExpression _sel ) )--- semantic domain-type T_InList = Environment ->- LocalIdentifierBindings ->- ( InList,(Either [TypeError] Type),InList)-data Inh_InList = Inh_InList {env_Inh_InList :: Environment,lib_Inh_InList :: LocalIdentifierBindings}-data Syn_InList = Syn_InList {annotatedTree_Syn_InList :: InList,listType_Syn_InList :: Either [TypeError] Type,originalTree_Syn_InList :: InList}-wrap_InList :: T_InList ->- Inh_InList ->- Syn_InList -wrap_InList sem (Inh_InList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_InList _lhsOannotatedTree _lhsOlistType _lhsOoriginalTree ))-sem_InList_InList :: Annotation ->- T_ExpressionList ->- T_InList -sem_InList_InList ann_ exprs_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: (Either [TypeError] Type)- _lhsOannotatedTree :: InList- _lhsOoriginalTree :: InList- _exprsOenv :: Environment- _exprsOlib :: LocalIdentifierBindings- _exprsIannotatedTree :: ExpressionList- _exprsIoriginalTree :: ExpressionList- _exprsItypeList :: ([Type])- -- "./TypeChecking/Expressions.ag"(line 299, column 9)- _lhsOlistType =- {-# LINE 299 "./TypeChecking/Expressions.ag" #-}- resolveResultSetType _lhsIenv _exprsItypeList- {-# LINE 5415 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- InList ann_ _exprsIannotatedTree- {-# LINE 5420 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- InList ann_ _exprsIoriginalTree- {-# LINE 5425 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5430 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5435 "AstInternal.hs" #-}- -- copy rule (down)- _exprsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5440 "AstInternal.hs" #-}- -- copy rule (down)- _exprsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 5445 "AstInternal.hs" #-}- ( _exprsIannotatedTree,_exprsIoriginalTree,_exprsItypeList) =- (exprs_ _exprsOenv _exprsOlib )- in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))-sem_InList_InSelect :: Annotation ->- T_SelectExpression ->- T_InList -sem_InList_InSelect ann_ sel_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: (Either [TypeError] Type)- _lhsOannotatedTree :: InList- _lhsOoriginalTree :: InList- _selOenv :: Environment- _selOlib :: LocalIdentifierBindings- _selIannotatedTree :: SelectExpression- _selIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selIoriginalTree :: SelectExpression- -- "./TypeChecking/Expressions.ag"(line 301, column 9)- _lhsOlistType =- {-# LINE 301 "./TypeChecking/Expressions.ag" #-}- do- attrs <- map snd <$> (unwrapSetOfComposite $- getTypeAnnotation _selIannotatedTree)- typ <- case length attrs of- 0 -> Left [InternalError- "got subquery with no columns? in inselect"]- 1 -> Right $ head attrs- _ -> Right $ AnonymousRecordType attrs- dependsOnRTpe attrs $ Right typ- {-# LINE 5475 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- InSelect ann_ _selIannotatedTree- {-# LINE 5480 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- InSelect ann_ _selIoriginalTree- {-# LINE 5485 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5490 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5495 "AstInternal.hs" #-}- -- copy rule (down)- _selOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5500 "AstInternal.hs" #-}- -- copy rule (down)- _selOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 5505 "AstInternal.hs" #-}- ( _selIannotatedTree,_selIlibUpdates,_selIoriginalTree) =- (sel_ _selOenv _selOlib )- in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))--- JoinExpression -----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative JoinOn:- child ann : {Annotation}- child expression : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative JoinUsing:- child ann : {Annotation}- child stringList : StringList - visit 0:- local annotatedTree : _- local originalTree : _--}-data JoinExpression = JoinOn (Annotation) (Expression) - | JoinUsing (Annotation) (StringList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_JoinExpression :: JoinExpression ->- T_JoinExpression -sem_JoinExpression (JoinOn _ann _expression ) =- (sem_JoinExpression_JoinOn _ann (sem_Expression _expression ) )-sem_JoinExpression (JoinUsing _ann _stringList ) =- (sem_JoinExpression_JoinUsing _ann (sem_StringList _stringList ) )--- semantic domain-type T_JoinExpression = Environment ->- LocalIdentifierBindings ->- ( JoinExpression,JoinExpression)-data Inh_JoinExpression = Inh_JoinExpression {env_Inh_JoinExpression :: Environment,lib_Inh_JoinExpression :: LocalIdentifierBindings}-data Syn_JoinExpression = Syn_JoinExpression {annotatedTree_Syn_JoinExpression :: JoinExpression,originalTree_Syn_JoinExpression :: JoinExpression}-wrap_JoinExpression :: T_JoinExpression ->- Inh_JoinExpression ->- Syn_JoinExpression -wrap_JoinExpression sem (Inh_JoinExpression _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_JoinExpression _lhsOannotatedTree _lhsOoriginalTree ))-sem_JoinExpression_JoinOn :: Annotation ->- T_Expression ->- T_JoinExpression -sem_JoinExpression_JoinOn ann_ expression_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinExpression- _lhsOoriginalTree :: JoinExpression- _expressionOenv :: Environment- _expressionOlib :: LocalIdentifierBindings- _expressionIannotatedTree :: Expression- _expressionIliftedColumnName :: String- _expressionIoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- JoinOn ann_ _expressionIannotatedTree- {-# LINE 5572 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- JoinOn ann_ _expressionIoriginalTree- {-# LINE 5577 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5582 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5587 "AstInternal.hs" #-}- -- copy rule (down)- _expressionOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5592 "AstInternal.hs" #-}- -- copy rule (down)- _expressionOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 5597 "AstInternal.hs" #-}- ( _expressionIannotatedTree,_expressionIliftedColumnName,_expressionIoriginalTree) =- (expression_ _expressionOenv _expressionOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_JoinExpression_JoinUsing :: Annotation ->- T_StringList ->- T_JoinExpression -sem_JoinExpression_JoinUsing ann_ stringList_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinExpression- _lhsOoriginalTree :: JoinExpression- _stringListOenv :: Environment- _stringListOlib :: LocalIdentifierBindings- _stringListIannotatedTree :: StringList- _stringListIoriginalTree :: StringList- _stringListIstrings :: ([String])- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- JoinUsing ann_ _stringListIannotatedTree- {-# LINE 5618 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- JoinUsing ann_ _stringListIoriginalTree- {-# LINE 5623 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5628 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5633 "AstInternal.hs" #-}- -- copy rule (down)- _stringListOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 5638 "AstInternal.hs" #-}- -- copy rule (down)- _stringListOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 5643 "AstInternal.hs" #-}- ( _stringListIannotatedTree,_stringListIoriginalTree,_stringListIstrings) =- (stringList_ _stringListOenv _stringListOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- JoinType -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cross:- visit 0:- local annotatedTree : _- local originalTree : _- alternative FullOuter:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Inner:- visit 0:- local annotatedTree : _- local originalTree : _- alternative LeftOuter:- visit 0:- local annotatedTree : _- local originalTree : _- alternative RightOuter:- visit 0:- local annotatedTree : _- local originalTree : _--}-data JoinType = Cross - | FullOuter - | Inner - | LeftOuter - | RightOuter - deriving ( Data,Eq,Show,Typeable)--- cata-sem_JoinType :: JoinType ->- T_JoinType -sem_JoinType (Cross ) =- (sem_JoinType_Cross )-sem_JoinType (FullOuter ) =- (sem_JoinType_FullOuter )-sem_JoinType (Inner ) =- (sem_JoinType_Inner )-sem_JoinType (LeftOuter ) =- (sem_JoinType_LeftOuter )-sem_JoinType (RightOuter ) =- (sem_JoinType_RightOuter )--- semantic domain-type T_JoinType = Environment ->- LocalIdentifierBindings ->- ( JoinType,JoinType)-data Inh_JoinType = Inh_JoinType {env_Inh_JoinType :: Environment,lib_Inh_JoinType :: LocalIdentifierBindings}-data Syn_JoinType = Syn_JoinType {annotatedTree_Syn_JoinType :: JoinType,originalTree_Syn_JoinType :: JoinType}-wrap_JoinType :: T_JoinType ->- Inh_JoinType ->- Syn_JoinType -wrap_JoinType sem (Inh_JoinType _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_JoinType _lhsOannotatedTree _lhsOoriginalTree ))-sem_JoinType_Cross :: T_JoinType -sem_JoinType_Cross =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinType- _lhsOoriginalTree :: JoinType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Cross- {-# LINE 5720 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Cross- {-# LINE 5725 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5730 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5735 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_JoinType_FullOuter :: T_JoinType -sem_JoinType_FullOuter =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinType- _lhsOoriginalTree :: JoinType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FullOuter- {-# LINE 5747 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FullOuter- {-# LINE 5752 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5757 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5762 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_JoinType_Inner :: T_JoinType -sem_JoinType_Inner =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinType- _lhsOoriginalTree :: JoinType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Inner- {-# LINE 5774 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Inner- {-# LINE 5779 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5784 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5789 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_JoinType_LeftOuter :: T_JoinType -sem_JoinType_LeftOuter =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinType- _lhsOoriginalTree :: JoinType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- LeftOuter- {-# LINE 5801 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- LeftOuter- {-# LINE 5806 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5811 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5816 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_JoinType_RightOuter :: T_JoinType -sem_JoinType_RightOuter =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: JoinType- _lhsOoriginalTree :: JoinType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RightOuter- {-# LINE 5828 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RightOuter- {-# LINE 5833 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5838 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5843 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Language -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Plpgsql:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Sql:- visit 0:- local annotatedTree : _- local originalTree : _--}-data Language = Plpgsql - | Sql - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Language :: Language ->- T_Language -sem_Language (Plpgsql ) =- (sem_Language_Plpgsql )-sem_Language (Sql ) =- (sem_Language_Sql )--- semantic domain-type T_Language = Environment ->- LocalIdentifierBindings ->- ( Language,Language)-data Inh_Language = Inh_Language {env_Inh_Language :: Environment,lib_Inh_Language :: LocalIdentifierBindings}-data Syn_Language = Syn_Language {annotatedTree_Syn_Language :: Language,originalTree_Syn_Language :: Language}-wrap_Language :: T_Language ->- Inh_Language ->- Syn_Language -wrap_Language sem (Inh_Language _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Language _lhsOannotatedTree _lhsOoriginalTree ))-sem_Language_Plpgsql :: T_Language -sem_Language_Plpgsql =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Language- _lhsOoriginalTree :: Language- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Plpgsql- {-# LINE 5897 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Plpgsql- {-# LINE 5902 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5907 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5912 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Language_Sql :: T_Language -sem_Language_Sql =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Language- _lhsOoriginalTree :: Language- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Sql- {-# LINE 5924 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Sql- {-# LINE 5929 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 5934 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 5939 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- LiftFlavour --------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative LiftAll:- visit 0:- local annotatedTree : _- local originalTree : _- alternative LiftAny:- visit 0:- local annotatedTree : _- local originalTree : _--}-data LiftFlavour = LiftAll - | LiftAny - deriving ( Data,Eq,Show,Typeable)--- cata-sem_LiftFlavour :: LiftFlavour ->- T_LiftFlavour -sem_LiftFlavour (LiftAll ) =- (sem_LiftFlavour_LiftAll )-sem_LiftFlavour (LiftAny ) =- (sem_LiftFlavour_LiftAny )--- semantic domain-type T_LiftFlavour = Environment ->- LocalIdentifierBindings ->- ( LiftFlavour,LiftFlavour)-data Inh_LiftFlavour = Inh_LiftFlavour {env_Inh_LiftFlavour :: Environment,lib_Inh_LiftFlavour :: LocalIdentifierBindings}-data Syn_LiftFlavour = Syn_LiftFlavour {annotatedTree_Syn_LiftFlavour :: LiftFlavour,originalTree_Syn_LiftFlavour :: LiftFlavour}-wrap_LiftFlavour :: T_LiftFlavour ->- Inh_LiftFlavour ->- Syn_LiftFlavour -wrap_LiftFlavour sem (Inh_LiftFlavour _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_LiftFlavour _lhsOannotatedTree _lhsOoriginalTree ))-sem_LiftFlavour_LiftAll :: T_LiftFlavour -sem_LiftFlavour_LiftAll =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: LiftFlavour- _lhsOoriginalTree :: LiftFlavour- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- LiftAll- {-# LINE 5993 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- LiftAll- {-# LINE 5998 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6003 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6008 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_LiftFlavour_LiftAny :: T_LiftFlavour -sem_LiftFlavour_LiftAny =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: LiftFlavour- _lhsOoriginalTree :: LiftFlavour- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- LiftAny- {-# LINE 6020 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- LiftAny- {-# LINE 6025 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6030 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6035 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- MaybeBoolExpression ------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Just:- child just : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nothing:- visit 0:- local annotatedTree : _- local originalTree : _--}-type MaybeBoolExpression = (Maybe (Expression))--- cata-sem_MaybeBoolExpression :: MaybeBoolExpression ->- T_MaybeBoolExpression -sem_MaybeBoolExpression (Prelude.Just x ) =- (sem_MaybeBoolExpression_Just (sem_Expression x ) )-sem_MaybeBoolExpression Prelude.Nothing =- sem_MaybeBoolExpression_Nothing--- semantic domain-type T_MaybeBoolExpression = Environment ->- LocalIdentifierBindings ->- ( MaybeBoolExpression,MaybeBoolExpression)-data Inh_MaybeBoolExpression = Inh_MaybeBoolExpression {env_Inh_MaybeBoolExpression :: Environment,lib_Inh_MaybeBoolExpression :: LocalIdentifierBindings}-data Syn_MaybeBoolExpression = Syn_MaybeBoolExpression {annotatedTree_Syn_MaybeBoolExpression :: MaybeBoolExpression,originalTree_Syn_MaybeBoolExpression :: MaybeBoolExpression}-wrap_MaybeBoolExpression :: T_MaybeBoolExpression ->- Inh_MaybeBoolExpression ->- Syn_MaybeBoolExpression -wrap_MaybeBoolExpression sem (Inh_MaybeBoolExpression _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_MaybeBoolExpression _lhsOannotatedTree _lhsOoriginalTree ))-sem_MaybeBoolExpression_Just :: T_Expression ->- T_MaybeBoolExpression -sem_MaybeBoolExpression_Just just_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: MaybeBoolExpression- _lhsOoriginalTree :: MaybeBoolExpression- _justOenv :: Environment- _justOlib :: LocalIdentifierBindings- _justIannotatedTree :: Expression- _justIliftedColumnName :: String- _justIoriginalTree :: Expression- -- "./TypeChecking/Misc.ag"(line 74, column 9)- _lhsOannotatedTree =- {-# LINE 74 "./TypeChecking/Misc.ag" #-}- if getTypeAnnotation _justIannotatedTree `notElem` [typeBool, TypeCheckFailed]- then Just $ updateAnnotation ((TypeErrorA ExpressionMustBeBool) :)- _justIannotatedTree- else Just $ _justIannotatedTree- {-# LINE 6097 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Just _justIannotatedTree- {-# LINE 6102 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Just _justIoriginalTree- {-# LINE 6107 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6112 "AstInternal.hs" #-}- -- copy rule (down)- _justOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6117 "AstInternal.hs" #-}- -- copy rule (down)- _justOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6122 "AstInternal.hs" #-}- ( _justIannotatedTree,_justIliftedColumnName,_justIoriginalTree) =- (just_ _justOenv _justOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_MaybeBoolExpression_Nothing :: T_MaybeBoolExpression -sem_MaybeBoolExpression_Nothing =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: MaybeBoolExpression- _lhsOoriginalTree :: MaybeBoolExpression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6136 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6141 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6146 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6151 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- MaybeExpression ----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Just:- child just : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nothing:- visit 0:- local annotatedTree : _- local originalTree : _--}-type MaybeExpression = (Maybe (Expression))--- cata-sem_MaybeExpression :: MaybeExpression ->- T_MaybeExpression -sem_MaybeExpression (Prelude.Just x ) =- (sem_MaybeExpression_Just (sem_Expression x ) )-sem_MaybeExpression Prelude.Nothing =- sem_MaybeExpression_Nothing--- semantic domain-type T_MaybeExpression = Environment ->- LocalIdentifierBindings ->- ( MaybeExpression,MaybeExpression)-data Inh_MaybeExpression = Inh_MaybeExpression {env_Inh_MaybeExpression :: Environment,lib_Inh_MaybeExpression :: LocalIdentifierBindings}-data Syn_MaybeExpression = Syn_MaybeExpression {annotatedTree_Syn_MaybeExpression :: MaybeExpression,originalTree_Syn_MaybeExpression :: MaybeExpression}-wrap_MaybeExpression :: T_MaybeExpression ->- Inh_MaybeExpression ->- Syn_MaybeExpression -wrap_MaybeExpression sem (Inh_MaybeExpression _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_MaybeExpression _lhsOannotatedTree _lhsOoriginalTree ))-sem_MaybeExpression_Just :: T_Expression ->- T_MaybeExpression -sem_MaybeExpression_Just just_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: MaybeExpression- _lhsOoriginalTree :: MaybeExpression- _justOenv :: Environment- _justOlib :: LocalIdentifierBindings- _justIannotatedTree :: Expression- _justIliftedColumnName :: String- _justIoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Just _justIannotatedTree- {-# LINE 6210 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Just _justIoriginalTree- {-# LINE 6215 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6220 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6225 "AstInternal.hs" #-}- -- copy rule (down)- _justOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6230 "AstInternal.hs" #-}- -- copy rule (down)- _justOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6235 "AstInternal.hs" #-}- ( _justIannotatedTree,_justIliftedColumnName,_justIoriginalTree) =- (just_ _justOenv _justOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_MaybeExpression_Nothing :: T_MaybeExpression -sem_MaybeExpression_Nothing =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: MaybeExpression- _lhsOoriginalTree :: MaybeExpression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6249 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6254 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6259 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6264 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- MaybeSelectList ----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - listType : Maybe [(String,Type)]- originalTree : SELF - alternatives:- alternative Just:- child just : SelectList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nothing:- visit 0:- local annotatedTree : _- local originalTree : _--}-type MaybeSelectList = (Maybe (SelectList))--- cata-sem_MaybeSelectList :: MaybeSelectList ->- T_MaybeSelectList -sem_MaybeSelectList (Prelude.Just x ) =- (sem_MaybeSelectList_Just (sem_SelectList x ) )-sem_MaybeSelectList Prelude.Nothing =- sem_MaybeSelectList_Nothing--- semantic domain-type T_MaybeSelectList = Environment ->- LocalIdentifierBindings ->- ( MaybeSelectList,(Maybe [(String,Type)]),MaybeSelectList)-data Inh_MaybeSelectList = Inh_MaybeSelectList {env_Inh_MaybeSelectList :: Environment,lib_Inh_MaybeSelectList :: LocalIdentifierBindings}-data Syn_MaybeSelectList = Syn_MaybeSelectList {annotatedTree_Syn_MaybeSelectList :: MaybeSelectList,listType_Syn_MaybeSelectList :: Maybe [(String,Type)],originalTree_Syn_MaybeSelectList :: MaybeSelectList}-wrap_MaybeSelectList :: T_MaybeSelectList ->- Inh_MaybeSelectList ->- Syn_MaybeSelectList -wrap_MaybeSelectList sem (Inh_MaybeSelectList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_MaybeSelectList _lhsOannotatedTree _lhsOlistType _lhsOoriginalTree ))-sem_MaybeSelectList_Just :: T_SelectList ->- T_MaybeSelectList -sem_MaybeSelectList_Just just_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: (Maybe [(String,Type)])- _lhsOannotatedTree :: MaybeSelectList- _lhsOoriginalTree :: MaybeSelectList- _justOenv :: Environment- _justOlib :: LocalIdentifierBindings- _justIannotatedTree :: SelectList- _justIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _justIlistType :: ([(String,Type)])- _justIoriginalTree :: SelectList- -- "./TypeChecking/SelectLists.ag"(line 25, column 12)- _lhsOlistType =- {-# LINE 25 "./TypeChecking/SelectLists.ag" #-}- Just _justIlistType- {-# LINE 6326 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Just _justIannotatedTree- {-# LINE 6331 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Just _justIoriginalTree- {-# LINE 6336 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6341 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6346 "AstInternal.hs" #-}- -- copy rule (down)- _justOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6351 "AstInternal.hs" #-}- -- copy rule (down)- _justOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6356 "AstInternal.hs" #-}- ( _justIannotatedTree,_justIlibUpdates,_justIlistType,_justIoriginalTree) =- (just_ _justOenv _justOlib )- in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))-sem_MaybeSelectList_Nothing :: T_MaybeSelectList -sem_MaybeSelectList_Nothing =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: (Maybe [(String,Type)])- _lhsOannotatedTree :: MaybeSelectList- _lhsOoriginalTree :: MaybeSelectList- -- "./TypeChecking/SelectLists.ag"(line 26, column 15)- _lhsOlistType =- {-# LINE 26 "./TypeChecking/SelectLists.ag" #-}- Nothing- {-# LINE 6371 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6376 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6381 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6386 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6391 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))--- Natural ------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Natural:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Unnatural:- visit 0:- local annotatedTree : _- local originalTree : _--}-data Natural = Natural - | Unnatural - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Natural :: Natural ->- T_Natural -sem_Natural (Natural ) =- (sem_Natural_Natural )-sem_Natural (Unnatural ) =- (sem_Natural_Unnatural )--- semantic domain-type T_Natural = Environment ->- LocalIdentifierBindings ->- ( Natural,Natural)-data Inh_Natural = Inh_Natural {env_Inh_Natural :: Environment,lib_Inh_Natural :: LocalIdentifierBindings}-data Syn_Natural = Syn_Natural {annotatedTree_Syn_Natural :: Natural,originalTree_Syn_Natural :: Natural}-wrap_Natural :: T_Natural ->- Inh_Natural ->- Syn_Natural -wrap_Natural sem (Inh_Natural _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Natural _lhsOannotatedTree _lhsOoriginalTree ))-sem_Natural_Natural :: T_Natural -sem_Natural_Natural =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Natural- _lhsOoriginalTree :: Natural- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Natural- {-# LINE 6445 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Natural- {-# LINE 6450 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6455 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6460 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Natural_Unnatural :: T_Natural -sem_Natural_Unnatural =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Natural- _lhsOoriginalTree :: Natural- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Unnatural- {-# LINE 6472 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Unnatural- {-# LINE 6477 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6482 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6487 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- OnExpr -------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Just:- child just : JoinExpression - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nothing:- visit 0:- local annotatedTree : _- local originalTree : _--}-type OnExpr = (Maybe (JoinExpression))--- cata-sem_OnExpr :: OnExpr ->- T_OnExpr -sem_OnExpr (Prelude.Just x ) =- (sem_OnExpr_Just (sem_JoinExpression x ) )-sem_OnExpr Prelude.Nothing =- sem_OnExpr_Nothing--- semantic domain-type T_OnExpr = Environment ->- LocalIdentifierBindings ->- ( OnExpr,OnExpr)-data Inh_OnExpr = Inh_OnExpr {env_Inh_OnExpr :: Environment,lib_Inh_OnExpr :: LocalIdentifierBindings}-data Syn_OnExpr = Syn_OnExpr {annotatedTree_Syn_OnExpr :: OnExpr,originalTree_Syn_OnExpr :: OnExpr}-wrap_OnExpr :: T_OnExpr ->- Inh_OnExpr ->- Syn_OnExpr -wrap_OnExpr sem (Inh_OnExpr _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_OnExpr _lhsOannotatedTree _lhsOoriginalTree ))-sem_OnExpr_Just :: T_JoinExpression ->- T_OnExpr -sem_OnExpr_Just just_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: OnExpr- _lhsOoriginalTree :: OnExpr- _justOenv :: Environment- _justOlib :: LocalIdentifierBindings- _justIannotatedTree :: JoinExpression- _justIoriginalTree :: JoinExpression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Just _justIannotatedTree- {-# LINE 6545 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Just _justIoriginalTree- {-# LINE 6550 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6555 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6560 "AstInternal.hs" #-}- -- copy rule (down)- _justOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6565 "AstInternal.hs" #-}- -- copy rule (down)- _justOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6570 "AstInternal.hs" #-}- ( _justIannotatedTree,_justIoriginalTree) =- (just_ _justOenv _justOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_OnExpr_Nothing :: T_OnExpr -sem_OnExpr_Nothing =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: OnExpr- _lhsOoriginalTree :: OnExpr- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6584 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Nothing- {-# LINE 6589 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6594 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6599 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- ParamDef -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - namedType : Type- originalTree : SELF - paramName : String- alternatives:- alternative ParamDef:- child ann : {Annotation}- child name : {String}- child typ : TypeName - visit 0:- local annotatedTree : _- local originalTree : _- alternative ParamDefTp:- child ann : {Annotation}- child typ : TypeName - visit 0:- local annotatedTree : _- local originalTree : _--}-data ParamDef = ParamDef (Annotation) (String) (TypeName) - | ParamDefTp (Annotation) (TypeName) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_ParamDef :: ParamDef ->- T_ParamDef -sem_ParamDef (ParamDef _ann _name _typ ) =- (sem_ParamDef_ParamDef _ann _name (sem_TypeName _typ ) )-sem_ParamDef (ParamDefTp _ann _typ ) =- (sem_ParamDef_ParamDefTp _ann (sem_TypeName _typ ) )--- semantic domain-type T_ParamDef = Environment ->- LocalIdentifierBindings ->- ( ParamDef,Type,ParamDef,String)-data Inh_ParamDef = Inh_ParamDef {env_Inh_ParamDef :: Environment,lib_Inh_ParamDef :: LocalIdentifierBindings}-data Syn_ParamDef = Syn_ParamDef {annotatedTree_Syn_ParamDef :: ParamDef,namedType_Syn_ParamDef :: Type,originalTree_Syn_ParamDef :: ParamDef,paramName_Syn_ParamDef :: String}-wrap_ParamDef :: T_ParamDef ->- Inh_ParamDef ->- Syn_ParamDef -wrap_ParamDef sem (Inh_ParamDef _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree,_lhsOparamName) =- (sem _lhsIenv _lhsIlib )- in (Syn_ParamDef _lhsOannotatedTree _lhsOnamedType _lhsOoriginalTree _lhsOparamName ))-sem_ParamDef_ParamDef :: Annotation ->- String ->- T_TypeName ->- T_ParamDef -sem_ParamDef_ParamDef ann_ name_ typ_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedType :: Type- _lhsOparamName :: String- _lhsOannotatedTree :: ParamDef- _lhsOoriginalTree :: ParamDef- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- -- "./TypeChecking/CreateFunction.ag"(line 56, column 9)- _lhsOnamedType =- {-# LINE 56 "./TypeChecking/CreateFunction.ag" #-}- _typInamedType- {-# LINE 6670 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 58, column 9)- _lhsOparamName =- {-# LINE 58 "./TypeChecking/CreateFunction.ag" #-}- name_- {-# LINE 6675 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ParamDef ann_ name_ _typIannotatedTree- {-# LINE 6680 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ParamDef ann_ name_ _typIoriginalTree- {-# LINE 6685 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6690 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6695 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6700 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6705 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree,_lhsOparamName)))-sem_ParamDef_ParamDefTp :: Annotation ->- T_TypeName ->- T_ParamDef -sem_ParamDef_ParamDefTp ann_ typ_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedType :: Type- _lhsOparamName :: String- _lhsOannotatedTree :: ParamDef- _lhsOoriginalTree :: ParamDef- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- -- "./TypeChecking/CreateFunction.ag"(line 56, column 9)- _lhsOnamedType =- {-# LINE 56 "./TypeChecking/CreateFunction.ag" #-}- _typInamedType- {-# LINE 6728 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 60, column 9)- _lhsOparamName =- {-# LINE 60 "./TypeChecking/CreateFunction.ag" #-}- ""- {-# LINE 6733 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ParamDefTp ann_ _typIannotatedTree- {-# LINE 6738 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ParamDefTp ann_ _typIoriginalTree- {-# LINE 6743 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6748 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6753 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6758 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6763 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree,_lhsOparamName)))--- ParamDefList -------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - params : [(String, Type)]- alternatives:- alternative Cons:- child hd : ParamDef - child tl : ParamDefList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type ParamDefList = [(ParamDef)]--- cata-sem_ParamDefList :: ParamDefList ->- T_ParamDefList -sem_ParamDefList list =- (Prelude.foldr sem_ParamDefList_Cons sem_ParamDefList_Nil (Prelude.map sem_ParamDef list) )--- semantic domain-type T_ParamDefList = Environment ->- LocalIdentifierBindings ->- ( ParamDefList,ParamDefList,([(String, Type)]))-data Inh_ParamDefList = Inh_ParamDefList {env_Inh_ParamDefList :: Environment,lib_Inh_ParamDefList :: LocalIdentifierBindings}-data Syn_ParamDefList = Syn_ParamDefList {annotatedTree_Syn_ParamDefList :: ParamDefList,originalTree_Syn_ParamDefList :: ParamDefList,params_Syn_ParamDefList :: [(String, Type)]}-wrap_ParamDefList :: T_ParamDefList ->- Inh_ParamDefList ->- Syn_ParamDefList -wrap_ParamDefList sem (Inh_ParamDefList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOparams) =- (sem _lhsIenv _lhsIlib )- in (Syn_ParamDefList _lhsOannotatedTree _lhsOoriginalTree _lhsOparams ))-sem_ParamDefList_Cons :: T_ParamDef ->- T_ParamDefList ->- T_ParamDefList -sem_ParamDefList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOparams :: ([(String, Type)])- _lhsOannotatedTree :: ParamDefList- _lhsOoriginalTree :: ParamDefList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: ParamDef- _hdInamedType :: Type- _hdIoriginalTree :: ParamDef- _hdIparamName :: String- _tlIannotatedTree :: ParamDefList- _tlIoriginalTree :: ParamDefList- _tlIparams :: ([(String, Type)])- -- "./TypeChecking/CreateFunction.ag"(line 64, column 13)- _lhsOparams =- {-# LINE 64 "./TypeChecking/CreateFunction.ag" #-}- ((_hdIparamName, _hdInamedType) : _tlIparams)- {-# LINE 6832 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 6837 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 6842 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6847 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6852 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6857 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6862 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 6867 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 6872 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdInamedType,_hdIoriginalTree,_hdIparamName) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree,_tlIparams) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOparams)))-sem_ParamDefList_Nil :: T_ParamDefList -sem_ParamDefList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOparams :: ([(String, Type)])- _lhsOannotatedTree :: ParamDefList- _lhsOoriginalTree :: ParamDefList- -- "./TypeChecking/CreateFunction.ag"(line 63, column 12)- _lhsOparams =- {-# LINE 63 "./TypeChecking/CreateFunction.ag" #-}- []- {-# LINE 6889 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 6894 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 6899 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6904 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6909 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOparams)))--- RaiseType ----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative RError:- visit 0:- local annotatedTree : _- local originalTree : _- alternative RException:- visit 0:- local annotatedTree : _- local originalTree : _- alternative RNotice:- visit 0:- local annotatedTree : _- local originalTree : _--}-data RaiseType = RError - | RException - | RNotice - deriving ( Data,Eq,Show,Typeable)--- cata-sem_RaiseType :: RaiseType ->- T_RaiseType -sem_RaiseType (RError ) =- (sem_RaiseType_RError )-sem_RaiseType (RException ) =- (sem_RaiseType_RException )-sem_RaiseType (RNotice ) =- (sem_RaiseType_RNotice )--- semantic domain-type T_RaiseType = Environment ->- LocalIdentifierBindings ->- ( RaiseType,RaiseType)-data Inh_RaiseType = Inh_RaiseType {env_Inh_RaiseType :: Environment,lib_Inh_RaiseType :: LocalIdentifierBindings}-data Syn_RaiseType = Syn_RaiseType {annotatedTree_Syn_RaiseType :: RaiseType,originalTree_Syn_RaiseType :: RaiseType}-wrap_RaiseType :: T_RaiseType ->- Inh_RaiseType ->- Syn_RaiseType -wrap_RaiseType sem (Inh_RaiseType _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_RaiseType _lhsOannotatedTree _lhsOoriginalTree ))-sem_RaiseType_RError :: T_RaiseType -sem_RaiseType_RError =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RaiseType- _lhsOoriginalTree :: RaiseType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RError- {-# LINE 6970 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RError- {-# LINE 6975 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 6980 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 6985 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RaiseType_RException :: T_RaiseType -sem_RaiseType_RException =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RaiseType- _lhsOoriginalTree :: RaiseType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RException- {-# LINE 6997 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RException- {-# LINE 7002 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7007 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7012 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RaiseType_RNotice :: T_RaiseType -sem_RaiseType_RNotice =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RaiseType- _lhsOoriginalTree :: RaiseType- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RNotice- {-# LINE 7024 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RNotice- {-# LINE 7029 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7034 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7039 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- RestartIdentity ----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative ContinueIdentity:- visit 0:- local annotatedTree : _- local originalTree : _- alternative RestartIdentity:- visit 0:- local annotatedTree : _- local originalTree : _--}-data RestartIdentity = ContinueIdentity - | RestartIdentity - deriving ( Data,Eq,Show,Typeable)--- cata-sem_RestartIdentity :: RestartIdentity ->- T_RestartIdentity -sem_RestartIdentity (ContinueIdentity ) =- (sem_RestartIdentity_ContinueIdentity )-sem_RestartIdentity (RestartIdentity ) =- (sem_RestartIdentity_RestartIdentity )--- semantic domain-type T_RestartIdentity = Environment ->- LocalIdentifierBindings ->- ( RestartIdentity,RestartIdentity)-data Inh_RestartIdentity = Inh_RestartIdentity {env_Inh_RestartIdentity :: Environment,lib_Inh_RestartIdentity :: LocalIdentifierBindings}-data Syn_RestartIdentity = Syn_RestartIdentity {annotatedTree_Syn_RestartIdentity :: RestartIdentity,originalTree_Syn_RestartIdentity :: RestartIdentity}-wrap_RestartIdentity :: T_RestartIdentity ->- Inh_RestartIdentity ->- Syn_RestartIdentity -wrap_RestartIdentity sem (Inh_RestartIdentity _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_RestartIdentity _lhsOannotatedTree _lhsOoriginalTree ))-sem_RestartIdentity_ContinueIdentity :: T_RestartIdentity -sem_RestartIdentity_ContinueIdentity =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RestartIdentity- _lhsOoriginalTree :: RestartIdentity- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ContinueIdentity- {-# LINE 7093 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ContinueIdentity- {-# LINE 7098 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7103 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7108 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RestartIdentity_RestartIdentity :: T_RestartIdentity -sem_RestartIdentity_RestartIdentity =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RestartIdentity- _lhsOoriginalTree :: RestartIdentity- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RestartIdentity- {-# LINE 7120 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RestartIdentity- {-# LINE 7125 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7130 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7135 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Root ---------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - producedEnv : Environment- producedLib : LocalIdentifierBindings- alternatives:- alternative Root:- child statements : StatementList - visit 0:- local annotatedTree : _- local originalTree : _--}-data Root = Root (StatementList) - deriving ( Show)--- cata-sem_Root :: Root ->- T_Root -sem_Root (Root _statements ) =- (sem_Root_Root (sem_StatementList _statements ) )--- semantic domain-type T_Root = Environment ->- LocalIdentifierBindings ->- ( Root,Root,Environment,LocalIdentifierBindings)-data Inh_Root = Inh_Root {env_Inh_Root :: Environment,lib_Inh_Root :: LocalIdentifierBindings}-data Syn_Root = Syn_Root {annotatedTree_Syn_Root :: Root,originalTree_Syn_Root :: Root,producedEnv_Syn_Root :: Environment,producedLib_Syn_Root :: LocalIdentifierBindings}-wrap_Root :: T_Root ->- Inh_Root ->- Syn_Root -wrap_Root sem (Inh_Root _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOproducedEnv,_lhsOproducedLib) =- (sem _lhsIenv _lhsIlib )- in (Syn_Root _lhsOannotatedTree _lhsOoriginalTree _lhsOproducedEnv _lhsOproducedLib ))-sem_Root_Root :: T_StatementList ->- T_Root -sem_Root_Root statements_ =- (\ _lhsIenv- _lhsIlib ->- (let _statementsOenvUpdates :: ([EnvironmentUpdate])- _statementsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Root- _lhsOoriginalTree :: Root- _lhsOproducedEnv :: Environment- _lhsOproducedLib :: LocalIdentifierBindings- _statementsOenv :: Environment- _statementsOlib :: LocalIdentifierBindings- _statementsIannotatedTree :: StatementList- _statementsIoriginalTree :: StatementList- _statementsIproducedEnv :: Environment- _statementsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 80, column 12)- _statementsOenvUpdates =- {-# LINE 80 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 7196 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 81, column 12)- _statementsOlibUpdates =- {-# LINE 81 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 7201 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Root _statementsIannotatedTree- {-# LINE 7206 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Root _statementsIoriginalTree- {-# LINE 7211 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7216 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7221 "AstInternal.hs" #-}- -- copy rule (up)- _lhsOproducedEnv =- {-# LINE 27 "./TypeChecking/Statements.ag" #-}- _statementsIproducedEnv- {-# LINE 7226 "AstInternal.hs" #-}- -- copy rule (up)- _lhsOproducedLib =- {-# LINE 28 "./TypeChecking/Statements.ag" #-}- _statementsIproducedLib- {-# LINE 7231 "AstInternal.hs" #-}- -- copy rule (down)- _statementsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7236 "AstInternal.hs" #-}- -- copy rule (down)- _statementsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7241 "AstInternal.hs" #-}- ( _statementsIannotatedTree,_statementsIoriginalTree,_statementsIproducedEnv,_statementsIproducedLib) =- (statements_ _statementsOenv _statementsOenvUpdates _statementsOlib _statementsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOproducedEnv,_lhsOproducedLib)))--- RowConstraint ------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative NotNullConstraint:- child ann : {Annotation}- child name : {String}- visit 0:- local annotatedTree : _- local originalTree : _- alternative NullConstraint:- child ann : {Annotation}- child name : {String}- visit 0:- local annotatedTree : _- local originalTree : _- alternative RowCheckConstraint:- child ann : {Annotation}- child name : {String}- child expression : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative RowPrimaryKeyConstraint:- child ann : {Annotation}- child name : {String}- visit 0:- local annotatedTree : _- local originalTree : _- alternative RowReferenceConstraint:- child ann : {Annotation}- child name : {String}- child table : {String}- child att : {Maybe String}- child onUpdate : Cascade - child onDelete : Cascade - visit 0:- local annotatedTree : _- local originalTree : _- alternative RowUniqueConstraint:- child ann : {Annotation}- child name : {String}- visit 0:- local annotatedTree : _- local originalTree : _--}-data RowConstraint = NotNullConstraint (Annotation) (String) - | NullConstraint (Annotation) (String) - | RowCheckConstraint (Annotation) (String) (Expression) - | RowPrimaryKeyConstraint (Annotation) (String) - | RowReferenceConstraint (Annotation) (String) (String) (Maybe String) (Cascade) (Cascade) - | RowUniqueConstraint (Annotation) (String) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_RowConstraint :: RowConstraint ->- T_RowConstraint -sem_RowConstraint (NotNullConstraint _ann _name ) =- (sem_RowConstraint_NotNullConstraint _ann _name )-sem_RowConstraint (NullConstraint _ann _name ) =- (sem_RowConstraint_NullConstraint _ann _name )-sem_RowConstraint (RowCheckConstraint _ann _name _expression ) =- (sem_RowConstraint_RowCheckConstraint _ann _name (sem_Expression _expression ) )-sem_RowConstraint (RowPrimaryKeyConstraint _ann _name ) =- (sem_RowConstraint_RowPrimaryKeyConstraint _ann _name )-sem_RowConstraint (RowReferenceConstraint _ann _name _table _att _onUpdate _onDelete ) =- (sem_RowConstraint_RowReferenceConstraint _ann _name _table _att (sem_Cascade _onUpdate ) (sem_Cascade _onDelete ) )-sem_RowConstraint (RowUniqueConstraint _ann _name ) =- (sem_RowConstraint_RowUniqueConstraint _ann _name )--- semantic domain-type T_RowConstraint = Environment ->- LocalIdentifierBindings ->- ( RowConstraint,RowConstraint)-data Inh_RowConstraint = Inh_RowConstraint {env_Inh_RowConstraint :: Environment,lib_Inh_RowConstraint :: LocalIdentifierBindings}-data Syn_RowConstraint = Syn_RowConstraint {annotatedTree_Syn_RowConstraint :: RowConstraint,originalTree_Syn_RowConstraint :: RowConstraint}-wrap_RowConstraint :: T_RowConstraint ->- Inh_RowConstraint ->- Syn_RowConstraint -wrap_RowConstraint sem (Inh_RowConstraint _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_RowConstraint _lhsOannotatedTree _lhsOoriginalTree ))-sem_RowConstraint_NotNullConstraint :: Annotation ->- String ->- T_RowConstraint -sem_RowConstraint_NotNullConstraint ann_ name_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraint- _lhsOoriginalTree :: RowConstraint- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- NotNullConstraint ann_ name_- {-# LINE 7344 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- NotNullConstraint ann_ name_- {-# LINE 7349 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7354 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7359 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RowConstraint_NullConstraint :: Annotation ->- String ->- T_RowConstraint -sem_RowConstraint_NullConstraint ann_ name_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraint- _lhsOoriginalTree :: RowConstraint- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- NullConstraint ann_ name_- {-# LINE 7373 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- NullConstraint ann_ name_- {-# LINE 7378 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7383 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7388 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RowConstraint_RowCheckConstraint :: Annotation ->- String ->- T_Expression ->- T_RowConstraint -sem_RowConstraint_RowCheckConstraint ann_ name_ expression_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraint- _lhsOoriginalTree :: RowConstraint- _expressionOenv :: Environment- _expressionOlib :: LocalIdentifierBindings- _expressionIannotatedTree :: Expression- _expressionIliftedColumnName :: String- _expressionIoriginalTree :: Expression- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RowCheckConstraint ann_ name_ _expressionIannotatedTree- {-# LINE 7408 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RowCheckConstraint ann_ name_ _expressionIoriginalTree- {-# LINE 7413 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7418 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7423 "AstInternal.hs" #-}- -- copy rule (down)- _expressionOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7428 "AstInternal.hs" #-}- -- copy rule (down)- _expressionOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7433 "AstInternal.hs" #-}- ( _expressionIannotatedTree,_expressionIliftedColumnName,_expressionIoriginalTree) =- (expression_ _expressionOenv _expressionOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RowConstraint_RowPrimaryKeyConstraint :: Annotation ->- String ->- T_RowConstraint -sem_RowConstraint_RowPrimaryKeyConstraint ann_ name_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraint- _lhsOoriginalTree :: RowConstraint- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RowPrimaryKeyConstraint ann_ name_- {-# LINE 7449 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RowPrimaryKeyConstraint ann_ name_- {-# LINE 7454 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7459 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7464 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RowConstraint_RowReferenceConstraint :: Annotation ->- String ->- String ->- (Maybe String) ->- T_Cascade ->- T_Cascade ->- T_RowConstraint -sem_RowConstraint_RowReferenceConstraint ann_ name_ table_ att_ onUpdate_ onDelete_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraint- _lhsOoriginalTree :: RowConstraint- _onUpdateOenv :: Environment- _onUpdateOlib :: LocalIdentifierBindings- _onDeleteOenv :: Environment- _onDeleteOlib :: LocalIdentifierBindings- _onUpdateIannotatedTree :: Cascade- _onUpdateIoriginalTree :: Cascade- _onDeleteIannotatedTree :: Cascade- _onDeleteIoriginalTree :: Cascade- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RowReferenceConstraint ann_ name_ table_ att_ _onUpdateIannotatedTree _onDeleteIannotatedTree- {-# LINE 7490 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RowReferenceConstraint ann_ name_ table_ att_ _onUpdateIoriginalTree _onDeleteIoriginalTree- {-# LINE 7495 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7500 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7505 "AstInternal.hs" #-}- -- copy rule (down)- _onUpdateOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7510 "AstInternal.hs" #-}- -- copy rule (down)- _onUpdateOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7515 "AstInternal.hs" #-}- -- copy rule (down)- _onDeleteOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7520 "AstInternal.hs" #-}- -- copy rule (down)- _onDeleteOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7525 "AstInternal.hs" #-}- ( _onUpdateIannotatedTree,_onUpdateIoriginalTree) =- (onUpdate_ _onUpdateOenv _onUpdateOlib )- ( _onDeleteIannotatedTree,_onDeleteIoriginalTree) =- (onDelete_ _onDeleteOenv _onDeleteOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RowConstraint_RowUniqueConstraint :: Annotation ->- String ->- T_RowConstraint -sem_RowConstraint_RowUniqueConstraint ann_ name_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraint- _lhsOoriginalTree :: RowConstraint- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RowUniqueConstraint ann_ name_- {-# LINE 7543 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RowUniqueConstraint ann_ name_- {-# LINE 7548 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7553 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7558 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- RowConstraintList --------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Cons:- child hd : RowConstraint - child tl : RowConstraintList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type RowConstraintList = [(RowConstraint)]--- cata-sem_RowConstraintList :: RowConstraintList ->- T_RowConstraintList -sem_RowConstraintList list =- (Prelude.foldr sem_RowConstraintList_Cons sem_RowConstraintList_Nil (Prelude.map sem_RowConstraint list) )--- semantic domain-type T_RowConstraintList = Environment ->- LocalIdentifierBindings ->- ( RowConstraintList,RowConstraintList)-data Inh_RowConstraintList = Inh_RowConstraintList {env_Inh_RowConstraintList :: Environment,lib_Inh_RowConstraintList :: LocalIdentifierBindings}-data Syn_RowConstraintList = Syn_RowConstraintList {annotatedTree_Syn_RowConstraintList :: RowConstraintList,originalTree_Syn_RowConstraintList :: RowConstraintList}-wrap_RowConstraintList :: T_RowConstraintList ->- Inh_RowConstraintList ->- Syn_RowConstraintList -wrap_RowConstraintList sem (Inh_RowConstraintList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_RowConstraintList _lhsOannotatedTree _lhsOoriginalTree ))-sem_RowConstraintList_Cons :: T_RowConstraint ->- T_RowConstraintList ->- T_RowConstraintList -sem_RowConstraintList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraintList- _lhsOoriginalTree :: RowConstraintList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: RowConstraint- _hdIoriginalTree :: RowConstraint- _tlIannotatedTree :: RowConstraintList- _tlIoriginalTree :: RowConstraintList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 7620 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 7625 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7630 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7635 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7640 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7645 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7650 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7655 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_RowConstraintList_Nil :: T_RowConstraintList -sem_RowConstraintList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: RowConstraintList- _lhsOoriginalTree :: RowConstraintList- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 7671 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 7676 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 7681 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7686 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- SelectExpression ---------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - libUpdates : [LocalIdentifierBindingsUpdate]- originalTree : SELF - alternatives:- alternative CombineSelect:- child ann : {Annotation}- child ctype : CombineType - child sel1 : SelectExpression - child sel2 : SelectExpression - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Select:- child ann : {Annotation}- child selDistinct : Distinct - child selSelectList : SelectList - child selTref : TableRefList - child selWhere : MaybeBoolExpression - child selGroupBy : ExpressionList - child selHaving : MaybeBoolExpression - child selOrderBy : ExpressionDirectionPairList - child selLimit : MaybeExpression - child selOffset : MaybeExpression - visit 0:- local newLib : _- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Values:- child ann : {Annotation}- child vll : ExpressionListList - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _--}-data SelectExpression = CombineSelect (Annotation) (CombineType) (SelectExpression) (SelectExpression) - | Select (Annotation) (Distinct) (SelectList) (TableRefList) (MaybeBoolExpression) (ExpressionList) (MaybeBoolExpression) (ExpressionDirectionPairList) (MaybeExpression) (MaybeExpression) - | Values (Annotation) (ExpressionListList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_SelectExpression :: SelectExpression ->- T_SelectExpression -sem_SelectExpression (CombineSelect _ann _ctype _sel1 _sel2 ) =- (sem_SelectExpression_CombineSelect _ann (sem_CombineType _ctype ) (sem_SelectExpression _sel1 ) (sem_SelectExpression _sel2 ) )-sem_SelectExpression (Select _ann _selDistinct _selSelectList _selTref _selWhere _selGroupBy _selHaving _selOrderBy _selLimit _selOffset ) =- (sem_SelectExpression_Select _ann (sem_Distinct _selDistinct ) (sem_SelectList _selSelectList ) (sem_TableRefList _selTref ) (sem_MaybeBoolExpression _selWhere ) (sem_ExpressionList _selGroupBy ) (sem_MaybeBoolExpression _selHaving ) (sem_ExpressionDirectionPairList _selOrderBy ) (sem_MaybeExpression _selLimit ) (sem_MaybeExpression _selOffset ) )-sem_SelectExpression (Values _ann _vll ) =- (sem_SelectExpression_Values _ann (sem_ExpressionListList _vll ) )--- semantic domain-type T_SelectExpression = Environment ->- LocalIdentifierBindings ->- ( SelectExpression,([LocalIdentifierBindingsUpdate]),SelectExpression)-data Inh_SelectExpression = Inh_SelectExpression {env_Inh_SelectExpression :: Environment,lib_Inh_SelectExpression :: LocalIdentifierBindings}-data Syn_SelectExpression = Syn_SelectExpression {annotatedTree_Syn_SelectExpression :: SelectExpression,libUpdates_Syn_SelectExpression :: [LocalIdentifierBindingsUpdate],originalTree_Syn_SelectExpression :: SelectExpression}-wrap_SelectExpression :: T_SelectExpression ->- Inh_SelectExpression ->- Syn_SelectExpression -wrap_SelectExpression sem (Inh_SelectExpression _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_SelectExpression _lhsOannotatedTree _lhsOlibUpdates _lhsOoriginalTree ))-sem_SelectExpression_CombineSelect :: Annotation ->- T_CombineType ->- T_SelectExpression ->- T_SelectExpression ->- T_SelectExpression -sem_SelectExpression_CombineSelect ann_ ctype_ sel1_ sel2_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: SelectExpression- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOoriginalTree :: SelectExpression- _ctypeOenv :: Environment- _ctypeOlib :: LocalIdentifierBindings- _sel1Oenv :: Environment- _sel1Olib :: LocalIdentifierBindings- _sel2Oenv :: Environment- _sel2Olib :: LocalIdentifierBindings- _ctypeIannotatedTree :: CombineType- _ctypeIoriginalTree :: CombineType- _sel1IannotatedTree :: SelectExpression- _sel1IlibUpdates :: ([LocalIdentifierBindingsUpdate])- _sel1IoriginalTree :: SelectExpression- _sel2IannotatedTree :: SelectExpression- _sel2IlibUpdates :: ([LocalIdentifierBindingsUpdate])- _sel2IoriginalTree :: SelectExpression- -- "./TypeChecking/SelectStatement.ag"(line 26, column 9)- _lhsOannotatedTree =- {-# LINE 26 "./TypeChecking/SelectStatement.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 7793 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 132, column 9)- _tpe =- {-# LINE 132 "./TypeChecking/SelectStatement.ag" #-}- let sel1t = getTypeAnnotation _sel1IannotatedTree- sel2t = getTypeAnnotation _sel2IannotatedTree- in dependsOnRTpe [sel1t, sel2t] $- typeCheckCombineSelect _lhsIenv sel1t sel2t- {-# LINE 7801 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 137, column 9)- _backTree =- {-# LINE 137 "./TypeChecking/SelectStatement.ag" #-}- CombineSelect ann_ _ctypeIannotatedTree- _sel1IannotatedTree- _sel2IannotatedTree- {-# LINE 7808 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 87, column 11)- _lhsOlibUpdates =- {-# LINE 87 "./TypeChecking/SelectLists.ag" #-}- []- {-# LINE 7813 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CombineSelect ann_ _ctypeIannotatedTree _sel1IannotatedTree _sel2IannotatedTree- {-# LINE 7818 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CombineSelect ann_ _ctypeIoriginalTree _sel1IoriginalTree _sel2IoriginalTree- {-# LINE 7823 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7828 "AstInternal.hs" #-}- -- copy rule (down)- _ctypeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7833 "AstInternal.hs" #-}- -- copy rule (down)- _ctypeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7838 "AstInternal.hs" #-}- -- copy rule (down)- _sel1Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7843 "AstInternal.hs" #-}- -- copy rule (down)- _sel1Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7848 "AstInternal.hs" #-}- -- copy rule (down)- _sel2Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 7853 "AstInternal.hs" #-}- -- copy rule (down)- _sel2Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 7858 "AstInternal.hs" #-}- ( _ctypeIannotatedTree,_ctypeIoriginalTree) =- (ctype_ _ctypeOenv _ctypeOlib )- ( _sel1IannotatedTree,_sel1IlibUpdates,_sel1IoriginalTree) =- (sel1_ _sel1Oenv _sel1Olib )- ( _sel2IannotatedTree,_sel2IlibUpdates,_sel2IoriginalTree) =- (sel2_ _sel2Oenv _sel2Olib )- in ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_SelectExpression_Select :: Annotation ->- T_Distinct ->- T_SelectList ->- T_TableRefList ->- T_MaybeBoolExpression ->- T_ExpressionList ->- T_MaybeBoolExpression ->- T_ExpressionDirectionPairList ->- T_MaybeExpression ->- T_MaybeExpression ->- T_SelectExpression -sem_SelectExpression_Select ann_ selDistinct_ selSelectList_ selTref_ selWhere_ selGroupBy_ selHaving_ selOrderBy_ selLimit_ selOffset_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: SelectExpression- _selSelectListOlib :: LocalIdentifierBindings- _selWhereOlib :: LocalIdentifierBindings- _selGroupByOlib :: LocalIdentifierBindings- _selOrderByOlib :: LocalIdentifierBindings- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOoriginalTree :: SelectExpression- _selDistinctOenv :: Environment- _selDistinctOlib :: LocalIdentifierBindings- _selSelectListOenv :: Environment- _selTrefOenv :: Environment- _selTrefOlib :: LocalIdentifierBindings- _selWhereOenv :: Environment- _selGroupByOenv :: Environment- _selHavingOenv :: Environment- _selHavingOlib :: LocalIdentifierBindings- _selOrderByOenv :: Environment- _selLimitOenv :: Environment- _selLimitOlib :: LocalIdentifierBindings- _selOffsetOenv :: Environment- _selOffsetOlib :: LocalIdentifierBindings- _selDistinctIannotatedTree :: Distinct- _selDistinctIoriginalTree :: Distinct- _selSelectListIannotatedTree :: SelectList- _selSelectListIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selSelectListIlistType :: ([(String,Type)])- _selSelectListIoriginalTree :: SelectList- _selTrefIannotatedTree :: TableRefList- _selTrefIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selTrefIoriginalTree :: TableRefList- _selWhereIannotatedTree :: MaybeBoolExpression- _selWhereIoriginalTree :: MaybeBoolExpression- _selGroupByIannotatedTree :: ExpressionList- _selGroupByIoriginalTree :: ExpressionList- _selGroupByItypeList :: ([Type])- _selHavingIannotatedTree :: MaybeBoolExpression- _selHavingIoriginalTree :: MaybeBoolExpression- _selOrderByIannotatedTree :: ExpressionDirectionPairList- _selOrderByIoriginalTree :: ExpressionDirectionPairList- _selLimitIannotatedTree :: MaybeExpression- _selLimitIoriginalTree :: MaybeExpression- _selOffsetIannotatedTree :: MaybeExpression- _selOffsetIoriginalTree :: MaybeExpression- -- "./TypeChecking/SelectStatement.ag"(line 26, column 9)- _lhsOannotatedTree =- {-# LINE 26 "./TypeChecking/SelectStatement.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 7930 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 97, column 10)- _newLib =- {-# LINE 97 "./TypeChecking/SelectStatement.ag" #-}- case updateBindings _lhsIlib _lhsIenv _selTrefIlibUpdates of- Left x -> error $ show x- Right e -> e- {-# LINE 7937 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 100, column 10)- _selSelectListOlib =- {-# LINE 100 "./TypeChecking/SelectStatement.ag" #-}- _newLib- {-# LINE 7942 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 101, column 10)- _selWhereOlib =- {-# LINE 101 "./TypeChecking/SelectStatement.ag" #-}- _newLib- {-# LINE 7947 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 102, column 10)- _selGroupByOlib =- {-# LINE 102 "./TypeChecking/SelectStatement.ag" #-}- _newLib- {-# LINE 7952 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 103, column 10)- _selOrderByOlib =- {-# LINE 103 "./TypeChecking/SelectStatement.ag" #-}- _newLib- {-# LINE 7957 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 114, column 9)- _tpe =- {-# LINE 114 "./TypeChecking/SelectStatement.ag" #-}- do- Right $ case _selSelectListIlistType of- [(_,Pseudo Void)] -> Pseudo Void- _ -> SetOfType $ CompositeType _selSelectListIlistType- {-# LINE 7965 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 121, column 9)- _backTree =- {-# LINE 121 "./TypeChecking/SelectStatement.ag" #-}- Select ann_- _selDistinctIannotatedTree- _selSelectListIannotatedTree- _selTrefIannotatedTree- _selWhereIannotatedTree- _selGroupByIannotatedTree- _selHavingIannotatedTree- _selOrderByIannotatedTree- _selLimitIannotatedTree- _selOffsetIannotatedTree- {-# LINE 7979 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 85, column 9)- _lhsOlibUpdates =- {-# LINE 85 "./TypeChecking/SelectLists.ag" #-}- _selSelectListIlibUpdates- {-# LINE 7984 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Select ann_ _selDistinctIannotatedTree _selSelectListIannotatedTree _selTrefIannotatedTree _selWhereIannotatedTree _selGroupByIannotatedTree _selHavingIannotatedTree _selOrderByIannotatedTree _selLimitIannotatedTree _selOffsetIannotatedTree- {-# LINE 7989 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Select ann_ _selDistinctIoriginalTree _selSelectListIoriginalTree _selTrefIoriginalTree _selWhereIoriginalTree _selGroupByIoriginalTree _selHavingIoriginalTree _selOrderByIoriginalTree _selLimitIoriginalTree _selOffsetIoriginalTree- {-# LINE 7994 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 7999 "AstInternal.hs" #-}- -- copy rule (down)- _selDistinctOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8004 "AstInternal.hs" #-}- -- copy rule (down)- _selDistinctOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8009 "AstInternal.hs" #-}- -- copy rule (down)- _selSelectListOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8014 "AstInternal.hs" #-}- -- copy rule (down)- _selTrefOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8019 "AstInternal.hs" #-}- -- copy rule (down)- _selTrefOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8024 "AstInternal.hs" #-}- -- copy rule (down)- _selWhereOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8029 "AstInternal.hs" #-}- -- copy rule (down)- _selGroupByOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8034 "AstInternal.hs" #-}- -- copy rule (down)- _selHavingOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8039 "AstInternal.hs" #-}- -- copy rule (down)- _selHavingOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8044 "AstInternal.hs" #-}- -- copy rule (down)- _selOrderByOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8049 "AstInternal.hs" #-}- -- copy rule (down)- _selLimitOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8054 "AstInternal.hs" #-}- -- copy rule (down)- _selLimitOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8059 "AstInternal.hs" #-}- -- copy rule (down)- _selOffsetOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8064 "AstInternal.hs" #-}- -- copy rule (down)- _selOffsetOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8069 "AstInternal.hs" #-}- ( _selDistinctIannotatedTree,_selDistinctIoriginalTree) =- (selDistinct_ _selDistinctOenv _selDistinctOlib )- ( _selSelectListIannotatedTree,_selSelectListIlibUpdates,_selSelectListIlistType,_selSelectListIoriginalTree) =- (selSelectList_ _selSelectListOenv _selSelectListOlib )- ( _selTrefIannotatedTree,_selTrefIlibUpdates,_selTrefIoriginalTree) =- (selTref_ _selTrefOenv _selTrefOlib )- ( _selWhereIannotatedTree,_selWhereIoriginalTree) =- (selWhere_ _selWhereOenv _selWhereOlib )- ( _selGroupByIannotatedTree,_selGroupByIoriginalTree,_selGroupByItypeList) =- (selGroupBy_ _selGroupByOenv _selGroupByOlib )- ( _selHavingIannotatedTree,_selHavingIoriginalTree) =- (selHaving_ _selHavingOenv _selHavingOlib )- ( _selOrderByIannotatedTree,_selOrderByIoriginalTree) =- (selOrderBy_ _selOrderByOenv _selOrderByOlib )- ( _selLimitIannotatedTree,_selLimitIoriginalTree) =- (selLimit_ _selLimitOenv _selLimitOlib )- ( _selOffsetIannotatedTree,_selOffsetIoriginalTree) =- (selOffset_ _selOffsetOenv _selOffsetOlib )- in ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_SelectExpression_Values :: Annotation ->- T_ExpressionListList ->- T_SelectExpression -sem_SelectExpression_Values ann_ vll_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: SelectExpression- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOoriginalTree :: SelectExpression- _vllOenv :: Environment- _vllOlib :: LocalIdentifierBindings- _vllIannotatedTree :: ExpressionListList- _vllIoriginalTree :: ExpressionListList- _vllItypeListList :: ([[Type]])- -- "./TypeChecking/SelectStatement.ag"(line 26, column 9)- _lhsOannotatedTree =- {-# LINE 26 "./TypeChecking/SelectStatement.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- Nothing- {-# LINE 8110 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 109, column 9)- _tpe =- {-# LINE 109 "./TypeChecking/SelectStatement.ag" #-}- typeCheckValuesExpr- _lhsIenv- _vllItypeListList- {-# LINE 8117 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 112, column 9)- _backTree =- {-# LINE 112 "./TypeChecking/SelectStatement.ag" #-}- Values ann_ _vllIannotatedTree- {-# LINE 8122 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 87, column 11)- _lhsOlibUpdates =- {-# LINE 87 "./TypeChecking/SelectLists.ag" #-}- []- {-# LINE 8127 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Values ann_ _vllIannotatedTree- {-# LINE 8132 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Values ann_ _vllIoriginalTree- {-# LINE 8137 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8142 "AstInternal.hs" #-}- -- copy rule (down)- _vllOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8147 "AstInternal.hs" #-}- -- copy rule (down)- _vllOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8152 "AstInternal.hs" #-}- ( _vllIannotatedTree,_vllIoriginalTree,_vllItypeListList) =- (vll_ _vllOenv _vllOlib )- in ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree)))--- SelectItem ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - columnName : String- itemType : Type- originalTree : SELF - alternatives:- alternative SelExp:- child ann : {Annotation}- child ex : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative SelectItem:- child ann : {Annotation}- child ex : Expression - child name : {String}- visit 0:- local annotatedTree : _- local originalTree : _--}-data SelectItem = SelExp (Annotation) (Expression) - | SelectItem (Annotation) (Expression) (String) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_SelectItem :: SelectItem ->- T_SelectItem -sem_SelectItem (SelExp _ann _ex ) =- (sem_SelectItem_SelExp _ann (sem_Expression _ex ) )-sem_SelectItem (SelectItem _ann _ex _name ) =- (sem_SelectItem_SelectItem _ann (sem_Expression _ex ) _name )--- semantic domain-type T_SelectItem = Environment ->- LocalIdentifierBindings ->- ( SelectItem,String,Type,SelectItem)-data Inh_SelectItem = Inh_SelectItem {env_Inh_SelectItem :: Environment,lib_Inh_SelectItem :: LocalIdentifierBindings}-data Syn_SelectItem = Syn_SelectItem {annotatedTree_Syn_SelectItem :: SelectItem,columnName_Syn_SelectItem :: String,itemType_Syn_SelectItem :: Type,originalTree_Syn_SelectItem :: SelectItem}-wrap_SelectItem :: T_SelectItem ->- Inh_SelectItem ->- Syn_SelectItem -wrap_SelectItem sem (Inh_SelectItem _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOcolumnName,_lhsOitemType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_SelectItem _lhsOannotatedTree _lhsOcolumnName _lhsOitemType _lhsOoriginalTree ))-sem_SelectItem_SelExp :: Annotation ->- T_Expression ->- T_SelectItem -sem_SelectItem_SelExp ann_ ex_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOitemType :: Type- _lhsOcolumnName :: String- _lhsOannotatedTree :: SelectItem- _lhsOoriginalTree :: SelectItem- _exOenv :: Environment- _exOlib :: LocalIdentifierBindings- _exIannotatedTree :: Expression- _exIliftedColumnName :: String- _exIoriginalTree :: Expression- -- "./TypeChecking/SelectLists.ag"(line 13, column 9)- _annotatedTree =- {-# LINE 13 "./TypeChecking/SelectLists.ag" #-}- SelExp ann_ $ fixStar _exIannotatedTree- {-# LINE 8224 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 35, column 9)- _lhsOitemType =- {-# LINE 35 "./TypeChecking/SelectLists.ag" #-}- getTypeAnnotation _exIannotatedTree- {-# LINE 8229 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 181, column 14)- _lhsOcolumnName =- {-# LINE 181 "./TypeChecking/SelectLists.ag" #-}- case _exIliftedColumnName of- "" -> "?column?"- s -> s- {-# LINE 8236 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SelExp ann_ _exIoriginalTree- {-# LINE 8241 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8246 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8251 "AstInternal.hs" #-}- -- copy rule (down)- _exOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8256 "AstInternal.hs" #-}- -- copy rule (down)- _exOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8261 "AstInternal.hs" #-}- ( _exIannotatedTree,_exIliftedColumnName,_exIoriginalTree) =- (ex_ _exOenv _exOlib )- in ( _lhsOannotatedTree,_lhsOcolumnName,_lhsOitemType,_lhsOoriginalTree)))-sem_SelectItem_SelectItem :: Annotation ->- T_Expression ->- String ->- T_SelectItem -sem_SelectItem_SelectItem ann_ ex_ name_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOitemType :: Type- _lhsOcolumnName :: String- _lhsOannotatedTree :: SelectItem- _lhsOoriginalTree :: SelectItem- _exOenv :: Environment- _exOlib :: LocalIdentifierBindings- _exIannotatedTree :: Expression- _exIliftedColumnName :: String- _exIoriginalTree :: Expression- -- "./TypeChecking/SelectLists.ag"(line 15, column 9)- _annotatedTree =- {-# LINE 15 "./TypeChecking/SelectLists.ag" #-}- SelectItem ann_ (fixStar _exIannotatedTree) name_- {-# LINE 8285 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 35, column 9)- _lhsOitemType =- {-# LINE 35 "./TypeChecking/SelectLists.ag" #-}- getTypeAnnotation _exIannotatedTree- {-# LINE 8290 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 184, column 18)- _lhsOcolumnName =- {-# LINE 184 "./TypeChecking/SelectLists.ag" #-}- name_- {-# LINE 8295 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SelectItem ann_ _exIoriginalTree name_- {-# LINE 8300 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8305 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8310 "AstInternal.hs" #-}- -- copy rule (down)- _exOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8315 "AstInternal.hs" #-}- -- copy rule (down)- _exOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8320 "AstInternal.hs" #-}- ( _exIannotatedTree,_exIliftedColumnName,_exIoriginalTree) =- (ex_ _exOenv _exOlib )- in ( _lhsOannotatedTree,_lhsOcolumnName,_lhsOitemType,_lhsOoriginalTree)))--- SelectItemList -----------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - listType : [(String,Type)]- originalTree : SELF - alternatives:- alternative Cons:- child hd : SelectItem - child tl : SelectItemList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type SelectItemList = [(SelectItem)]--- cata-sem_SelectItemList :: SelectItemList ->- T_SelectItemList -sem_SelectItemList list =- (Prelude.foldr sem_SelectItemList_Cons sem_SelectItemList_Nil (Prelude.map sem_SelectItem list) )--- semantic domain-type T_SelectItemList = Environment ->- LocalIdentifierBindings ->- ( SelectItemList,([(String,Type)]),SelectItemList)-data Inh_SelectItemList = Inh_SelectItemList {env_Inh_SelectItemList :: Environment,lib_Inh_SelectItemList :: LocalIdentifierBindings}-data Syn_SelectItemList = Syn_SelectItemList {annotatedTree_Syn_SelectItemList :: SelectItemList,listType_Syn_SelectItemList :: [(String,Type)],originalTree_Syn_SelectItemList :: SelectItemList}-wrap_SelectItemList :: T_SelectItemList ->- Inh_SelectItemList ->- Syn_SelectItemList -wrap_SelectItemList sem (Inh_SelectItemList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_SelectItemList _lhsOannotatedTree _lhsOlistType _lhsOoriginalTree ))-sem_SelectItemList_Cons :: T_SelectItem ->- T_SelectItemList ->- T_SelectItemList -sem_SelectItemList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: ([(String,Type)])- _lhsOannotatedTree :: SelectItemList- _lhsOoriginalTree :: SelectItemList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: SelectItem- _hdIcolumnName :: String- _hdIitemType :: Type- _hdIoriginalTree :: SelectItem- _tlIannotatedTree :: SelectItemList- _tlIlistType :: ([(String,Type)])- _tlIoriginalTree :: SelectItemList- -- "./TypeChecking/SelectLists.ag"(line 29, column 12)- _lhsOlistType =- {-# LINE 29 "./TypeChecking/SelectLists.ag" #-}- expandStar _lhsIlib _hdIcolumnName _hdIitemType _tlIlistType- {-# LINE 8389 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 8394 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 8399 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8404 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8409 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8414 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8419 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8424 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8429 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIcolumnName,_hdIitemType,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIlistType,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))-sem_SelectItemList_Nil :: T_SelectItemList -sem_SelectItemList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: ([(String,Type)])- _lhsOannotatedTree :: SelectItemList- _lhsOoriginalTree :: SelectItemList- -- "./TypeChecking/SelectLists.ag"(line 30, column 11)- _lhsOlistType =- {-# LINE 30 "./TypeChecking/SelectLists.ag" #-}- []- {-# LINE 8446 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 8451 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 8456 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8461 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8466 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))--- SelectList ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - libUpdates : [LocalIdentifierBindingsUpdate]- listType : [(String,Type)]- originalTree : SELF - alternatives:- alternative SelectList:- child ann : {Annotation}- child items : SelectItemList - child into : StringList - visit 0:- local errs : _- local stuff : _- local annotatedTree : _- local originalTree : _--}-data SelectList = SelectList (Annotation) (SelectItemList) (StringList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_SelectList :: SelectList ->- T_SelectList -sem_SelectList (SelectList _ann _items _into ) =- (sem_SelectList_SelectList _ann (sem_SelectItemList _items ) (sem_StringList _into ) )--- semantic domain-type T_SelectList = Environment ->- LocalIdentifierBindings ->- ( SelectList,([LocalIdentifierBindingsUpdate]),([(String,Type)]),SelectList)-data Inh_SelectList = Inh_SelectList {env_Inh_SelectList :: Environment,lib_Inh_SelectList :: LocalIdentifierBindings}-data Syn_SelectList = Syn_SelectList {annotatedTree_Syn_SelectList :: SelectList,libUpdates_Syn_SelectList :: [LocalIdentifierBindingsUpdate],listType_Syn_SelectList :: [(String,Type)],originalTree_Syn_SelectList :: SelectList}-wrap_SelectList :: T_SelectList ->- Inh_SelectList ->- Syn_SelectList -wrap_SelectList sem (Inh_SelectList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOlistType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_SelectList _lhsOannotatedTree _lhsOlibUpdates _lhsOlistType _lhsOoriginalTree ))-sem_SelectList_SelectList :: Annotation ->- T_SelectItemList ->- T_StringList ->- T_SelectList -sem_SelectList_SelectList ann_ items_ into_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlistType :: ([(String,Type)])- _lhsOannotatedTree :: SelectList- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOoriginalTree :: SelectList- _itemsOenv :: Environment- _itemsOlib :: LocalIdentifierBindings- _intoOenv :: Environment- _intoOlib :: LocalIdentifierBindings- _itemsIannotatedTree :: SelectItemList- _itemsIlistType :: ([(String,Type)])- _itemsIoriginalTree :: SelectItemList- _intoIannotatedTree :: StringList- _intoIoriginalTree :: StringList- _intoIstrings :: ([String])- -- "./TypeChecking/SelectLists.ag"(line 41, column 9)- _lhsOlistType =- {-# LINE 41 "./TypeChecking/SelectLists.ag" #-}- _itemsIlistType- {-# LINE 8535 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 43, column 9)- _errs =- {-# LINE 43 "./TypeChecking/SelectLists.ag" #-}- case _stuff of- (er,_) -> er- {-# LINE 8541 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 45, column 9)- _stuff =- {-# LINE 45 "./TypeChecking/SelectLists.ag" #-}- case () of- _ | null sl -> ([],Nothing)- | not (null targetTypeErrs) -> (targetTypeErrs,Nothing)- | (case targetTypes of- [PgRecord _] -> True- _ -> False) -> ([],Just (head sl, CompositeType _itemsIlistType))- | matchingComposite /= Left [] -> (fromLeft [] matchingComposite,Nothing)- | length sl /= length _itemsIlistType -> ([WrongNumberOfColumns],Nothing)- | not (null assignErrs) -> (assignErrs,Nothing)- | otherwise -> ([],Nothing)- where- targetTypeEithers = map (libLookupID _lhsIlib) sl- targetTypeErrs = concat $ lefts $ targetTypeEithers- targetTypes = rights $ targetTypeEithers- typePairs = zip (map snd _itemsIlistType) targetTypes- assignErrs = concat $ lefts $ map (uncurry $ checkAssignmentValid _lhsIenv) typePairs- sl = _intoIstrings- matchingComposite =- case targetTypes of- [t] | isCompositeType t -> checkAssignmentValid _lhsIenv (AnonymousRecordType (map snd _itemsIlistType)) t- _ -> Left []- {-# LINE 8566 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 68, column 9)- _lhsOannotatedTree =- {-# LINE 68 "./TypeChecking/SelectLists.ag" #-}- SelectList (ann_ ++ map TypeErrorA _errs )- _itemsIannotatedTree- _intoIannotatedTree- {-# LINE 8573 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 71, column 9)- _lhsOlibUpdates =- {-# LINE 71 "./TypeChecking/SelectLists.ag" #-}- case _stuff of- (_,Just r) -> [LibStackIDs [("", [r])]]- _ -> []- {-# LINE 8580 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SelectList ann_ _itemsIannotatedTree _intoIannotatedTree- {-# LINE 8585 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SelectList ann_ _itemsIoriginalTree _intoIoriginalTree- {-# LINE 8590 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8595 "AstInternal.hs" #-}- -- copy rule (down)- _itemsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8600 "AstInternal.hs" #-}- -- copy rule (down)- _itemsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8605 "AstInternal.hs" #-}- -- copy rule (down)- _intoOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8610 "AstInternal.hs" #-}- -- copy rule (down)- _intoOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8615 "AstInternal.hs" #-}- ( _itemsIannotatedTree,_itemsIlistType,_itemsIoriginalTree) =- (items_ _itemsOenv _itemsOlib )- ( _intoIannotatedTree,_intoIoriginalTree,_intoIstrings) =- (into_ _intoOenv _intoOlib )- in ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOlistType,_lhsOoriginalTree)))--- SetClause ----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - pairs : [(String,Type)]- rowSetError : Maybe TypeError- alternatives:- alternative RowSetClause:- child ann : {Annotation}- child atts : StringList - child vals : ExpressionList - visit 0:- local rowSetError : _- local annotatedTree : _- local originalTree : _- alternative SetClause:- child ann : {Annotation}- child att : {String}- child val : Expression - visit 0:- local annotatedTree : _- local originalTree : _--}-data SetClause = RowSetClause (Annotation) (StringList) (ExpressionList) - | SetClause (Annotation) (String) (Expression) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_SetClause :: SetClause ->- T_SetClause -sem_SetClause (RowSetClause _ann _atts _vals ) =- (sem_SetClause_RowSetClause _ann (sem_StringList _atts ) (sem_ExpressionList _vals ) )-sem_SetClause (SetClause _ann _att _val ) =- (sem_SetClause_SetClause _ann _att (sem_Expression _val ) )--- semantic domain-type T_SetClause = Environment ->- LocalIdentifierBindings ->- ( SetClause,SetClause,([(String,Type)]),(Maybe TypeError))-data Inh_SetClause = Inh_SetClause {env_Inh_SetClause :: Environment,lib_Inh_SetClause :: LocalIdentifierBindings}-data Syn_SetClause = Syn_SetClause {annotatedTree_Syn_SetClause :: SetClause,originalTree_Syn_SetClause :: SetClause,pairs_Syn_SetClause :: [(String,Type)],rowSetError_Syn_SetClause :: Maybe TypeError}-wrap_SetClause :: T_SetClause ->- Inh_SetClause ->- Syn_SetClause -wrap_SetClause sem (Inh_SetClause _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOpairs,_lhsOrowSetError) =- (sem _lhsIenv _lhsIlib )- in (Syn_SetClause _lhsOannotatedTree _lhsOoriginalTree _lhsOpairs _lhsOrowSetError ))-sem_SetClause_RowSetClause :: Annotation ->- T_StringList ->- T_ExpressionList ->- T_SetClause -sem_SetClause_RowSetClause ann_ atts_ vals_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOpairs :: ([(String,Type)])- _lhsOannotatedTree :: SetClause- _lhsOoriginalTree :: SetClause- _lhsOrowSetError :: (Maybe TypeError)- _attsOenv :: Environment- _attsOlib :: LocalIdentifierBindings- _valsOenv :: Environment- _valsOlib :: LocalIdentifierBindings- _attsIannotatedTree :: StringList- _attsIoriginalTree :: StringList- _attsIstrings :: ([String])- _valsIannotatedTree :: ExpressionList- _valsIoriginalTree :: ExpressionList- _valsItypeList :: ([Type])- -- "./TypeChecking/Dml.ag"(line 128, column 9)- _rowSetError =- {-# LINE 128 "./TypeChecking/Dml.ag" #-}- let atts = _attsIstrings- types = getRowTypes _valsItypeList- in if length atts /= length types- then Just WrongNumberOfColumns- else Nothing- {-# LINE 8701 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 134, column 9)- _lhsOpairs =- {-# LINE 134 "./TypeChecking/Dml.ag" #-}- zip _attsIstrings $ getRowTypes _valsItypeList- {-# LINE 8706 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- RowSetClause ann_ _attsIannotatedTree _valsIannotatedTree- {-# LINE 8711 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- RowSetClause ann_ _attsIoriginalTree _valsIoriginalTree- {-# LINE 8716 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8721 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8726 "AstInternal.hs" #-}- -- copy rule (from local)- _lhsOrowSetError =- {-# LINE 121 "./TypeChecking/Dml.ag" #-}- _rowSetError- {-# LINE 8731 "AstInternal.hs" #-}- -- copy rule (down)- _attsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8736 "AstInternal.hs" #-}- -- copy rule (down)- _attsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8741 "AstInternal.hs" #-}- -- copy rule (down)- _valsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8746 "AstInternal.hs" #-}- -- copy rule (down)- _valsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8751 "AstInternal.hs" #-}- ( _attsIannotatedTree,_attsIoriginalTree,_attsIstrings) =- (atts_ _attsOenv _attsOlib )- ( _valsIannotatedTree,_valsIoriginalTree,_valsItypeList) =- (vals_ _valsOenv _valsOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOpairs,_lhsOrowSetError)))-sem_SetClause_SetClause :: Annotation ->- String ->- T_Expression ->- T_SetClause -sem_SetClause_SetClause ann_ att_ val_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOpairs :: ([(String,Type)])- _lhsOrowSetError :: (Maybe TypeError)- _lhsOannotatedTree :: SetClause- _lhsOoriginalTree :: SetClause- _valOenv :: Environment- _valOlib :: LocalIdentifierBindings- _valIannotatedTree :: Expression- _valIliftedColumnName :: String- _valIoriginalTree :: Expression- -- "./TypeChecking/Dml.ag"(line 125, column 9)- _lhsOpairs =- {-# LINE 125 "./TypeChecking/Dml.ag" #-}- [(att_, getTypeAnnotation _valIannotatedTree)]- {-# LINE 8777 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 126, column 9)- _lhsOrowSetError =- {-# LINE 126 "./TypeChecking/Dml.ag" #-}- Nothing- {-# LINE 8782 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SetClause ann_ att_ _valIannotatedTree- {-# LINE 8787 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SetClause ann_ att_ _valIoriginalTree- {-# LINE 8792 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8797 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8802 "AstInternal.hs" #-}- -- copy rule (down)- _valOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8807 "AstInternal.hs" #-}- -- copy rule (down)- _valOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8812 "AstInternal.hs" #-}- ( _valIannotatedTree,_valIliftedColumnName,_valIoriginalTree) =- (val_ _valOenv _valOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOpairs,_lhsOrowSetError)))--- SetClauseList ------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - pairs : [(String,Type)]- rowSetErrors : [TypeError]- alternatives:- alternative Cons:- child hd : SetClause - child tl : SetClauseList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type SetClauseList = [(SetClause)]--- cata-sem_SetClauseList :: SetClauseList ->- T_SetClauseList -sem_SetClauseList list =- (Prelude.foldr sem_SetClauseList_Cons sem_SetClauseList_Nil (Prelude.map sem_SetClause list) )--- semantic domain-type T_SetClauseList = Environment ->- LocalIdentifierBindings ->- ( SetClauseList,SetClauseList,([(String,Type)]),([TypeError]))-data Inh_SetClauseList = Inh_SetClauseList {env_Inh_SetClauseList :: Environment,lib_Inh_SetClauseList :: LocalIdentifierBindings}-data Syn_SetClauseList = Syn_SetClauseList {annotatedTree_Syn_SetClauseList :: SetClauseList,originalTree_Syn_SetClauseList :: SetClauseList,pairs_Syn_SetClauseList :: [(String,Type)],rowSetErrors_Syn_SetClauseList :: [TypeError]}-wrap_SetClauseList :: T_SetClauseList ->- Inh_SetClauseList ->- Syn_SetClauseList -wrap_SetClauseList sem (Inh_SetClauseList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOpairs,_lhsOrowSetErrors) =- (sem _lhsIenv _lhsIlib )- in (Syn_SetClauseList _lhsOannotatedTree _lhsOoriginalTree _lhsOpairs _lhsOrowSetErrors ))-sem_SetClauseList_Cons :: T_SetClause ->- T_SetClauseList ->- T_SetClauseList -sem_SetClauseList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOpairs :: ([(String,Type)])- _lhsOrowSetErrors :: ([TypeError])- _lhsOannotatedTree :: SetClauseList- _lhsOoriginalTree :: SetClauseList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: SetClause- _hdIoriginalTree :: SetClause- _hdIpairs :: ([(String,Type)])- _hdIrowSetError :: (Maybe TypeError)- _tlIannotatedTree :: SetClauseList- _tlIoriginalTree :: SetClauseList- _tlIpairs :: ([(String,Type)])- _tlIrowSetErrors :: ([TypeError])- -- "./TypeChecking/Dml.ag"(line 115, column 10)- _lhsOpairs =- {-# LINE 115 "./TypeChecking/Dml.ag" #-}- _hdIpairs ++ _tlIpairs- {-# LINE 8884 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 116, column 10)- _lhsOrowSetErrors =- {-# LINE 116 "./TypeChecking/Dml.ag" #-}- maybeToList _hdIrowSetError ++ _tlIrowSetErrors- {-# LINE 8889 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 8894 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 8899 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8904 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8909 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8914 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8919 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 8924 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 8929 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIoriginalTree,_hdIpairs,_hdIrowSetError) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree,_tlIpairs,_tlIrowSetErrors) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOpairs,_lhsOrowSetErrors)))-sem_SetClauseList_Nil :: T_SetClauseList -sem_SetClauseList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOpairs :: ([(String,Type)])- _lhsOrowSetErrors :: ([TypeError])- _lhsOannotatedTree :: SetClauseList- _lhsOoriginalTree :: SetClauseList- -- "./TypeChecking/Dml.ag"(line 117, column 9)- _lhsOpairs =- {-# LINE 117 "./TypeChecking/Dml.ag" #-}- []- {-# LINE 8947 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 118, column 9)- _lhsOrowSetErrors =- {-# LINE 118 "./TypeChecking/Dml.ag" #-}- []- {-# LINE 8952 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 8957 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 8962 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 8967 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 8972 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOpairs,_lhsOrowSetErrors)))--- SetValue -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative SetId:- child ann : {Annotation}- child string : {String}- visit 0:- local annotatedTree : _- local originalTree : _- alternative SetNum:- child ann : {Annotation}- child double : {Double}- visit 0:- local annotatedTree : _- local originalTree : _- alternative SetStr:- child ann : {Annotation}- child string : {String}- visit 0:- local annotatedTree : _- local originalTree : _--}-data SetValue = SetId (Annotation) (String) - | SetNum (Annotation) (Double) - | SetStr (Annotation) (String) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_SetValue :: SetValue ->- T_SetValue -sem_SetValue (SetId _ann _string ) =- (sem_SetValue_SetId _ann _string )-sem_SetValue (SetNum _ann _double ) =- (sem_SetValue_SetNum _ann _double )-sem_SetValue (SetStr _ann _string ) =- (sem_SetValue_SetStr _ann _string )--- semantic domain-type T_SetValue = Environment ->- LocalIdentifierBindings ->- ( SetValue,SetValue)-data Inh_SetValue = Inh_SetValue {env_Inh_SetValue :: Environment,lib_Inh_SetValue :: LocalIdentifierBindings}-data Syn_SetValue = Syn_SetValue {annotatedTree_Syn_SetValue :: SetValue,originalTree_Syn_SetValue :: SetValue}-wrap_SetValue :: T_SetValue ->- Inh_SetValue ->- Syn_SetValue -wrap_SetValue sem (Inh_SetValue _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_SetValue _lhsOannotatedTree _lhsOoriginalTree ))-sem_SetValue_SetId :: Annotation ->- String ->- T_SetValue -sem_SetValue_SetId ann_ string_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: SetValue- _lhsOoriginalTree :: SetValue- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SetId ann_ string_- {-# LINE 9041 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SetId ann_ string_- {-# LINE 9046 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9051 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9056 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_SetValue_SetNum :: Annotation ->- Double ->- T_SetValue -sem_SetValue_SetNum ann_ double_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: SetValue- _lhsOoriginalTree :: SetValue- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SetNum ann_ double_- {-# LINE 9070 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SetNum ann_ double_- {-# LINE 9075 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9080 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9085 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_SetValue_SetStr :: Annotation ->- String ->- T_SetValue -sem_SetValue_SetStr ann_ string_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: SetValue- _lhsOoriginalTree :: SetValue- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SetStr ann_ string_- {-# LINE 9099 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SetStr ann_ string_- {-# LINE 9104 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9109 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9114 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- Statement ----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- inProducedEnv : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - envUpdates : [EnvironmentUpdate]- libUpdates : [LocalIdentifierBindingsUpdate]- originalTree : SELF - alternatives:- alternative AlterSequence:- child ann : {Annotation}- child name : {String}- child ownedBy : {String}- visit 0:- local libUpdates : _- local annotatedTree : _- local originalTree : _- alternative AlterTable:- child ann : {Annotation}- child name : {String}- child actions : {[AlterTableAction]}- visit 0:- local annotatedTree : _- local originalTree : _- alternative Assignment:- child ann : {Annotation}- child target : {String}- child value : Expression - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local statementType : _- local annotatedTree : _- local originalTree : _- alternative CaseStatement:- child ann : {Annotation}- child val : Expression - child cases : ExpressionListStatementListPairList - child els : StatementList - visit 0:- local annotatedTree : _- local originalTree : _- alternative ContinueStatement:- child ann : {Annotation}- visit 0:- local annotatedTree : _- local originalTree : _- alternative Copy:- child ann : {Annotation}- child table : {String}- child targetCols : StringList - child source : CopySource - visit 0:- local annotatedTree : _- local originalTree : _- alternative CopyData:- child ann : {Annotation}- child insData : {String}- visit 0:- local annotatedTree : _- local originalTree : _- alternative CreateDomain:- child ann : {Annotation}- child name : {String}- child typ : TypeName - child checkName : {String}- child check : MaybeBoolExpression - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local backTree : _- local statementType : _- local envUpdates : {[EnvironmentUpdate]}- local annotatedTree : _- local originalTree : _- alternative CreateFunction:- child ann : {Annotation}- child name : {String}- child params : ParamDefList - child rettype : TypeName - child lang : Language - child bodyQuote : {String}- child body : FnBody - child vol : Volatility - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local envUpdates : {[EnvironmentUpdate]}- local parameterTypes : _- local backTree : _- local statementType : _- local annotatedTree : _- local originalTree : _- alternative CreateLanguage:- child ann : {Annotation}- child name : {String}- visit 0:- local libUpdates : _- local annotatedTree : _- local originalTree : _- alternative CreateSequence:- child ann : {Annotation}- child name : {String}- child incr : {Integer}- child min : {Integer}- child max : {Integer}- child start : {Integer}- child cache : {Integer}- visit 0:- local libUpdates : _- local annotatedTree : _- local originalTree : _- alternative CreateTable:- child ann : {Annotation}- child name : {String}- child atts : AttributeDefList - child cons : ConstraintList - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local envUpdates : {[EnvironmentUpdate]}- local attrTypes : {[Type]}- local statementType : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative CreateTableAs:- child ann : {Annotation}- child name : {String}- child expr : SelectExpression - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local envUpdates : {[EnvironmentUpdate]}- local selType : _- local attrs : _- local backTree : _- local statementType : _- local annotatedTree : _- local originalTree : _- alternative CreateTrigger:- child ann : {Annotation}- child name : {String}- child wh : TriggerWhen - child events : {[TriggerEvent]}- child tbl : {String}- child firing : TriggerFire - child fnName : {String}- child fnArgs : {[Expression]}- visit 0:- local annotatedTree : _- local originalTree : _- alternative CreateType:- child ann : {Annotation}- child name : {String}- child atts : TypeAttributeDefList - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local backTree : _- local statementType : _- local envUpdates : {[EnvironmentUpdate]}- local annotatedTree : _- local originalTree : _- alternative CreateView:- child ann : {Annotation}- child name : {String}- child expr : SelectExpression - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local backTree : _- local attrs : _- local envUpdates : {[EnvironmentUpdate]}- local statementType : _- local annotatedTree : _- local originalTree : _- alternative Delete:- child ann : {Annotation}- child table : {String}- child whr : MaybeBoolExpression - child returning : MaybeSelectList - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local statementType : _- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local lib : _- local annotatedTree : _- local originalTree : _- alternative DropFunction:- child ann : {Annotation}- child ifE : IfExists - child sigs : StringTypeNameListPairList - child cascade : Cascade - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local statementType : _- local annotatedTree : _- local originalTree : _- alternative DropSomething:- child ann : {Annotation}- child dropType : DropType - child ifE : IfExists - child names : StringList - child cascade : Cascade - visit 0:- local annotatedTree : _- local originalTree : _- alternative Execute:- child ann : {Annotation}- child expr : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative ExecuteInto:- child ann : {Annotation}- child expr : Expression - child targets : StringList - visit 0:- local annotatedTree : _- local originalTree : _- alternative ForIntegerStatement:- child ann : {Annotation}- child var : {String}- child from : Expression - child to : Expression - child sts : StatementList - visit 0:- local libUpdates : _- local varTypeE : _- local tpe : {Either [TypeError] Type}- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local statementType : _- local annotatedTree : _- local originalTree : _- alternative ForSelectStatement:- child ann : {Annotation}- child var : {String}- child sel : SelectExpression - child sts : StatementList - visit 0:- local libUpdates : _- local selType : _- local tpe : {Either [TypeError] Type}- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local statementType : _- local annotatedTree : _- local originalTree : _- alternative If:- child ann : {Annotation}- child cases : ExpressionStatementListPairList - child els : StatementList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Insert:- child ann : {Annotation}- child table : {String}- child targetCols : StringList - child insData : SelectExpression - child returning : MaybeSelectList - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local statementType : _- local columnTypes : _- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local annotatedTree : _- local originalTree : _- alternative Notify:- child ann : {Annotation}- child name : {String}- visit 0:- local libUpdates : _- local annotatedTree : _- local originalTree : _- alternative NullStatement:- child ann : {Annotation}- visit 0:- local annotatedTree : _- local originalTree : _- alternative Perform:- child ann : {Annotation}- child expr : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative Raise:- child ann : {Annotation}- child level : RaiseType - child message : {String}- child args : ExpressionList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Return:- child ann : {Annotation}- child value : MaybeExpression - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local statementType : _- local annotatedTree : _- local originalTree : _- alternative ReturnNext:- child ann : {Annotation}- child expr : Expression - visit 0:- local annotatedTree : _- local originalTree : _- alternative ReturnQuery:- child ann : {Annotation}- child sel : SelectExpression - visit 0:- local annotatedTree : _- local originalTree : _- alternative SelectStatement:- child ann : {Annotation}- child ex : SelectExpression - visit 0:- local tpe : {Either [TypeError] Type}- local statementType : _- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local libUpdates : _- local annotatedTree : _- local originalTree : _- alternative Set:- child ann : {Annotation}- child name : {String}- child values : {[SetValue]}- visit 0:- local libUpdates : _- local annotatedTree : _- local originalTree : _- alternative Truncate:- child ann : {Annotation}- child tables : StringList - child restartIdentity : RestartIdentity - child cascade : Cascade - visit 0:- local annotatedTree : _- local originalTree : _- alternative Update:- child ann : {Annotation}- child table : {String}- child assigns : SetClauseList - child whr : MaybeBoolExpression - child returning : MaybeSelectList - visit 0:- local libUpdates : _- local tpe : {Either [TypeError] Type}- local statementType : _- local columnTypes : _- local backTree : _- local envUpdates : {[EnvironmentUpdate]}- local lib : _- local annotatedTree : _- local originalTree : _- alternative WhileStatement:- child ann : {Annotation}- child expr : Expression - child sts : StatementList - visit 0:- local annotatedTree : _- local originalTree : _--}-data Statement = AlterSequence (Annotation) (String) (String) - | AlterTable (Annotation) (String) ([AlterTableAction]) - | Assignment (Annotation) (String) (Expression) - | CaseStatement (Annotation) (Expression) (ExpressionListStatementListPairList) (StatementList) - | ContinueStatement (Annotation) - | Copy (Annotation) (String) (StringList) (CopySource) - | CopyData (Annotation) (String) - | CreateDomain (Annotation) (String) (TypeName) (String) (MaybeBoolExpression) - | CreateFunction (Annotation) (String) (ParamDefList) (TypeName) (Language) (String) (FnBody) (Volatility) - | CreateLanguage (Annotation) (String) - | CreateSequence (Annotation) (String) (Integer) (Integer) (Integer) (Integer) (Integer) - | CreateTable (Annotation) (String) (AttributeDefList) (ConstraintList) - | CreateTableAs (Annotation) (String) (SelectExpression) - | CreateTrigger (Annotation) (String) (TriggerWhen) ([TriggerEvent]) (String) (TriggerFire) (String) ([Expression]) - | CreateType (Annotation) (String) (TypeAttributeDefList) - | CreateView (Annotation) (String) (SelectExpression) - | Delete (Annotation) (String) (MaybeBoolExpression) (MaybeSelectList) - | DropFunction (Annotation) (IfExists) (StringTypeNameListPairList) (Cascade) - | DropSomething (Annotation) (DropType) (IfExists) (StringList) (Cascade) - | Execute (Annotation) (Expression) - | ExecuteInto (Annotation) (Expression) (StringList) - | ForIntegerStatement (Annotation) (String) (Expression) (Expression) (StatementList) - | ForSelectStatement (Annotation) (String) (SelectExpression) (StatementList) - | If (Annotation) (ExpressionStatementListPairList) (StatementList) - | Insert (Annotation) (String) (StringList) (SelectExpression) (MaybeSelectList) - | Notify (Annotation) (String) - | NullStatement (Annotation) - | Perform (Annotation) (Expression) - | Raise (Annotation) (RaiseType) (String) (ExpressionList) - | Return (Annotation) (MaybeExpression) - | ReturnNext (Annotation) (Expression) - | ReturnQuery (Annotation) (SelectExpression) - | SelectStatement (Annotation) (SelectExpression) - | Set (Annotation) (String) ([SetValue]) - | Truncate (Annotation) (StringList) (RestartIdentity) (Cascade) - | Update (Annotation) (String) (SetClauseList) (MaybeBoolExpression) (MaybeSelectList) - | WhileStatement (Annotation) (Expression) (StatementList) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Statement :: Statement ->- T_Statement -sem_Statement (AlterSequence _ann _name _ownedBy ) =- (sem_Statement_AlterSequence _ann _name _ownedBy )-sem_Statement (AlterTable _ann _name _actions ) =- (sem_Statement_AlterTable _ann _name _actions )-sem_Statement (Assignment _ann _target _value ) =- (sem_Statement_Assignment _ann _target (sem_Expression _value ) )-sem_Statement (CaseStatement _ann _val _cases _els ) =- (sem_Statement_CaseStatement _ann (sem_Expression _val ) (sem_ExpressionListStatementListPairList _cases ) (sem_StatementList _els ) )-sem_Statement (ContinueStatement _ann ) =- (sem_Statement_ContinueStatement _ann )-sem_Statement (Copy _ann _table _targetCols _source ) =- (sem_Statement_Copy _ann _table (sem_StringList _targetCols ) (sem_CopySource _source ) )-sem_Statement (CopyData _ann _insData ) =- (sem_Statement_CopyData _ann _insData )-sem_Statement (CreateDomain _ann _name _typ _checkName _check ) =- (sem_Statement_CreateDomain _ann _name (sem_TypeName _typ ) _checkName (sem_MaybeBoolExpression _check ) )-sem_Statement (CreateFunction _ann _name _params _rettype _lang _bodyQuote _body _vol ) =- (sem_Statement_CreateFunction _ann _name (sem_ParamDefList _params ) (sem_TypeName _rettype ) (sem_Language _lang ) _bodyQuote (sem_FnBody _body ) (sem_Volatility _vol ) )-sem_Statement (CreateLanguage _ann _name ) =- (sem_Statement_CreateLanguage _ann _name )-sem_Statement (CreateSequence _ann _name _incr _min _max _start _cache ) =- (sem_Statement_CreateSequence _ann _name _incr _min _max _start _cache )-sem_Statement (CreateTable _ann _name _atts _cons ) =- (sem_Statement_CreateTable _ann _name (sem_AttributeDefList _atts ) (sem_ConstraintList _cons ) )-sem_Statement (CreateTableAs _ann _name _expr ) =- (sem_Statement_CreateTableAs _ann _name (sem_SelectExpression _expr ) )-sem_Statement (CreateTrigger _ann _name _wh _events _tbl _firing _fnName _fnArgs ) =- (sem_Statement_CreateTrigger _ann _name (sem_TriggerWhen _wh ) _events _tbl (sem_TriggerFire _firing ) _fnName _fnArgs )-sem_Statement (CreateType _ann _name _atts ) =- (sem_Statement_CreateType _ann _name (sem_TypeAttributeDefList _atts ) )-sem_Statement (CreateView _ann _name _expr ) =- (sem_Statement_CreateView _ann _name (sem_SelectExpression _expr ) )-sem_Statement (Delete _ann _table _whr _returning ) =- (sem_Statement_Delete _ann _table (sem_MaybeBoolExpression _whr ) (sem_MaybeSelectList _returning ) )-sem_Statement (DropFunction _ann _ifE _sigs _cascade ) =- (sem_Statement_DropFunction _ann (sem_IfExists _ifE ) (sem_StringTypeNameListPairList _sigs ) (sem_Cascade _cascade ) )-sem_Statement (DropSomething _ann _dropType _ifE _names _cascade ) =- (sem_Statement_DropSomething _ann (sem_DropType _dropType ) (sem_IfExists _ifE ) (sem_StringList _names ) (sem_Cascade _cascade ) )-sem_Statement (Execute _ann _expr ) =- (sem_Statement_Execute _ann (sem_Expression _expr ) )-sem_Statement (ExecuteInto _ann _expr _targets ) =- (sem_Statement_ExecuteInto _ann (sem_Expression _expr ) (sem_StringList _targets ) )-sem_Statement (ForIntegerStatement _ann _var _from _to _sts ) =- (sem_Statement_ForIntegerStatement _ann _var (sem_Expression _from ) (sem_Expression _to ) (sem_StatementList _sts ) )-sem_Statement (ForSelectStatement _ann _var _sel _sts ) =- (sem_Statement_ForSelectStatement _ann _var (sem_SelectExpression _sel ) (sem_StatementList _sts ) )-sem_Statement (If _ann _cases _els ) =- (sem_Statement_If _ann (sem_ExpressionStatementListPairList _cases ) (sem_StatementList _els ) )-sem_Statement (Insert _ann _table _targetCols _insData _returning ) =- (sem_Statement_Insert _ann _table (sem_StringList _targetCols ) (sem_SelectExpression _insData ) (sem_MaybeSelectList _returning ) )-sem_Statement (Notify _ann _name ) =- (sem_Statement_Notify _ann _name )-sem_Statement (NullStatement _ann ) =- (sem_Statement_NullStatement _ann )-sem_Statement (Perform _ann _expr ) =- (sem_Statement_Perform _ann (sem_Expression _expr ) )-sem_Statement (Raise _ann _level _message _args ) =- (sem_Statement_Raise _ann (sem_RaiseType _level ) _message (sem_ExpressionList _args ) )-sem_Statement (Return _ann _value ) =- (sem_Statement_Return _ann (sem_MaybeExpression _value ) )-sem_Statement (ReturnNext _ann _expr ) =- (sem_Statement_ReturnNext _ann (sem_Expression _expr ) )-sem_Statement (ReturnQuery _ann _sel ) =- (sem_Statement_ReturnQuery _ann (sem_SelectExpression _sel ) )-sem_Statement (SelectStatement _ann _ex ) =- (sem_Statement_SelectStatement _ann (sem_SelectExpression _ex ) )-sem_Statement (Set _ann _name _values ) =- (sem_Statement_Set _ann _name _values )-sem_Statement (Truncate _ann _tables _restartIdentity _cascade ) =- (sem_Statement_Truncate _ann (sem_StringList _tables ) (sem_RestartIdentity _restartIdentity ) (sem_Cascade _cascade ) )-sem_Statement (Update _ann _table _assigns _whr _returning ) =- (sem_Statement_Update _ann _table (sem_SetClauseList _assigns ) (sem_MaybeBoolExpression _whr ) (sem_MaybeSelectList _returning ) )-sem_Statement (WhileStatement _ann _expr _sts ) =- (sem_Statement_WhileStatement _ann (sem_Expression _expr ) (sem_StatementList _sts ) )--- semantic domain-type T_Statement = Environment ->- Environment ->- LocalIdentifierBindings ->- ( Statement,([EnvironmentUpdate]),([LocalIdentifierBindingsUpdate]),Statement)-data Inh_Statement = Inh_Statement {env_Inh_Statement :: Environment,inProducedEnv_Inh_Statement :: Environment,lib_Inh_Statement :: LocalIdentifierBindings}-data Syn_Statement = Syn_Statement {annotatedTree_Syn_Statement :: Statement,envUpdates_Syn_Statement :: [EnvironmentUpdate],libUpdates_Syn_Statement :: [LocalIdentifierBindingsUpdate],originalTree_Syn_Statement :: Statement}-wrap_Statement :: T_Statement ->- Inh_Statement ->- Syn_Statement -wrap_Statement sem (Inh_Statement _lhsIenv _lhsIinProducedEnv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIinProducedEnv _lhsIlib )- in (Syn_Statement _lhsOannotatedTree _lhsOenvUpdates _lhsOlibUpdates _lhsOoriginalTree ))-sem_Statement_AlterSequence :: Annotation ->- String ->- String ->- T_Statement -sem_Statement_AlterSequence ann_ name_ ownedBy_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9644 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9649 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9654 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- AlterSequence ann_ name_ ownedBy_- {-# LINE 9659 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- AlterSequence ann_ name_ ownedBy_- {-# LINE 9664 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9669 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9674 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_AlterTable :: Annotation ->- String ->- ([AlterTableAction]) ->- T_Statement -sem_Statement_AlterTable ann_ name_ actions_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9692 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9697 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- AlterTable ann_ name_ actions_- {-# LINE 9702 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- AlterTable ann_ name_ actions_- {-# LINE 9707 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9712 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9717 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Assignment :: Annotation ->- String ->- T_Expression ->- T_Statement -sem_Statement_Assignment ann_ target_ value_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _valueOenv :: Environment- _valueOlib :: LocalIdentifierBindings- _valueIannotatedTree :: Expression- _valueIliftedColumnName :: String- _valueIoriginalTree :: Expression- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 9746 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 9751 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 9756 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9761 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 23, column 9)- _tpe =- {-# LINE 23 "./TypeChecking/Plpgsql.ag" #-}- do- let fromType = getTypeAnnotation _valueIannotatedTree- toType <- libLookupID _lhsIlib target_- dependsOnRTpe [getTypeAnnotation _valueIannotatedTree, toType] $ do- checkAssignmentValid _lhsIenv fromType toType- return $ Pseudo Void- {-# LINE 9771 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 30, column 9)- _backTree =- {-# LINE 30 "./TypeChecking/Plpgsql.ag" #-}- Assignment ann_ target_ _valueIannotatedTree- {-# LINE 9776 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 31, column 9)- _envUpdates =- {-# LINE 31 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 9781 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 32, column 9)- _statementType =- {-# LINE 32 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 9786 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Assignment ann_ target_ _valueIannotatedTree- {-# LINE 9791 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Assignment ann_ target_ _valueIoriginalTree- {-# LINE 9796 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9801 "AstInternal.hs" #-}- -- copy rule (down)- _valueOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 9806 "AstInternal.hs" #-}- -- copy rule (down)- _valueOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 9811 "AstInternal.hs" #-}- ( _valueIannotatedTree,_valueIliftedColumnName,_valueIoriginalTree) =- (value_ _valueOenv _valueOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CaseStatement :: Annotation ->- T_Expression ->- T_ExpressionListStatementListPairList ->- T_StatementList ->- T_Statement -sem_Statement_CaseStatement ann_ val_ cases_ els_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _elsOenvUpdates :: ([EnvironmentUpdate])- _elsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _valOenv :: Environment- _valOlib :: LocalIdentifierBindings- _casesOenv :: Environment- _casesOlib :: LocalIdentifierBindings- _elsOenv :: Environment- _elsOlib :: LocalIdentifierBindings- _valIannotatedTree :: Expression- _valIliftedColumnName :: String- _valIoriginalTree :: Expression- _casesIannotatedTree :: ExpressionListStatementListPairList- _casesIoriginalTree :: ExpressionListStatementListPairList- _elsIannotatedTree :: StatementList- _elsIoriginalTree :: StatementList- _elsIproducedEnv :: Environment- _elsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9849 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9854 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 106, column 9)- _elsOenvUpdates =- {-# LINE 106 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9859 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 107, column 9)- _elsOlibUpdates =- {-# LINE 107 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9864 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CaseStatement ann_ _valIannotatedTree _casesIannotatedTree _elsIannotatedTree- {-# LINE 9869 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CaseStatement ann_ _valIoriginalTree _casesIoriginalTree _elsIoriginalTree- {-# LINE 9874 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9879 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9884 "AstInternal.hs" #-}- -- copy rule (down)- _valOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 9889 "AstInternal.hs" #-}- -- copy rule (down)- _valOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 9894 "AstInternal.hs" #-}- -- copy rule (down)- _casesOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 9899 "AstInternal.hs" #-}- -- copy rule (down)- _casesOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 9904 "AstInternal.hs" #-}- -- copy rule (down)- _elsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 9909 "AstInternal.hs" #-}- -- copy rule (down)- _elsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 9914 "AstInternal.hs" #-}- ( _valIannotatedTree,_valIliftedColumnName,_valIoriginalTree) =- (val_ _valOenv _valOlib )- ( _casesIannotatedTree,_casesIoriginalTree) =- (cases_ _casesOenv _casesOlib )- ( _elsIannotatedTree,_elsIoriginalTree,_elsIproducedEnv,_elsIproducedLib) =- (els_ _elsOenv _elsOenvUpdates _elsOlib _elsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_ContinueStatement :: Annotation ->- T_Statement -sem_Statement_ContinueStatement ann_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9936 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9941 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ContinueStatement ann_- {-# LINE 9946 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ContinueStatement ann_- {-# LINE 9951 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 9956 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 9961 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Copy :: Annotation ->- String ->- T_StringList ->- T_CopySource ->- T_Statement -sem_Statement_Copy ann_ table_ targetCols_ source_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _targetColsOenv :: Environment- _targetColsOlib :: LocalIdentifierBindings- _sourceOenv :: Environment- _sourceOlib :: LocalIdentifierBindings- _targetColsIannotatedTree :: StringList- _targetColsIoriginalTree :: StringList- _targetColsIstrings :: ([String])- _sourceIannotatedTree :: CopySource- _sourceIoriginalTree :: CopySource- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9989 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 9994 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Copy ann_ table_ _targetColsIannotatedTree _sourceIannotatedTree- {-# LINE 9999 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Copy ann_ table_ _targetColsIoriginalTree _sourceIoriginalTree- {-# LINE 10004 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 10009 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10014 "AstInternal.hs" #-}- -- copy rule (down)- _targetColsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10019 "AstInternal.hs" #-}- -- copy rule (down)- _targetColsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10024 "AstInternal.hs" #-}- -- copy rule (down)- _sourceOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10029 "AstInternal.hs" #-}- -- copy rule (down)- _sourceOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10034 "AstInternal.hs" #-}- ( _targetColsIannotatedTree,_targetColsIoriginalTree,_targetColsIstrings) =- (targetCols_ _targetColsOenv _targetColsOlib )- ( _sourceIannotatedTree,_sourceIoriginalTree) =- (source_ _sourceOenv _sourceOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CopyData :: Annotation ->- String ->- T_Statement -sem_Statement_CopyData ann_ insData_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10055 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10060 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CopyData ann_ insData_- {-# LINE 10065 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CopyData ann_ insData_- {-# LINE 10070 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 10075 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10080 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateDomain :: Annotation ->- String ->- T_TypeName ->- String ->- T_MaybeBoolExpression ->- T_Statement -sem_Statement_CreateDomain ann_ name_ typ_ checkName_ check_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _checkOlib :: LocalIdentifierBindings- _lhsOoriginalTree :: Statement- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _checkOenv :: Environment- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- _checkIannotatedTree :: MaybeBoolExpression- _checkIoriginalTree :: MaybeBoolExpression- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 10115 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 10120 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 10125 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10130 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 64, column 9)- _tpe =- {-# LINE 64 "./TypeChecking/MiscCreates.ag" #-}- Right $ Pseudo Void- {-# LINE 10135 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 65, column 9)- _backTree =- {-# LINE 65 "./TypeChecking/MiscCreates.ag" #-}- CreateDomain ann_ name_ _typIannotatedTree checkName_ _checkIannotatedTree- {-# LINE 10140 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 66, column 9)- _statementType =- {-# LINE 66 "./TypeChecking/MiscCreates.ag" #-}- []- {-# LINE 10145 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 67, column 9)- _envUpdates =- {-# LINE 67 "./TypeChecking/MiscCreates.ag" #-}- [EnvCreateDomain (DomainType name_) _typInamedType]- {-# LINE 10150 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 69, column 9)- _checkOlib =- {-# LINE 69 "./TypeChecking/MiscCreates.ag" #-}- fromRight _lhsIlib $- updateBindings _lhsIlib _lhsIenv- [LibStackIDs [("", [("value", _typInamedType)])]]- {-# LINE 10157 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateDomain ann_ name_ _typIannotatedTree checkName_ _checkIannotatedTree- {-# LINE 10162 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateDomain ann_ name_ _typIoriginalTree checkName_ _checkIoriginalTree- {-# LINE 10167 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10172 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10177 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10182 "AstInternal.hs" #-}- -- copy rule (down)- _checkOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10187 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- ( _checkIannotatedTree,_checkIoriginalTree) =- (check_ _checkOenv _checkOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateFunction :: Annotation ->- String ->- T_ParamDefList ->- T_TypeName ->- T_Language ->- String ->- T_FnBody ->- T_Volatility ->- T_Statement -sem_Statement_CreateFunction ann_ name_ params_ rettype_ lang_ bodyQuote_ body_ vol_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _bodyOenv :: Environment- _bodyOlib :: LocalIdentifierBindings- _lhsOoriginalTree :: Statement- _paramsOenv :: Environment- _paramsOlib :: LocalIdentifierBindings- _rettypeOenv :: Environment- _rettypeOlib :: LocalIdentifierBindings- _langOenv :: Environment- _langOlib :: LocalIdentifierBindings- _volOenv :: Environment- _volOlib :: LocalIdentifierBindings- _paramsIannotatedTree :: ParamDefList- _paramsIoriginalTree :: ParamDefList- _paramsIparams :: ([(String, Type)])- _rettypeIannotatedTree :: TypeName- _rettypeInamedType :: Type- _rettypeIoriginalTree :: TypeName- _langIannotatedTree :: Language- _langIoriginalTree :: Language- _bodyIannotatedTree :: FnBody- _bodyIoriginalTree :: FnBody- _volIannotatedTree :: Volatility- _volIoriginalTree :: Volatility- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 10242 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 10247 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 10252 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10257 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 23, column 9)- _tpe =- {-# LINE 23 "./TypeChecking/CreateFunction.ag" #-}- dependsOnRTpe- (_rettypeInamedType : _parameterTypes ) $- Right $ Pseudo Void- {-# LINE 10264 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 26, column 9)- _envUpdates =- {-# LINE 26 "./TypeChecking/CreateFunction.ag" #-}- dependsOn [tpeToT _tpe ] []- [EnvCreateFunction FunName- (map toLower name_)- _parameterTypes- _rettypeInamedType- False]- {-# LINE 10274 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 32, column 9)- _parameterTypes =- {-# LINE 32 "./TypeChecking/CreateFunction.ag" #-}- (map snd _paramsIparams)- {-# LINE 10279 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 34, column 9)- _backTree =- {-# LINE 34 "./TypeChecking/CreateFunction.ag" #-}- CreateFunction ann_- name_- _paramsIannotatedTree- _rettypeIannotatedTree- _langIannotatedTree- bodyQuote_- _bodyIannotatedTree- _volIannotatedTree- {-# LINE 10291 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 42, column 9)- _statementType =- {-# LINE 42 "./TypeChecking/CreateFunction.ag" #-}- []- {-# LINE 10296 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 43, column 9)- _bodyOenv =- {-# LINE 43 "./TypeChecking/CreateFunction.ag" #-}- _lhsIinProducedEnv- {-# LINE 10301 "AstInternal.hs" #-}- -- "./TypeChecking/CreateFunction.ag"(line 99, column 9)- _bodyOlib =- {-# LINE 99 "./TypeChecking/CreateFunction.ag" #-}- let p = _paramsIparams- ++ (zip posNames $ map snd _paramsIparams)- in fromRight _lhsIlib $- updateBindings _lhsIlib _lhsIenv- [LibStackIDs [("", p)- ,(name_, _paramsIparams)]]- where- posNames :: [String]- posNames = map (\l -> '$':show l) [1..]- {-# LINE 10314 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateFunction ann_ name_ _paramsIannotatedTree _rettypeIannotatedTree _langIannotatedTree bodyQuote_ _bodyIannotatedTree _volIannotatedTree- {-# LINE 10319 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateFunction ann_ name_ _paramsIoriginalTree _rettypeIoriginalTree _langIoriginalTree bodyQuote_ _bodyIoriginalTree _volIoriginalTree- {-# LINE 10324 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10329 "AstInternal.hs" #-}- -- copy rule (down)- _paramsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10334 "AstInternal.hs" #-}- -- copy rule (down)- _paramsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10339 "AstInternal.hs" #-}- -- copy rule (down)- _rettypeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10344 "AstInternal.hs" #-}- -- copy rule (down)- _rettypeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10349 "AstInternal.hs" #-}- -- copy rule (down)- _langOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10354 "AstInternal.hs" #-}- -- copy rule (down)- _langOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10359 "AstInternal.hs" #-}- -- copy rule (down)- _volOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10364 "AstInternal.hs" #-}- -- copy rule (down)- _volOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10369 "AstInternal.hs" #-}- ( _paramsIannotatedTree,_paramsIoriginalTree,_paramsIparams) =- (params_ _paramsOenv _paramsOlib )- ( _rettypeIannotatedTree,_rettypeInamedType,_rettypeIoriginalTree) =- (rettype_ _rettypeOenv _rettypeOlib )- ( _langIannotatedTree,_langIoriginalTree) =- (lang_ _langOenv _langOlib )- ( _bodyIannotatedTree,_bodyIoriginalTree) =- (body_ _bodyOenv _bodyOlib )- ( _volIannotatedTree,_volIoriginalTree) =- (vol_ _volOenv _volOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateLanguage :: Annotation ->- String ->- T_Statement -sem_Statement_CreateLanguage ann_ name_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10396 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10401 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10406 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateLanguage ann_ name_- {-# LINE 10411 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateLanguage ann_ name_- {-# LINE 10416 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 10421 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10426 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateSequence :: Annotation ->- String ->- Integer ->- Integer ->- Integer ->- Integer ->- Integer ->- T_Statement -sem_Statement_CreateSequence ann_ name_ incr_ min_ max_ start_ cache_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10448 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10453 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10458 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateSequence ann_ name_ incr_ min_ max_ start_ cache_- {-# LINE 10463 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateSequence ann_ name_ incr_ min_ max_ start_ cache_- {-# LINE 10468 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 10473 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10478 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateTable :: Annotation ->- String ->- T_AttributeDefList ->- T_ConstraintList ->- T_Statement -sem_Statement_CreateTable ann_ name_ atts_ cons_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _attrTypes :: ([Type])- _consOlib :: LocalIdentifierBindings- _lhsOoriginalTree :: Statement- _attsOenv :: Environment- _attsOlib :: LocalIdentifierBindings- _consOenv :: Environment- _attsIannotatedTree :: AttributeDefList- _attsIattrs :: ([(String, Type)])- _attsIoriginalTree :: AttributeDefList- _consIannotatedTree :: ConstraintList- _consIoriginalTree :: ConstraintList- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 10513 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 10518 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 10523 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10528 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 25, column 9)- _tpe =- {-# LINE 25 "./TypeChecking/CreateTable.ag" #-}- dependsOnRTpe _attrTypes $ Right $ Pseudo Void- {-# LINE 10533 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 26, column 9)- _envUpdates =- {-# LINE 26 "./TypeChecking/CreateTable.ag" #-}- dependsOn _attrTypes []- [EnvCreateTable name_ _attsIattrs defaultSystemColumns]- {-# LINE 10539 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 29, column 9)- _attrTypes =- {-# LINE 29 "./TypeChecking/CreateTable.ag" #-}- map snd _attsIattrs- {-# LINE 10544 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 31, column 9)- _statementType =- {-# LINE 31 "./TypeChecking/CreateTable.ag" #-}- []- {-# LINE 10549 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 32, column 9)- _backTree =- {-# LINE 32 "./TypeChecking/CreateTable.ag" #-}- CreateTable ann_- name_- _attsIannotatedTree- _consIannotatedTree- {-# LINE 10557 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 36, column 9)- _consOlib =- {-# LINE 36 "./TypeChecking/CreateTable.ag" #-}- case updateBindings _lhsIlib _lhsIenv- [LibStackIDs [("", _attsIattrs)]] of- Left x -> error $ show x- Right e -> e- {-# LINE 10565 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateTable ann_ name_ _attsIannotatedTree _consIannotatedTree- {-# LINE 10570 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateTable ann_ name_ _attsIoriginalTree _consIoriginalTree- {-# LINE 10575 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10580 "AstInternal.hs" #-}- -- copy rule (down)- _attsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10585 "AstInternal.hs" #-}- -- copy rule (down)- _attsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10590 "AstInternal.hs" #-}- -- copy rule (down)- _consOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10595 "AstInternal.hs" #-}- ( _attsIannotatedTree,_attsIattrs,_attsIoriginalTree) =- (atts_ _attsOenv _attsOlib )- ( _consIannotatedTree,_consIoriginalTree) =- (cons_ _consOenv _consOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateTableAs :: Annotation ->- String ->- T_SelectExpression ->- T_Statement -sem_Statement_CreateTableAs ann_ name_ expr_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _exprIannotatedTree :: SelectExpression- _exprIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _exprIoriginalTree :: SelectExpression- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 10628 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 10633 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 10638 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10643 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 53, column 9)- _tpe =- {-# LINE 53 "./TypeChecking/CreateTable.ag" #-}- dependsOnRTpe [_selType ] $ do- _attrs- Right _selType- {-# LINE 10650 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 57, column 9)- _envUpdates =- {-# LINE 57 "./TypeChecking/CreateTable.ag" #-}- leftToEmpty (\as -> [EnvCreateTable name_ as defaultSystemColumns]) $ do- ats <- _attrs- return $ dependsOn (tpeToT _tpe :- (map snd ats)) [] ats- {-# LINE 10658 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 63, column 9)- _selType =- {-# LINE 63 "./TypeChecking/CreateTable.ag" #-}- getTypeAnnotation _exprIannotatedTree- {-# LINE 10663 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 65, column 9)- _attrs =- {-# LINE 65 "./TypeChecking/CreateTable.ag" #-}- unwrapSetOfComposite _selType- {-# LINE 10668 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 67, column 9)- _backTree =- {-# LINE 67 "./TypeChecking/CreateTable.ag" #-}- CreateTableAs ann_ name_ _exprIannotatedTree- {-# LINE 10673 "AstInternal.hs" #-}- -- "./TypeChecking/CreateTable.ag"(line 68, column 9)- _statementType =- {-# LINE 68 "./TypeChecking/CreateTable.ag" #-}- []- {-# LINE 10678 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateTableAs ann_ name_ _exprIannotatedTree- {-# LINE 10683 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateTableAs ann_ name_ _exprIoriginalTree- {-# LINE 10688 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10693 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10698 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10703 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIlibUpdates,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateTrigger :: Annotation ->- String ->- T_TriggerWhen ->- ([TriggerEvent]) ->- String ->- T_TriggerFire ->- String ->- ([Expression]) ->- T_Statement -sem_Statement_CreateTrigger ann_ name_ wh_ events_ tbl_ firing_ fnName_ fnArgs_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _whOenv :: Environment- _whOlib :: LocalIdentifierBindings- _firingOenv :: Environment- _firingOlib :: LocalIdentifierBindings- _whIannotatedTree :: TriggerWhen- _whIoriginalTree :: TriggerWhen- _firingIannotatedTree :: TriggerFire- _firingIoriginalTree :: TriggerFire- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10736 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10741 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateTrigger ann_ name_ _whIannotatedTree events_ tbl_ _firingIannotatedTree fnName_ fnArgs_- {-# LINE 10746 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateTrigger ann_ name_ _whIoriginalTree events_ tbl_ _firingIoriginalTree fnName_ fnArgs_- {-# LINE 10751 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 10756 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10761 "AstInternal.hs" #-}- -- copy rule (down)- _whOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10766 "AstInternal.hs" #-}- -- copy rule (down)- _whOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10771 "AstInternal.hs" #-}- -- copy rule (down)- _firingOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10776 "AstInternal.hs" #-}- -- copy rule (down)- _firingOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10781 "AstInternal.hs" #-}- ( _whIannotatedTree,_whIoriginalTree) =- (wh_ _whOenv _whOlib )- ( _firingIannotatedTree,_firingIoriginalTree) =- (firing_ _firingOenv _firingOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateType :: Annotation ->- String ->- T_TypeAttributeDefList ->- T_Statement -sem_Statement_CreateType ann_ name_ atts_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _attsOenv :: Environment- _attsOlib :: LocalIdentifierBindings- _attsIannotatedTree :: TypeAttributeDefList- _attsIattrs :: ([(String, Type)])- _attsIoriginalTree :: TypeAttributeDefList- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 10814 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 10819 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 10824 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10829 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 51, column 9)- _tpe =- {-# LINE 51 "./TypeChecking/MiscCreates.ag" #-}- Right $ Pseudo Void- {-# LINE 10834 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 52, column 9)- _backTree =- {-# LINE 52 "./TypeChecking/MiscCreates.ag" #-}- CreateType ann_ name_ _attsIannotatedTree- {-# LINE 10839 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 53, column 9)- _statementType =- {-# LINE 53 "./TypeChecking/MiscCreates.ag" #-}- []- {-# LINE 10844 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 54, column 9)- _envUpdates =- {-# LINE 54 "./TypeChecking/MiscCreates.ag" #-}- [EnvCreateComposite name_ _attsIattrs]- {-# LINE 10849 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateType ann_ name_ _attsIannotatedTree- {-# LINE 10854 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateType ann_ name_ _attsIoriginalTree- {-# LINE 10859 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10864 "AstInternal.hs" #-}- -- copy rule (down)- _attsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10869 "AstInternal.hs" #-}- -- copy rule (down)- _attsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10874 "AstInternal.hs" #-}- ( _attsIannotatedTree,_attsIattrs,_attsIoriginalTree) =- (atts_ _attsOenv _attsOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_CreateView :: Annotation ->- String ->- T_SelectExpression ->- T_Statement -sem_Statement_CreateView ann_ name_ expr_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _exprIannotatedTree :: SelectExpression- _exprIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _exprIoriginalTree :: SelectExpression- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 10905 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 10910 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 10915 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 10920 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 15, column 9)- _tpe =- {-# LINE 15 "./TypeChecking/MiscCreates.ag" #-}- dependsOnRTpe [getTypeAnnotation _exprIannotatedTree] $- Right $ Pseudo Void- {-# LINE 10926 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 17, column 9)- _backTree =- {-# LINE 17 "./TypeChecking/MiscCreates.ag" #-}- CreateView ann_ name_ _exprIannotatedTree- {-# LINE 10931 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 18, column 9)- _attrs =- {-# LINE 18 "./TypeChecking/MiscCreates.ag" #-}- case getTypeAnnotation _exprIannotatedTree of- SetOfType (CompositeType c) -> c- _ -> []- {-# LINE 10938 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 21, column 9)- _envUpdates =- {-# LINE 21 "./TypeChecking/MiscCreates.ag" #-}- [EnvCreateView name_ _attrs ]- {-# LINE 10943 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 22, column 9)- _statementType =- {-# LINE 22 "./TypeChecking/MiscCreates.ag" #-}- []- {-# LINE 10948 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- CreateView ann_ name_ _exprIannotatedTree- {-# LINE 10953 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- CreateView ann_ name_ _exprIoriginalTree- {-# LINE 10958 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 10963 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 10968 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 10973 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIlibUpdates,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Delete :: Annotation ->- String ->- T_MaybeBoolExpression ->- T_MaybeSelectList ->- T_Statement -sem_Statement_Delete ann_ table_ whr_ returning_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _whrOlib :: LocalIdentifierBindings- _returningOlib :: LocalIdentifierBindings- _lhsOoriginalTree :: Statement- _whrOenv :: Environment- _returningOenv :: Environment- _whrIannotatedTree :: MaybeBoolExpression- _whrIoriginalTree :: MaybeBoolExpression- _returningIannotatedTree :: MaybeSelectList- _returningIlistType :: (Maybe [(String,Type)])- _returningIoriginalTree :: MaybeSelectList- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 11009 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 11014 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 11019 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11024 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 153, column 9)- _tpe =- {-# LINE 153 "./TypeChecking/Dml.ag" #-}- checkRelationExists _lhsIenv table_ >>- Right (Pseudo Void)- {-# LINE 11030 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 156, column 9)- _statementType =- {-# LINE 156 "./TypeChecking/Dml.ag" #-}- [StatementType [] (fromMaybe [] _returningIlistType)]- {-# LINE 11035 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 158, column 9)- _backTree =- {-# LINE 158 "./TypeChecking/Dml.ag" #-}- Delete ann_ table_ _whrIannotatedTree _returningIannotatedTree- {-# LINE 11040 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 159, column 9)- _envUpdates =- {-# LINE 159 "./TypeChecking/Dml.ag" #-}- []- {-# LINE 11045 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 164, column 9)- _lib =- {-# LINE 164 "./TypeChecking/Dml.ag" #-}- fromRight _lhsIlib $ do- columnTypes <- envCompositeAttrs _lhsIenv relationComposites table_- updateBindings _lhsIlib _lhsIenv [LibStackIDs [("", columnTypes)]]- {-# LINE 11052 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 168, column 9)- _whrOlib =- {-# LINE 168 "./TypeChecking/Dml.ag" #-}- _lib- {-# LINE 11057 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 169, column 9)- _returningOlib =- {-# LINE 169 "./TypeChecking/Dml.ag" #-}- _lib- {-# LINE 11062 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Delete ann_ table_ _whrIannotatedTree _returningIannotatedTree- {-# LINE 11067 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Delete ann_ table_ _whrIoriginalTree _returningIoriginalTree- {-# LINE 11072 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11077 "AstInternal.hs" #-}- -- copy rule (down)- _whrOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11082 "AstInternal.hs" #-}- -- copy rule (down)- _returningOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11087 "AstInternal.hs" #-}- ( _whrIannotatedTree,_whrIoriginalTree) =- (whr_ _whrOenv _whrOlib )- ( _returningIannotatedTree,_returningIlistType,_returningIoriginalTree) =- (returning_ _returningOenv _returningOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_DropFunction :: Annotation ->- T_IfExists ->- T_StringTypeNameListPairList ->- T_Cascade ->- T_Statement -sem_Statement_DropFunction ann_ ifE_ sigs_ cascade_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _ifEOenv :: Environment- _ifEOlib :: LocalIdentifierBindings- _sigsOenv :: Environment- _sigsOlib :: LocalIdentifierBindings- _cascadeOenv :: Environment- _cascadeOlib :: LocalIdentifierBindings- _ifEIannotatedTree :: IfExists- _ifEIoriginalTree :: IfExists- _sigsIannotatedTree :: StringTypeNameListPairList- _sigsIfnSigs :: ([(String,[Type])])- _sigsIoriginalTree :: StringTypeNameListPairList- _cascadeIannotatedTree :: Cascade- _cascadeIoriginalTree :: Cascade- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 11129 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 11134 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 11139 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11144 "AstInternal.hs" #-}- -- "./TypeChecking/Drops.ag"(line 10, column 9)- _tpe =- {-# LINE 10 "./TypeChecking/Drops.ag" #-}- Right $ Pseudo Void- {-# LINE 11149 "AstInternal.hs" #-}- -- "./TypeChecking/Drops.ag"(line 11, column 9)- _backTree =- {-# LINE 11 "./TypeChecking/Drops.ag" #-}- DropFunction ann_ _ifEIannotatedTree _sigsIannotatedTree _cascadeIannotatedTree- {-# LINE 11154 "AstInternal.hs" #-}- -- "./TypeChecking/Drops.ag"(line 12, column 9)- _envUpdates =- {-# LINE 12 "./TypeChecking/Drops.ag" #-}- flip map _sigsIfnSigs $ \(nm,args) ->- EnvDropFunction ifE nm args- where- ifE = _ifEIannotatedTree == IfExists- {-# LINE 11162 "AstInternal.hs" #-}- -- "./TypeChecking/Drops.ag"(line 16, column 9)- _statementType =- {-# LINE 16 "./TypeChecking/Drops.ag" #-}- []- {-# LINE 11167 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- DropFunction ann_ _ifEIannotatedTree _sigsIannotatedTree _cascadeIannotatedTree- {-# LINE 11172 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- DropFunction ann_ _ifEIoriginalTree _sigsIoriginalTree _cascadeIoriginalTree- {-# LINE 11177 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11182 "AstInternal.hs" #-}- -- copy rule (down)- _ifEOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11187 "AstInternal.hs" #-}- -- copy rule (down)- _ifEOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11192 "AstInternal.hs" #-}- -- copy rule (down)- _sigsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11197 "AstInternal.hs" #-}- -- copy rule (down)- _sigsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11202 "AstInternal.hs" #-}- -- copy rule (down)- _cascadeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11207 "AstInternal.hs" #-}- -- copy rule (down)- _cascadeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11212 "AstInternal.hs" #-}- ( _ifEIannotatedTree,_ifEIoriginalTree) =- (ifE_ _ifEOenv _ifEOlib )- ( _sigsIannotatedTree,_sigsIfnSigs,_sigsIoriginalTree) =- (sigs_ _sigsOenv _sigsOlib )- ( _cascadeIannotatedTree,_cascadeIoriginalTree) =- (cascade_ _cascadeOenv _cascadeOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_DropSomething :: Annotation ->- T_DropType ->- T_IfExists ->- T_StringList ->- T_Cascade ->- T_Statement -sem_Statement_DropSomething ann_ dropType_ ifE_ names_ cascade_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _dropTypeOenv :: Environment- _dropTypeOlib :: LocalIdentifierBindings- _ifEOenv :: Environment- _ifEOlib :: LocalIdentifierBindings- _namesOenv :: Environment- _namesOlib :: LocalIdentifierBindings- _cascadeOenv :: Environment- _cascadeOlib :: LocalIdentifierBindings- _dropTypeIannotatedTree :: DropType- _dropTypeIoriginalTree :: DropType- _ifEIannotatedTree :: IfExists- _ifEIoriginalTree :: IfExists- _namesIannotatedTree :: StringList- _namesIoriginalTree :: StringList- _namesIstrings :: ([String])- _cascadeIannotatedTree :: Cascade- _cascadeIoriginalTree :: Cascade- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11255 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11260 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- DropSomething ann_ _dropTypeIannotatedTree _ifEIannotatedTree _namesIannotatedTree _cascadeIannotatedTree- {-# LINE 11265 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- DropSomething ann_ _dropTypeIoriginalTree _ifEIoriginalTree _namesIoriginalTree _cascadeIoriginalTree- {-# LINE 11270 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 11275 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11280 "AstInternal.hs" #-}- -- copy rule (down)- _dropTypeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11285 "AstInternal.hs" #-}- -- copy rule (down)- _dropTypeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11290 "AstInternal.hs" #-}- -- copy rule (down)- _ifEOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11295 "AstInternal.hs" #-}- -- copy rule (down)- _ifEOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11300 "AstInternal.hs" #-}- -- copy rule (down)- _namesOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11305 "AstInternal.hs" #-}- -- copy rule (down)- _namesOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11310 "AstInternal.hs" #-}- -- copy rule (down)- _cascadeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11315 "AstInternal.hs" #-}- -- copy rule (down)- _cascadeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11320 "AstInternal.hs" #-}- ( _dropTypeIannotatedTree,_dropTypeIoriginalTree) =- (dropType_ _dropTypeOenv _dropTypeOlib )- ( _ifEIannotatedTree,_ifEIoriginalTree) =- (ifE_ _ifEOenv _ifEOlib )- ( _namesIannotatedTree,_namesIoriginalTree,_namesIstrings) =- (names_ _namesOenv _namesOlib )- ( _cascadeIannotatedTree,_cascadeIoriginalTree) =- (cascade_ _cascadeOenv _cascadeOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Execute :: Annotation ->- T_Expression ->- T_Statement -sem_Statement_Execute ann_ expr_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11350 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11355 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Execute ann_ _exprIannotatedTree- {-# LINE 11360 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Execute ann_ _exprIoriginalTree- {-# LINE 11365 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 11370 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11375 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11380 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11385 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_ExecuteInto :: Annotation ->- T_Expression ->- T_StringList ->- T_Statement -sem_Statement_ExecuteInto ann_ expr_ targets_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _targetsOenv :: Environment- _targetsOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- _targetsIannotatedTree :: StringList- _targetsIoriginalTree :: StringList- _targetsIstrings :: ([String])- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11415 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11420 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ExecuteInto ann_ _exprIannotatedTree _targetsIannotatedTree- {-# LINE 11425 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ExecuteInto ann_ _exprIoriginalTree _targetsIoriginalTree- {-# LINE 11430 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 11435 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11440 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11445 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11450 "AstInternal.hs" #-}- -- copy rule (down)- _targetsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11455 "AstInternal.hs" #-}- -- copy rule (down)- _targetsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11460 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- ( _targetsIannotatedTree,_targetsIoriginalTree,_targetsIstrings) =- (targets_ _targetsOenv _targetsOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_ForIntegerStatement :: Annotation ->- String ->- T_Expression ->- T_Expression ->- T_StatementList ->- T_Statement -sem_Statement_ForIntegerStatement ann_ var_ from_ to_ sts_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _stsOenvUpdates :: ([EnvironmentUpdate])- _stsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _stsOlib :: LocalIdentifierBindings- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _fromOenv :: Environment- _fromOlib :: LocalIdentifierBindings- _toOenv :: Environment- _toOlib :: LocalIdentifierBindings- _stsOenv :: Environment- _fromIannotatedTree :: Expression- _fromIliftedColumnName :: String- _fromIoriginalTree :: Expression- _toIannotatedTree :: Expression- _toIliftedColumnName :: String- _toIoriginalTree :: Expression- _stsIannotatedTree :: StatementList- _stsIoriginalTree :: StatementList- _stsIproducedEnv :: Environment- _stsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 11508 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 11513 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 11518 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11523 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 110, column 9)- _stsOenvUpdates =- {-# LINE 110 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11528 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 111, column 9)- _stsOlibUpdates =- {-# LINE 111 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11533 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 36, column 9)- _varTypeE =- {-# LINE 36 "./TypeChecking/Plpgsql.ag" #-}- libLookupID _lhsIlib var_- {-# LINE 11538 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 37, column 9)- _tpe =- {-# LINE 37 "./TypeChecking/Plpgsql.ag" #-}- do- let fromType = getTypeAnnotation _fromIannotatedTree- toType = getTypeAnnotation _toIannotatedTree- dependsOnRTpe [fromType,toType] $ do- errorWhen (fromType /= toType) [FromToTypesNotSame fromType toType]- case _varTypeE of- Right t -> checkAssignmentValid _lhsIenv fromType t- Left _ -> return ()- return $ Pseudo Void- {-# LINE 11551 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 48, column 9)- _stsOlib =- {-# LINE 48 "./TypeChecking/Plpgsql.ag" #-}- case _varTypeE of- Left [UnrecognisedIdentifier var_] ->- fromRight _lhsIlib $- updateBindings _lhsIlib _lhsIenv- [LibStackIDs [("", [(var_,getTypeAnnotation _fromIannotatedTree)])]]- _ -> _lhsIlib- {-# LINE 11561 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 56, column 9)- _backTree =- {-# LINE 56 "./TypeChecking/Plpgsql.ag" #-}- ForIntegerStatement ann_ var_ _fromIannotatedTree _toIannotatedTree _stsIannotatedTree- {-# LINE 11566 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 57, column 9)- _envUpdates =- {-# LINE 57 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 11571 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 58, column 9)- _statementType =- {-# LINE 58 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 11576 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ForIntegerStatement ann_ var_ _fromIannotatedTree _toIannotatedTree _stsIannotatedTree- {-# LINE 11581 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ForIntegerStatement ann_ var_ _fromIoriginalTree _toIoriginalTree _stsIoriginalTree- {-# LINE 11586 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11591 "AstInternal.hs" #-}- -- copy rule (down)- _fromOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11596 "AstInternal.hs" #-}- -- copy rule (down)- _fromOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11601 "AstInternal.hs" #-}- -- copy rule (down)- _toOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11606 "AstInternal.hs" #-}- -- copy rule (down)- _toOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11611 "AstInternal.hs" #-}- -- copy rule (down)- _stsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11616 "AstInternal.hs" #-}- ( _fromIannotatedTree,_fromIliftedColumnName,_fromIoriginalTree) =- (from_ _fromOenv _fromOlib )- ( _toIannotatedTree,_toIliftedColumnName,_toIoriginalTree) =- (to_ _toOenv _toOlib )- ( _stsIannotatedTree,_stsIoriginalTree,_stsIproducedEnv,_stsIproducedLib) =- (sts_ _stsOenv _stsOenvUpdates _stsOlib _stsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_ForSelectStatement :: Annotation ->- String ->- T_SelectExpression ->- T_StatementList ->- T_Statement -sem_Statement_ForSelectStatement ann_ var_ sel_ sts_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _stsOenvUpdates :: ([EnvironmentUpdate])- _stsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _stsOlib :: LocalIdentifierBindings- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _selOenv :: Environment- _selOlib :: LocalIdentifierBindings- _stsOenv :: Environment- _selIannotatedTree :: SelectExpression- _selIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selIoriginalTree :: SelectExpression- _stsIannotatedTree :: StatementList- _stsIoriginalTree :: StatementList- _stsIproducedEnv :: Environment- _stsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 11660 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 11665 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 11670 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11675 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 110, column 9)- _stsOenvUpdates =- {-# LINE 110 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11680 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 111, column 9)- _stsOlibUpdates =- {-# LINE 111 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11685 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 63, column 9)- _selType =- {-# LINE 63 "./TypeChecking/Plpgsql.ag" #-}- getTypeAnnotation _selIannotatedTree- {-# LINE 11690 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 64, column 9)- _tpe =- {-# LINE 64 "./TypeChecking/Plpgsql.ag" #-}- do- dependsOnRTpe [_selType ] $ do- toType <- libLookupID _lhsIlib var_- dependsOnRTpe [toType] $ do- checkAssignmentValid _lhsIenv _selType toType- return $ Pseudo Void- {-# LINE 11700 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 75, column 9)- _stsOlib =- {-# LINE 75 "./TypeChecking/Plpgsql.ag" #-}- if okToUpdate- then fromRight _lhsIlib $- updateBindings _lhsIlib _lhsIenv [LibStackIDs [("", [(var_,_selType )])]]- else _lhsIlib- where- okToUpdate = isRight _tpe && _selType /= TypeCheckFailed- {-# LINE 11710 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 84, column 9)- _backTree =- {-# LINE 84 "./TypeChecking/Plpgsql.ag" #-}- ForSelectStatement ann_ var_ _selIannotatedTree _stsIannotatedTree- {-# LINE 11715 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 85, column 9)- _envUpdates =- {-# LINE 85 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 11720 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 86, column 9)- _statementType =- {-# LINE 86 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 11725 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ForSelectStatement ann_ var_ _selIannotatedTree _stsIannotatedTree- {-# LINE 11730 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ForSelectStatement ann_ var_ _selIoriginalTree _stsIoriginalTree- {-# LINE 11735 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11740 "AstInternal.hs" #-}- -- copy rule (down)- _selOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11745 "AstInternal.hs" #-}- -- copy rule (down)- _selOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11750 "AstInternal.hs" #-}- -- copy rule (down)- _stsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11755 "AstInternal.hs" #-}- ( _selIannotatedTree,_selIlibUpdates,_selIoriginalTree) =- (sel_ _selOenv _selOlib )- ( _stsIannotatedTree,_stsIoriginalTree,_stsIproducedEnv,_stsIproducedLib) =- (sts_ _stsOenv _stsOenvUpdates _stsOlib _stsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_If :: Annotation ->- T_ExpressionStatementListPairList ->- T_StatementList ->- T_Statement -sem_Statement_If ann_ cases_ els_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _elsOenvUpdates :: ([EnvironmentUpdate])- _elsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _casesOenv :: Environment- _casesOlib :: LocalIdentifierBindings- _elsOenv :: Environment- _elsOlib :: LocalIdentifierBindings- _casesIannotatedTree :: ExpressionStatementListPairList- _casesIoriginalTree :: ExpressionStatementListPairList- _elsIannotatedTree :: StatementList- _elsIoriginalTree :: StatementList- _elsIproducedEnv :: Environment- _elsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11789 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11794 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 106, column 9)- _elsOenvUpdates =- {-# LINE 106 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11799 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 107, column 9)- _elsOlibUpdates =- {-# LINE 107 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11804 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- If ann_ _casesIannotatedTree _elsIannotatedTree- {-# LINE 11809 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- If ann_ _casesIoriginalTree _elsIoriginalTree- {-# LINE 11814 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 11819 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11824 "AstInternal.hs" #-}- -- copy rule (down)- _casesOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11829 "AstInternal.hs" #-}- -- copy rule (down)- _casesOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11834 "AstInternal.hs" #-}- -- copy rule (down)- _elsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11839 "AstInternal.hs" #-}- -- copy rule (down)- _elsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11844 "AstInternal.hs" #-}- ( _casesIannotatedTree,_casesIoriginalTree) =- (cases_ _casesOenv _casesOlib )- ( _elsIannotatedTree,_elsIoriginalTree,_elsIproducedEnv,_elsIproducedLib) =- (els_ _elsOenv _elsOenvUpdates _elsOlib _elsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Insert :: Annotation ->- String ->- T_StringList ->- T_SelectExpression ->- T_MaybeSelectList ->- T_Statement -sem_Statement_Insert ann_ table_ targetCols_ insData_ returning_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _returningOlib :: LocalIdentifierBindings- _lhsOoriginalTree :: Statement- _targetColsOenv :: Environment- _targetColsOlib :: LocalIdentifierBindings- _insDataOenv :: Environment- _insDataOlib :: LocalIdentifierBindings- _returningOenv :: Environment- _targetColsIannotatedTree :: StringList- _targetColsIoriginalTree :: StringList- _targetColsIstrings :: ([String])- _insDataIannotatedTree :: SelectExpression- _insDataIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _insDataIoriginalTree :: SelectExpression- _returningIannotatedTree :: MaybeSelectList- _returningIlistType :: (Maybe [(String,Type)])- _returningIoriginalTree :: MaybeSelectList- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 11889 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 11894 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 11899 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 11904 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 18, column 9)- _tpe =- {-# LINE 18 "./TypeChecking/Dml.ag" #-}- dependsOnRTpe [getTypeAnnotation _insDataIannotatedTree] $ do- _columnTypes- Right $ Pseudo Void- {-# LINE 11911 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 22, column 9)- _statementType =- {-# LINE 22 "./TypeChecking/Dml.ag" #-}- leftToEmpty (\ct -> [StatementType [] (fromMaybe [] _returningIlistType)]) _columnTypes- {-# LINE 11916 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 25, column 9)- _columnTypes =- {-# LINE 25 "./TypeChecking/Dml.ag" #-}- do- tys <- unwrapSetOfComposite $- getTypeAnnotation _insDataIannotatedTree- checkColumnConsistency _lhsIenv- table_- _targetColsIstrings- tys- {-# LINE 11927 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 34, column 9)- _backTree =- {-# LINE 34 "./TypeChecking/Dml.ag" #-}- Insert ann_ table_ _targetColsIannotatedTree- _insDataIannotatedTree _returningIannotatedTree- {-# LINE 11933 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 36, column 9)- _envUpdates =- {-# LINE 36 "./TypeChecking/Dml.ag" #-}- []- {-# LINE 11938 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 42, column 9)- _returningOlib =- {-# LINE 42 "./TypeChecking/Dml.ag" #-}- fromRight _lhsIlib $ do- atts <- envCompositeAttrs _lhsIenv relationComposites table_- updateBindings _lhsIlib _lhsIenv [LibStackIDs [("", atts)]]- {-# LINE 11945 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Insert ann_ table_ _targetColsIannotatedTree _insDataIannotatedTree _returningIannotatedTree- {-# LINE 11950 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Insert ann_ table_ _targetColsIoriginalTree _insDataIoriginalTree _returningIoriginalTree- {-# LINE 11955 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 11960 "AstInternal.hs" #-}- -- copy rule (down)- _targetColsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11965 "AstInternal.hs" #-}- -- copy rule (down)- _targetColsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11970 "AstInternal.hs" #-}- -- copy rule (down)- _insDataOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11975 "AstInternal.hs" #-}- -- copy rule (down)- _insDataOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 11980 "AstInternal.hs" #-}- -- copy rule (down)- _returningOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 11985 "AstInternal.hs" #-}- ( _targetColsIannotatedTree,_targetColsIoriginalTree,_targetColsIstrings) =- (targetCols_ _targetColsOenv _targetColsOlib )- ( _insDataIannotatedTree,_insDataIlibUpdates,_insDataIoriginalTree) =- (insData_ _insDataOenv _insDataOlib )- ( _returningIannotatedTree,_returningIlistType,_returningIoriginalTree) =- (returning_ _returningOenv _returningOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Notify :: Annotation ->- String ->- T_Statement -sem_Statement_Notify ann_ name_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12008 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12013 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12018 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Notify ann_ name_- {-# LINE 12023 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Notify ann_ name_- {-# LINE 12028 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12033 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12038 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_NullStatement :: Annotation ->- T_Statement -sem_Statement_NullStatement ann_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12054 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12059 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- NullStatement ann_- {-# LINE 12064 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- NullStatement ann_- {-# LINE 12069 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12074 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12079 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Perform :: Annotation ->- T_Expression ->- T_Statement -sem_Statement_Perform ann_ expr_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12101 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12106 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Perform ann_ _exprIannotatedTree- {-# LINE 12111 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Perform ann_ _exprIoriginalTree- {-# LINE 12116 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12121 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12126 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12131 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12136 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Raise :: Annotation ->- T_RaiseType ->- String ->- T_ExpressionList ->- T_Statement -sem_Statement_Raise ann_ level_ message_ args_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _levelOenv :: Environment- _levelOlib :: LocalIdentifierBindings- _argsOenv :: Environment- _argsOlib :: LocalIdentifierBindings- _levelIannotatedTree :: RaiseType- _levelIoriginalTree :: RaiseType- _argsIannotatedTree :: ExpressionList- _argsIoriginalTree :: ExpressionList- _argsItypeList :: ([Type])- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12166 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12171 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Raise ann_ _levelIannotatedTree message_ _argsIannotatedTree- {-# LINE 12176 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Raise ann_ _levelIoriginalTree message_ _argsIoriginalTree- {-# LINE 12181 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12186 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12191 "AstInternal.hs" #-}- -- copy rule (down)- _levelOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12196 "AstInternal.hs" #-}- -- copy rule (down)- _levelOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12201 "AstInternal.hs" #-}- -- copy rule (down)- _argsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12206 "AstInternal.hs" #-}- -- copy rule (down)- _argsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12211 "AstInternal.hs" #-}- ( _levelIannotatedTree,_levelIoriginalTree) =- (level_ _levelOenv _levelOlib )- ( _argsIannotatedTree,_argsIoriginalTree,_argsItypeList) =- (args_ _argsOenv _argsOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Return :: Annotation ->- T_MaybeExpression ->- T_Statement -sem_Statement_Return ann_ value_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _valueOenv :: Environment- _valueOlib :: LocalIdentifierBindings- _valueIannotatedTree :: MaybeExpression- _valueIoriginalTree :: MaybeExpression- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 12242 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 12247 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 12252 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12257 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 12, column 9)- _tpe =- {-# LINE 12 "./TypeChecking/Plpgsql.ag" #-}- dependsOnRTpe [maybe typeBool- getTypeAnnotation- _valueIannotatedTree] $ Right $ Pseudo Void- {-# LINE 12264 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 16, column 9)- _backTree =- {-# LINE 16 "./TypeChecking/Plpgsql.ag" #-}- Return ann_ _valueIannotatedTree- {-# LINE 12269 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 17, column 9)- _envUpdates =- {-# LINE 17 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 12274 "AstInternal.hs" #-}- -- "./TypeChecking/Plpgsql.ag"(line 18, column 9)- _statementType =- {-# LINE 18 "./TypeChecking/Plpgsql.ag" #-}- []- {-# LINE 12279 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Return ann_ _valueIannotatedTree- {-# LINE 12284 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Return ann_ _valueIoriginalTree- {-# LINE 12289 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12294 "AstInternal.hs" #-}- -- copy rule (down)- _valueOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12299 "AstInternal.hs" #-}- -- copy rule (down)- _valueOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12304 "AstInternal.hs" #-}- ( _valueIannotatedTree,_valueIoriginalTree) =- (value_ _valueOenv _valueOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_ReturnNext :: Annotation ->- T_Expression ->- T_Statement -sem_Statement_ReturnNext ann_ expr_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12328 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12333 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ReturnNext ann_ _exprIannotatedTree- {-# LINE 12338 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ReturnNext ann_ _exprIoriginalTree- {-# LINE 12343 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12348 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12353 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12358 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12363 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_ReturnQuery :: Annotation ->- T_SelectExpression ->- T_Statement -sem_Statement_ReturnQuery ann_ sel_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _selOenv :: Environment- _selOlib :: LocalIdentifierBindings- _selIannotatedTree :: SelectExpression- _selIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selIoriginalTree :: SelectExpression- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12387 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12392 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ReturnQuery ann_ _selIannotatedTree- {-# LINE 12397 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ReturnQuery ann_ _selIoriginalTree- {-# LINE 12402 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12407 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12412 "AstInternal.hs" #-}- -- copy rule (down)- _selOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12417 "AstInternal.hs" #-}- -- copy rule (down)- _selOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12422 "AstInternal.hs" #-}- ( _selIannotatedTree,_selIlibUpdates,_selIoriginalTree) =- (sel_ _selOenv _selOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_SelectStatement :: Annotation ->- T_SelectExpression ->- T_Statement -sem_Statement_SelectStatement ann_ ex_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _lhsOoriginalTree :: Statement- _exOenv :: Environment- _exOlib :: LocalIdentifierBindings- _exIannotatedTree :: SelectExpression- _exIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _exIoriginalTree :: SelectExpression- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 12452 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 12457 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 12462 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 14, column 9)- _tpe =- {-# LINE 14 "./TypeChecking/SelectStatement.ag" #-}- dependsOnRTpe [getTypeAnnotation _exIannotatedTree] $ Right $ Pseudo Void- {-# LINE 12467 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 15, column 9)- _statementType =- {-# LINE 15 "./TypeChecking/SelectStatement.ag" #-}- [StatementType ph $ leftToEmpty id $- unwrapSetOfComposite $- getTypeAnnotation _exIannotatedTree]- where- ph = flip map (getPlaceholders _exIannotatedTree)- $ const $ ScalarType "text"- {-# LINE 12477 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 21, column 9)- _backTree =- {-# LINE 21 "./TypeChecking/SelectStatement.ag" #-}- SelectStatement ann_ _exIannotatedTree- {-# LINE 12482 "AstInternal.hs" #-}- -- "./TypeChecking/SelectStatement.ag"(line 22, column 9)- _envUpdates =- {-# LINE 22 "./TypeChecking/SelectStatement.ag" #-}- []- {-# LINE 12487 "AstInternal.hs" #-}- -- "./TypeChecking/SelectLists.ag"(line 79, column 9)- _libUpdates =- {-# LINE 79 "./TypeChecking/SelectLists.ag" #-}- _exIlibUpdates- {-# LINE 12492 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SelectStatement ann_ _exIannotatedTree- {-# LINE 12497 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SelectStatement ann_ _exIoriginalTree- {-# LINE 12502 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12507 "AstInternal.hs" #-}- -- copy rule (down)- _exOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12512 "AstInternal.hs" #-}- -- copy rule (down)- _exOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12517 "AstInternal.hs" #-}- ( _exIannotatedTree,_exIlibUpdates,_exIoriginalTree) =- (ex_ _exOenv _exOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Set :: Annotation ->- String ->- ([SetValue]) ->- T_Statement -sem_Statement_Set ann_ name_ values_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12537 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12542 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12547 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Set ann_ name_ values_- {-# LINE 12552 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Set ann_ name_ values_- {-# LINE 12557 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12562 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12567 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Truncate :: Annotation ->- T_StringList ->- T_RestartIdentity ->- T_Cascade ->- T_Statement -sem_Statement_Truncate ann_ tables_ restartIdentity_ cascade_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _tablesOenv :: Environment- _tablesOlib :: LocalIdentifierBindings- _restartIdentityOenv :: Environment- _restartIdentityOlib :: LocalIdentifierBindings- _cascadeOenv :: Environment- _cascadeOlib :: LocalIdentifierBindings- _tablesIannotatedTree :: StringList- _tablesIoriginalTree :: StringList- _tablesIstrings :: ([String])- _restartIdentityIannotatedTree :: RestartIdentity- _restartIdentityIoriginalTree :: RestartIdentity- _cascadeIannotatedTree :: Cascade- _cascadeIoriginalTree :: Cascade- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12599 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12604 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Truncate ann_ _tablesIannotatedTree _restartIdentityIannotatedTree _cascadeIannotatedTree- {-# LINE 12609 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Truncate ann_ _tablesIoriginalTree _restartIdentityIoriginalTree _cascadeIoriginalTree- {-# LINE 12614 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12619 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12624 "AstInternal.hs" #-}- -- copy rule (down)- _tablesOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12629 "AstInternal.hs" #-}- -- copy rule (down)- _tablesOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12634 "AstInternal.hs" #-}- -- copy rule (down)- _restartIdentityOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12639 "AstInternal.hs" #-}- -- copy rule (down)- _restartIdentityOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12644 "AstInternal.hs" #-}- -- copy rule (down)- _cascadeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12649 "AstInternal.hs" #-}- -- copy rule (down)- _cascadeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12654 "AstInternal.hs" #-}- ( _tablesIannotatedTree,_tablesIoriginalTree,_tablesIstrings) =- (tables_ _tablesOenv _tablesOlib )- ( _restartIdentityIannotatedTree,_restartIdentityIoriginalTree) =- (restartIdentity_ _restartIdentityOenv _restartIdentityOlib )- ( _cascadeIannotatedTree,_cascadeIoriginalTree) =- (cascade_ _cascadeOenv _cascadeOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_Update :: Annotation ->- String ->- T_SetClauseList ->- T_MaybeBoolExpression ->- T_MaybeSelectList ->- T_Statement -sem_Statement_Update ann_ table_ assigns_ whr_ returning_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOannotatedTree :: Statement- _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tpe :: (Either [TypeError] Type)- _envUpdates :: ([EnvironmentUpdate])- _whrOlib :: LocalIdentifierBindings- _assignsOlib :: LocalIdentifierBindings- _returningOlib :: LocalIdentifierBindings- _lhsOoriginalTree :: Statement- _assignsOenv :: Environment- _whrOenv :: Environment- _returningOenv :: Environment- _assignsIannotatedTree :: SetClauseList- _assignsIoriginalTree :: SetClauseList- _assignsIpairs :: ([(String,Type)])- _assignsIrowSetErrors :: ([TypeError])- _whrIannotatedTree :: MaybeBoolExpression- _whrIoriginalTree :: MaybeBoolExpression- _returningIannotatedTree :: MaybeSelectList- _returningIlistType :: (Maybe [(String,Type)])- _returningIoriginalTree :: MaybeSelectList- -- "./TypeChecking/Statements.ag"(line 61, column 9)- _lhsOannotatedTree =- {-# LINE 61 "./TypeChecking/Statements.ag" #-}- annTypesAndErrors _backTree- (tpeToT _tpe )- (getErrors _tpe )- $ Just (map StatementTypeA _statementType ++- [EnvUpdates _envUpdates ])- {-# LINE 12701 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 67, column 9)- _lhsOenvUpdates =- {-# LINE 67 "./TypeChecking/Statements.ag" #-}- _envUpdates- {-# LINE 12706 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 68, column 9)- _lhsOlibUpdates =- {-# LINE 68 "./TypeChecking/Statements.ag" #-}- _libUpdates- {-# LINE 12711 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 73, column 9)- _libUpdates =- {-# LINE 73 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12716 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 58, column 9)- _tpe =- {-# LINE 58 "./TypeChecking/Dml.ag" #-}- do- checkRelationExists _lhsIenv table_- dependsOnRTpe (map snd _assignsIpairs) $ do- _columnTypes- liftErrors _assignsIrowSetErrors- return $ Pseudo Void- {-# LINE 12726 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 65, column 9)- _statementType =- {-# LINE 65 "./TypeChecking/Dml.ag" #-}- leftToEmpty (\ct -> [StatementType [] (fromMaybe [] _returningIlistType)]) _columnTypes- {-# LINE 12731 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 68, column 9)- _columnTypes =- {-# LINE 68 "./TypeChecking/Dml.ag" #-}- checkColumnConsistency _lhsIenv- table_- (map fst _assignsIpairs)- _assignsIpairs- {-# LINE 12739 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 74, column 9)- _backTree =- {-# LINE 74 "./TypeChecking/Dml.ag" #-}- Update ann_- table_- _assignsIannotatedTree- _whrIannotatedTree- _returningIannotatedTree- {-# LINE 12748 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 79, column 9)- _envUpdates =- {-# LINE 79 "./TypeChecking/Dml.ag" #-}- []- {-# LINE 12753 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 87, column 9)- _lib =- {-# LINE 87 "./TypeChecking/Dml.ag" #-}- fromRight _lhsIlib $ do- ct <- envCompositeAttrs _lhsIenv- relationComposites- table_- updateBindings _lhsIlib _lhsIenv [LibStackIDs [("", ct)]]- {-# LINE 12762 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 93, column 9)- _whrOlib =- {-# LINE 93 "./TypeChecking/Dml.ag" #-}- _lib- {-# LINE 12767 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 94, column 9)- _assignsOlib =- {-# LINE 94 "./TypeChecking/Dml.ag" #-}- _lib- {-# LINE 12772 "AstInternal.hs" #-}- -- "./TypeChecking/Dml.ag"(line 95, column 9)- _returningOlib =- {-# LINE 95 "./TypeChecking/Dml.ag" #-}- _lib- {-# LINE 12777 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Update ann_ table_ _assignsIannotatedTree _whrIannotatedTree _returningIannotatedTree- {-# LINE 12782 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Update ann_ table_ _assignsIoriginalTree _whrIoriginalTree _returningIoriginalTree- {-# LINE 12787 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12792 "AstInternal.hs" #-}- -- copy rule (down)- _assignsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12797 "AstInternal.hs" #-}- -- copy rule (down)- _whrOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12802 "AstInternal.hs" #-}- -- copy rule (down)- _returningOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12807 "AstInternal.hs" #-}- ( _assignsIannotatedTree,_assignsIoriginalTree,_assignsIpairs,_assignsIrowSetErrors) =- (assigns_ _assignsOenv _assignsOlib )- ( _whrIannotatedTree,_whrIoriginalTree) =- (whr_ _whrOenv _whrOlib )- ( _returningIannotatedTree,_returningIlistType,_returningIoriginalTree) =- (returning_ _returningOenv _returningOlib )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_Statement_WhileStatement :: Annotation ->- T_Expression ->- T_StatementList ->- T_Statement -sem_Statement_WhileStatement ann_ expr_ sts_ =- (\ _lhsIenv- _lhsIinProducedEnv- _lhsIlib ->- (let _lhsOenvUpdates :: ([EnvironmentUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _stsOenvUpdates :: ([EnvironmentUpdate])- _stsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: Statement- _lhsOoriginalTree :: Statement- _exprOenv :: Environment- _exprOlib :: LocalIdentifierBindings- _stsOenv :: Environment- _stsOlib :: LocalIdentifierBindings- _exprIannotatedTree :: Expression- _exprIliftedColumnName :: String- _exprIoriginalTree :: Expression- _stsIannotatedTree :: StatementList- _stsIoriginalTree :: StatementList- _stsIproducedEnv :: Environment- _stsIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 89, column 9)- _lhsOenvUpdates =- {-# LINE 89 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12844 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 90, column 9)- _lhsOlibUpdates =- {-# LINE 90 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12849 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 110, column 9)- _stsOenvUpdates =- {-# LINE 110 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12854 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 111, column 9)- _stsOlibUpdates =- {-# LINE 111 "./TypeChecking/Statements.ag" #-}- []- {-# LINE 12859 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- WhileStatement ann_ _exprIannotatedTree _stsIannotatedTree- {-# LINE 12864 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- WhileStatement ann_ _exprIoriginalTree _stsIoriginalTree- {-# LINE 12869 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 12874 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 12879 "AstInternal.hs" #-}- -- copy rule (down)- _exprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12884 "AstInternal.hs" #-}- -- copy rule (down)- _exprOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12889 "AstInternal.hs" #-}- -- copy rule (down)- _stsOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 12894 "AstInternal.hs" #-}- -- copy rule (down)- _stsOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 12899 "AstInternal.hs" #-}- ( _exprIannotatedTree,_exprIliftedColumnName,_exprIoriginalTree) =- (expr_ _exprOenv _exprOlib )- ( _stsIannotatedTree,_stsIoriginalTree,_stsIproducedEnv,_stsIproducedLib) =- (sts_ _stsOenv _stsOenvUpdates _stsOlib _stsOlibUpdates )- in ( _lhsOannotatedTree,_lhsOenvUpdates,_lhsOlibUpdates,_lhsOoriginalTree)))--- StatementList ------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- envUpdates : [EnvironmentUpdate]- lib : LocalIdentifierBindings- libUpdates : [LocalIdentifierBindingsUpdate]- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - producedEnv : Environment- producedLib : LocalIdentifierBindings- alternatives:- alternative Cons:- child hd : Statement - child tl : StatementList - visit 0:- local newEnv : _- local newLib : _- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local newEnv : _- local newLib : _- local annotatedTree : _- local originalTree : _--}-type StatementList = [(Statement)]--- cata-sem_StatementList :: StatementList ->- T_StatementList -sem_StatementList list =- (Prelude.foldr sem_StatementList_Cons sem_StatementList_Nil (Prelude.map sem_Statement list) )--- semantic domain-type T_StatementList = Environment ->- ([EnvironmentUpdate]) ->- LocalIdentifierBindings ->- ([LocalIdentifierBindingsUpdate]) ->- ( StatementList,StatementList,Environment,LocalIdentifierBindings)-data Inh_StatementList = Inh_StatementList {env_Inh_StatementList :: Environment,envUpdates_Inh_StatementList :: [EnvironmentUpdate],lib_Inh_StatementList :: LocalIdentifierBindings,libUpdates_Inh_StatementList :: [LocalIdentifierBindingsUpdate]}-data Syn_StatementList = Syn_StatementList {annotatedTree_Syn_StatementList :: StatementList,originalTree_Syn_StatementList :: StatementList,producedEnv_Syn_StatementList :: Environment,producedLib_Syn_StatementList :: LocalIdentifierBindings}-wrap_StatementList :: T_StatementList ->- Inh_StatementList ->- Syn_StatementList -wrap_StatementList sem (Inh_StatementList _lhsIenv _lhsIenvUpdates _lhsIlib _lhsIlibUpdates ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOproducedEnv,_lhsOproducedLib) =- (sem _lhsIenv _lhsIenvUpdates _lhsIlib _lhsIlibUpdates )- in (Syn_StatementList _lhsOannotatedTree _lhsOoriginalTree _lhsOproducedEnv _lhsOproducedLib ))-sem_StatementList_Cons :: T_Statement ->- T_StatementList ->- T_StatementList -sem_StatementList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIenvUpdates- _lhsIlib- _lhsIlibUpdates ->- (let _hdOenv :: Environment- _tlOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOlib :: LocalIdentifierBindings- _lhsOproducedEnv :: Environment- _lhsOproducedLib :: LocalIdentifierBindings- _tlOenvUpdates :: ([EnvironmentUpdate])- _tlOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _hdOinProducedEnv :: Environment- _lhsOannotatedTree :: StatementList- _lhsOoriginalTree :: StatementList- _hdIannotatedTree :: Statement- _hdIenvUpdates :: ([EnvironmentUpdate])- _hdIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _hdIoriginalTree :: Statement- _tlIannotatedTree :: StatementList- _tlIoriginalTree :: StatementList- _tlIproducedEnv :: Environment- _tlIproducedLib :: LocalIdentifierBindings- -- "./TypeChecking/Statements.ag"(line 36, column 9)- _newEnv =- {-# LINE 36 "./TypeChecking/Statements.ag" #-}- fromRight _lhsIenv $ updateEnvironment _lhsIenv _lhsIenvUpdates- {-# LINE 12986 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 37, column 9)- _newLib =- {-# LINE 37 "./TypeChecking/Statements.ag" #-}- fromRight _lhsIlib $ updateBindings _lhsIlib _lhsIenv _lhsIlibUpdates- {-# LINE 12991 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 39, column 9)- _hdOenv =- {-# LINE 39 "./TypeChecking/Statements.ag" #-}- _newEnv- {-# LINE 12996 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 40, column 9)- _tlOenv =- {-# LINE 40 "./TypeChecking/Statements.ag" #-}- _newEnv- {-# LINE 13001 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 41, column 9)- _hdOlib =- {-# LINE 41 "./TypeChecking/Statements.ag" #-}- _newLib- {-# LINE 13006 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 42, column 9)- _tlOlib =- {-# LINE 42 "./TypeChecking/Statements.ag" #-}- _newLib- {-# LINE 13011 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 46, column 9)- _lhsOproducedEnv =- {-# LINE 46 "./TypeChecking/Statements.ag" #-}- _tlIproducedEnv- {-# LINE 13016 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 47, column 9)- _lhsOproducedLib =- {-# LINE 47 "./TypeChecking/Statements.ag" #-}- _tlIproducedLib- {-# LINE 13021 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 50, column 9)- _tlOenvUpdates =- {-# LINE 50 "./TypeChecking/Statements.ag" #-}- _hdIenvUpdates- {-# LINE 13026 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 51, column 9)- _tlOlibUpdates =- {-# LINE 51 "./TypeChecking/Statements.ag" #-}- _hdIlibUpdates- {-# LINE 13031 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 76, column 12)- _hdOinProducedEnv =- {-# LINE 76 "./TypeChecking/Statements.ag" #-}- _tlIproducedEnv- {-# LINE 13036 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 13041 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 13046 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13051 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13056 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIenvUpdates,_hdIlibUpdates,_hdIoriginalTree) =- (hd_ _hdOenv _hdOinProducedEnv _hdOlib )- ( _tlIannotatedTree,_tlIoriginalTree,_tlIproducedEnv,_tlIproducedLib) =- (tl_ _tlOenv _tlOenvUpdates _tlOlib _tlOlibUpdates )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOproducedEnv,_lhsOproducedLib)))-sem_StatementList_Nil :: T_StatementList -sem_StatementList_Nil =- (\ _lhsIenv- _lhsIenvUpdates- _lhsIlib- _lhsIlibUpdates ->- (let _lhsOproducedEnv :: Environment- _lhsOproducedLib :: LocalIdentifierBindings- _lhsOannotatedTree :: StatementList- _lhsOoriginalTree :: StatementList- -- "./TypeChecking/Statements.ag"(line 36, column 9)- _newEnv =- {-# LINE 36 "./TypeChecking/Statements.ag" #-}- fromRight _lhsIenv $ updateEnvironment _lhsIenv _lhsIenvUpdates- {-# LINE 13076 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 37, column 9)- _newLib =- {-# LINE 37 "./TypeChecking/Statements.ag" #-}- fromRight _lhsIlib $ updateBindings _lhsIlib _lhsIenv _lhsIlibUpdates- {-# LINE 13081 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 53, column 9)- _lhsOproducedEnv =- {-# LINE 53 "./TypeChecking/Statements.ag" #-}- _newEnv- {-# LINE 13086 "AstInternal.hs" #-}- -- "./TypeChecking/Statements.ag"(line 54, column 9)- _lhsOproducedLib =- {-# LINE 54 "./TypeChecking/Statements.ag" #-}- _newLib- {-# LINE 13091 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 13096 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 13101 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13106 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13111 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOproducedEnv,_lhsOproducedLib)))--- StringList ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - strings : [String]- alternatives:- alternative Cons:- child hd : {String}- child tl : StringList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type StringList = [(String)]--- cata-sem_StringList :: StringList ->- T_StringList -sem_StringList list =- (Prelude.foldr sem_StringList_Cons sem_StringList_Nil list )--- semantic domain-type T_StringList = Environment ->- LocalIdentifierBindings ->- ( StringList,StringList,([String]))-data Inh_StringList = Inh_StringList {env_Inh_StringList :: Environment,lib_Inh_StringList :: LocalIdentifierBindings}-data Syn_StringList = Syn_StringList {annotatedTree_Syn_StringList :: StringList,originalTree_Syn_StringList :: StringList,strings_Syn_StringList :: [String]}-wrap_StringList :: T_StringList ->- Inh_StringList ->- Syn_StringList -wrap_StringList sem (Inh_StringList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOstrings) =- (sem _lhsIenv _lhsIlib )- in (Syn_StringList _lhsOannotatedTree _lhsOoriginalTree _lhsOstrings ))-sem_StringList_Cons :: String ->- T_StringList ->- T_StringList -sem_StringList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOstrings :: ([String])- _lhsOannotatedTree :: StringList- _lhsOoriginalTree :: StringList- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _tlIannotatedTree :: StringList- _tlIoriginalTree :: StringList- _tlIstrings :: ([String])- -- "./TypeChecking/Misc.ag"(line 67, column 10)- _lhsOstrings =- {-# LINE 67 "./TypeChecking/Misc.ag" #-}- hd_ : _tlIstrings- {-# LINE 13172 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) hd_ _tlIannotatedTree- {-# LINE 13177 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) hd_ _tlIoriginalTree- {-# LINE 13182 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13187 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13192 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13197 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13202 "AstInternal.hs" #-}- ( _tlIannotatedTree,_tlIoriginalTree,_tlIstrings) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOstrings)))-sem_StringList_Nil :: T_StringList -sem_StringList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOstrings :: ([String])- _lhsOannotatedTree :: StringList- _lhsOoriginalTree :: StringList- -- "./TypeChecking/Misc.ag"(line 68, column 9)- _lhsOstrings =- {-# LINE 68 "./TypeChecking/Misc.ag" #-}- []- {-# LINE 13217 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 13222 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 13227 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13232 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13237 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOstrings)))--- StringTypeNameListPair ---------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - fnSig : (String,[Type])- originalTree : SELF - alternatives:- alternative Tuple:- child x1 : {String}- child x2 : TypeNameList - visit 0:- local annotatedTree : _- local originalTree : _--}-type StringTypeNameListPair = ( (String),(TypeNameList))--- cata-sem_StringTypeNameListPair :: StringTypeNameListPair ->- T_StringTypeNameListPair -sem_StringTypeNameListPair ( x1,x2) =- (sem_StringTypeNameListPair_Tuple x1 (sem_TypeNameList x2 ) )--- semantic domain-type T_StringTypeNameListPair = Environment ->- LocalIdentifierBindings ->- ( StringTypeNameListPair,((String,[Type])),StringTypeNameListPair)-data Inh_StringTypeNameListPair = Inh_StringTypeNameListPair {env_Inh_StringTypeNameListPair :: Environment,lib_Inh_StringTypeNameListPair :: LocalIdentifierBindings}-data Syn_StringTypeNameListPair = Syn_StringTypeNameListPair {annotatedTree_Syn_StringTypeNameListPair :: StringTypeNameListPair,fnSig_Syn_StringTypeNameListPair :: (String,[Type]),originalTree_Syn_StringTypeNameListPair :: StringTypeNameListPair}-wrap_StringTypeNameListPair :: T_StringTypeNameListPair ->- Inh_StringTypeNameListPair ->- Syn_StringTypeNameListPair -wrap_StringTypeNameListPair sem (Inh_StringTypeNameListPair _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOfnSig,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_StringTypeNameListPair _lhsOannotatedTree _lhsOfnSig _lhsOoriginalTree ))-sem_StringTypeNameListPair_Tuple :: String ->- T_TypeNameList ->- T_StringTypeNameListPair -sem_StringTypeNameListPair_Tuple x1_ x2_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOfnSig :: ((String,[Type]))- _lhsOannotatedTree :: StringTypeNameListPair- _lhsOoriginalTree :: StringTypeNameListPair- _x2Oenv :: Environment- _x2Olib :: LocalIdentifierBindings- _x2IannotatedTree :: TypeNameList- _x2InamedTypes :: ([Type])- _x2IoriginalTree :: TypeNameList- -- "./TypeChecking/Drops.ag"(line 25, column 13)- _lhsOfnSig =- {-# LINE 25 "./TypeChecking/Drops.ag" #-}- (x1_, _x2InamedTypes)- {-# LINE 13294 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (x1_,_x2IannotatedTree)- {-# LINE 13299 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (x1_,_x2IoriginalTree)- {-# LINE 13304 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13309 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13314 "AstInternal.hs" #-}- -- copy rule (down)- _x2Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13319 "AstInternal.hs" #-}- -- copy rule (down)- _x2Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13324 "AstInternal.hs" #-}- ( _x2IannotatedTree,_x2InamedTypes,_x2IoriginalTree) =- (x2_ _x2Oenv _x2Olib )- in ( _lhsOannotatedTree,_lhsOfnSig,_lhsOoriginalTree)))--- StringTypeNameListPairList -----------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - fnSigs : [(String,[Type])]- originalTree : SELF - alternatives:- alternative Cons:- child hd : StringTypeNameListPair - child tl : StringTypeNameListPairList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type StringTypeNameListPairList = [(StringTypeNameListPair)]--- cata-sem_StringTypeNameListPairList :: StringTypeNameListPairList ->- T_StringTypeNameListPairList -sem_StringTypeNameListPairList list =- (Prelude.foldr sem_StringTypeNameListPairList_Cons sem_StringTypeNameListPairList_Nil (Prelude.map sem_StringTypeNameListPair list) )--- semantic domain-type T_StringTypeNameListPairList = Environment ->- LocalIdentifierBindings ->- ( StringTypeNameListPairList,([(String,[Type])]),StringTypeNameListPairList)-data Inh_StringTypeNameListPairList = Inh_StringTypeNameListPairList {env_Inh_StringTypeNameListPairList :: Environment,lib_Inh_StringTypeNameListPairList :: LocalIdentifierBindings}-data Syn_StringTypeNameListPairList = Syn_StringTypeNameListPairList {annotatedTree_Syn_StringTypeNameListPairList :: StringTypeNameListPairList,fnSigs_Syn_StringTypeNameListPairList :: [(String,[Type])],originalTree_Syn_StringTypeNameListPairList :: StringTypeNameListPairList}-wrap_StringTypeNameListPairList :: T_StringTypeNameListPairList ->- Inh_StringTypeNameListPairList ->- Syn_StringTypeNameListPairList -wrap_StringTypeNameListPairList sem (Inh_StringTypeNameListPairList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOfnSigs,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_StringTypeNameListPairList _lhsOannotatedTree _lhsOfnSigs _lhsOoriginalTree ))-sem_StringTypeNameListPairList_Cons :: T_StringTypeNameListPair ->- T_StringTypeNameListPairList ->- T_StringTypeNameListPairList -sem_StringTypeNameListPairList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOfnSigs :: ([(String,[Type])])- _lhsOannotatedTree :: StringTypeNameListPairList- _lhsOoriginalTree :: StringTypeNameListPairList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: StringTypeNameListPair- _hdIfnSig :: ((String,[Type]))- _hdIoriginalTree :: StringTypeNameListPair- _tlIannotatedTree :: StringTypeNameListPairList- _tlIfnSigs :: ([(String,[Type])])- _tlIoriginalTree :: StringTypeNameListPairList- -- "./TypeChecking/Drops.ag"(line 20, column 12)- _lhsOfnSigs =- {-# LINE 20 "./TypeChecking/Drops.ag" #-}- _hdIfnSig : _tlIfnSigs- {-# LINE 13392 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 13397 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 13402 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13407 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13412 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13417 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13422 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13427 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13432 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIfnSig,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIfnSigs,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOfnSigs,_lhsOoriginalTree)))-sem_StringTypeNameListPairList_Nil :: T_StringTypeNameListPairList -sem_StringTypeNameListPairList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOfnSigs :: ([(String,[Type])])- _lhsOannotatedTree :: StringTypeNameListPairList- _lhsOoriginalTree :: StringTypeNameListPairList- -- "./TypeChecking/Drops.ag"(line 21, column 11)- _lhsOfnSigs =- {-# LINE 21 "./TypeChecking/Drops.ag" #-}- []- {-# LINE 13449 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 13454 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 13459 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13464 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13469 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOfnSigs,_lhsOoriginalTree)))--- TableAlias ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative FullAlias:- child alias : {String}- child cols : {[String]}- visit 0:- local annotatedTree : _- local originalTree : _- alternative NoAlias:- visit 0:- local annotatedTree : _- local originalTree : _- alternative TableAlias:- child alias : {String}- visit 0:- local annotatedTree : _- local originalTree : _--}-data TableAlias = FullAlias (String) ([String]) - | NoAlias - | TableAlias (String) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TableAlias :: TableAlias ->- T_TableAlias -sem_TableAlias (FullAlias _alias _cols ) =- (sem_TableAlias_FullAlias _alias _cols )-sem_TableAlias (NoAlias ) =- (sem_TableAlias_NoAlias )-sem_TableAlias (TableAlias _alias ) =- (sem_TableAlias_TableAlias _alias )--- semantic domain-type T_TableAlias = Environment ->- LocalIdentifierBindings ->- ( TableAlias,TableAlias)-data Inh_TableAlias = Inh_TableAlias {env_Inh_TableAlias :: Environment,lib_Inh_TableAlias :: LocalIdentifierBindings}-data Syn_TableAlias = Syn_TableAlias {annotatedTree_Syn_TableAlias :: TableAlias,originalTree_Syn_TableAlias :: TableAlias}-wrap_TableAlias :: T_TableAlias ->- Inh_TableAlias ->- Syn_TableAlias -wrap_TableAlias sem (Inh_TableAlias _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TableAlias _lhsOannotatedTree _lhsOoriginalTree ))-sem_TableAlias_FullAlias :: String ->- ([String]) ->- T_TableAlias -sem_TableAlias_FullAlias alias_ cols_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TableAlias- _lhsOoriginalTree :: TableAlias- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- FullAlias alias_ cols_- {-# LINE 13535 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- FullAlias alias_ cols_- {-# LINE 13540 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13545 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13550 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_TableAlias_NoAlias :: T_TableAlias -sem_TableAlias_NoAlias =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TableAlias- _lhsOoriginalTree :: TableAlias- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- NoAlias- {-# LINE 13562 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- NoAlias- {-# LINE 13567 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13572 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13577 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_TableAlias_TableAlias :: String ->- T_TableAlias -sem_TableAlias_TableAlias alias_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TableAlias- _lhsOoriginalTree :: TableAlias- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TableAlias alias_- {-# LINE 13590 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TableAlias alias_- {-# LINE 13595 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 13600 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13605 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- TableRef -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- jlibUpdates : [LocalIdentifierBindingsUpdate]- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - idLookups : [(String,Type)]- libUpdates : [LocalIdentifierBindingsUpdate]- originalTree : SELF - qidLookups : [(String,[(String,Type)])]- qstarExpansion : [(String,[(String,Type)])]- starExpansion : [(String,Type)]- alternatives:- alternative JoinedTref:- child ann : {Annotation}- child tbl : TableRef - child nat : Natural - child joinType : JoinType - child tbl1 : TableRef - child onExpr : OnExpr - child alias : TableAlias - visit 0:- local libUpdates : _- local errs : _- local removeJoinAttrs : _- local ejoinAttrs : {Either [TypeError] [(String,Type)]}- local joinNames : _- local joinAttrs : _- local idLookups : {[(String,Type)]}- local qidLookups : {[(String,[(String,Type)])]}- local starExpansion : {[(String,Type)]}- local qstarExpansion : {[(String,[(String,Type)])]}- local newLib : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative SubTref:- child ann : {Annotation}- child sel : SelectExpression - child alias : TableAlias - visit 0:- local libUpdates : _- local errs : _- local selectAttrs : {Either [TypeError] [(String,Type)]}- local idLookups : {[(String,Type)]}- local qidLookups : {[(String,[(String,Type)])]}- local starExpansion : {[(String,Type)]}- local qstarExpansion : {[(String,[(String,Type)])]}- local backTree : _- local annotatedTree : _- local originalTree : _- alternative Tref:- child ann : {Annotation}- child tbl : {String}- child alias : TableAlias - visit 0:- local libUpdates : _- local errs : _- local relType : {Either [TypeError] ([(String, Type)], [(String, Type)])}- local relType1 : _- local pAttrs : _- local sAttrs : _- local idLookups : {[(String,Type)]}- local alias : _- local qidLookups : {[(String,[(String,Type)])]}- local starExpansion : {[(String,Type)]}- local qstarExpansion : {[(String,[(String,Type)])]}- local backTree : _- local annotatedTree : _- local originalTree : _- alternative TrefFun:- child ann : {Annotation}- child fn : Expression - child alias : TableAlias - visit 0:- local libUpdates : _- local errs : _- local eqfunIdens : {Either [TypeError] (String,[(String,Type)])}- local qfunIdens : _- local alias2 : _- local funIdens : _- local alias : _- local idLookups : {[(String,Type)]}- local qidLookups : {[(String,[(String,Type)])]}- local starExpansion : {[(String,Type)]}- local qstarExpansion : {[(String,[(String,Type)])]}- local backTree : _- local annotatedTree : _- local originalTree : _--}-data TableRef = JoinedTref (Annotation) (TableRef) (Natural) (JoinType) (TableRef) (OnExpr) (TableAlias) - | SubTref (Annotation) (SelectExpression) (TableAlias) - | Tref (Annotation) (String) (TableAlias) - | TrefFun (Annotation) (Expression) (TableAlias) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TableRef :: TableRef ->- T_TableRef -sem_TableRef (JoinedTref _ann _tbl _nat _joinType _tbl1 _onExpr _alias ) =- (sem_TableRef_JoinedTref _ann (sem_TableRef _tbl ) (sem_Natural _nat ) (sem_JoinType _joinType ) (sem_TableRef _tbl1 ) (sem_OnExpr _onExpr ) (sem_TableAlias _alias ) )-sem_TableRef (SubTref _ann _sel _alias ) =- (sem_TableRef_SubTref _ann (sem_SelectExpression _sel ) (sem_TableAlias _alias ) )-sem_TableRef (Tref _ann _tbl _alias ) =- (sem_TableRef_Tref _ann _tbl (sem_TableAlias _alias ) )-sem_TableRef (TrefFun _ann _fn _alias ) =- (sem_TableRef_TrefFun _ann (sem_Expression _fn ) (sem_TableAlias _alias ) )--- semantic domain-type T_TableRef = Environment ->- ([LocalIdentifierBindingsUpdate]) ->- LocalIdentifierBindings ->- ( TableRef,([(String,Type)]),([LocalIdentifierBindingsUpdate]),TableRef,([(String,[(String,Type)])]),([(String,[(String,Type)])]),([(String,Type)]))-data Inh_TableRef = Inh_TableRef {env_Inh_TableRef :: Environment,jlibUpdates_Inh_TableRef :: [LocalIdentifierBindingsUpdate],lib_Inh_TableRef :: LocalIdentifierBindings}-data Syn_TableRef = Syn_TableRef {annotatedTree_Syn_TableRef :: TableRef,idLookups_Syn_TableRef :: [(String,Type)],libUpdates_Syn_TableRef :: [LocalIdentifierBindingsUpdate],originalTree_Syn_TableRef :: TableRef,qidLookups_Syn_TableRef :: [(String,[(String,Type)])],qstarExpansion_Syn_TableRef :: [(String,[(String,Type)])],starExpansion_Syn_TableRef :: [(String,Type)]}-wrap_TableRef :: T_TableRef ->- Inh_TableRef ->- Syn_TableRef -wrap_TableRef sem (Inh_TableRef _lhsIenv _lhsIjlibUpdates _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOidLookups,_lhsOlibUpdates,_lhsOoriginalTree,_lhsOqidLookups,_lhsOqstarExpansion,_lhsOstarExpansion) =- (sem _lhsIenv _lhsIjlibUpdates _lhsIlib )- in (Syn_TableRef _lhsOannotatedTree _lhsOidLookups _lhsOlibUpdates _lhsOoriginalTree _lhsOqidLookups _lhsOqstarExpansion _lhsOstarExpansion ))-sem_TableRef_JoinedTref :: Annotation ->- T_TableRef ->- T_Natural ->- T_JoinType ->- T_TableRef ->- T_OnExpr ->- T_TableAlias ->- T_TableRef -sem_TableRef_JoinedTref ann_ tbl_ nat_ joinType_ tbl1_ onExpr_ alias_ =- (\ _lhsIenv- _lhsIjlibUpdates- _lhsIlib ->- (let _lhsOannotatedTree :: TableRef- _ejoinAttrs :: (Either [TypeError] [(String,Type)])- _idLookups :: ([(String,Type)])- _qidLookups :: ([(String,[(String,Type)])])- _starExpansion :: ([(String,Type)])- _qstarExpansion :: ([(String,[(String,Type)])])- _onExprOlib :: LocalIdentifierBindings- _tblOjlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tbl1OjlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOidLookups :: ([(String,Type)])- _lhsOqidLookups :: ([(String,[(String,Type)])])- _lhsOstarExpansion :: ([(String,Type)])- _lhsOqstarExpansion :: ([(String,[(String,Type)])])- _lhsOoriginalTree :: TableRef- _tblOenv :: Environment- _tblOlib :: LocalIdentifierBindings- _natOenv :: Environment- _natOlib :: LocalIdentifierBindings- _joinTypeOenv :: Environment- _joinTypeOlib :: LocalIdentifierBindings- _tbl1Oenv :: Environment- _tbl1Olib :: LocalIdentifierBindings- _onExprOenv :: Environment- _aliasOenv :: Environment- _aliasOlib :: LocalIdentifierBindings- _tblIannotatedTree :: TableRef- _tblIidLookups :: ([(String,Type)])- _tblIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tblIoriginalTree :: TableRef- _tblIqidLookups :: ([(String,[(String,Type)])])- _tblIqstarExpansion :: ([(String,[(String,Type)])])- _tblIstarExpansion :: ([(String,Type)])- _natIannotatedTree :: Natural- _natIoriginalTree :: Natural- _joinTypeIannotatedTree :: JoinType- _joinTypeIoriginalTree :: JoinType- _tbl1IannotatedTree :: TableRef- _tbl1IidLookups :: ([(String,Type)])- _tbl1IlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tbl1IoriginalTree :: TableRef- _tbl1IqidLookups :: ([(String,[(String,Type)])])- _tbl1IqstarExpansion :: ([(String,[(String,Type)])])- _tbl1IstarExpansion :: ([(String,Type)])- _onExprIannotatedTree :: OnExpr- _onExprIoriginalTree :: OnExpr- _aliasIannotatedTree :: TableAlias- _aliasIoriginalTree :: TableAlias- -- "./TypeChecking/TableRefs.ag"(line 33, column 9)- _lhsOannotatedTree =- {-# LINE 33 "./TypeChecking/TableRefs.ag" #-}- updateAnnotation (map TypeErrorA _errs ++) _backTree- {-# LINE 13794 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 75, column 9)- _libUpdates =- {-# LINE 75 "./TypeChecking/TableRefs.ag" #-}- if null _errs- then [LibStackIDs $ ("", _idLookups ): _qidLookups- ,LibSetStarExpansion $ ("", _starExpansion ): _qstarExpansion ]- else []- {-# LINE 13802 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 135, column 9)- _errs =- {-# LINE 135 "./TypeChecking/TableRefs.ag" #-}- fromLeft [] _ejoinAttrs- {-# LINE 13807 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 136, column 9)- _removeJoinAttrs =- {-# LINE 136 "./TypeChecking/TableRefs.ag" #-}- filter (\(n,_) -> n `notElem` _joinNames )- {-# LINE 13812 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 146, column 9)- _ejoinAttrs =- {-# LINE 146 "./TypeChecking/TableRefs.ag" #-}- do- let jns = case (_natIannotatedTree, _onExprIoriginalTree) of- (Natural, _) -> commonFieldNames- (_,Just (JoinUsing _ s)) -> s- _ -> []- tjtsm = map (flip lookup _tblIidLookups) jns- t1jtsm = map (flip lookup _tbl1IidLookups) jns- errorWhen (not $ null $ filter (==Nothing) $ tjtsm ++ t1jtsm)- [MissingJoinAttribute]- let tjts = catMaybes tjtsm- t1jts = catMaybes t1jtsm- resolvedTypes :: [Either [TypeError] Type]- resolvedTypes = map (\(a,b) -> resolveResultSetType _lhsIenv [a,b]) $ zip tjts t1jts- liftErrors $ concat $ lefts resolvedTypes- return $ zip jns $ rights resolvedTypes- where- commonFieldNames = intersect (f _tblIstarExpansion) (f _tbl1IstarExpansion)- where f = map fst- {-# LINE 13834 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 170, column 9)- _joinNames =- {-# LINE 170 "./TypeChecking/TableRefs.ag" #-}- map fst _joinAttrs- {-# LINE 13839 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 171, column 9)- _joinAttrs =- {-# LINE 171 "./TypeChecking/TableRefs.ag" #-}- fromRight [] _ejoinAttrs- {-# LINE 13844 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 176, column 9)- _idLookups =- {-# LINE 176 "./TypeChecking/TableRefs.ag" #-}- _joinAttrs ++- _removeJoinAttrs _tblIidLookups ++- _removeJoinAttrs _tbl1IidLookups- {-# LINE 13851 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 179, column 9)- _qidLookups =- {-# LINE 179 "./TypeChecking/TableRefs.ag" #-}- _tblIqidLookups ++ _tbl1IqidLookups- {-# LINE 13856 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 180, column 9)- _starExpansion =- {-# LINE 180 "./TypeChecking/TableRefs.ag" #-}- _joinAttrs ++- _removeJoinAttrs _tblIstarExpansion ++- _removeJoinAttrs _tbl1IstarExpansion- {-# LINE 13863 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 183, column 9)- _qstarExpansion =- {-# LINE 183 "./TypeChecking/TableRefs.ag" #-}- _tblIqstarExpansion ++ _tbl1IqstarExpansion- {-# LINE 13868 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 187, column 9)- _newLib =- {-# LINE 187 "./TypeChecking/TableRefs.ag" #-}- case updateBindings _lhsIlib _lhsIenv (_libUpdates ++ _lhsIjlibUpdates) of- Left x -> error $ show x- Right e -> e- {-# LINE 13875 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 190, column 9)- _onExprOlib =- {-# LINE 190 "./TypeChecking/TableRefs.ag" #-}- _newLib- {-# LINE 13880 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 192, column 9)- _tblOjlibUpdates =- {-# LINE 192 "./TypeChecking/TableRefs.ag" #-}- _libUpdates- {-# LINE 13885 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 193, column 9)- _tbl1OjlibUpdates =- {-# LINE 193 "./TypeChecking/TableRefs.ag" #-}- _libUpdates- {-# LINE 13890 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 248, column 9)- _lhsOlibUpdates =- {-# LINE 248 "./TypeChecking/TableRefs.ag" #-}- _libUpdates- {-# LINE 13895 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 249, column 9)- _lhsOidLookups =- {-# LINE 249 "./TypeChecking/TableRefs.ag" #-}- _idLookups- {-# LINE 13900 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 250, column 9)- _lhsOqidLookups =- {-# LINE 250 "./TypeChecking/TableRefs.ag" #-}- _qidLookups- {-# LINE 13905 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 251, column 9)- _lhsOstarExpansion =- {-# LINE 251 "./TypeChecking/TableRefs.ag" #-}- _starExpansion- {-# LINE 13910 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 252, column 9)- _lhsOqstarExpansion =- {-# LINE 252 "./TypeChecking/TableRefs.ag" #-}- _qstarExpansion- {-# LINE 13915 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 264, column 9)- _backTree =- {-# LINE 264 "./TypeChecking/TableRefs.ag" #-}- JoinedTref ann_- _tblIannotatedTree- _natIannotatedTree- _joinTypeIannotatedTree- _tbl1IannotatedTree- _onExprIannotatedTree- _aliasIannotatedTree- {-# LINE 13926 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- JoinedTref ann_ _tblIannotatedTree _natIannotatedTree _joinTypeIannotatedTree _tbl1IannotatedTree _onExprIannotatedTree _aliasIannotatedTree- {-# LINE 13931 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- JoinedTref ann_ _tblIoriginalTree _natIoriginalTree _joinTypeIoriginalTree _tbl1IoriginalTree _onExprIoriginalTree _aliasIoriginalTree- {-# LINE 13936 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 13941 "AstInternal.hs" #-}- -- copy rule (down)- _tblOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13946 "AstInternal.hs" #-}- -- copy rule (down)- _tblOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13951 "AstInternal.hs" #-}- -- copy rule (down)- _natOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13956 "AstInternal.hs" #-}- -- copy rule (down)- _natOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13961 "AstInternal.hs" #-}- -- copy rule (down)- _joinTypeOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13966 "AstInternal.hs" #-}- -- copy rule (down)- _joinTypeOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13971 "AstInternal.hs" #-}- -- copy rule (down)- _tbl1Oenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13976 "AstInternal.hs" #-}- -- copy rule (down)- _tbl1Olib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13981 "AstInternal.hs" #-}- -- copy rule (down)- _onExprOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13986 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 13991 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 13996 "AstInternal.hs" #-}- ( _tblIannotatedTree,_tblIidLookups,_tblIlibUpdates,_tblIoriginalTree,_tblIqidLookups,_tblIqstarExpansion,_tblIstarExpansion) =- (tbl_ _tblOenv _tblOjlibUpdates _tblOlib )- ( _natIannotatedTree,_natIoriginalTree) =- (nat_ _natOenv _natOlib )- ( _joinTypeIannotatedTree,_joinTypeIoriginalTree) =- (joinType_ _joinTypeOenv _joinTypeOlib )- ( _tbl1IannotatedTree,_tbl1IidLookups,_tbl1IlibUpdates,_tbl1IoriginalTree,_tbl1IqidLookups,_tbl1IqstarExpansion,_tbl1IstarExpansion) =- (tbl1_ _tbl1Oenv _tbl1OjlibUpdates _tbl1Olib )- ( _onExprIannotatedTree,_onExprIoriginalTree) =- (onExpr_ _onExprOenv _onExprOlib )- ( _aliasIannotatedTree,_aliasIoriginalTree) =- (alias_ _aliasOenv _aliasOlib )- in ( _lhsOannotatedTree,_lhsOidLookups,_lhsOlibUpdates,_lhsOoriginalTree,_lhsOqidLookups,_lhsOqstarExpansion,_lhsOstarExpansion)))-sem_TableRef_SubTref :: Annotation ->- T_SelectExpression ->- T_TableAlias ->- T_TableRef -sem_TableRef_SubTref ann_ sel_ alias_ =- (\ _lhsIenv- _lhsIjlibUpdates- _lhsIlib ->- (let _lhsOannotatedTree :: TableRef- _selectAttrs :: (Either [TypeError] [(String,Type)])- _idLookups :: ([(String,Type)])- _qidLookups :: ([(String,[(String,Type)])])- _starExpansion :: ([(String,Type)])- _qstarExpansion :: ([(String,[(String,Type)])])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOidLookups :: ([(String,Type)])- _lhsOqidLookups :: ([(String,[(String,Type)])])- _lhsOstarExpansion :: ([(String,Type)])- _lhsOqstarExpansion :: ([(String,[(String,Type)])])- _lhsOoriginalTree :: TableRef- _selOenv :: Environment- _selOlib :: LocalIdentifierBindings- _aliasOenv :: Environment- _aliasOlib :: LocalIdentifierBindings- _selIannotatedTree :: SelectExpression- _selIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _selIoriginalTree :: SelectExpression- _aliasIannotatedTree :: TableAlias- _aliasIoriginalTree :: TableAlias- -- "./TypeChecking/TableRefs.ag"(line 33, column 9)- _lhsOannotatedTree =- {-# LINE 33 "./TypeChecking/TableRefs.ag" #-}- updateAnnotation (map TypeErrorA _errs ++) _backTree- {-# LINE 14043 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 75, column 9)- _libUpdates =- {-# LINE 75 "./TypeChecking/TableRefs.ag" #-}- if null _errs- then [LibStackIDs $ ("", _idLookups ): _qidLookups- ,LibSetStarExpansion $ ("", _starExpansion ): _qstarExpansion ]- else []- {-# LINE 14051 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 92, column 9)- _errs =- {-# LINE 92 "./TypeChecking/TableRefs.ag" #-}- case _selectAttrs of- Left e -> e- Right _ -> []- {-# LINE 14058 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 96, column 9)- _selectAttrs =- {-# LINE 96 "./TypeChecking/TableRefs.ag" #-}- unwrapSetOfComposite (getTypeAnnotation _selIannotatedTree)- {-# LINE 14063 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 98, column 9)- _idLookups =- {-# LINE 98 "./TypeChecking/TableRefs.ag" #-}- fromRight [] _selectAttrs- {-# LINE 14068 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 99, column 9)- _qidLookups =- {-# LINE 99 "./TypeChecking/TableRefs.ag" #-}- [(getAlias "" _aliasIannotatedTree, _idLookups )]- {-# LINE 14073 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 100, column 9)- _starExpansion =- {-# LINE 100 "./TypeChecking/TableRefs.ag" #-}- _idLookups- {-# LINE 14078 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 101, column 9)- _qstarExpansion =- {-# LINE 101 "./TypeChecking/TableRefs.ag" #-}- _qidLookups- {-# LINE 14083 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 248, column 9)- _lhsOlibUpdates =- {-# LINE 248 "./TypeChecking/TableRefs.ag" #-}- _libUpdates- {-# LINE 14088 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 249, column 9)- _lhsOidLookups =- {-# LINE 249 "./TypeChecking/TableRefs.ag" #-}- _idLookups- {-# LINE 14093 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 250, column 9)- _lhsOqidLookups =- {-# LINE 250 "./TypeChecking/TableRefs.ag" #-}- _qidLookups- {-# LINE 14098 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 251, column 9)- _lhsOstarExpansion =- {-# LINE 251 "./TypeChecking/TableRefs.ag" #-}- _starExpansion- {-# LINE 14103 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 252, column 9)- _lhsOqstarExpansion =- {-# LINE 252 "./TypeChecking/TableRefs.ag" #-}- _qstarExpansion- {-# LINE 14108 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 258, column 9)- _backTree =- {-# LINE 258 "./TypeChecking/TableRefs.ag" #-}- SubTref ann_ _selIannotatedTree _aliasIannotatedTree- {-# LINE 14113 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SubTref ann_ _selIannotatedTree _aliasIannotatedTree- {-# LINE 14118 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SubTref ann_ _selIoriginalTree _aliasIoriginalTree- {-# LINE 14123 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14128 "AstInternal.hs" #-}- -- copy rule (down)- _selOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14133 "AstInternal.hs" #-}- -- copy rule (down)- _selOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14138 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14143 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14148 "AstInternal.hs" #-}- ( _selIannotatedTree,_selIlibUpdates,_selIoriginalTree) =- (sel_ _selOenv _selOlib )- ( _aliasIannotatedTree,_aliasIoriginalTree) =- (alias_ _aliasOenv _aliasOlib )- in ( _lhsOannotatedTree,_lhsOidLookups,_lhsOlibUpdates,_lhsOoriginalTree,_lhsOqidLookups,_lhsOqstarExpansion,_lhsOstarExpansion)))-sem_TableRef_Tref :: Annotation ->- String ->- T_TableAlias ->- T_TableRef -sem_TableRef_Tref ann_ tbl_ alias_ =- (\ _lhsIenv- _lhsIjlibUpdates- _lhsIlib ->- (let _lhsOannotatedTree :: TableRef- _relType :: (Either [TypeError] ([(String, Type)], [(String, Type)]))- _idLookups :: ([(String,Type)])- _qidLookups :: ([(String,[(String,Type)])])- _starExpansion :: ([(String,Type)])- _qstarExpansion :: ([(String,[(String,Type)])])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOidLookups :: ([(String,Type)])- _lhsOqidLookups :: ([(String,[(String,Type)])])- _lhsOstarExpansion :: ([(String,Type)])- _lhsOqstarExpansion :: ([(String,[(String,Type)])])- _lhsOoriginalTree :: TableRef- _aliasOenv :: Environment- _aliasOlib :: LocalIdentifierBindings- _aliasIannotatedTree :: TableAlias- _aliasIoriginalTree :: TableAlias- -- "./TypeChecking/TableRefs.ag"(line 33, column 9)- _lhsOannotatedTree =- {-# LINE 33 "./TypeChecking/TableRefs.ag" #-}- updateAnnotation (map TypeErrorA _errs ++) _backTree- {-# LINE 14182 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 75, column 9)- _libUpdates =- {-# LINE 75 "./TypeChecking/TableRefs.ag" #-}- if null _errs- then [LibStackIDs $ ("", _idLookups ): _qidLookups- ,LibSetStarExpansion $ ("", _starExpansion ): _qstarExpansion ]- else []- {-# LINE 14190 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 104, column 9)- _errs =- {-# LINE 104 "./TypeChecking/TableRefs.ag" #-}- case _relType of- Left e -> e- Right _ -> []- {-# LINE 14197 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 108, column 9)- _relType =- {-# LINE 108 "./TypeChecking/TableRefs.ag" #-}- envCompositeAttrsPair _lhsIenv [] tbl_- {-# LINE 14202 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 109, column 9)- _relType1 =- {-# LINE 109 "./TypeChecking/TableRefs.ag" #-}- fromRight ([],[]) _relType- {-# LINE 14207 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 110, column 9)- _pAttrs =- {-# LINE 110 "./TypeChecking/TableRefs.ag" #-}- fst _relType1- {-# LINE 14212 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 111, column 9)- _sAttrs =- {-# LINE 111 "./TypeChecking/TableRefs.ag" #-}- snd _relType1- {-# LINE 14217 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 113, column 9)- _idLookups =- {-# LINE 113 "./TypeChecking/TableRefs.ag" #-}- _pAttrs ++ _sAttrs- {-# LINE 14222 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 114, column 9)- _alias =- {-# LINE 114 "./TypeChecking/TableRefs.ag" #-}- getAlias tbl_ _aliasIannotatedTree- {-# LINE 14227 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 115, column 9)- _qidLookups =- {-# LINE 115 "./TypeChecking/TableRefs.ag" #-}- [(_alias , _idLookups )]- {-# LINE 14232 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 116, column 9)- _starExpansion =- {-# LINE 116 "./TypeChecking/TableRefs.ag" #-}- _pAttrs- {-# LINE 14237 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 117, column 9)- _qstarExpansion =- {-# LINE 117 "./TypeChecking/TableRefs.ag" #-}- [(_alias , _pAttrs )]- {-# LINE 14242 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 248, column 9)- _lhsOlibUpdates =- {-# LINE 248 "./TypeChecking/TableRefs.ag" #-}- _libUpdates- {-# LINE 14247 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 249, column 9)- _lhsOidLookups =- {-# LINE 249 "./TypeChecking/TableRefs.ag" #-}- _idLookups- {-# LINE 14252 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 250, column 9)- _lhsOqidLookups =- {-# LINE 250 "./TypeChecking/TableRefs.ag" #-}- _qidLookups- {-# LINE 14257 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 251, column 9)- _lhsOstarExpansion =- {-# LINE 251 "./TypeChecking/TableRefs.ag" #-}- _starExpansion- {-# LINE 14262 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 252, column 9)- _lhsOqstarExpansion =- {-# LINE 252 "./TypeChecking/TableRefs.ag" #-}- _qstarExpansion- {-# LINE 14267 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 260, column 9)- _backTree =- {-# LINE 260 "./TypeChecking/TableRefs.ag" #-}- Tref ann_ tbl_ _aliasIannotatedTree- {-# LINE 14272 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Tref ann_ tbl_ _aliasIannotatedTree- {-# LINE 14277 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Tref ann_ tbl_ _aliasIoriginalTree- {-# LINE 14282 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14287 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14292 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14297 "AstInternal.hs" #-}- ( _aliasIannotatedTree,_aliasIoriginalTree) =- (alias_ _aliasOenv _aliasOlib )- in ( _lhsOannotatedTree,_lhsOidLookups,_lhsOlibUpdates,_lhsOoriginalTree,_lhsOqidLookups,_lhsOqstarExpansion,_lhsOstarExpansion)))-sem_TableRef_TrefFun :: Annotation ->- T_Expression ->- T_TableAlias ->- T_TableRef -sem_TableRef_TrefFun ann_ fn_ alias_ =- (\ _lhsIenv- _lhsIjlibUpdates- _lhsIlib ->- (let _lhsOannotatedTree :: TableRef- _eqfunIdens :: (Either [TypeError] (String,[(String,Type)]))- _idLookups :: ([(String,Type)])- _qidLookups :: ([(String,[(String,Type)])])- _starExpansion :: ([(String,Type)])- _qstarExpansion :: ([(String,[(String,Type)])])- _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOidLookups :: ([(String,Type)])- _lhsOqidLookups :: ([(String,[(String,Type)])])- _lhsOstarExpansion :: ([(String,Type)])- _lhsOqstarExpansion :: ([(String,[(String,Type)])])- _lhsOoriginalTree :: TableRef- _fnOenv :: Environment- _fnOlib :: LocalIdentifierBindings- _aliasOenv :: Environment- _aliasOlib :: LocalIdentifierBindings- _fnIannotatedTree :: Expression- _fnIliftedColumnName :: String- _fnIoriginalTree :: Expression- _aliasIannotatedTree :: TableAlias- _aliasIoriginalTree :: TableAlias- -- "./TypeChecking/TableRefs.ag"(line 33, column 9)- _lhsOannotatedTree =- {-# LINE 33 "./TypeChecking/TableRefs.ag" #-}- updateAnnotation (map TypeErrorA _errs ++) _backTree- {-# LINE 14334 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 75, column 9)- _libUpdates =- {-# LINE 75 "./TypeChecking/TableRefs.ag" #-}- if null _errs- then [LibStackIDs $ ("", _idLookups ): _qidLookups- ,LibSetStarExpansion $ ("", _starExpansion ): _qstarExpansion ]- else []- {-# LINE 14342 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 120, column 9)- _errs =- {-# LINE 120 "./TypeChecking/TableRefs.ag" #-}- case _eqfunIdens of- Left e -> e- Right _ -> []- {-# LINE 14349 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 124, column 9)- _eqfunIdens =- {-# LINE 124 "./TypeChecking/TableRefs.ag" #-}- funIdens _lhsIenv _alias _fnIannotatedTree- {-# LINE 14354 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 125, column 9)- _qfunIdens =- {-# LINE 125 "./TypeChecking/TableRefs.ag" #-}- fromRight ("",[]) _eqfunIdens- {-# LINE 14359 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 126, column 9)- _alias2 =- {-# LINE 126 "./TypeChecking/TableRefs.ag" #-}- fst _qfunIdens- {-# LINE 14364 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 127, column 9)- _funIdens =- {-# LINE 127 "./TypeChecking/TableRefs.ag" #-}- snd _qfunIdens- {-# LINE 14369 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 128, column 9)- _alias =- {-# LINE 128 "./TypeChecking/TableRefs.ag" #-}- getAlias "" _aliasIannotatedTree- {-# LINE 14374 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 130, column 9)- _idLookups =- {-# LINE 130 "./TypeChecking/TableRefs.ag" #-}- _funIdens- {-# LINE 14379 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 131, column 9)- _qidLookups =- {-# LINE 131 "./TypeChecking/TableRefs.ag" #-}- [(_alias2, _idLookups )]- {-# LINE 14384 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 132, column 9)- _starExpansion =- {-# LINE 132 "./TypeChecking/TableRefs.ag" #-}- _idLookups- {-# LINE 14389 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 133, column 9)- _qstarExpansion =- {-# LINE 133 "./TypeChecking/TableRefs.ag" #-}- _qidLookups- {-# LINE 14394 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 248, column 9)- _lhsOlibUpdates =- {-# LINE 248 "./TypeChecking/TableRefs.ag" #-}- _libUpdates- {-# LINE 14399 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 249, column 9)- _lhsOidLookups =- {-# LINE 249 "./TypeChecking/TableRefs.ag" #-}- _idLookups- {-# LINE 14404 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 250, column 9)- _lhsOqidLookups =- {-# LINE 250 "./TypeChecking/TableRefs.ag" #-}- _qidLookups- {-# LINE 14409 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 251, column 9)- _lhsOstarExpansion =- {-# LINE 251 "./TypeChecking/TableRefs.ag" #-}- _starExpansion- {-# LINE 14414 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 252, column 9)- _lhsOqstarExpansion =- {-# LINE 252 "./TypeChecking/TableRefs.ag" #-}- _qstarExpansion- {-# LINE 14419 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 262, column 9)- _backTree =- {-# LINE 262 "./TypeChecking/TableRefs.ag" #-}- TrefFun ann_ _fnIannotatedTree _aliasIannotatedTree- {-# LINE 14424 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TrefFun ann_ _fnIannotatedTree _aliasIannotatedTree- {-# LINE 14429 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TrefFun ann_ _fnIoriginalTree _aliasIoriginalTree- {-# LINE 14434 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14439 "AstInternal.hs" #-}- -- copy rule (down)- _fnOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14444 "AstInternal.hs" #-}- -- copy rule (down)- _fnOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14449 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14454 "AstInternal.hs" #-}- -- copy rule (down)- _aliasOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14459 "AstInternal.hs" #-}- ( _fnIannotatedTree,_fnIliftedColumnName,_fnIoriginalTree) =- (fn_ _fnOenv _fnOlib )- ( _aliasIannotatedTree,_aliasIoriginalTree) =- (alias_ _aliasOenv _aliasOlib )- in ( _lhsOannotatedTree,_lhsOidLookups,_lhsOlibUpdates,_lhsOoriginalTree,_lhsOqidLookups,_lhsOqstarExpansion,_lhsOstarExpansion)))--- TableRefList -------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - libUpdates : [LocalIdentifierBindingsUpdate]- originalTree : SELF - alternatives:- alternative Cons:- child hd : TableRef - child tl : TableRefList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type TableRefList = [(TableRef)]--- cata-sem_TableRefList :: TableRefList ->- T_TableRefList -sem_TableRefList list =- (Prelude.foldr sem_TableRefList_Cons sem_TableRefList_Nil (Prelude.map sem_TableRef list) )--- semantic domain-type T_TableRefList = Environment ->- LocalIdentifierBindings ->- ( TableRefList,([LocalIdentifierBindingsUpdate]),TableRefList)-data Inh_TableRefList = Inh_TableRefList {env_Inh_TableRefList :: Environment,lib_Inh_TableRefList :: LocalIdentifierBindings}-data Syn_TableRefList = Syn_TableRefList {annotatedTree_Syn_TableRefList :: TableRefList,libUpdates_Syn_TableRefList :: [LocalIdentifierBindingsUpdate],originalTree_Syn_TableRefList :: TableRefList}-wrap_TableRefList :: T_TableRefList ->- Inh_TableRefList ->- Syn_TableRefList -wrap_TableRefList sem (Inh_TableRefList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TableRefList _lhsOannotatedTree _lhsOlibUpdates _lhsOoriginalTree ))-sem_TableRefList_Cons :: T_TableRef ->- T_TableRefList ->- T_TableRefList -sem_TableRefList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _hdOjlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: TableRefList- _lhsOoriginalTree :: TableRefList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: TableRef- _hdIidLookups :: ([(String,Type)])- _hdIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _hdIoriginalTree :: TableRef- _hdIqidLookups :: ([(String,[(String,Type)])])- _hdIqstarExpansion :: ([(String,[(String,Type)])])- _hdIstarExpansion :: ([(String,Type)])- _tlIannotatedTree :: TableRefList- _tlIlibUpdates :: ([LocalIdentifierBindingsUpdate])- _tlIoriginalTree :: TableRefList- -- "./TypeChecking/TableRefs.ag"(line 40, column 9)- _lhsOlibUpdates =- {-# LINE 40 "./TypeChecking/TableRefs.ag" #-}- _hdIlibUpdates- {-# LINE 14534 "AstInternal.hs" #-}- -- "./TypeChecking/TableRefs.ag"(line 197, column 12)- _hdOjlibUpdates =- {-# LINE 197 "./TypeChecking/TableRefs.ag" #-}- []- {-# LINE 14539 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 14544 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 14549 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14554 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14559 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14564 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14569 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 14574 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 14579 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIidLookups,_hdIlibUpdates,_hdIoriginalTree,_hdIqidLookups,_hdIqstarExpansion,_hdIstarExpansion) =- (hd_ _hdOenv _hdOjlibUpdates _hdOlib )- ( _tlIannotatedTree,_tlIlibUpdates,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree)))-sem_TableRefList_Nil :: T_TableRefList -sem_TableRefList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOlibUpdates :: ([LocalIdentifierBindingsUpdate])- _lhsOannotatedTree :: TableRefList- _lhsOoriginalTree :: TableRefList- -- "./TypeChecking/TableRefs.ag"(line 38, column 9)- _lhsOlibUpdates =- {-# LINE 38 "./TypeChecking/TableRefs.ag" #-}- []- {-# LINE 14596 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 14601 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 14606 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14611 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14616 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOlibUpdates,_lhsOoriginalTree)))--- TriggerEvent -------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative TDelete:- visit 0:- local annotatedTree : _- local originalTree : _- alternative TInsert:- visit 0:- local annotatedTree : _- local originalTree : _- alternative TUpdate:- visit 0:- local annotatedTree : _- local originalTree : _--}-data TriggerEvent = TDelete - | TInsert - | TUpdate - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TriggerEvent :: TriggerEvent ->- T_TriggerEvent -sem_TriggerEvent (TDelete ) =- (sem_TriggerEvent_TDelete )-sem_TriggerEvent (TInsert ) =- (sem_TriggerEvent_TInsert )-sem_TriggerEvent (TUpdate ) =- (sem_TriggerEvent_TUpdate )--- semantic domain-type T_TriggerEvent = Environment ->- LocalIdentifierBindings ->- ( TriggerEvent,TriggerEvent)-data Inh_TriggerEvent = Inh_TriggerEvent {env_Inh_TriggerEvent :: Environment,lib_Inh_TriggerEvent :: LocalIdentifierBindings}-data Syn_TriggerEvent = Syn_TriggerEvent {annotatedTree_Syn_TriggerEvent :: TriggerEvent,originalTree_Syn_TriggerEvent :: TriggerEvent}-wrap_TriggerEvent :: T_TriggerEvent ->- Inh_TriggerEvent ->- Syn_TriggerEvent -wrap_TriggerEvent sem (Inh_TriggerEvent _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TriggerEvent _lhsOannotatedTree _lhsOoriginalTree ))-sem_TriggerEvent_TDelete :: T_TriggerEvent -sem_TriggerEvent_TDelete =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerEvent- _lhsOoriginalTree :: TriggerEvent- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TDelete- {-# LINE 14677 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TDelete- {-# LINE 14682 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14687 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14692 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_TriggerEvent_TInsert :: T_TriggerEvent -sem_TriggerEvent_TInsert =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerEvent- _lhsOoriginalTree :: TriggerEvent- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TInsert- {-# LINE 14704 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TInsert- {-# LINE 14709 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14714 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14719 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_TriggerEvent_TUpdate :: T_TriggerEvent -sem_TriggerEvent_TUpdate =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerEvent- _lhsOoriginalTree :: TriggerEvent- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TUpdate- {-# LINE 14731 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TUpdate- {-# LINE 14736 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14741 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14746 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- TriggerFire --------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative EachRow:- visit 0:- local annotatedTree : _- local originalTree : _- alternative EachStatement:- visit 0:- local annotatedTree : _- local originalTree : _--}-data TriggerFire = EachRow - | EachStatement - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TriggerFire :: TriggerFire ->- T_TriggerFire -sem_TriggerFire (EachRow ) =- (sem_TriggerFire_EachRow )-sem_TriggerFire (EachStatement ) =- (sem_TriggerFire_EachStatement )--- semantic domain-type T_TriggerFire = Environment ->- LocalIdentifierBindings ->- ( TriggerFire,TriggerFire)-data Inh_TriggerFire = Inh_TriggerFire {env_Inh_TriggerFire :: Environment,lib_Inh_TriggerFire :: LocalIdentifierBindings}-data Syn_TriggerFire = Syn_TriggerFire {annotatedTree_Syn_TriggerFire :: TriggerFire,originalTree_Syn_TriggerFire :: TriggerFire}-wrap_TriggerFire :: T_TriggerFire ->- Inh_TriggerFire ->- Syn_TriggerFire -wrap_TriggerFire sem (Inh_TriggerFire _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TriggerFire _lhsOannotatedTree _lhsOoriginalTree ))-sem_TriggerFire_EachRow :: T_TriggerFire -sem_TriggerFire_EachRow =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerFire- _lhsOoriginalTree :: TriggerFire- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- EachRow- {-# LINE 14800 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- EachRow- {-# LINE 14805 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14810 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14815 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_TriggerFire_EachStatement :: T_TriggerFire -sem_TriggerFire_EachStatement =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerFire- _lhsOoriginalTree :: TriggerFire- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- EachStatement- {-# LINE 14827 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- EachStatement- {-# LINE 14832 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14837 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14842 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- TriggerWhen --------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative TriggerAfter:- visit 0:- local annotatedTree : _- local originalTree : _- alternative TriggerBefore:- visit 0:- local annotatedTree : _- local originalTree : _--}-data TriggerWhen = TriggerAfter - | TriggerBefore - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TriggerWhen :: TriggerWhen ->- T_TriggerWhen -sem_TriggerWhen (TriggerAfter ) =- (sem_TriggerWhen_TriggerAfter )-sem_TriggerWhen (TriggerBefore ) =- (sem_TriggerWhen_TriggerBefore )--- semantic domain-type T_TriggerWhen = Environment ->- LocalIdentifierBindings ->- ( TriggerWhen,TriggerWhen)-data Inh_TriggerWhen = Inh_TriggerWhen {env_Inh_TriggerWhen :: Environment,lib_Inh_TriggerWhen :: LocalIdentifierBindings}-data Syn_TriggerWhen = Syn_TriggerWhen {annotatedTree_Syn_TriggerWhen :: TriggerWhen,originalTree_Syn_TriggerWhen :: TriggerWhen}-wrap_TriggerWhen :: T_TriggerWhen ->- Inh_TriggerWhen ->- Syn_TriggerWhen -wrap_TriggerWhen sem (Inh_TriggerWhen _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TriggerWhen _lhsOannotatedTree _lhsOoriginalTree ))-sem_TriggerWhen_TriggerAfter :: T_TriggerWhen -sem_TriggerWhen_TriggerAfter =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerWhen- _lhsOoriginalTree :: TriggerWhen- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TriggerAfter- {-# LINE 14896 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TriggerAfter- {-# LINE 14901 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14906 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14911 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_TriggerWhen_TriggerBefore :: T_TriggerWhen -sem_TriggerWhen_TriggerBefore =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: TriggerWhen- _lhsOoriginalTree :: TriggerWhen- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TriggerBefore- {-# LINE 14923 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TriggerBefore- {-# LINE 14928 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 14933 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 14938 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))--- TypeAttributeDef ---------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - attrName : String- namedType : Type- originalTree : SELF - alternatives:- alternative TypeAttDef:- child ann : {Annotation}- child name : {String}- child typ : TypeName - visit 0:- local annotatedTree : _- local originalTree : _--}-data TypeAttributeDef = TypeAttDef (Annotation) (String) (TypeName) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TypeAttributeDef :: TypeAttributeDef ->- T_TypeAttributeDef -sem_TypeAttributeDef (TypeAttDef _ann _name _typ ) =- (sem_TypeAttributeDef_TypeAttDef _ann _name (sem_TypeName _typ ) )--- semantic domain-type T_TypeAttributeDef = Environment ->- LocalIdentifierBindings ->- ( TypeAttributeDef,String,Type,TypeAttributeDef)-data Inh_TypeAttributeDef = Inh_TypeAttributeDef {env_Inh_TypeAttributeDef :: Environment,lib_Inh_TypeAttributeDef :: LocalIdentifierBindings}-data Syn_TypeAttributeDef = Syn_TypeAttributeDef {annotatedTree_Syn_TypeAttributeDef :: TypeAttributeDef,attrName_Syn_TypeAttributeDef :: String,namedType_Syn_TypeAttributeDef :: Type,originalTree_Syn_TypeAttributeDef :: TypeAttributeDef}-wrap_TypeAttributeDef :: T_TypeAttributeDef ->- Inh_TypeAttributeDef ->- Syn_TypeAttributeDef -wrap_TypeAttributeDef sem (Inh_TypeAttributeDef _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TypeAttributeDef _lhsOannotatedTree _lhsOattrName _lhsOnamedType _lhsOoriginalTree ))-sem_TypeAttributeDef_TypeAttDef :: Annotation ->- String ->- T_TypeName ->- T_TypeAttributeDef -sem_TypeAttributeDef_TypeAttDef ann_ name_ typ_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOattrName :: String- _lhsOnamedType :: Type- _lhsOannotatedTree :: TypeAttributeDef- _lhsOoriginalTree :: TypeAttributeDef- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- -- "./TypeChecking/MiscCreates.ag"(line 40, column 9)- _lhsOattrName =- {-# LINE 40 "./TypeChecking/MiscCreates.ag" #-}- name_- {-# LINE 15000 "AstInternal.hs" #-}- -- "./TypeChecking/MiscCreates.ag"(line 41, column 9)- _lhsOnamedType =- {-# LINE 41 "./TypeChecking/MiscCreates.ag" #-}- _typInamedType- {-# LINE 15005 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- TypeAttDef ann_ name_ _typIannotatedTree- {-# LINE 15010 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- TypeAttDef ann_ name_ _typIoriginalTree- {-# LINE 15015 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15020 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15025 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15030 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15035 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- in ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType,_lhsOoriginalTree)))--- TypeAttributeDefList -----------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - attrs : [(String, Type)]- originalTree : SELF - alternatives:- alternative Cons:- child hd : TypeAttributeDef - child tl : TypeAttributeDefList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type TypeAttributeDefList = [(TypeAttributeDef)]--- cata-sem_TypeAttributeDefList :: TypeAttributeDefList ->- T_TypeAttributeDefList -sem_TypeAttributeDefList list =- (Prelude.foldr sem_TypeAttributeDefList_Cons sem_TypeAttributeDefList_Nil (Prelude.map sem_TypeAttributeDef list) )--- semantic domain-type T_TypeAttributeDefList = Environment ->- LocalIdentifierBindings ->- ( TypeAttributeDefList,([(String, Type)]),TypeAttributeDefList)-data Inh_TypeAttributeDefList = Inh_TypeAttributeDefList {env_Inh_TypeAttributeDefList :: Environment,lib_Inh_TypeAttributeDefList :: LocalIdentifierBindings}-data Syn_TypeAttributeDefList = Syn_TypeAttributeDefList {annotatedTree_Syn_TypeAttributeDefList :: TypeAttributeDefList,attrs_Syn_TypeAttributeDefList :: [(String, Type)],originalTree_Syn_TypeAttributeDefList :: TypeAttributeDefList}-wrap_TypeAttributeDefList :: T_TypeAttributeDefList ->- Inh_TypeAttributeDefList ->- Syn_TypeAttributeDefList -wrap_TypeAttributeDefList sem (Inh_TypeAttributeDefList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOattrs,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TypeAttributeDefList _lhsOannotatedTree _lhsOattrs _lhsOoriginalTree ))-sem_TypeAttributeDefList_Cons :: T_TypeAttributeDef ->- T_TypeAttributeDefList ->- T_TypeAttributeDefList -sem_TypeAttributeDefList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOattrs :: ([(String, Type)])- _lhsOannotatedTree :: TypeAttributeDefList- _lhsOoriginalTree :: TypeAttributeDefList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: TypeAttributeDef- _hdIattrName :: String- _hdInamedType :: Type- _hdIoriginalTree :: TypeAttributeDef- _tlIannotatedTree :: TypeAttributeDefList- _tlIattrs :: ([(String, Type)])- _tlIoriginalTree :: TypeAttributeDefList- -- "./TypeChecking/MiscCreates.ag"(line 46, column 12)- _lhsOattrs =- {-# LINE 46 "./TypeChecking/MiscCreates.ag" #-}- (_hdIattrName, _hdInamedType) : _tlIattrs- {-# LINE 15104 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 15109 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 15114 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15119 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15124 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15129 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15134 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15139 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15144 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIattrName,_hdInamedType,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIattrs,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOattrs,_lhsOoriginalTree)))-sem_TypeAttributeDefList_Nil :: T_TypeAttributeDefList -sem_TypeAttributeDefList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOattrs :: ([(String, Type)])- _lhsOannotatedTree :: TypeAttributeDefList- _lhsOoriginalTree :: TypeAttributeDefList- -- "./TypeChecking/MiscCreates.ag"(line 47, column 11)- _lhsOattrs =- {-# LINE 47 "./TypeChecking/MiscCreates.ag" #-}- []- {-# LINE 15161 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 15166 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 15171 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15176 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15181 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOattrs,_lhsOoriginalTree)))--- TypeName -----------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - namedType : Type- originalTree : SELF - alternatives:- alternative ArrayTypeName:- child ann : {Annotation}- child typ : TypeName - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative PrecTypeName:- child ann : {Annotation}- child tn : {String}- child prec : {Integer}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative SetOfTypeName:- child ann : {Annotation}- child typ : TypeName - visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _- alternative SimpleTypeName:- child ann : {Annotation}- child tn : {String}- visit 0:- local tpe : _- local backTree : _- local annotatedTree : _- local originalTree : _--}-data TypeName = ArrayTypeName (Annotation) (TypeName) - | PrecTypeName (Annotation) (String) (Integer) - | SetOfTypeName (Annotation) (TypeName) - | SimpleTypeName (Annotation) (String) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_TypeName :: TypeName ->- T_TypeName -sem_TypeName (ArrayTypeName _ann _typ ) =- (sem_TypeName_ArrayTypeName _ann (sem_TypeName _typ ) )-sem_TypeName (PrecTypeName _ann _tn _prec ) =- (sem_TypeName_PrecTypeName _ann _tn _prec )-sem_TypeName (SetOfTypeName _ann _typ ) =- (sem_TypeName_SetOfTypeName _ann (sem_TypeName _typ ) )-sem_TypeName (SimpleTypeName _ann _tn ) =- (sem_TypeName_SimpleTypeName _ann _tn )--- semantic domain-type T_TypeName = Environment ->- LocalIdentifierBindings ->- ( TypeName,Type,TypeName)-data Inh_TypeName = Inh_TypeName {env_Inh_TypeName :: Environment,lib_Inh_TypeName :: LocalIdentifierBindings}-data Syn_TypeName = Syn_TypeName {annotatedTree_Syn_TypeName :: TypeName,namedType_Syn_TypeName :: Type,originalTree_Syn_TypeName :: TypeName}-wrap_TypeName :: T_TypeName ->- Inh_TypeName ->- Syn_TypeName -wrap_TypeName sem (Inh_TypeName _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TypeName _lhsOannotatedTree _lhsOnamedType _lhsOoriginalTree ))-sem_TypeName_ArrayTypeName :: Annotation ->- T_TypeName ->- T_TypeName -sem_TypeName_ArrayTypeName ann_ typ_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedType :: Type- _lhsOannotatedTree :: TypeName- _lhsOoriginalTree :: TypeName- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- -- "./TypeChecking/Misc.ag"(line 19, column 10)- _lhsOnamedType =- {-# LINE 19 "./TypeChecking/Misc.ag" #-}- tpeToT _tpe- {-# LINE 15275 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 20, column 10)- _lhsOannotatedTree =- {-# LINE 20 "./TypeChecking/Misc.ag" #-}- updateAnnotation- ((map TypeErrorA $ getErrors _tpe ) ++)- _backTree- {-# LINE 15282 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 30, column 9)- _tpe =- {-# LINE 30 "./TypeChecking/Misc.ag" #-}- dependsOnRTpe [_typInamedType] $ Right $ ArrayType _typInamedType- {-# LINE 15287 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 31, column 9)- _backTree =- {-# LINE 31 "./TypeChecking/Misc.ag" #-}- ArrayTypeName ann_ _typIannotatedTree- {-# LINE 15292 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- ArrayTypeName ann_ _typIannotatedTree- {-# LINE 15297 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- ArrayTypeName ann_ _typIoriginalTree- {-# LINE 15302 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15307 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15312 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15317 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))-sem_TypeName_PrecTypeName :: Annotation ->- String ->- Integer ->- T_TypeName -sem_TypeName_PrecTypeName ann_ tn_ prec_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedType :: Type- _lhsOannotatedTree :: TypeName- _lhsOoriginalTree :: TypeName- -- "./TypeChecking/Misc.ag"(line 19, column 10)- _lhsOnamedType =- {-# LINE 19 "./TypeChecking/Misc.ag" #-}- tpeToT _tpe- {-# LINE 15335 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 20, column 10)- _lhsOannotatedTree =- {-# LINE 20 "./TypeChecking/Misc.ag" #-}- updateAnnotation- ((map TypeErrorA $ getErrors _tpe ) ++)- _backTree- {-# LINE 15342 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 36, column 9)- _tpe =- {-# LINE 36 "./TypeChecking/Misc.ag" #-}- envLookupType _lhsIenv $ canonicalizeTypeName tn_- {-# LINE 15347 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 37, column 9)- _backTree =- {-# LINE 37 "./TypeChecking/Misc.ag" #-}- PrecTypeName ann_ tn_ prec_- {-# LINE 15352 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- PrecTypeName ann_ tn_ prec_- {-# LINE 15357 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- PrecTypeName ann_ tn_ prec_- {-# LINE 15362 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15367 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))-sem_TypeName_SetOfTypeName :: Annotation ->- T_TypeName ->- T_TypeName -sem_TypeName_SetOfTypeName ann_ typ_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedType :: Type- _lhsOannotatedTree :: TypeName- _lhsOoriginalTree :: TypeName- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- -- "./TypeChecking/Misc.ag"(line 19, column 10)- _lhsOnamedType =- {-# LINE 19 "./TypeChecking/Misc.ag" #-}- tpeToT _tpe- {-# LINE 15387 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 20, column 10)- _lhsOannotatedTree =- {-# LINE 20 "./TypeChecking/Misc.ag" #-}- updateAnnotation- ((map TypeErrorA $ getErrors _tpe ) ++)- _backTree- {-# LINE 15394 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 33, column 9)- _tpe =- {-# LINE 33 "./TypeChecking/Misc.ag" #-}- dependsOnRTpe [_typInamedType] $ Right $ SetOfType _typInamedType- {-# LINE 15399 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 34, column 9)- _backTree =- {-# LINE 34 "./TypeChecking/Misc.ag" #-}- SetOfTypeName ann_ _typIannotatedTree- {-# LINE 15404 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SetOfTypeName ann_ _typIannotatedTree- {-# LINE 15409 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SetOfTypeName ann_ _typIoriginalTree- {-# LINE 15414 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15419 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15424 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15429 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))-sem_TypeName_SimpleTypeName :: Annotation ->- String ->- T_TypeName -sem_TypeName_SimpleTypeName ann_ tn_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedType :: Type- _lhsOannotatedTree :: TypeName- _lhsOoriginalTree :: TypeName- -- "./TypeChecking/Misc.ag"(line 19, column 10)- _lhsOnamedType =- {-# LINE 19 "./TypeChecking/Misc.ag" #-}- tpeToT _tpe- {-# LINE 15446 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 20, column 10)- _lhsOannotatedTree =- {-# LINE 20 "./TypeChecking/Misc.ag" #-}- updateAnnotation- ((map TypeErrorA $ getErrors _tpe ) ++)- _backTree- {-# LINE 15453 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 27, column 9)- _tpe =- {-# LINE 27 "./TypeChecking/Misc.ag" #-}- envLookupType _lhsIenv $ canonicalizeTypeName tn_- {-# LINE 15458 "AstInternal.hs" #-}- -- "./TypeChecking/Misc.ag"(line 28, column 9)- _backTree =- {-# LINE 28 "./TypeChecking/Misc.ag" #-}- SimpleTypeName ann_ tn_- {-# LINE 15463 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- SimpleTypeName ann_ tn_- {-# LINE 15468 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- SimpleTypeName ann_ tn_- {-# LINE 15473 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15478 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))--- TypeNameList -------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - namedTypes : [Type]- originalTree : SELF - alternatives:- alternative Cons:- child hd : TypeName - child tl : TypeNameList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type TypeNameList = [(TypeName)]--- cata-sem_TypeNameList :: TypeNameList ->- T_TypeNameList -sem_TypeNameList list =- (Prelude.foldr sem_TypeNameList_Cons sem_TypeNameList_Nil (Prelude.map sem_TypeName list) )--- semantic domain-type T_TypeNameList = Environment ->- LocalIdentifierBindings ->- ( TypeNameList,([Type]),TypeNameList)-data Inh_TypeNameList = Inh_TypeNameList {env_Inh_TypeNameList :: Environment,lib_Inh_TypeNameList :: LocalIdentifierBindings}-data Syn_TypeNameList = Syn_TypeNameList {annotatedTree_Syn_TypeNameList :: TypeNameList,namedTypes_Syn_TypeNameList :: [Type],originalTree_Syn_TypeNameList :: TypeNameList}-wrap_TypeNameList :: T_TypeNameList ->- Inh_TypeNameList ->- Syn_TypeNameList -wrap_TypeNameList sem (Inh_TypeNameList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOnamedTypes,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_TypeNameList _lhsOannotatedTree _lhsOnamedTypes _lhsOoriginalTree ))-sem_TypeNameList_Cons :: T_TypeName ->- T_TypeNameList ->- T_TypeNameList -sem_TypeNameList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedTypes :: ([Type])- _lhsOannotatedTree :: TypeNameList- _lhsOoriginalTree :: TypeNameList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: TypeName- _hdInamedType :: Type- _hdIoriginalTree :: TypeName- _tlIannotatedTree :: TypeNameList- _tlInamedTypes :: ([Type])- _tlIoriginalTree :: TypeNameList- -- "./TypeChecking/Drops.ag"(line 30, column 12)- _lhsOnamedTypes =- {-# LINE 30 "./TypeChecking/Drops.ag" #-}- _hdInamedType : _tlInamedTypes- {-# LINE 15544 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 15549 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 15554 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15559 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15564 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15569 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15574 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15579 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15584 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdInamedType,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlInamedTypes,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOnamedTypes,_lhsOoriginalTree)))-sem_TypeNameList_Nil :: T_TypeNameList -sem_TypeNameList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOnamedTypes :: ([Type])- _lhsOannotatedTree :: TypeNameList- _lhsOoriginalTree :: TypeNameList- -- "./TypeChecking/Drops.ag"(line 31, column 11)- _lhsOnamedTypes =- {-# LINE 31 "./TypeChecking/Drops.ag" #-}- []- {-# LINE 15601 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 15606 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 15611 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15616 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15621 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOnamedTypes,_lhsOoriginalTree)))--- VarDef -------------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - def : (String,Type)- originalTree : SELF - alternatives:- alternative VarDef:- child ann : {Annotation}- child name : {String}- child typ : TypeName - child value : {Maybe Expression}- visit 0:- local annotatedTree : _- local originalTree : _--}-data VarDef = VarDef (Annotation) (String) (TypeName) (Maybe Expression) - deriving ( Data,Eq,Show,Typeable)--- cata-sem_VarDef :: VarDef ->- T_VarDef -sem_VarDef (VarDef _ann _name _typ _value ) =- (sem_VarDef_VarDef _ann _name (sem_TypeName _typ ) _value )--- semantic domain-type T_VarDef = Environment ->- LocalIdentifierBindings ->- ( VarDef,((String,Type)),VarDef)-data Inh_VarDef = Inh_VarDef {env_Inh_VarDef :: Environment,lib_Inh_VarDef :: LocalIdentifierBindings}-data Syn_VarDef = Syn_VarDef {annotatedTree_Syn_VarDef :: VarDef,def_Syn_VarDef :: (String,Type),originalTree_Syn_VarDef :: VarDef}-wrap_VarDef :: T_VarDef ->- Inh_VarDef ->- Syn_VarDef -wrap_VarDef sem (Inh_VarDef _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOdef,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_VarDef _lhsOannotatedTree _lhsOdef _lhsOoriginalTree ))-sem_VarDef_VarDef :: Annotation ->- String ->- T_TypeName ->- (Maybe Expression) ->- T_VarDef -sem_VarDef_VarDef ann_ name_ typ_ value_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOdef :: ((String,Type))- _lhsOannotatedTree :: VarDef- _lhsOoriginalTree :: VarDef- _typOenv :: Environment- _typOlib :: LocalIdentifierBindings- _typIannotatedTree :: TypeName- _typInamedType :: Type- _typIoriginalTree :: TypeName- -- "./TypeChecking/CreateFunction.ag"(line 131, column 14)- _lhsOdef =- {-# LINE 131 "./TypeChecking/CreateFunction.ag" #-}- (name_, if _typInamedType == Pseudo Record then PgRecord Nothing else _typInamedType)- {-# LINE 15683 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- VarDef ann_ name_ _typIannotatedTree value_- {-# LINE 15688 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- VarDef ann_ name_ _typIoriginalTree value_- {-# LINE 15693 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15698 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15703 "AstInternal.hs" #-}- -- copy rule (down)- _typOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15708 "AstInternal.hs" #-}- -- copy rule (down)- _typOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15713 "AstInternal.hs" #-}- ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =- (typ_ _typOenv _typOlib )- in ( _lhsOannotatedTree,_lhsOdef,_lhsOoriginalTree)))--- VarDefList ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - defs : [(String,Type)]- originalTree : SELF - alternatives:- alternative Cons:- child hd : VarDef - child tl : VarDefList - visit 0:- local annotatedTree : _- local originalTree : _- alternative Nil:- visit 0:- local annotatedTree : _- local originalTree : _--}-type VarDefList = [(VarDef)]--- cata-sem_VarDefList :: VarDefList ->- T_VarDefList -sem_VarDefList list =- (Prelude.foldr sem_VarDefList_Cons sem_VarDefList_Nil (Prelude.map sem_VarDef list) )--- semantic domain-type T_VarDefList = Environment ->- LocalIdentifierBindings ->- ( VarDefList,([(String,Type)]),VarDefList)-data Inh_VarDefList = Inh_VarDefList {env_Inh_VarDefList :: Environment,lib_Inh_VarDefList :: LocalIdentifierBindings}-data Syn_VarDefList = Syn_VarDefList {annotatedTree_Syn_VarDefList :: VarDefList,defs_Syn_VarDefList :: [(String,Type)],originalTree_Syn_VarDefList :: VarDefList}-wrap_VarDefList :: T_VarDefList ->- Inh_VarDefList ->- Syn_VarDefList -wrap_VarDefList sem (Inh_VarDefList _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOdefs,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_VarDefList _lhsOannotatedTree _lhsOdefs _lhsOoriginalTree ))-sem_VarDefList_Cons :: T_VarDef ->- T_VarDefList ->- T_VarDefList -sem_VarDefList_Cons hd_ tl_ =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOdefs :: ([(String,Type)])- _lhsOannotatedTree :: VarDefList- _lhsOoriginalTree :: VarDefList- _hdOenv :: Environment- _hdOlib :: LocalIdentifierBindings- _tlOenv :: Environment- _tlOlib :: LocalIdentifierBindings- _hdIannotatedTree :: VarDef- _hdIdef :: ((String,Type))- _hdIoriginalTree :: VarDef- _tlIannotatedTree :: VarDefList- _tlIdefs :: ([(String,Type)])- _tlIoriginalTree :: VarDefList- -- "./TypeChecking/CreateFunction.ag"(line 134, column 12)- _lhsOdefs =- {-# LINE 134 "./TypeChecking/CreateFunction.ag" #-}- _hdIdef : _tlIdefs- {-# LINE 15781 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIannotatedTree _tlIannotatedTree- {-# LINE 15786 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- (:) _hdIoriginalTree _tlIoriginalTree- {-# LINE 15791 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15796 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15801 "AstInternal.hs" #-}- -- copy rule (down)- _hdOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15806 "AstInternal.hs" #-}- -- copy rule (down)- _hdOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15811 "AstInternal.hs" #-}- -- copy rule (down)- _tlOenv =- {-# LINE 56 "./TypeChecking/TypeChecking.ag" #-}- _lhsIenv- {-# LINE 15816 "AstInternal.hs" #-}- -- copy rule (down)- _tlOlib =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _lhsIlib- {-# LINE 15821 "AstInternal.hs" #-}- ( _hdIannotatedTree,_hdIdef,_hdIoriginalTree) =- (hd_ _hdOenv _hdOlib )- ( _tlIannotatedTree,_tlIdefs,_tlIoriginalTree) =- (tl_ _tlOenv _tlOlib )- in ( _lhsOannotatedTree,_lhsOdefs,_lhsOoriginalTree)))-sem_VarDefList_Nil :: T_VarDefList -sem_VarDefList_Nil =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOdefs :: ([(String,Type)])- _lhsOannotatedTree :: VarDefList- _lhsOoriginalTree :: VarDefList- -- "./TypeChecking/CreateFunction.ag"(line 135, column 11)- _lhsOdefs =- {-# LINE 135 "./TypeChecking/CreateFunction.ag" #-}- []- {-# LINE 15838 "AstInternal.hs" #-}- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 15843 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- []- {-# LINE 15848 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15853 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15858 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOdefs,_lhsOoriginalTree)))--- Volatility ---------------------------------------------------{-- visit 0:- inherited attributes:- env : Environment- lib : LocalIdentifierBindings- synthesized attributes:- annotatedTree : SELF - originalTree : SELF - alternatives:- alternative Immutable:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Stable:- visit 0:- local annotatedTree : _- local originalTree : _- alternative Volatile:- visit 0:- local annotatedTree : _- local originalTree : _--}-data Volatility = Immutable - | Stable - | Volatile - deriving ( Data,Eq,Show,Typeable)--- cata-sem_Volatility :: Volatility ->- T_Volatility -sem_Volatility (Immutable ) =- (sem_Volatility_Immutable )-sem_Volatility (Stable ) =- (sem_Volatility_Stable )-sem_Volatility (Volatile ) =- (sem_Volatility_Volatile )--- semantic domain-type T_Volatility = Environment ->- LocalIdentifierBindings ->- ( Volatility,Volatility)-data Inh_Volatility = Inh_Volatility {env_Inh_Volatility :: Environment,lib_Inh_Volatility :: LocalIdentifierBindings}-data Syn_Volatility = Syn_Volatility {annotatedTree_Syn_Volatility :: Volatility,originalTree_Syn_Volatility :: Volatility}-wrap_Volatility :: T_Volatility ->- Inh_Volatility ->- Syn_Volatility -wrap_Volatility sem (Inh_Volatility _lhsIenv _lhsIlib ) =- (let ( _lhsOannotatedTree,_lhsOoriginalTree) =- (sem _lhsIenv _lhsIlib )- in (Syn_Volatility _lhsOannotatedTree _lhsOoriginalTree ))-sem_Volatility_Immutable :: T_Volatility -sem_Volatility_Immutable =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Volatility- _lhsOoriginalTree :: Volatility- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Immutable- {-# LINE 15919 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Immutable- {-# LINE 15924 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15929 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15934 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Volatility_Stable :: T_Volatility -sem_Volatility_Stable =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Volatility- _lhsOoriginalTree :: Volatility- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Stable- {-# LINE 15946 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Stable- {-# LINE 15951 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15956 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15961 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))-sem_Volatility_Volatile :: T_Volatility -sem_Volatility_Volatile =- (\ _lhsIenv- _lhsIlib ->- (let _lhsOannotatedTree :: Volatility- _lhsOoriginalTree :: Volatility- -- self rule- _annotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- Volatile- {-# LINE 15973 "AstInternal.hs" #-}- -- self rule- _originalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- Volatile- {-# LINE 15978 "AstInternal.hs" #-}- -- self rule- _lhsOannotatedTree =- {-# LINE 57 "./TypeChecking/TypeChecking.ag" #-}- _annotatedTree- {-# LINE 15983 "AstInternal.hs" #-}- -- self rule- _lhsOoriginalTree =- {-# LINE 63 "./TypeChecking/TypeChecking.ag" #-}- _originalTree- {-# LINE 15988 "AstInternal.hs" #-}- in ( _lhsOannotatedTree,_lhsOoriginalTree)))
− Database/HsSqlPpp/AstInternals/Environment/DefaultTemplate1Environment.lhs
@@ -1,29027 +0,0 @@--Copyright 2009 Jake Wheat--This file contains--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment-> (defaultTemplate1Environment-> ) where--> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal-> import Database.HsSqlPpp.AstInternals.TypeType--> defaultTemplate1Environment :: Environment-> defaultTemplate1Environment =-> (\l -> case l of-> Left x -> error $ show x-> Right e -> e) $-> updateEnvironment defaultEnvironment-> [ EnvCreateScalar (-> ScalarType "bool" )-> "B"-> True-> , EnvCreateScalar (-> ScalarType "bytea" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "char" )-> "S"-> False-> , EnvCreateScalar (-> ScalarType "name" )-> "S"-> False-> , EnvCreateScalar (-> ScalarType "int8" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "int2" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "int2vector" )-> "A"-> False-> , EnvCreateScalar (-> ScalarType "int4" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "regproc" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "text" )-> "S"-> True-> , EnvCreateScalar (-> ScalarType "oid" )-> "N"-> True-> , EnvCreateScalar (-> ScalarType "tid" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "xid" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "cid" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "oidvector" )-> "A"-> False-> , EnvCreateScalar (-> ScalarType "xml" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "point" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "lseg" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "path" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "box" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "polygon" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "line" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "float4" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "float8" )-> "N"-> True-> , EnvCreateScalar (-> ScalarType "abstime" )-> "D"-> False-> , EnvCreateScalar (-> ScalarType "reltime" )-> "T"-> False-> , EnvCreateScalar (-> ScalarType "tinterval" )-> "T"-> False-> , EnvCreateScalar (-> ScalarType "circle" )-> "G"-> False-> , EnvCreateScalar (-> ScalarType "money" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "macaddr" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "inet" )-> "I"-> True-> , EnvCreateScalar (-> ScalarType "cidr" )-> "I"-> False-> , EnvCreateScalar (-> ScalarType "aclitem" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "bpchar" )-> "S"-> False-> , EnvCreateScalar (-> ScalarType "varchar" )-> "S"-> False-> , EnvCreateScalar (-> ScalarType "date" )-> "D"-> False-> , EnvCreateScalar (-> ScalarType "time" )-> "D"-> False-> , EnvCreateScalar (-> ScalarType "timestamp" )-> "D"-> False-> , EnvCreateScalar (-> ScalarType "timestamptz" )-> "D"-> True-> , EnvCreateScalar (-> ScalarType "interval" )-> "T"-> True-> , EnvCreateScalar (-> ScalarType "timetz" )-> "D"-> False-> , EnvCreateScalar (-> ScalarType "bit" )-> "V"-> False-> , EnvCreateScalar (-> ScalarType "varbit" )-> "V"-> True-> , EnvCreateScalar (-> ScalarType "numeric" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "refcursor" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "regprocedure" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "regoper" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "regoperator" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "regclass" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "regtype" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "uuid" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "tsvector" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "gtsvector" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "tsquery" )-> "U"-> False-> , EnvCreateScalar (-> ScalarType "regconfig" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "regdictionary" )-> "N"-> False-> , EnvCreateScalar (-> ScalarType "txid_snapshot" )-> "U"-> False-> , EnvCreateDomain (-> DomainType "information_schema.cardinal_number" ) (-> ScalarType "int4" )-> , EnvCreateDomain (-> DomainType "information_schema.character_data" ) (-> ScalarType "varchar" )-> , EnvCreateDomain (-> DomainType "information_schema.sql_identifier" ) (-> ScalarType "varchar" )-> , EnvCreateDomain (-> DomainType "information_schema.time_stamp" ) (-> ScalarType "timestamptz" )-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "int2" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "float4" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "float8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "numeric" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "int8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "int4" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "float4" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "float8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "numeric" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "int8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "int2" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "float4" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "float8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "numeric" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "float4" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float4" ) (-> ScalarType "int2" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float4" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float4" ) (-> ScalarType "float8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "float4" ) (-> ScalarType "numeric" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float8" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float8" ) (-> ScalarType "int2" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float8" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float8" ) (-> ScalarType "float4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "float8" ) (-> ScalarType "numeric" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "numeric" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "numeric" ) (-> ScalarType "int2" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "numeric" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "numeric" ) (-> ScalarType "float4" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "numeric" ) (-> ScalarType "float8" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "bool" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "bool" ) (-> ScalarType "int4" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regproc" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regproc" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regproc" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regproc" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regproc" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regproc" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regproc" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regproc" ) (-> ScalarType "regprocedure" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regprocedure" ) (-> ScalarType "regproc" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regprocedure" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regprocedure" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regprocedure" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regprocedure" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regprocedure" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regprocedure" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regprocedure" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regoper" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regoper" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regoper" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regoper" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regoper" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regoper" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regoper" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regoper" ) (-> ScalarType "regoperator" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regoperator" ) (-> ScalarType "regoper" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regoperator" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regoperator" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regoperator" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regoperator" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regoperator" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regoperator" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regoperator" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regclass" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regclass" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regclass" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regclass" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regclass" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regclass" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regclass" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regtype" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regtype" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regtype" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regtype" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regtype" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regtype" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regtype" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regconfig" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regconfig" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regconfig" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regconfig" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regconfig" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regconfig" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regconfig" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "oid" ) (-> ScalarType "regdictionary" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regdictionary" ) (-> ScalarType "oid" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "regdictionary" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int2" ) (-> ScalarType "regdictionary" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "regdictionary" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "regdictionary" ) (-> ScalarType "int8" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "regdictionary" ) (-> ScalarType "int4" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "text" ) (-> ScalarType "regclass" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "regclass" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "text" ) (-> ScalarType "bpchar" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "text" ) (-> ScalarType "varchar" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "bpchar" ) (-> ScalarType "text" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "bpchar" ) (-> ScalarType "varchar" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "text" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "bpchar" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "char" ) (-> ScalarType "text" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "char" ) (-> ScalarType "bpchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "char" ) (-> ScalarType "varchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "name" ) (-> ScalarType "text" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "name" ) (-> ScalarType "bpchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "name" ) (-> ScalarType "varchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "text" ) (-> ScalarType "char" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "bpchar" ) (-> ScalarType "char" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "char" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "text" ) (-> ScalarType "name" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "bpchar" ) (-> ScalarType "name" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "name" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "char" ) (-> ScalarType "int4" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "char" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "abstime" ) (-> ScalarType "date" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "abstime" ) (-> ScalarType "time" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "abstime" ) (-> ScalarType "timestamp" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "abstime" ) (-> ScalarType "timestamptz" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "reltime" ) (-> ScalarType "interval" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "date" ) (-> ScalarType "timestamp" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "date" ) (-> ScalarType "timestamptz" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "time" ) (-> ScalarType "interval" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "time" ) (-> ScalarType "timetz" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "timestamp" ) (-> ScalarType "abstime" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamp" ) (-> ScalarType "date" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamp" ) (-> ScalarType "time" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamp" ) (-> ScalarType "timestamptz" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "timestamptz" ) (-> ScalarType "abstime" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamptz" ) (-> ScalarType "date" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamptz" ) (-> ScalarType "time" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamptz" ) (-> ScalarType "timestamp" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timestamptz" ) (-> ScalarType "timetz" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "interval" ) (-> ScalarType "reltime" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "interval" ) (-> ScalarType "time" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "timetz" ) (-> ScalarType "time" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "abstime" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "abstime" ) (-> ScalarType "int4" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "reltime" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "reltime" ) (-> ScalarType "int4" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "lseg" ) (-> ScalarType "point" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "path" ) (-> ScalarType "point" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "path" ) (-> ScalarType "polygon" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "box" ) (-> ScalarType "point" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "box" ) (-> ScalarType "lseg" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "box" ) (-> ScalarType "polygon" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "box" ) (-> ScalarType "circle" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "polygon" ) (-> ScalarType "point" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "polygon" ) (-> ScalarType "path" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "polygon" ) (-> ScalarType "box" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "polygon" ) (-> ScalarType "circle" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "circle" ) (-> ScalarType "point" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "circle" ) (-> ScalarType "box" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "circle" ) (-> ScalarType "polygon" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "cidr" ) (-> ScalarType "inet" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "inet" ) (-> ScalarType "cidr" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "bit" ) (-> ScalarType "varbit" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varbit" ) (-> ScalarType "bit" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "int8" ) (-> ScalarType "bit" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "int4" ) (-> ScalarType "bit" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "bit" ) (-> ScalarType "int8" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "bit" ) (-> ScalarType "int4" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "cidr" ) (-> ScalarType "text" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "inet" ) (-> ScalarType "text" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "bool" ) (-> ScalarType "text" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "xml" ) (-> ScalarType "text" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "text" ) (-> ScalarType "xml" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "cidr" ) (-> ScalarType "varchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "inet" ) (-> ScalarType "varchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "bool" ) (-> ScalarType "varchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "xml" ) (-> ScalarType "varchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "xml" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "cidr" ) (-> ScalarType "bpchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "inet" ) (-> ScalarType "bpchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "bool" ) (-> ScalarType "bpchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "xml" ) (-> ScalarType "bpchar" )-> AssignmentCastContext-> , EnvCreateCast (-> ScalarType "bpchar" ) (-> ScalarType "xml" )-> ExplicitCastContext-> , EnvCreateCast (-> ScalarType "bpchar" ) (-> ScalarType "bpchar" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varchar" ) (-> ScalarType "varchar" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "time" ) (-> ScalarType "time" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "timestamp" ) (-> ScalarType "timestamp" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "timestamptz" ) (-> ScalarType "timestamptz" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "interval" ) (-> ScalarType "interval" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "timetz" ) (-> ScalarType "timetz" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "bit" ) (-> ScalarType "bit" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "varbit" ) (-> ScalarType "varbit" )-> ImplicitCastContext-> , EnvCreateCast (-> ScalarType "numeric" ) (-> ScalarType "numeric" )-> ImplicitCastContext-> , EnvCreateFunction-> FunPrefix-> "~"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunPrefix-> "~"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunPrefix-> "~"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunPrefix-> "~"-> [ ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunPrefix-> "~"-> [ ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunPrefix-> "||/"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "|/"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "|"-> [ ScalarType "tinterval"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunPrefix-> "@@"-> [ ScalarType "circle"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunPrefix-> "@@"-> [ ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunPrefix-> "@@"-> [ ScalarType "path"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunPrefix-> "@@"-> [ ScalarType "polygon"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunPrefix-> "@@"-> [ ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunPrefix-> "@-@"-> [ ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "@-@"-> [ ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "@"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunPrefix-> "@"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunPrefix-> "@"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunPrefix-> "@"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "@"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunPrefix-> "@"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunPrefix-> "?|"-> [ ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunPrefix-> "?|"-> [ ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunPrefix-> "?-"-> [ ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunPrefix-> "?-"-> [ ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunPrefix-> "-"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunPrefix-> "+"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunPrefix-> "+"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunPrefix-> "+"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunPrefix-> "+"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunPrefix-> "+"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunPrefix-> "+"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunPrefix-> "#"-> [ ScalarType "path"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunPrefix-> "#"-> [ ScalarType "polygon"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunPrefix-> "!!"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunPrefix-> "!!"-> [ ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunPostfix-> "!"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "~~*"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~~*"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~~*"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~~"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~~"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~~"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~>~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~>~"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~>=~"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~>=~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~="-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~="-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~="-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~="-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~="-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~<~"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~<~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~<=~"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~<=~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~*"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~*"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~*"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "polygon"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "~"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "varbit" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ Pseudo AnyElement-> , Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ Pseudo AnyNonArray-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ Pseudo AnyArray-> , Pseudo AnyElement-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunBinary-> "||"-> [ ScalarType "text"-> , Pseudo AnyNonArray-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunBinary-> "|>>"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "|>>"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "|>>"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "|&>"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "|&>"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "|&>"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "|"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "|"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "|"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "|"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunBinary-> "|"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunBinary-> "^"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "^"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "@@@"-> [ ScalarType "tsquery"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@@@"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@@"-> [ ScalarType "text"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@@"-> [ ScalarType "tsquery"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@@"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@@"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "polygon"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "@>"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?||"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?||"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?|"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?-|"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?-|"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?-"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "?#"-> [ ScalarType "line"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">^"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">^"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>="-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">>"-> [ ScalarType "bit"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">="-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> ">"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "aclitem"-> , ScalarType "aclitem"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int2vector"-> , ScalarType "int2vector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "cid"-> , ScalarType "cid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "xid"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "xid"-> , ScalarType "xid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "="-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<^"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<^"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "point"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "point"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "point"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "point"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "point"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<@"-> [ ScalarType "point"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<?>"-> [ ScalarType "abstime"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<>"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<="-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<|"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<|"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<|"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<="-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "bit"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "<<"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "circle"-> , ScalarType "polygon"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "point"-> , ScalarType "line"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "point"-> , ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "point"-> , ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "point"-> , ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "point"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<->"-> [ ScalarType "line"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "<#>"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "tinterval" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "<"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "money"-> , ScalarType "float4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "money"-> , ScalarType "int4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "interval"-> , ScalarType "float8"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "money"-> , ScalarType "int2"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "money"-> , ScalarType "float8"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "/"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "date"-> , ScalarType "int4"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "date"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ArrayType ( ScalarType "aclitem" ) )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "inet"-> , ScalarType "int8"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "time"-> , ScalarType "interval"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "timetz"-> , ScalarType "interval"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "abstime"-> , ScalarType "reltime"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "-"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "date"-> , ScalarType "time"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "timetz"-> , ScalarType "interval"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "time"-> , ScalarType "interval"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "time"-> , ScalarType "date"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "date"-> , ScalarType "timetz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int8"-> , ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ArrayType ( ScalarType "aclitem" ) )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "inet"-> , ScalarType "int8"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "interval"-> , ScalarType "date"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "date"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "timetz"-> , ScalarType "date"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "interval"-> , ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "interval"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "date"-> , ScalarType "int4"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "interval"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "int4"-> , ScalarType "date"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "abstime"-> , ScalarType "reltime"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunBinary-> "+"-> [ ScalarType "interval"-> , ScalarType "time"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "money"-> , ScalarType "float4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float4"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "money"-> , ScalarType "float8"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "money"-> , ScalarType "int4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "money"-> , ScalarType "int2"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float8"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int4"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int2"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float8"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "interval"-> , ScalarType "float8"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "*"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunBinary-> "&>"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&>"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&>"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&<|"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&<|"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&<|"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&<"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&<"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&<"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&&"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&&"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&&"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&&"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&&"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "&&"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunBinary-> "&"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunBinary-> "&"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunBinary-> "&"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "&"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "&"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "%"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "%"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunBinary-> "%"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "%"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "#>="-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "#>"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "#="-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "#<>"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "#<="-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "#<"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "line"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "point"-> , ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "line"-> , ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "point"-> , ScalarType "line"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "point"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "##"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunBinary-> "#"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~*"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~*"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~*"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~~"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~*"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~*"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~*"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunBinary-> "!~"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_cascade_del"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_cascade_upd"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_check_ins"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_check_upd"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_noaction_del"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_noaction_upd"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_restrict_del"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_restrict_upd"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_setdefault_del"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_setdefault_upd"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_setnull_del"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "RI_FKey_setnull_upd"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "abbrev"-> [ ScalarType "cidr"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "abbrev"-> [ ScalarType "inet"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "abs"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "abs"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "abs"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "abs"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "abs"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "abs"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "abstime"-> [ ScalarType "timestamp"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "abstime"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "abstimeeq"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "abstimege"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "abstimegt"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "abstimein"-> [ Pseudo Cstring-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "abstimele"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "abstimelt"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "abstimene"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "abstimeout"-> [ ScalarType "abstime"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "abstimerecv"-> [ Pseudo Internal-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "abstimesend"-> [ ScalarType "abstime"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "aclcontains"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "aclinsert"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ArrayType ( ScalarType "aclitem" ) )-> False-> , EnvCreateFunction-> FunName-> "aclitemeq"-> [ ScalarType "aclitem"-> , ScalarType "aclitem"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "aclitemin"-> [ Pseudo Cstring-> ] (-> ScalarType "aclitem" )-> False-> , EnvCreateFunction-> FunName-> "aclitemout"-> [ ScalarType "aclitem"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "aclremove"-> [ ArrayType ( ScalarType "aclitem" )-> , ScalarType "aclitem"-> ] (-> ArrayType ( ScalarType "aclitem" ) )-> False-> , EnvCreateFunction-> FunName-> "acos"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "age"-> [ ScalarType "xid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "age"-> [ ScalarType "timestamp"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "age"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "age"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "age"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "any_in"-> [ Pseudo Cstring-> ] (-> Pseudo Any )-> False-> , EnvCreateFunction-> FunName-> "any_out"-> [ Pseudo Any-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "anyarray_in"-> [ Pseudo Cstring-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "anyarray_out"-> [ Pseudo AnyArray-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "anyarray_recv"-> [ Pseudo Internal-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "anyarray_send"-> [ Pseudo AnyArray-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "anyelement_in"-> [ Pseudo Cstring-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunName-> "anyelement_out"-> [ Pseudo AnyElement-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "anyenum_in"-> [ Pseudo Cstring-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "anyenum_out"-> [ Pseudo AnyEnum-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "anynonarray_in"-> [ Pseudo Cstring-> ] (-> Pseudo AnyNonArray )-> False-> , EnvCreateFunction-> FunName-> "anynonarray_out"-> [ Pseudo AnyNonArray-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "anytextcat"-> [ Pseudo AnyNonArray-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "area"-> [ ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "area"-> [ ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "area"-> [ ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "areajoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "areasel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "array_agg_finalfn"-> [ Pseudo Internal-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_agg_transfn"-> [ Pseudo Internal-> , Pseudo AnyElement-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "array_append"-> [ Pseudo AnyArray-> , Pseudo AnyElement-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_cat"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_dims"-> [ Pseudo AnyArray-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "array_eq"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "array_fill"-> [ Pseudo AnyElement-> , ArrayType ( ScalarType "int4" )-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_fill"-> [ Pseudo AnyElement-> , ArrayType ( ScalarType "int4" )-> , ArrayType ( ScalarType "int4" )-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_ge"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "array_gt"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "array_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_larger"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_le"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "array_length"-> [ Pseudo AnyArray-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "array_lower"-> [ Pseudo AnyArray-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "array_lt"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "array_ndims"-> [ Pseudo AnyArray-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "array_ne"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "array_out"-> [ Pseudo AnyArray-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "array_prepend"-> [ Pseudo AnyElement-> , Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_send"-> [ Pseudo AnyArray-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "array_smaller"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "array_to_string"-> [ Pseudo AnyArray-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "array_upper"-> [ Pseudo AnyArray-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "arraycontained"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "arraycontains"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "arrayoverlap"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ascii"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "ascii_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "ascii_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "asin"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "atan"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "atan2"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "big5_to_euc_tw"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "big5_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "big5_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "bit"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bit"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bit"-> [ ScalarType "bit"-> , ScalarType "int4"-> , ScalarType "bool"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bit_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bit_length"-> [ ScalarType "bytea"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bit_length"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bit_length"-> [ ScalarType "bit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bit_out"-> [ ScalarType "bit"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "bit_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bit_send"-> [ ScalarType "bit"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "bitand"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bitcat"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "varbit" )-> False-> , EnvCreateFunction-> FunName-> "bitcmp"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "biteq"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bitge"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bitgt"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bitle"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bitlt"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bitne"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bitnot"-> [ ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bitor"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bitshiftleft"-> [ ScalarType "bit"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bitshiftright"-> [ ScalarType "bit"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bittypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bittypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "bitxor"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "bool"-> [ ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "booland_statefunc"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "booleq"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolge"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolgt"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolin"-> [ Pseudo Cstring-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolle"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boollt"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolne"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolor_statefunc"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolout"-> [ ScalarType "bool"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "boolrecv"-> [ Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "boolsend"-> [ ScalarType "bool"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "box"-> [ ScalarType "polygon"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box"-> [ ScalarType "circle"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_above"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_above_eq"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_add"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_below"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_below_eq"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_center"-> [ ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "box_contain"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_contained"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_distance"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "box_div"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_eq"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_ge"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_gt"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_in"-> [ Pseudo Cstring-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_intersect"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_le"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_left"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_lt"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_mul"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_out"-> [ ScalarType "box"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "box_overabove"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_overbelow"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_overlap"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_overleft"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_overright"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_recv"-> [ Pseudo Internal-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "box_right"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_same"-> [ ScalarType "box"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "box_send"-> [ ScalarType "box"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "box_sub"-> [ ScalarType "box"-> , ScalarType "point"-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "bpchar"-> [ ScalarType "char"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpchar"-> [ ScalarType "name"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpchar"-> [ ScalarType "bpchar"-> , ScalarType "int4"-> , ScalarType "bool"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpchar_larger"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpchar_pattern_ge"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpchar_pattern_gt"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpchar_pattern_le"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpchar_pattern_lt"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpchar_smaller"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpcharcmp"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bpchareq"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharge"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpchargt"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpchariclike"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharicnlike"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharicregexeq"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharicregexne"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharin"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpcharle"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharlike"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharlt"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharne"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharnlike"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharout"-> [ ScalarType "bpchar"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "bpcharrecv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunName-> "bpcharregexeq"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharregexne"-> [ ScalarType "bpchar"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bpcharsend"-> [ ScalarType "bpchar"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "bpchartypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bpchartypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "broadcast"-> [ ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "btabstimecmp"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btarraycmp"-> [ Pseudo AnyArray-> , Pseudo AnyArray-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btbeginscan"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "btboolcmp"-> [ ScalarType "bool"-> , ScalarType "bool"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btbpchar_pattern_cmp"-> [ ScalarType "bpchar"-> , ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btbuild"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "btbulkdelete"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "btcharcmp"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btcostestimate"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "btendscan"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "btfloat48cmp"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btfloat4cmp"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btfloat84cmp"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btfloat8cmp"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btgetbitmap"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "btgettuple"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "btinsert"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "btint24cmp"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint28cmp"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint2cmp"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint42cmp"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint48cmp"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint4cmp"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint82cmp"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint84cmp"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btint8cmp"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btmarkpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "btnamecmp"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btoidcmp"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btoidvectorcmp"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btoptions"-> [ ArrayType ( ScalarType "text" )-> , ScalarType "bool"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "btrecordcmp"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btreltimecmp"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btrescan"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "btrestrpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "btrim"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "btrim"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "btrim"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "bttext_pattern_cmp"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bttextcmp"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bttidcmp"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "bttintervalcmp"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "btvacuumcleanup"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "byteacat"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "byteacmp"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "byteaeq"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "byteage"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "byteagt"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "byteain"-> [ Pseudo Cstring-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "byteale"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bytealike"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "bytealt"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "byteane"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "byteanlike"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "byteaout"-> [ ScalarType "bytea"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "bytearecv"-> [ Pseudo Internal-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "byteasend"-> [ ScalarType "bytea"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "cash_cmp"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "cash_div_flt4"-> [ ScalarType "money"-> , ScalarType "float4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_div_flt8"-> [ ScalarType "money"-> , ScalarType "float8"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_div_int2"-> [ ScalarType "money"-> , ScalarType "int2"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_div_int4"-> [ ScalarType "money"-> , ScalarType "int4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_eq"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cash_ge"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cash_gt"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cash_in"-> [ Pseudo Cstring-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_le"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cash_lt"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cash_mi"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_mul_flt4"-> [ ScalarType "money"-> , ScalarType "float4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_mul_flt8"-> [ ScalarType "money"-> , ScalarType "float8"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_mul_int2"-> [ ScalarType "money"-> , ScalarType "int2"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_mul_int4"-> [ ScalarType "money"-> , ScalarType "int4"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_ne"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cash_out"-> [ ScalarType "money"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "cash_pl"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_recv"-> [ Pseudo Internal-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cash_send"-> [ ScalarType "money"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "cash_words"-> [ ScalarType "money"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "cashlarger"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cashsmaller"-> [ ScalarType "money"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "cbrt"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "ceil"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "ceil"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "ceiling"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "ceiling"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "center"-> [ ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "center"-> [ ScalarType "circle"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "char"-> [ ScalarType "int4"-> ] (-> ScalarType "char" )-> False-> , EnvCreateFunction-> FunName-> "char"-> [ ScalarType "text"-> ] (-> ScalarType "char" )-> False-> , EnvCreateFunction-> FunName-> "char_length"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "char_length"-> [ ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "character_length"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "character_length"-> [ ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "chareq"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "charge"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "chargt"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "charin"-> [ Pseudo Cstring-> ] (-> ScalarType "char" )-> False-> , EnvCreateFunction-> FunName-> "charle"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "charlt"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "charne"-> [ ScalarType "char"-> , ScalarType "char"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "charout"-> [ ScalarType "char"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "charrecv"-> [ Pseudo Internal-> ] (-> ScalarType "char" )-> False-> , EnvCreateFunction-> FunName-> "charsend"-> [ ScalarType "char"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "chr"-> [ ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "cideq"-> [ ScalarType "cid"-> , ScalarType "cid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "cidin"-> [ Pseudo Cstring-> ] (-> ScalarType "cid" )-> False-> , EnvCreateFunction-> FunName-> "cidout"-> [ ScalarType "cid"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "cidr"-> [ ScalarType "inet"-> ] (-> ScalarType "cidr" )-> False-> , EnvCreateFunction-> FunName-> "cidr_in"-> [ Pseudo Cstring-> ] (-> ScalarType "cidr" )-> False-> , EnvCreateFunction-> FunName-> "cidr_out"-> [ ScalarType "cidr"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "cidr_recv"-> [ Pseudo Internal-> ] (-> ScalarType "cidr" )-> False-> , EnvCreateFunction-> FunName-> "cidr_send"-> [ ScalarType "cidr"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "cidrecv"-> [ Pseudo Internal-> ] (-> ScalarType "cid" )-> False-> , EnvCreateFunction-> FunName-> "cidsend"-> [ ScalarType "cid"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "circle"-> [ ScalarType "box"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle"-> [ ScalarType "polygon"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle"-> [ ScalarType "point"-> , ScalarType "float8"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle_above"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_add_pt"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle_below"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_center"-> [ ScalarType "circle"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "circle_contain"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_contain_pt"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_contained"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_distance"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "circle_div_pt"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle_eq"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_ge"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_gt"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_in"-> [ Pseudo Cstring-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle_le"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_left"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_lt"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_mul_pt"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle_ne"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_out"-> [ ScalarType "circle"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "circle_overabove"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_overbelow"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_overlap"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_overleft"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_overright"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_recv"-> [ Pseudo Internal-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "circle_right"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_same"-> [ ScalarType "circle"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "circle_send"-> [ ScalarType "circle"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "circle_sub_pt"-> [ ScalarType "circle"-> , ScalarType "point"-> ] (-> ScalarType "circle" )-> False-> , EnvCreateFunction-> FunName-> "clock_timestamp"-> [] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "close_lb"-> [ ScalarType "line"-> , ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_ls"-> [ ScalarType "line"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_lseg"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_pb"-> [ ScalarType "point"-> , ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_pl"-> [ ScalarType "point"-> , ScalarType "line"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_ps"-> [ ScalarType "point"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_sb"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "close_sl"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "col_description"-> [ ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "contjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "contsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "convert"-> [ ScalarType "bytea"-> , ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "convert_from"-> [ ScalarType "bytea"-> , ScalarType "name"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "convert_to"-> [ ScalarType "text"-> , ScalarType "name"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "cos"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "cot"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "cstring_in"-> [ Pseudo Cstring-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "cstring_out"-> [ Pseudo Cstring-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "cstring_recv"-> [ Pseudo Internal-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "cstring_send"-> [ Pseudo Cstring-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "current_database"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "current_query"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "current_schema"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "current_schemas"-> [ ScalarType "bool"-> ] (-> ArrayType ( ScalarType "name" ) )-> False-> , EnvCreateFunction-> FunName-> "current_setting"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "current_user"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "currtid"-> [ ScalarType "oid"-> , ScalarType "tid"-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunName-> "currtid2"-> [ ScalarType "text"-> , ScalarType "tid"-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunName-> "currval"-> [ ScalarType "regclass"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "cursor_to_xml"-> [ ScalarType "refcursor"-> , ScalarType "int4"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "cursor_to_xmlschema"-> [ ScalarType "refcursor"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "database_to_xml"-> [ ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "database_to_xml_and_xmlschema"-> [ ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "database_to_xmlschema"-> [ ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "date"-> [ ScalarType "abstime"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date"-> [ ScalarType "timestamp"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_cmp"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "date_cmp_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "date_cmp_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "date_eq"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_eq_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_eq_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_ge"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_ge_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_ge_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_gt"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_gt_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_gt_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_in"-> [ Pseudo Cstring-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_larger"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_le"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_le_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_le_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_lt"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_lt_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_lt_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_mi"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "date_mi_interval"-> [ ScalarType "date"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "date_mii"-> [ ScalarType "date"-> , ScalarType "int4"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_ne"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_ne_timestamp"-> [ ScalarType "date"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_ne_timestamptz"-> [ ScalarType "date"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "date_out"-> [ ScalarType "date"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "abstime"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "reltime"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "date"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "time"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "timestamp"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "timestamptz"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "interval"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_part"-> [ ScalarType "text"-> , ScalarType "timetz"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "date_pl_interval"-> [ ScalarType "date"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "date_pli"-> [ ScalarType "date"-> , ScalarType "int4"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_recv"-> [ Pseudo Internal-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_send"-> [ ScalarType "date"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "date_smaller"-> [ ScalarType "date"-> , ScalarType "date"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "date_trunc"-> [ ScalarType "text"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "date_trunc"-> [ ScalarType "text"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "date_trunc"-> [ ScalarType "text"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "datetime_pl"-> [ ScalarType "date"-> , ScalarType "time"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "datetimetz_pl"-> [ ScalarType "date"-> , ScalarType "timetz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "dcbrt"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "decode"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "degrees"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dexp"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "diagonal"-> [ ScalarType "box"-> ] (-> ScalarType "lseg" )-> False-> , EnvCreateFunction-> FunName-> "diameter"-> [ ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dispell_init"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dispell_lexize"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dist_cpoly"-> [ ScalarType "circle"-> , ScalarType "polygon"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_lb"-> [ ScalarType "line"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_pb"-> [ ScalarType "point"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_pc"-> [ ScalarType "point"-> , ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_pl"-> [ ScalarType "point"-> , ScalarType "line"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_ppath"-> [ ScalarType "point"-> , ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_ps"-> [ ScalarType "point"-> , ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_sb"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dist_sl"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "div"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "dlog1"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dlog10"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "domain_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> Pseudo Any )-> False-> , EnvCreateFunction-> FunName-> "domain_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> Pseudo Any )-> False-> , EnvCreateFunction-> FunName-> "dpow"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dround"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dsimple_init"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dsimple_lexize"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dsnowball_init"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dsnowball_lexize"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dsqrt"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "dsynonym_init"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dsynonym_lexize"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "dtrunc"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "encode"-> [ ScalarType "bytea"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "enum_cmp"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "enum_eq"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "enum_first"-> [ Pseudo AnyEnum-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "enum_ge"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "enum_gt"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "enum_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "enum_larger"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "enum_last"-> [ Pseudo AnyEnum-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "enum_le"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "enum_lt"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "enum_ne"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "enum_out"-> [ Pseudo AnyEnum-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "enum_range"-> [ Pseudo AnyEnum-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "enum_range"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunName-> "enum_recv"-> [ Pseudo Cstring-> , ScalarType "oid"-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "enum_send"-> [ Pseudo AnyEnum-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "enum_smaller"-> [ Pseudo AnyEnum-> , Pseudo AnyEnum-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunName-> "eqjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "eqsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "euc_cn_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_cn_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_jis_2004_to_shift_jis_2004"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_jis_2004_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_jp_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_jp_to_sjis"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_jp_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_kr_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_kr_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_tw_to_big5"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_tw_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "euc_tw_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "exp"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "exp"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "factorial"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "family"-> [ ScalarType "inet"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "flatfile_update_trigger"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "float4"-> [ ScalarType "int8"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4"-> [ ScalarType "int2"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4"-> [ ScalarType "int4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4"-> [ ScalarType "float8"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4"-> [ ScalarType "numeric"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float48div"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float48eq"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float48ge"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float48gt"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float48le"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float48lt"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float48mi"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float48mul"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float48ne"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float48pl"-> [ ScalarType "float4"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float4_accum"-> [ ArrayType ( ScalarType "float8" )-> , ScalarType "float4"-> ] (-> ArrayType ( ScalarType "float8" ) )-> False-> , EnvCreateFunction-> FunName-> "float4abs"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4div"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4eq"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float4ge"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float4gt"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float4in"-> [ Pseudo Cstring-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4larger"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4le"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float4lt"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float4mi"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4mul"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4ne"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float4out"-> [ ScalarType "float4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "float4pl"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4recv"-> [ Pseudo Internal-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4send"-> [ ScalarType "float4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "float4smaller"-> [ ScalarType "float4"-> , ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4um"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float4up"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "float8"-> [ ScalarType "int8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8"-> [ ScalarType "int2"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8"-> [ ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8"-> [ ScalarType "numeric"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float84div"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float84eq"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float84ge"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float84gt"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float84le"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float84lt"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float84mi"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float84mul"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float84ne"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float84pl"-> [ ScalarType "float8"-> , ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_accum"-> [ ArrayType ( ScalarType "float8" )-> , ScalarType "float8"-> ] (-> ArrayType ( ScalarType "float8" ) )-> False-> , EnvCreateFunction-> FunName-> "float8_avg"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_corr"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_covar_pop"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_covar_samp"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_accum"-> [ ArrayType ( ScalarType "float8" )-> , ScalarType "float8"-> , ScalarType "float8"-> ] (-> ArrayType ( ScalarType "float8" ) )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_avgx"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_avgy"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_intercept"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_r2"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_slope"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_sxx"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_sxy"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_regr_syy"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_stddev_pop"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_stddev_samp"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_var_pop"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8_var_samp"-> [ ArrayType ( ScalarType "float8" )-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8abs"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8div"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8eq"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float8ge"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float8gt"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float8in"-> [ Pseudo Cstring-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8larger"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8le"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float8lt"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float8mi"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8mul"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8ne"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "float8out"-> [ ScalarType "float8"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "float8pl"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8recv"-> [ Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8send"-> [ ScalarType "float8"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "float8smaller"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8um"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "float8up"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "floor"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "floor"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "flt4_mul_cash"-> [ ScalarType "float4"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "flt8_mul_cash"-> [ ScalarType "float8"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "fmgr_c_validator"-> [ ScalarType "oid"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "fmgr_internal_validator"-> [ ScalarType "oid"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "fmgr_sql_validator"-> [ ScalarType "oid"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "format_type"-> [ ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "gb18030_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gbk_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "generate_series"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> SetOfType ( ScalarType "int8" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_series"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> SetOfType ( ScalarType "int4" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_series"-> [ ScalarType "int8"-> , ScalarType "int8"-> , ScalarType "int8"-> ] (-> SetOfType ( ScalarType "int8" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_series"-> [ ScalarType "int4"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> SetOfType ( ScalarType "int4" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_series"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> SetOfType ( ScalarType "timestamp" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_series"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> SetOfType ( ScalarType "timestamptz" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_subscripts"-> [ Pseudo AnyArray-> , ScalarType "int4"-> ] (-> SetOfType ( ScalarType "int4" ) )-> False-> , EnvCreateFunction-> FunName-> "generate_subscripts"-> [ Pseudo AnyArray-> , ScalarType "int4"-> , ScalarType "bool"-> ] (-> SetOfType ( ScalarType "int4" ) )-> False-> , EnvCreateFunction-> FunName-> "get_bit"-> [ ScalarType "bytea"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "get_byte"-> [ ScalarType "bytea"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "get_current_ts_config"-> [] (-> ScalarType "regconfig" )-> False-> , EnvCreateFunction-> FunName-> "getdatabaseencoding"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "getpgusername"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "gin_cmp_prefix"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "gin_cmp_tslexeme"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "gin_extract_tsquery"-> [ ScalarType "tsquery"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gin_extract_tsvector"-> [ ScalarType "tsvector"-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gin_tsquery_consistent"-> [ Pseudo Internal-> , ScalarType "int2"-> , ScalarType "tsquery"-> , ScalarType "int4"-> , Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ginarrayconsistent"-> [ Pseudo Internal-> , ScalarType "int2"-> , Pseudo AnyArray-> , ScalarType "int4"-> , Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ginarrayextract"-> [ Pseudo AnyArray-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "ginbeginscan"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "ginbuild"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "ginbulkdelete"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gincostestimate"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "ginendscan"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gingetbitmap"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "gininsert"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ginmarkpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "ginoptions"-> [ ArrayType ( ScalarType "text" )-> , ScalarType "bool"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "ginqueryarrayextract"-> [ Pseudo AnyArray-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "ginrescan"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "ginrestrpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "ginvacuumcleanup"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_box_compress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_box_consistent"-> [ Pseudo Internal-> , ScalarType "box"-> , ScalarType "int4"-> , ScalarType "oid"-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gist_box_decompress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_box_penalty"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_box_picksplit"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_box_same"-> [ ScalarType "box"-> , ScalarType "box"-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_box_union"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "box" )-> False-> , EnvCreateFunction-> FunName-> "gist_circle_compress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_circle_consistent"-> [ Pseudo Internal-> , ScalarType "circle"-> , ScalarType "int4"-> , ScalarType "oid"-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gist_poly_compress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gist_poly_consistent"-> [ Pseudo Internal-> , ScalarType "polygon"-> , ScalarType "int4"-> , ScalarType "oid"-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gistbeginscan"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gistbuild"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gistbulkdelete"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gistcostestimate"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gistendscan"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gistgetbitmap"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "gistgettuple"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gistinsert"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gistmarkpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gistoptions"-> [ ArrayType ( ScalarType "text" )-> , ScalarType "bool"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "gistrescan"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gistrestrpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "gistvacuumcleanup"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_compress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_consistent"-> [ Pseudo Internal-> , Pseudo Internal-> , ScalarType "int4"-> , ScalarType "oid"-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_decompress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_penalty"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_picksplit"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_same"-> [ ScalarType "int8"-> , ScalarType "int8"-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsquery_union"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_compress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_consistent"-> [ Pseudo Internal-> , ScalarType "gtsvector"-> , ScalarType "int4"-> , ScalarType "oid"-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_decompress"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_penalty"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_picksplit"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_same"-> [ ScalarType "gtsvector"-> , ScalarType "gtsvector"-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvector_union"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "gtsvectorin"-> [ Pseudo Cstring-> ] (-> ScalarType "gtsvector" )-> False-> , EnvCreateFunction-> FunName-> "gtsvectorout"-> [ ScalarType "gtsvector"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "has_any_column_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_any_column_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_any_column_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_any_column_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_any_column_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_any_column_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "text"-> , ScalarType "int2"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "oid"-> , ScalarType "int2"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "int2"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "int2"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "int2"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "int2"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_column_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_database_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_database_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_database_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_database_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_database_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_database_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_foreign_data_wrapper_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_foreign_data_wrapper_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_foreign_data_wrapper_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_foreign_data_wrapper_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_foreign_data_wrapper_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_foreign_data_wrapper_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_function_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_function_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_function_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_function_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_function_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_function_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_language_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_language_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_language_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_language_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_language_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_language_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_schema_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_schema_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_schema_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_schema_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_schema_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_schema_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_server_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_server_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_server_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_server_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_server_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_server_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_table_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_table_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_table_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_table_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_table_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_table_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_tablespace_privilege"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_tablespace_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_tablespace_privilege"-> [ ScalarType "name"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_tablespace_privilege"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_tablespace_privilege"-> [ ScalarType "oid"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "has_tablespace_privilege"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "hash_aclitem"-> [ ScalarType "aclitem"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hash_numeric"-> [ ScalarType "numeric"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashbeginscan"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "hashbpchar"-> [ ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashbuild"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "hashbulkdelete"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "hashchar"-> [ ScalarType "char"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashcostestimate"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "hashendscan"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "hashenum"-> [ Pseudo AnyEnum-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashfloat4"-> [ ScalarType "float4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashfloat8"-> [ ScalarType "float8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashgetbitmap"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "hashgettuple"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "hashinet"-> [ ScalarType "inet"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashinsert"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "hashint2"-> [ ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashint2vector"-> [ ScalarType "int2vector"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashint4"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashint8"-> [ ScalarType "int8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashmacaddr"-> [ ScalarType "macaddr"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashmarkpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "hashname"-> [ ScalarType "name"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashoid"-> [ ScalarType "oid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashoidvector"-> [ ScalarType "oidvector"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashoptions"-> [ ArrayType ( ScalarType "text" )-> , ScalarType "bool"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "hashrescan"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "hashrestrpos"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "hashtext"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "hashvacuumcleanup"-> [ Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "hashvarlena"-> [ Pseudo Internal-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "height"-> [ ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "host"-> [ ScalarType "inet"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "hostmask"-> [ ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "iclikejoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "iclikesel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "icnlikejoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "icnlikesel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "icregexeqjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "icregexeqsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "icregexnejoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "icregexnesel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "inet_client_addr"-> [] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inet_client_port"-> [] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "inet_in"-> [ Pseudo Cstring-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inet_out"-> [ ScalarType "inet"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "inet_recv"-> [ Pseudo Internal-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inet_send"-> [ ScalarType "inet"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "inet_server_addr"-> [] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inet_server_port"-> [] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "inetand"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inetmi"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "inetmi_int8"-> [ ScalarType "inet"-> , ScalarType "int8"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inetnot"-> [ ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inetor"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "inetpl"-> [ ScalarType "inet"-> , ScalarType "int8"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "initcap"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "int2"-> [ ScalarType "int8"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2"-> [ ScalarType "int4"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2"-> [ ScalarType "float4"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2"-> [ ScalarType "float8"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2"-> [ ScalarType "numeric"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int24div"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int24eq"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int24ge"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int24gt"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int24le"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int24lt"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int24mi"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int24mul"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int24ne"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int24pl"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int28div"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int28eq"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int28ge"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int28gt"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int28le"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int28lt"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int28mi"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int28mul"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int28ne"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int28pl"-> [ ScalarType "int2"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int2_accum"-> [ ArrayType ( ScalarType "numeric" )-> , ScalarType "int2"-> ] (-> ArrayType ( ScalarType "numeric" ) )-> False-> , EnvCreateFunction-> FunName-> "int2_avg_accum"-> [ ArrayType ( ScalarType "int8" )-> , ScalarType "int2"-> ] (-> ArrayType ( ScalarType "int8" ) )-> False-> , EnvCreateFunction-> FunName-> "int2_mul_cash"-> [ ScalarType "int2"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "int2_sum"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int2abs"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2and"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2div"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2eq"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2ge"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2gt"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2in"-> [ Pseudo Cstring-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2larger"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2le"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2lt"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2mi"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2mod"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2mul"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2ne"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2not"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2or"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2out"-> [ ScalarType "int2"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "int2pl"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2recv"-> [ Pseudo Internal-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2send"-> [ ScalarType "int2"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "int2shl"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2shr"-> [ ScalarType "int2"-> , ScalarType "int4"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2smaller"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2um"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2up"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int2vectoreq"-> [ ScalarType "int2vector"-> , ScalarType "int2vector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int2vectorin"-> [ Pseudo Cstring-> ] (-> ScalarType "int2vector" )-> False-> , EnvCreateFunction-> FunName-> "int2vectorout"-> [ ScalarType "int2vector"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "int2vectorrecv"-> [ Pseudo Internal-> ] (-> ScalarType "int2vector" )-> False-> , EnvCreateFunction-> FunName-> "int2vectorsend"-> [ ScalarType "int2vector"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "int2xor"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "bool"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "char"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "int8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "float4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "float8"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "bit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4"-> [ ScalarType "numeric"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int42div"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int42eq"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int42ge"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int42gt"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int42le"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int42lt"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int42mi"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int42mul"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int42ne"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int42pl"-> [ ScalarType "int4"-> , ScalarType "int2"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int48div"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int48eq"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int48ge"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int48gt"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int48le"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int48lt"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int48mi"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int48mul"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int48ne"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int48pl"-> [ ScalarType "int4"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int4_accum"-> [ ArrayType ( ScalarType "numeric" )-> , ScalarType "int4"-> ] (-> ArrayType ( ScalarType "numeric" ) )-> False-> , EnvCreateFunction-> FunName-> "int4_avg_accum"-> [ ArrayType ( ScalarType "int8" )-> , ScalarType "int4"-> ] (-> ArrayType ( ScalarType "int8" ) )-> False-> , EnvCreateFunction-> FunName-> "int4_mul_cash"-> [ ScalarType "int4"-> , ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunName-> "int4_sum"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int4abs"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4and"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4div"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4eq"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int4ge"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int4gt"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int4in"-> [ Pseudo Cstring-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4inc"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4larger"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4le"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int4lt"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int4mi"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4mod"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4mul"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4ne"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int4not"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4or"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4out"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "int4pl"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4recv"-> [ Pseudo Internal-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4send"-> [ ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "int4shl"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4shr"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4smaller"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4um"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4up"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int4xor"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "float4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "float8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "bit"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8"-> [ ScalarType "numeric"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int82div"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int82eq"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int82ge"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int82gt"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int82le"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int82lt"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int82mi"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int82mul"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int82ne"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int82pl"-> [ ScalarType "int8"-> , ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int84div"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int84eq"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int84ge"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int84gt"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int84le"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int84lt"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int84mi"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int84mul"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int84ne"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int84pl"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8_accum"-> [ ArrayType ( ScalarType "numeric" )-> , ScalarType "int8"-> ] (-> ArrayType ( ScalarType "numeric" ) )-> False-> , EnvCreateFunction-> FunName-> "int8_avg"-> [ ArrayType ( ScalarType "int8" )-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "int8_avg_accum"-> [ ArrayType ( ScalarType "numeric" )-> , ScalarType "int8"-> ] (-> ArrayType ( ScalarType "numeric" ) )-> False-> , EnvCreateFunction-> FunName-> "int8_sum"-> [ ScalarType "numeric"-> , ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "int8abs"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8and"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8div"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8eq"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int8ge"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int8gt"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int8in"-> [ Pseudo Cstring-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8inc"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8inc_any"-> [ ScalarType "int8"-> , Pseudo Any-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8inc_float8_float8"-> [ ScalarType "int8"-> , ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8larger"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8le"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int8lt"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int8mi"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8mod"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8mul"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8ne"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "int8not"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8or"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8out"-> [ ScalarType "int8"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "int8pl"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8pl_inet"-> [ ScalarType "int8"-> , ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "int8recv"-> [ Pseudo Internal-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8send"-> [ ScalarType "int8"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "int8shl"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8shr"-> [ ScalarType "int8"-> , ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8smaller"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8um"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8up"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "int8xor"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "integer_pl_date"-> [ ScalarType "int4"-> , ScalarType "date"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "inter_lb"-> [ ScalarType "line"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "inter_sb"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "inter_sl"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "internal_in"-> [ Pseudo Cstring-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "internal_out"-> [ Pseudo Internal-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "interval"-> [ ScalarType "reltime"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval"-> [ ScalarType "time"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval"-> [ ScalarType "interval"-> , ScalarType "int4"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_accum"-> [ ArrayType ( ScalarType "interval" )-> , ScalarType "interval"-> ] (-> ArrayType ( ScalarType "interval" ) )-> False-> , EnvCreateFunction-> FunName-> "interval_avg"-> [ ArrayType ( ScalarType "interval" )-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_cmp"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "interval_div"-> [ ScalarType "interval"-> , ScalarType "float8"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_eq"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "interval_ge"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "interval_gt"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "interval_hash"-> [ ScalarType "interval"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "interval_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_larger"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_le"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "interval_lt"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "interval_mi"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_mul"-> [ ScalarType "interval"-> , ScalarType "float8"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_ne"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "interval_out"-> [ ScalarType "interval"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "interval_pl"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_pl_date"-> [ ScalarType "interval"-> , ScalarType "date"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "interval_pl_time"-> [ ScalarType "interval"-> , ScalarType "time"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "interval_pl_timestamp"-> [ ScalarType "interval"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "interval_pl_timestamptz"-> [ ScalarType "interval"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "interval_pl_timetz"-> [ ScalarType "interval"-> , ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "interval_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_send"-> [ ScalarType "interval"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "interval_smaller"-> [ ScalarType "interval"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "interval_um"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "intervaltypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "intervaltypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "intinterval"-> [ ScalarType "abstime"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isclosed"-> [ ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isfinite"-> [ ScalarType "abstime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isfinite"-> [ ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isfinite"-> [ ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isfinite"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isfinite"-> [ ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ishorizontal"-> [ ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ishorizontal"-> [ ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ishorizontal"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "iso8859_1_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "iso8859_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "iso_to_koi8r"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "iso_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "iso_to_win1251"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "iso_to_win866"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "isopen"-> [ ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isparallel"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isparallel"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isperp"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isperp"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isvertical"-> [ ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isvertical"-> [ ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "isvertical"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "johab_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "justify_days"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "justify_hours"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "justify_interval"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "koi8r_to_iso"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "koi8r_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "koi8r_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "koi8r_to_win1251"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "koi8r_to_win866"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "koi8u_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "language_handler_in"-> [ Pseudo Cstring-> ] (-> Pseudo LanguageHandler )-> False-> , EnvCreateFunction-> FunName-> "language_handler_out"-> [ Pseudo LanguageHandler-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "lastval"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "latin1_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "latin2_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "latin2_to_win1250"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "latin3_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "latin4_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "bytea"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "bit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "tsvector"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "length"-> [ ScalarType "bytea"-> , ScalarType "name"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "like"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "like"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "like"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "like_escape"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "like_escape"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "likejoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "likesel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "line"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "line" )-> False-> , EnvCreateFunction-> FunName-> "line_distance"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "line_eq"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "line_horizontal"-> [ ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "line_in"-> [ Pseudo Cstring-> ] (-> ScalarType "line" )-> False-> , EnvCreateFunction-> FunName-> "line_interpt"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "line_intersect"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "line_out"-> [ ScalarType "line"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "line_parallel"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "line_perp"-> [ ScalarType "line"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "line_recv"-> [ Pseudo Internal-> ] (-> ScalarType "line" )-> False-> , EnvCreateFunction-> FunName-> "line_send"-> [ ScalarType "line"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "line_vertical"-> [ ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ln"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "ln"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "lo_close"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lo_creat"-> [ ScalarType "int4"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "lo_create"-> [ ScalarType "oid"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "lo_export"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lo_import"-> [ ScalarType "text"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "lo_import"-> [ ScalarType "text"-> , ScalarType "oid"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "lo_lseek"-> [ ScalarType "int4"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lo_open"-> [ ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lo_tell"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lo_truncate"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lo_unlink"-> [ ScalarType "oid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "log"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "log"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "log"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "loread"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "lower"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "lowrite"-> [ ScalarType "int4"-> , ScalarType "bytea"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "lpad"-> [ ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "lpad"-> [ ScalarType "text"-> , ScalarType "int4"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "lseg"-> [ ScalarType "box"-> ] (-> ScalarType "lseg" )-> False-> , EnvCreateFunction-> FunName-> "lseg"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "lseg" )-> False-> , EnvCreateFunction-> FunName-> "lseg_center"-> [ ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "lseg_distance"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "lseg_eq"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_ge"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_gt"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_horizontal"-> [ ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_in"-> [ Pseudo Cstring-> ] (-> ScalarType "lseg" )-> False-> , EnvCreateFunction-> FunName-> "lseg_interpt"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "lseg_intersect"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_le"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_length"-> [ ScalarType "lseg"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "lseg_lt"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_ne"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_out"-> [ ScalarType "lseg"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "lseg_parallel"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_perp"-> [ ScalarType "lseg"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "lseg_recv"-> [ Pseudo Internal-> ] (-> ScalarType "lseg" )-> False-> , EnvCreateFunction-> FunName-> "lseg_send"-> [ ScalarType "lseg"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "lseg_vertical"-> [ ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ltrim"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "ltrim"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_cmp"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_eq"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_ge"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_gt"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_in"-> [ Pseudo Cstring-> ] (-> ScalarType "macaddr" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_le"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_lt"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_ne"-> [ ScalarType "macaddr"-> , ScalarType "macaddr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_out"-> [ ScalarType "macaddr"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "macaddr_recv"-> [ Pseudo Internal-> ] (-> ScalarType "macaddr" )-> False-> , EnvCreateFunction-> FunName-> "macaddr_send"-> [ ScalarType "macaddr"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "makeaclitem"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> , ScalarType "bool"-> ] (-> ScalarType "aclitem" )-> False-> , EnvCreateFunction-> FunName-> "masklen"-> [ ScalarType "inet"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "md5"-> [ ScalarType "bytea"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "md5"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "mic_to_ascii"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_big5"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_euc_cn"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_euc_jp"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_euc_kr"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_euc_tw"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_iso"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_koi8r"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_latin1"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_latin2"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_latin3"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_latin4"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_sjis"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_win1250"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_win1251"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mic_to_win866"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "mktinterval"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "tinterval" )-> False-> , EnvCreateFunction-> FunName-> "mod"-> [ ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "mod"-> [ ScalarType "int2"-> , ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunName-> "mod"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "mod"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "mul_d_interval"-> [ ScalarType "float8"-> , ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "name"-> [ ScalarType "text"-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "name"-> [ ScalarType "bpchar"-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "name"-> [ ScalarType "varchar"-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "nameeq"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namege"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namegt"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nameiclike"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nameicnlike"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nameicregexeq"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nameicregexne"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namein"-> [ Pseudo Cstring-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "namele"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namelike"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namelt"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namene"-> [ ScalarType "name"-> , ScalarType "name"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namenlike"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nameout"-> [ ScalarType "name"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "namerecv"-> [ Pseudo Internal-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "nameregexeq"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nameregexne"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "namesend"-> [ ScalarType "name"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "neqjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "neqsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "netmask"-> [ ScalarType "inet"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "network"-> [ ScalarType "inet"-> ] (-> ScalarType "cidr" )-> False-> , EnvCreateFunction-> FunName-> "network_cmp"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "network_eq"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_ge"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_gt"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_le"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_lt"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_ne"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_sub"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_subeq"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_sup"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "network_supeq"-> [ ScalarType "inet"-> , ScalarType "inet"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "nextval"-> [ ScalarType "regclass"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "nlikejoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "nlikesel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "notlike"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "notlike"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "notlike"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "now"-> [] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "npoints"-> [ ScalarType "path"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "npoints"-> [ ScalarType "polygon"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "numeric"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric"-> [ ScalarType "float4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric"-> [ ScalarType "float8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric"-> [ ScalarType "numeric"-> , ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_abs"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_accum"-> [ ArrayType ( ScalarType "numeric" )-> , ScalarType "numeric"-> ] (-> ArrayType ( ScalarType "numeric" ) )-> False-> , EnvCreateFunction-> FunName-> "numeric_add"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_avg"-> [ ArrayType ( ScalarType "numeric" )-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_avg_accum"-> [ ArrayType ( ScalarType "numeric" )-> , ScalarType "numeric"-> ] (-> ArrayType ( ScalarType "numeric" ) )-> False-> , EnvCreateFunction-> FunName-> "numeric_cmp"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "numeric_div"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_div_trunc"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_eq"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "numeric_exp"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_fac"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_ge"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "numeric_gt"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "numeric_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_inc"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_larger"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_le"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "numeric_ln"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_log"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_lt"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "numeric_mod"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_mul"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_ne"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "numeric_out"-> [ ScalarType "numeric"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "numeric_power"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_send"-> [ ScalarType "numeric"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "numeric_smaller"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_sqrt"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_stddev_pop"-> [ ArrayType ( ScalarType "numeric" )-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_stddev_samp"-> [ ArrayType ( ScalarType "numeric" )-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_sub"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_uminus"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_uplus"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_var_pop"-> [ ArrayType ( ScalarType "numeric" )-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numeric_var_samp"-> [ ArrayType ( ScalarType "numeric" )-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "numerictypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "numerictypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "numnode"-> [ ScalarType "tsquery"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "obj_description"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "obj_description"-> [ ScalarType "oid"-> , ScalarType "name"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "octet_length"-> [ ScalarType "bytea"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "octet_length"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "octet_length"-> [ ScalarType "bpchar"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "octet_length"-> [ ScalarType "bit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "oid"-> [ ScalarType "int8"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "oideq"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidge"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidgt"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidin"-> [ Pseudo Cstring-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "oidlarger"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "oidle"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidlt"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidne"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidout"-> [ ScalarType "oid"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "oidrecv"-> [ Pseudo Internal-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "oidsend"-> [ ScalarType "oid"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "oidsmaller"-> [ ScalarType "oid"-> , ScalarType "oid"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "oidvectoreq"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorge"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorgt"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorin"-> [ Pseudo Cstring-> ] (-> ScalarType "oidvector" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorle"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorlt"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorne"-> [ ScalarType "oidvector"-> , ScalarType "oidvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorout"-> [ ScalarType "oidvector"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "oidvectorrecv"-> [ Pseudo Internal-> ] (-> ScalarType "oidvector" )-> False-> , EnvCreateFunction-> FunName-> "oidvectorsend"-> [ ScalarType "oidvector"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "oidvectortypes"-> [ ScalarType "oidvector"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "on_pb"-> [ ScalarType "point"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "on_pl"-> [ ScalarType "point"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "on_ppath"-> [ ScalarType "point"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "on_ps"-> [ ScalarType "point"-> , ScalarType "lseg"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "on_sb"-> [ ScalarType "lseg"-> , ScalarType "box"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "on_sl"-> [ ScalarType "lseg"-> , ScalarType "line"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "opaque_in"-> [ Pseudo Cstring-> ] (-> Pseudo Opaque )-> False-> , EnvCreateFunction-> FunName-> "opaque_out"-> [ Pseudo Opaque-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "time"-> , ScalarType "time"-> , ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "time"-> , ScalarType "time"-> , ScalarType "time"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "time"-> , ScalarType "interval"-> , ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "time"-> , ScalarType "interval"-> , ScalarType "time"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> , ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> , ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamp"-> , ScalarType "interval"-> , ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamp"-> , ScalarType "interval"-> , ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> , ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> , ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamptz"-> , ScalarType "interval"-> , ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timestamptz"-> , ScalarType "interval"-> , ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlaps"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> , ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "overlay"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "overlay"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "path"-> [ ScalarType "polygon"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_add"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_add_pt"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_center"-> [ ScalarType "path"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "path_contain_pt"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_distance"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "path_div_pt"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_in"-> [ Pseudo Cstring-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_inter"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_length"-> [ ScalarType "path"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "path_mul_pt"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_n_eq"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_n_ge"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_n_gt"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_n_le"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_n_lt"-> [ ScalarType "path"-> , ScalarType "path"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "path_npoints"-> [ ScalarType "path"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "path_out"-> [ ScalarType "path"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "path_recv"-> [ Pseudo Internal-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "path_send"-> [ ScalarType "path"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "path_sub_pt"-> [ ScalarType "path"-> , ScalarType "point"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "pclose"-> [ ScalarType "path"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_lock"-> [ ScalarType "int8"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_lock"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_lock_shared"-> [ ScalarType "int8"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_lock_shared"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_unlock"-> [ ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_unlock"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_unlock_all"-> [] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_unlock_shared"-> [ ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_advisory_unlock_shared"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_backend_pid"-> [] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "pg_cancel_backend"-> [ ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_char_to_encoding"-> [ ScalarType "name"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "pg_client_encoding"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "pg_column_size"-> [ Pseudo Any-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "pg_conf_load_time"-> [] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_conversion_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_current_xlog_insert_location"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_current_xlog_location"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_cursor"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_database_size"-> [ ScalarType "name"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_database_size"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_encoding_to_char"-> [ ScalarType "int4"-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "pg_function_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_constraintdef"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_constraintdef"-> [ ScalarType "oid"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_expr"-> [ ScalarType "text"-> , ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_expr"-> [ ScalarType "text"-> , ScalarType "oid"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_function_arguments"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_function_identity_arguments"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_function_result"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_functiondef"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_indexdef"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_indexdef"-> [ ScalarType "oid"-> , ScalarType "int4"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_keywords"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_get_ruledef"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_ruledef"-> [ ScalarType "oid"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_serial_sequence"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_triggerdef"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_userbyid"-> [ ScalarType "oid"-> ] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_viewdef"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_viewdef"-> [ ScalarType "oid"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_viewdef"-> [ ScalarType "text"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_get_viewdef"-> [ ScalarType "oid"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_has_role"-> [ ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_has_role"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_has_role"-> [ ScalarType "name"-> , ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_has_role"-> [ ScalarType "name"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_has_role"-> [ ScalarType "oid"-> , ScalarType "name"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_has_role"-> [ ScalarType "oid"-> , ScalarType "oid"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_is_other_temp_schema"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_lock_status"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_ls_dir"-> [ ScalarType "text"-> ] (-> SetOfType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "pg_my_temp_schema"-> [] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "pg_opclass_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_operator_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_options_to_table"-> [ ArrayType ( ScalarType "text" )-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_postmaster_start_time"-> [] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_prepared_statement"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_prepared_xact"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_read_file"-> [ ScalarType "text"-> , ScalarType "int8"-> , ScalarType "int8"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_relation_size"-> [ ScalarType "regclass"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_relation_size"-> [ ScalarType "regclass"-> , ScalarType "text"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_reload_conf"-> [] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_rotate_logfile"-> [] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_show_all_settings"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_size_pretty"-> [ ScalarType "int8"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_sleep"-> [ ScalarType "float8"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_start_backup"-> [ ScalarType "text"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_clear_snapshot"-> [] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_file"-> [ ScalarType "text"-> ] (-> Pseudo Record )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_activity"-> [ ScalarType "int4"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_activity"-> [ ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_activity_start"-> [ ScalarType "int4"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_client_addr"-> [ ScalarType "int4"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_client_port"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_dbid"-> [ ScalarType "int4"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_idset"-> [] (-> SetOfType ( ScalarType "int4" ) )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_pid"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_start"-> [ ScalarType "int4"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_userid"-> [ ScalarType "int4"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_waiting"-> [ ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_backend_xact_start"-> [ ScalarType "int4"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_bgwriter_buf_written_checkpoints"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_bgwriter_buf_written_clean"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_bgwriter_maxwritten_clean"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_bgwriter_requested_checkpoints"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_bgwriter_timed_checkpoints"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_blocks_fetched"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_blocks_hit"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_buf_alloc"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_buf_written_backend"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_blocks_fetched"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_blocks_hit"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_numbackends"-> [ ScalarType "oid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_tuples_deleted"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_tuples_fetched"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_tuples_inserted"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_tuples_returned"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_tuples_updated"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_xact_commit"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_db_xact_rollback"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_dead_tuples"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_function_calls"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_function_self_time"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_function_time"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_last_analyze_time"-> [ ScalarType "oid"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_last_autoanalyze_time"-> [ ScalarType "oid"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_last_autovacuum_time"-> [ ScalarType "oid"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_last_vacuum_time"-> [ ScalarType "oid"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_live_tuples"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_numscans"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_tuples_deleted"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_tuples_fetched"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_tuples_hot_updated"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_tuples_inserted"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_tuples_returned"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_get_tuples_updated"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_stat_reset"-> [] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "pg_stop_backup"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_switch_xlog"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_table_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_tablespace_databases"-> [ ScalarType "oid"-> ] (-> SetOfType ( ScalarType "oid" ) )-> False-> , EnvCreateFunction-> FunName-> "pg_tablespace_size"-> [ ScalarType "name"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_tablespace_size"-> [ ScalarType "oid"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_terminate_backend"-> [ ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_timezone_abbrevs"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_timezone_names"-> [] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "pg_total_relation_size"-> [ ScalarType "regclass"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "pg_try_advisory_lock"-> [ ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_try_advisory_lock"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_try_advisory_lock_shared"-> [ ScalarType "int8"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_try_advisory_lock_shared"-> [ ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_ts_config_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_ts_dict_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_ts_parser_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_ts_template_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_type_is_visible"-> [ ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pg_typeof"-> [ Pseudo Any-> ] (-> ScalarType "regtype" )-> False-> , EnvCreateFunction-> FunName-> "pg_xlogfile_name"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "pg_xlogfile_name_offset"-> [ ScalarType "text"-> ] (-> Pseudo Record )-> False-> , EnvCreateFunction-> FunName-> "pi"-> [] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "plainto_tsquery"-> [ ScalarType "text"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "plainto_tsquery"-> [ ScalarType "regconfig"-> , ScalarType "text"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "point"-> [ ScalarType "lseg"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point"-> [ ScalarType "path"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point"-> [ ScalarType "box"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point"-> [ ScalarType "polygon"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point"-> [ ScalarType "circle"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_above"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_add"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_below"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_distance"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "point_div"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_eq"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_horiz"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_in"-> [ Pseudo Cstring-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_left"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_mul"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_ne"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_out"-> [ ScalarType "point"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "point_recv"-> [ Pseudo Internal-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_right"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "point_send"-> [ ScalarType "point"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "point_sub"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "point_vert"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_above"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_below"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_center"-> [ ScalarType "polygon"-> ] (-> ScalarType "point" )-> False-> , EnvCreateFunction-> FunName-> "poly_contain"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_contain_pt"-> [ ScalarType "polygon"-> , ScalarType "point"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_contained"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_distance"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "poly_in"-> [ Pseudo Cstring-> ] (-> ScalarType "polygon" )-> False-> , EnvCreateFunction-> FunName-> "poly_left"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_npoints"-> [ ScalarType "polygon"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "poly_out"-> [ ScalarType "polygon"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "poly_overabove"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_overbelow"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_overlap"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_overleft"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_overright"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_recv"-> [ Pseudo Internal-> ] (-> ScalarType "polygon" )-> False-> , EnvCreateFunction-> FunName-> "poly_right"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_same"-> [ ScalarType "polygon"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "poly_send"-> [ ScalarType "polygon"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "polygon"-> [ ScalarType "path"-> ] (-> ScalarType "polygon" )-> False-> , EnvCreateFunction-> FunName-> "polygon"-> [ ScalarType "box"-> ] (-> ScalarType "polygon" )-> False-> , EnvCreateFunction-> FunName-> "polygon"-> [ ScalarType "circle"-> ] (-> ScalarType "polygon" )-> False-> , EnvCreateFunction-> FunName-> "polygon"-> [ ScalarType "int4"-> , ScalarType "circle"-> ] (-> ScalarType "polygon" )-> False-> , EnvCreateFunction-> FunName-> "popen"-> [ ScalarType "path"-> ] (-> ScalarType "path" )-> False-> , EnvCreateFunction-> FunName-> "position"-> [ ScalarType "bytea"-> , ScalarType "bytea"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "position"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "position"-> [ ScalarType "bit"-> , ScalarType "bit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "positionjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "positionsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "postgresql_fdw_validator"-> [ ArrayType ( ScalarType "text" )-> , ScalarType "oid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pow"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "pow"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "power"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "power"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "prsd_end"-> [ Pseudo Internal-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "prsd_headline"-> [ Pseudo Internal-> , Pseudo Internal-> , ScalarType "tsquery"-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "prsd_lextype"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "prsd_nexttoken"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "prsd_start"-> [ Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "pt_contained_circle"-> [ ScalarType "point"-> , ScalarType "circle"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "pt_contained_poly"-> [ ScalarType "point"-> , ScalarType "polygon"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "query_to_xml"-> [ ScalarType "text"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "query_to_xml_and_xmlschema"-> [ ScalarType "text"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "query_to_xmlschema"-> [ ScalarType "text"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "querytree"-> [ ScalarType "tsquery"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "quote_ident"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "quote_literal"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "quote_literal"-> [ Pseudo AnyElement-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "quote_nullable"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "quote_nullable"-> [ Pseudo AnyElement-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "radians"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "radius"-> [ ScalarType "circle"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "random"-> [] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "record_eq"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "record_ge"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "record_gt"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "record_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> Pseudo Record )-> False-> , EnvCreateFunction-> FunName-> "record_le"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "record_lt"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "record_ne"-> [ Pseudo Record-> , Pseudo Record-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "record_out"-> [ Pseudo Record-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "record_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> Pseudo Record )-> False-> , EnvCreateFunction-> FunName-> "record_send"-> [ Pseudo Record-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regclass"-> [ ScalarType "text"-> ] (-> ScalarType "regclass" )-> False-> , EnvCreateFunction-> FunName-> "regclassin"-> [ Pseudo Cstring-> ] (-> ScalarType "regclass" )-> False-> , EnvCreateFunction-> FunName-> "regclassout"-> [ ScalarType "regclass"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regclassrecv"-> [ Pseudo Internal-> ] (-> ScalarType "regclass" )-> False-> , EnvCreateFunction-> FunName-> "regclasssend"-> [ ScalarType "regclass"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regconfigin"-> [ Pseudo Cstring-> ] (-> ScalarType "regconfig" )-> False-> , EnvCreateFunction-> FunName-> "regconfigout"-> [ ScalarType "regconfig"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regconfigrecv"-> [ Pseudo Internal-> ] (-> ScalarType "regconfig" )-> False-> , EnvCreateFunction-> FunName-> "regconfigsend"-> [ ScalarType "regconfig"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regdictionaryin"-> [ Pseudo Cstring-> ] (-> ScalarType "regdictionary" )-> False-> , EnvCreateFunction-> FunName-> "regdictionaryout"-> [ ScalarType "regdictionary"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regdictionaryrecv"-> [ Pseudo Internal-> ] (-> ScalarType "regdictionary" )-> False-> , EnvCreateFunction-> FunName-> "regdictionarysend"-> [ ScalarType "regdictionary"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regexeqjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "regexeqsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "regexnejoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "regexnesel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "regexp_matches"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> SetOfType ( ArrayType ( ScalarType "text" ) ) )-> False-> , EnvCreateFunction-> FunName-> "regexp_matches"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> SetOfType ( ArrayType ( ScalarType "text" ) ) )-> False-> , EnvCreateFunction-> FunName-> "regexp_replace"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "regexp_replace"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "regexp_split_to_array"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ArrayType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "regexp_split_to_array"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ArrayType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "regexp_split_to_table"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> SetOfType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "regexp_split_to_table"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> SetOfType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "regoperatorin"-> [ Pseudo Cstring-> ] (-> ScalarType "regoperator" )-> False-> , EnvCreateFunction-> FunName-> "regoperatorout"-> [ ScalarType "regoperator"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regoperatorrecv"-> [ Pseudo Internal-> ] (-> ScalarType "regoperator" )-> False-> , EnvCreateFunction-> FunName-> "regoperatorsend"-> [ ScalarType "regoperator"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regoperin"-> [ Pseudo Cstring-> ] (-> ScalarType "regoper" )-> False-> , EnvCreateFunction-> FunName-> "regoperout"-> [ ScalarType "regoper"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regoperrecv"-> [ Pseudo Internal-> ] (-> ScalarType "regoper" )-> False-> , EnvCreateFunction-> FunName-> "regopersend"-> [ ScalarType "regoper"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regprocedurein"-> [ Pseudo Cstring-> ] (-> ScalarType "regprocedure" )-> False-> , EnvCreateFunction-> FunName-> "regprocedureout"-> [ ScalarType "regprocedure"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regprocedurerecv"-> [ Pseudo Internal-> ] (-> ScalarType "regprocedure" )-> False-> , EnvCreateFunction-> FunName-> "regproceduresend"-> [ ScalarType "regprocedure"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regprocin"-> [ Pseudo Cstring-> ] (-> ScalarType "regproc" )-> False-> , EnvCreateFunction-> FunName-> "regprocout"-> [ ScalarType "regproc"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regprocrecv"-> [ Pseudo Internal-> ] (-> ScalarType "regproc" )-> False-> , EnvCreateFunction-> FunName-> "regprocsend"-> [ ScalarType "regproc"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "regtypein"-> [ Pseudo Cstring-> ] (-> ScalarType "regtype" )-> False-> , EnvCreateFunction-> FunName-> "regtypeout"-> [ ScalarType "regtype"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "regtyperecv"-> [ Pseudo Internal-> ] (-> ScalarType "regtype" )-> False-> , EnvCreateFunction-> FunName-> "regtypesend"-> [ ScalarType "regtype"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "reltime"-> [ ScalarType "interval"-> ] (-> ScalarType "reltime" )-> False-> , EnvCreateFunction-> FunName-> "reltimeeq"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "reltimege"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "reltimegt"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "reltimein"-> [ Pseudo Cstring-> ] (-> ScalarType "reltime" )-> False-> , EnvCreateFunction-> FunName-> "reltimele"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "reltimelt"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "reltimene"-> [ ScalarType "reltime"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "reltimeout"-> [ ScalarType "reltime"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "reltimerecv"-> [ Pseudo Internal-> ] (-> ScalarType "reltime" )-> False-> , EnvCreateFunction-> FunName-> "reltimesend"-> [ ScalarType "reltime"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "repeat"-> [ ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "replace"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "round"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "round"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "round"-> [ ScalarType "numeric"-> , ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "rpad"-> [ ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "rpad"-> [ ScalarType "text"-> , ScalarType "int4"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "rtrim"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "rtrim"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "scalargtjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "scalargtsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "scalarltjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "scalarltsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "schema_to_xml"-> [ ScalarType "name"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "schema_to_xml_and_xmlschema"-> [ ScalarType "name"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "schema_to_xmlschema"-> [ ScalarType "name"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "session_user"-> [] (-> ScalarType "name" )-> False-> , EnvCreateFunction-> FunName-> "set_bit"-> [ ScalarType "bytea"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "set_byte"-> [ ScalarType "bytea"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "set_config"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "set_masklen"-> [ ScalarType "cidr"-> , ScalarType "int4"-> ] (-> ScalarType "cidr" )-> False-> , EnvCreateFunction-> FunName-> "set_masklen"-> [ ScalarType "inet"-> , ScalarType "int4"-> ] (-> ScalarType "inet" )-> False-> , EnvCreateFunction-> FunName-> "setseed"-> [ ScalarType "float8"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "setval"-> [ ScalarType "regclass"-> , ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "setval"-> [ ScalarType "regclass"-> , ScalarType "int8"-> , ScalarType "bool"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "setweight"-> [ ScalarType "tsvector"-> , ScalarType "char"-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "shell_in"-> [ Pseudo Cstring-> ] (-> Pseudo Opaque )-> False-> , EnvCreateFunction-> FunName-> "shell_out"-> [ Pseudo Opaque-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "shift_jis_2004_to_euc_jis_2004"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "shift_jis_2004_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "shobj_description"-> [ ScalarType "oid"-> , ScalarType "name"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "sign"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "sign"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "similar_escape"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "sin"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "sjis_to_euc_jp"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "sjis_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "sjis_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "slope"-> [ ScalarType "point"-> , ScalarType "point"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "smgreq"-> [ ScalarType "smgr"-> , ScalarType "smgr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "smgrin"-> [ Pseudo Cstring-> ] (-> ScalarType "smgr" )-> False-> , EnvCreateFunction-> FunName-> "smgrne"-> [ ScalarType "smgr"-> , ScalarType "smgr"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "smgrout"-> [ ScalarType "smgr"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "split_part"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "sqrt"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "sqrt"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "statement_timestamp"-> [] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "string_to_array"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ArrayType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "strip"-> [ ScalarType "tsvector"-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "strpos"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "substr"-> [ ScalarType "bytea"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "substr"-> [ ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "substr"-> [ ScalarType "bytea"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "substr"-> [ ScalarType "text"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "bytea"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "bit"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "bytea"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "text"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "substring"-> [ ScalarType "bit"-> , ScalarType "int4"-> , ScalarType "int4"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunName-> "suppress_redundant_updates_trigger"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "table_to_xml"-> [ ScalarType "regclass"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "table_to_xml_and_xmlschema"-> [ ScalarType "regclass"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "table_to_xmlschema"-> [ ScalarType "regclass"-> , ScalarType "bool"-> , ScalarType "bool"-> , ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "tan"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "text"-> [ ScalarType "bool"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text"-> [ ScalarType "char"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text"-> [ ScalarType "name"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text"-> [ ScalarType "xml"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text"-> [ ScalarType "inet"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text"-> [ ScalarType "bpchar"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text_ge"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_gt"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_larger"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "text_le"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_lt"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_pattern_ge"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_pattern_gt"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_pattern_le"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_pattern_lt"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "text_smaller"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "textanycat"-> [ ScalarType "text"-> , Pseudo AnyNonArray-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "textcat"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "texteq"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "texticlike"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "texticnlike"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "texticregexeq"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "texticregexne"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "textin"-> [ Pseudo Cstring-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "textlen"-> [ ScalarType "text"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "textlike"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "textne"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "textnlike"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "textout"-> [ ScalarType "text"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "textrecv"-> [ Pseudo Internal-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "textregexeq"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "textregexne"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "textsend"-> [ ScalarType "text"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "thesaurus_init"-> [ Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "thesaurus_lexize"-> [ Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> , Pseudo Internal-> ] (-> Pseudo Internal )-> False-> , EnvCreateFunction-> FunName-> "tideq"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tidge"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tidgt"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tidin"-> [ Pseudo Cstring-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunName-> "tidlarger"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunName-> "tidle"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tidlt"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tidne"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tidout"-> [ ScalarType "tid"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "tidrecv"-> [ Pseudo Internal-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunName-> "tidsend"-> [ ScalarType "tid"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "tidsmaller"-> [ ScalarType "tid"-> , ScalarType "tid"-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunName-> "time"-> [ ScalarType "abstime"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time"-> [ ScalarType "timestamp"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time"-> [ ScalarType "interval"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time"-> [ ScalarType "timetz"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time"-> [ ScalarType "time"-> , ScalarType "int4"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time_cmp"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "time_eq"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "time_ge"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "time_gt"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "time_hash"-> [ ScalarType "time"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "time_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time_larger"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time_le"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "time_lt"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "time_mi_interval"-> [ ScalarType "time"-> , ScalarType "interval"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time_mi_time"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "time_ne"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "time_out"-> [ ScalarType "time"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "time_pl_interval"-> [ ScalarType "time"-> , ScalarType "interval"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "time_send"-> [ ScalarType "time"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "time_smaller"-> [ ScalarType "time"-> , ScalarType "time"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunName-> "timedate_pl"-> [ ScalarType "time"-> , ScalarType "date"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timemi"-> [ ScalarType "abstime"-> , ScalarType "reltime"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "timenow"-> [] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "timeofday"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "timepl"-> [ ScalarType "abstime"-> , ScalarType "reltime"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "timestamp"-> [ ScalarType "abstime"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp"-> [ ScalarType "date"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp"-> [ ScalarType "date"-> , ScalarType "time"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp"-> [ ScalarType "timestamp"-> , ScalarType "int4"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_cmp"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_cmp_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_cmp_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_eq"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_eq_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_eq_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_ge"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_ge_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_ge_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_gt"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_gt_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_gt_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_hash"-> [ ScalarType "timestamp"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_larger"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_le"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_le_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_le_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_lt"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_lt_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_lt_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_mi"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_mi_interval"-> [ ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_ne"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_ne_date"-> [ ScalarType "timestamp"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_ne_timestamptz"-> [ ScalarType "timestamp"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_out"-> [ ScalarType "timestamp"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timestamp_pl_interval"-> [ ScalarType "timestamp"-> , ScalarType "interval"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_send"-> [ ScalarType "timestamp"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "timestamp_smaller"-> [ ScalarType "timestamp"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timestamptypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamptypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timestamptz"-> [ ScalarType "abstime"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz"-> [ ScalarType "date"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz"-> [ ScalarType "timestamp"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz"-> [ ScalarType "date"-> , ScalarType "time"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz"-> [ ScalarType "date"-> , ScalarType "timetz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz"-> [ ScalarType "timestamptz"-> , ScalarType "int4"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_cmp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_cmp_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_cmp_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_eq"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_eq_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_eq_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_ge"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_ge_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_ge_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_gt"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_gt_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_gt_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_larger"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_le"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_le_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_le_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_lt"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_lt_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_lt_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_mi"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_mi_interval"-> [ ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_ne"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_ne_date"-> [ ScalarType "timestamptz"-> , ScalarType "date"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_ne_timestamp"-> [ ScalarType "timestamptz"-> , ScalarType "timestamp"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_out"-> [ ScalarType "timestamptz"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_pl_interval"-> [ ScalarType "timestamptz"-> , ScalarType "interval"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_send"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "timestamptz_smaller"-> [ ScalarType "timestamptz"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timestamptztypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timestamptztypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timetypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timetypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timetz"-> [ ScalarType "time"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz"-> [ ScalarType "timetz"-> , ScalarType "int4"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz_cmp"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timetz_eq"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timetz_ge"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timetz_gt"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timetz_hash"-> [ ScalarType "timetz"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timetz_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz_larger"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz_le"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timetz_lt"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timetz_mi_interval"-> [ ScalarType "timetz"-> , ScalarType "interval"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz_ne"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "timetz_out"-> [ ScalarType "timetz"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timetz_pl_interval"-> [ ScalarType "timetz"-> , ScalarType "interval"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetz_send"-> [ ScalarType "timetz"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "timetz_smaller"-> [ ScalarType "timetz"-> , ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timetzdate_pl"-> [ ScalarType "timetz"-> , ScalarType "date"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timetztypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "timetztypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "timezone"-> [ ScalarType "text"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timezone"-> [ ScalarType "text"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timezone"-> [ ScalarType "text"-> , ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "timezone"-> [ ScalarType "interval"-> , ScalarType "timestamp"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "timezone"-> [ ScalarType "interval"-> , ScalarType "timestamptz"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunName-> "timezone"-> [ ScalarType "interval"-> , ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunName-> "tinterval"-> [ ScalarType "abstime"-> , ScalarType "abstime"-> ] (-> ScalarType "tinterval" )-> False-> , EnvCreateFunction-> FunName-> "tintervalct"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalend"-> [ ScalarType "tinterval"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "tintervaleq"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalge"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalgt"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalin"-> [ Pseudo Cstring-> ] (-> ScalarType "tinterval" )-> False-> , EnvCreateFunction-> FunName-> "tintervalle"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalleneq"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervallenge"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervallengt"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervallenle"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervallenlt"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervallenne"-> [ ScalarType "tinterval"-> , ScalarType "reltime"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervallt"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalne"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalout"-> [ ScalarType "tinterval"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "tintervalov"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalrecv"-> [ Pseudo Internal-> ] (-> ScalarType "tinterval" )-> False-> , EnvCreateFunction-> FunName-> "tintervalrel"-> [ ScalarType "tinterval"-> ] (-> ScalarType "reltime" )-> False-> , EnvCreateFunction-> FunName-> "tintervalsame"-> [ ScalarType "tinterval"-> , ScalarType "tinterval"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tintervalsend"-> [ ScalarType "tinterval"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "tintervalstart"-> [ ScalarType "tinterval"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunName-> "to_ascii"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_ascii"-> [ ScalarType "text"-> , ScalarType "name"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_ascii"-> [ ScalarType "text"-> , ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "int8"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "int4"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "float4"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "float8"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "timestamp"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "timestamptz"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "interval"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_char"-> [ ScalarType "numeric"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_date"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunName-> "to_hex"-> [ ScalarType "int8"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_hex"-> [ ScalarType "int4"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "to_number"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "to_timestamp"-> [ ScalarType "float8"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "to_timestamp"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "to_tsquery"-> [ ScalarType "text"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "to_tsquery"-> [ ScalarType "regconfig"-> , ScalarType "text"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "to_tsvector"-> [ ScalarType "text"-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "to_tsvector"-> [ ScalarType "regconfig"-> , ScalarType "text"-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "transaction_timestamp"-> [] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunName-> "translate"-> [ ScalarType "text"-> , ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "trigger_in"-> [ Pseudo Cstring-> ] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "trigger_out"-> [ Pseudo Trigger-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "trunc"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "trunc"-> [ ScalarType "macaddr"-> ] (-> ScalarType "macaddr" )-> False-> , EnvCreateFunction-> FunName-> "trunc"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "trunc"-> [ ScalarType "numeric"-> , ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunName-> "ts_debug"-> [ ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_debug"-> [ ScalarType "regconfig"-> , ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_headline"-> [ ScalarType "text"-> , ScalarType "tsquery"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "ts_headline"-> [ ScalarType "text"-> , ScalarType "tsquery"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "ts_headline"-> [ ScalarType "regconfig"-> , ScalarType "text"-> , ScalarType "tsquery"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "ts_headline"-> [ ScalarType "regconfig"-> , ScalarType "text"-> , ScalarType "tsquery"-> , ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "ts_lexize"-> [ ScalarType "regdictionary"-> , ScalarType "text"-> ] (-> ArrayType ( ScalarType "text" ) )-> False-> , EnvCreateFunction-> FunName-> "ts_match_qv"-> [ ScalarType "tsquery"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ts_match_tq"-> [ ScalarType "text"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ts_match_tt"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ts_match_vq"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "ts_parse"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_parse"-> [ ScalarType "oid"-> , ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_rank"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank"-> [ ArrayType ( ScalarType "float4" )-> , ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> , ScalarType "int4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank"-> [ ArrayType ( ScalarType "float4" )-> , ScalarType "tsvector"-> , ScalarType "tsquery"-> , ScalarType "int4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank_cd"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank_cd"-> [ ArrayType ( ScalarType "float4" )-> , ScalarType "tsvector"-> , ScalarType "tsquery"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank_cd"-> [ ScalarType "tsvector"-> , ScalarType "tsquery"-> , ScalarType "int4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rank_cd"-> [ ArrayType ( ScalarType "float4" )-> , ScalarType "tsvector"-> , ScalarType "tsquery"-> , ScalarType "int4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunName-> "ts_rewrite"-> [ ScalarType "tsquery"-> , ScalarType "text"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "ts_rewrite"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "ts_stat"-> [ ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_stat"-> [ ScalarType "text"-> , ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_token_type"-> [ ScalarType "text"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_token_type"-> [ ScalarType "oid"-> ] (-> SetOfType ( Pseudo Record ) )-> False-> , EnvCreateFunction-> FunName-> "ts_typanalyze"-> [ Pseudo Internal-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsmatchjoinsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int2"-> , Pseudo Internal-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "tsmatchsel"-> [ Pseudo Internal-> , ScalarType "oid"-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "tsq_mcontained"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsq_mcontains"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_and"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_cmp"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_eq"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_ge"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_gt"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_le"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_lt"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_ne"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_not"-> [ ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "tsquery_or"-> [ ScalarType "tsquery"-> , ScalarType "tsquery"-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "tsqueryin"-> [ Pseudo Cstring-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "tsqueryout"-> [ ScalarType "tsquery"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "tsqueryrecv"-> [ Pseudo Internal-> ] (-> ScalarType "tsquery" )-> False-> , EnvCreateFunction-> FunName-> "tsquerysend"-> [ ScalarType "tsquery"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_cmp"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_concat"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_eq"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_ge"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_gt"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_le"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_lt"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_ne"-> [ ScalarType "tsvector"-> , ScalarType "tsvector"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "tsvector_update_trigger"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "tsvector_update_trigger_column"-> [] (-> Pseudo Trigger )-> False-> , EnvCreateFunction-> FunName-> "tsvectorin"-> [ Pseudo Cstring-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "tsvectorout"-> [ ScalarType "tsvector"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "tsvectorrecv"-> [ Pseudo Internal-> ] (-> ScalarType "tsvector" )-> False-> , EnvCreateFunction-> FunName-> "tsvectorsend"-> [ ScalarType "tsvector"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "txid_current"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "txid_current_snapshot"-> [] (-> ScalarType "txid_snapshot" )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_in"-> [ Pseudo Cstring-> ] (-> ScalarType "txid_snapshot" )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_out"-> [ ScalarType "txid_snapshot"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_recv"-> [ Pseudo Internal-> ] (-> ScalarType "txid_snapshot" )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_send"-> [ ScalarType "txid_snapshot"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_xip"-> [ ScalarType "txid_snapshot"-> ] (-> SetOfType ( ScalarType "int8" ) )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_xmax"-> [ ScalarType "txid_snapshot"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "txid_snapshot_xmin"-> [ ScalarType "txid_snapshot"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunName-> "txid_visible_in_snapshot"-> [ ScalarType "int8"-> , ScalarType "txid_snapshot"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uhc_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "unknownin"-> [ Pseudo Cstring-> ] (-> ScalarType "unknown" )-> False-> , EnvCreateFunction-> FunName-> "unknownout"-> [ ScalarType "unknown"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "unknownrecv"-> [ Pseudo Internal-> ] (-> ScalarType "unknown" )-> False-> , EnvCreateFunction-> FunName-> "unknownsend"-> [ ScalarType "unknown"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "unnest"-> [ Pseudo AnyArray-> ] (-> SetOfType ( Pseudo AnyElement ) )-> False-> , EnvCreateFunction-> FunName-> "upper"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_ascii"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_big5"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_euc_cn"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_euc_jis_2004"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_euc_jp"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_euc_kr"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_euc_tw"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_gb18030"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_gbk"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_iso8859"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_iso8859_1"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_johab"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_koi8r"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_koi8u"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_shift_jis_2004"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_sjis"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_uhc"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "utf8_to_win"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "uuid_cmp"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "uuid_eq"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uuid_ge"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uuid_gt"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uuid_hash"-> [ ScalarType "uuid"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "uuid_in"-> [ Pseudo Cstring-> ] (-> ScalarType "uuid" )-> False-> , EnvCreateFunction-> FunName-> "uuid_le"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uuid_lt"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uuid_ne"-> [ ScalarType "uuid"-> , ScalarType "uuid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "uuid_out"-> [ ScalarType "uuid"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "uuid_recv"-> [ Pseudo Internal-> ] (-> ScalarType "uuid" )-> False-> , EnvCreateFunction-> FunName-> "uuid_send"-> [ ScalarType "uuid"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "varbit"-> [ ScalarType "varbit"-> , ScalarType "int4"-> , ScalarType "bool"-> ] (-> ScalarType "varbit" )-> False-> , EnvCreateFunction-> FunName-> "varbit_in"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "varbit" )-> False-> , EnvCreateFunction-> FunName-> "varbit_out"-> [ ScalarType "varbit"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "varbit_recv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "varbit" )-> False-> , EnvCreateFunction-> FunName-> "varbit_send"-> [ ScalarType "varbit"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "varbitcmp"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "varbiteq"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "varbitge"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "varbitgt"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "varbitle"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "varbitlt"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "varbitne"-> [ ScalarType "varbit"-> , ScalarType "varbit"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "varbittypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "varbittypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "varchar"-> [ ScalarType "name"-> ] (-> ScalarType "varchar" )-> False-> , EnvCreateFunction-> FunName-> "varchar"-> [ ScalarType "varchar"-> , ScalarType "int4"-> , ScalarType "bool"-> ] (-> ScalarType "varchar" )-> False-> , EnvCreateFunction-> FunName-> "varcharin"-> [ Pseudo Cstring-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "varchar" )-> False-> , EnvCreateFunction-> FunName-> "varcharout"-> [ ScalarType "varchar"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "varcharrecv"-> [ Pseudo Internal-> , ScalarType "oid"-> , ScalarType "int4"-> ] (-> ScalarType "varchar" )-> False-> , EnvCreateFunction-> FunName-> "varcharsend"-> [ ScalarType "varchar"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "varchartypmodin"-> [ ArrayType ( Pseudo Cstring )-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "varchartypmodout"-> [ ScalarType "int4"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "version"-> [] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunName-> "void_in"-> [ Pseudo Cstring-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "void_out"-> [ Pseudo Void-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "width"-> [ ScalarType "box"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunName-> "width_bucket"-> [ ScalarType "float8"-> , ScalarType "float8"-> , ScalarType "float8"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "width_bucket"-> [ ScalarType "numeric"-> , ScalarType "numeric"-> , ScalarType "numeric"-> , ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunName-> "win1250_to_latin2"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win1250_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win1251_to_iso"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win1251_to_koi8r"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win1251_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win1251_to_win866"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win866_to_iso"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win866_to_koi8r"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win866_to_mic"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win866_to_win1251"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "win_to_utf8"-> [ ScalarType "int4"-> , ScalarType "int4"-> , Pseudo Cstring-> , Pseudo Internal-> , ScalarType "int4"-> ] (-> Pseudo Void )-> False-> , EnvCreateFunction-> FunName-> "xideq"-> [ ScalarType "xid"-> , ScalarType "xid"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "xideqint4"-> [ ScalarType "xid"-> , ScalarType "int4"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "xidin"-> [ Pseudo Cstring-> ] (-> ScalarType "xid" )-> False-> , EnvCreateFunction-> FunName-> "xidout"-> [ ScalarType "xid"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "xidrecv"-> [ Pseudo Internal-> ] (-> ScalarType "xid" )-> False-> , EnvCreateFunction-> FunName-> "xidsend"-> [ ScalarType "xid"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "xml"-> [ ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "xml_in"-> [ Pseudo Cstring-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "xml_out"-> [ ScalarType "xml"-> ] (-> Pseudo Cstring )-> False-> , EnvCreateFunction-> FunName-> "xml_recv"-> [ Pseudo Internal-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "xml_send"-> [ ScalarType "xml"-> ] (-> ScalarType "bytea" )-> False-> , EnvCreateFunction-> FunName-> "xmlcomment"-> [ ScalarType "text"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "xmlconcat2"-> [ ScalarType "xml"-> , ScalarType "xml"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunName-> "xmlvalidate"-> [ ScalarType "xml"-> , ScalarType "text"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunName-> "xpath"-> [ ScalarType "text"-> , ScalarType "xml"-> ] (-> ArrayType ( ScalarType "xml" ) )-> False-> , EnvCreateFunction-> FunName-> "xpath"-> [ ScalarType "text"-> , ScalarType "xml"-> , ArrayType ( ScalarType "text" )-> ] (-> ArrayType ( ScalarType "xml" ) )-> False-> , EnvCreateFunction-> FunAgg-> "array_agg"-> [ Pseudo AnyElement-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunAgg-> "avg"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_and"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_and"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_and"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_and"-> [ ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_or"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_or"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_or"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunAgg-> "bit_or"-> [ ScalarType "bit"-> ] (-> ScalarType "bit" )-> False-> , EnvCreateFunction-> FunAgg-> "bool_and"-> [ ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunAgg-> "bool_or"-> [ ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunAgg-> "corr"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "count"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "count"-> [ Pseudo Any-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "covar_pop"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "covar_samp"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "every"-> [ ScalarType "bool"-> ] (-> ScalarType "bool" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "oid"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "tid"-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "abstime"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "bpchar"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "date"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "time"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunAgg-> "max"-> [ Pseudo AnyEnum-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "int8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "int2"-> ] (-> ScalarType "int2" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "text"-> ] (-> ScalarType "text" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "oid"-> ] (-> ScalarType "oid" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "tid"-> ] (-> ScalarType "tid" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "abstime"-> ] (-> ScalarType "abstime" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "bpchar"-> ] (-> ScalarType "bpchar" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "date"-> ] (-> ScalarType "date" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "time"-> ] (-> ScalarType "time" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "timestamp"-> ] (-> ScalarType "timestamp" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "timestamptz"-> ] (-> ScalarType "timestamptz" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "timetz"-> ] (-> ScalarType "timetz" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ Pseudo AnyArray-> ] (-> Pseudo AnyArray )-> False-> , EnvCreateFunction-> FunAgg-> "min"-> [ Pseudo AnyEnum-> ] (-> Pseudo AnyEnum )-> False-> , EnvCreateFunction-> FunAgg-> "regr_avgx"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_avgy"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_count"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_intercept"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_r2"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_slope"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_sxx"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_sxy"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "regr_syy"-> [ ScalarType "float8"-> , ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_pop"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_pop"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_pop"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_pop"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_pop"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_pop"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_samp"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_samp"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_samp"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_samp"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_samp"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "stddev_samp"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "int2"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "int4"-> ] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "float4"-> ] (-> ScalarType "float4" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "money"-> ] (-> ScalarType "money" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "interval"-> ] (-> ScalarType "interval" )-> False-> , EnvCreateFunction-> FunAgg-> "sum"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_pop"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_pop"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_pop"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_pop"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "var_pop"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "var_pop"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_samp"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_samp"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_samp"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "var_samp"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "var_samp"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "var_samp"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "variance"-> [ ScalarType "int8"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "variance"-> [ ScalarType "int2"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "variance"-> [ ScalarType "int4"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "variance"-> [ ScalarType "float4"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "variance"-> [ ScalarType "float8"-> ] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunAgg-> "variance"-> [ ScalarType "numeric"-> ] (-> ScalarType "numeric" )-> False-> , EnvCreateFunction-> FunAgg-> "xmlagg"-> [ ScalarType "xml"-> ] (-> ScalarType "xml" )-> False-> , EnvCreateFunction-> FunWindow-> "cume_dist"-> [] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunWindow-> "dense_rank"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunWindow-> "first_value"-> [ Pseudo AnyElement-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "lag"-> [ Pseudo AnyElement-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "lag"-> [ Pseudo AnyElement-> , ScalarType "int4"-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "lag"-> [ Pseudo AnyElement-> , ScalarType "int4"-> , Pseudo AnyElement-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "last_value"-> [ Pseudo AnyElement-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "lead"-> [ Pseudo AnyElement-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "lead"-> [ Pseudo AnyElement-> , ScalarType "int4"-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "lead"-> [ Pseudo AnyElement-> , ScalarType "int4"-> , Pseudo AnyElement-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "nth_value"-> [ Pseudo AnyElement-> , ScalarType "int4"-> ] (-> Pseudo AnyElement )-> False-> , EnvCreateFunction-> FunWindow-> "ntile"-> [ ScalarType "int4"-> ] (-> ScalarType "int4" )-> False-> , EnvCreateFunction-> FunWindow-> "percent_rank"-> [] (-> ScalarType "float8" )-> False-> , EnvCreateFunction-> FunWindow-> "rank"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateFunction-> FunWindow-> "row_number"-> [] (-> ScalarType "int8" )-> False-> , EnvCreateTable-> "pg_aggregate"-> [ ( "aggfnoid"-> , ScalarType "regproc"-> )-> , ( "aggtransfn"-> , ScalarType "regproc"-> )-> , ( "aggfinalfn"-> , ScalarType "regproc"-> )-> , ( "aggsortop"-> , ScalarType "oid"-> )-> , ( "aggtranstype"-> , ScalarType "oid"-> )-> , ( "agginitval"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_am"-> [ ( "amname"-> , ScalarType "name"-> )-> , ( "amstrategies"-> , ScalarType "int2"-> )-> , ( "amsupport"-> , ScalarType "int2"-> )-> , ( "amcanorder"-> , ScalarType "bool"-> )-> , ( "amcanbackward"-> , ScalarType "bool"-> )-> , ( "amcanunique"-> , ScalarType "bool"-> )-> , ( "amcanmulticol"-> , ScalarType "bool"-> )-> , ( "amoptionalkey"-> , ScalarType "bool"-> )-> , ( "amindexnulls"-> , ScalarType "bool"-> )-> , ( "amsearchnulls"-> , ScalarType "bool"-> )-> , ( "amstorage"-> , ScalarType "bool"-> )-> , ( "amclusterable"-> , ScalarType "bool"-> )-> , ( "amkeytype"-> , ScalarType "oid"-> )-> , ( "aminsert"-> , ScalarType "regproc"-> )-> , ( "ambeginscan"-> , ScalarType "regproc"-> )-> , ( "amgettuple"-> , ScalarType "regproc"-> )-> , ( "amgetbitmap"-> , ScalarType "regproc"-> )-> , ( "amrescan"-> , ScalarType "regproc"-> )-> , ( "amendscan"-> , ScalarType "regproc"-> )-> , ( "ammarkpos"-> , ScalarType "regproc"-> )-> , ( "amrestrpos"-> , ScalarType "regproc"-> )-> , ( "ambuild"-> , ScalarType "regproc"-> )-> , ( "ambulkdelete"-> , ScalarType "regproc"-> )-> , ( "amvacuumcleanup"-> , ScalarType "regproc"-> )-> , ( "amcostestimate"-> , ScalarType "regproc"-> )-> , ( "amoptions"-> , ScalarType "regproc"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_amop"-> [ ( "amopfamily"-> , ScalarType "oid"-> )-> , ( "amoplefttype"-> , ScalarType "oid"-> )-> , ( "amoprighttype"-> , ScalarType "oid"-> )-> , ( "amopstrategy"-> , ScalarType "int2"-> )-> , ( "amopopr"-> , ScalarType "oid"-> )-> , ( "amopmethod"-> , ScalarType "oid"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_amproc"-> [ ( "amprocfamily"-> , ScalarType "oid"-> )-> , ( "amproclefttype"-> , ScalarType "oid"-> )-> , ( "amprocrighttype"-> , ScalarType "oid"-> )-> , ( "amprocnum"-> , ScalarType "int2"-> )-> , ( "amproc"-> , ScalarType "regproc"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_attrdef"-> [ ( "adrelid"-> , ScalarType "oid"-> )-> , ( "adnum"-> , ScalarType "int2"-> )-> , ( "adbin"-> , ScalarType "text"-> )-> , ( "adsrc"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_attribute"-> [ ( "attrelid"-> , ScalarType "oid"-> )-> , ( "attname"-> , ScalarType "name"-> )-> , ( "atttypid"-> , ScalarType "oid"-> )-> , ( "attstattarget"-> , ScalarType "int4"-> )-> , ( "attlen"-> , ScalarType "int2"-> )-> , ( "attnum"-> , ScalarType "int2"-> )-> , ( "attndims"-> , ScalarType "int4"-> )-> , ( "attcacheoff"-> , ScalarType "int4"-> )-> , ( "atttypmod"-> , ScalarType "int4"-> )-> , ( "attbyval"-> , ScalarType "bool"-> )-> , ( "attstorage"-> , ScalarType "char"-> )-> , ( "attalign"-> , ScalarType "char"-> )-> , ( "attnotnull"-> , ScalarType "bool"-> )-> , ( "atthasdef"-> , ScalarType "bool"-> )-> , ( "attisdropped"-> , ScalarType "bool"-> )-> , ( "attislocal"-> , ScalarType "bool"-> )-> , ( "attinhcount"-> , ScalarType "int4"-> )-> , ( "attacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_auth_members"-> [ ( "roleid"-> , ScalarType "oid"-> )-> , ( "member"-> , ScalarType "oid"-> )-> , ( "grantor"-> , ScalarType "oid"-> )-> , ( "admin_option"-> , ScalarType "bool"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_authid"-> [ ( "rolname"-> , ScalarType "name"-> )-> , ( "rolsuper"-> , ScalarType "bool"-> )-> , ( "rolinherit"-> , ScalarType "bool"-> )-> , ( "rolcreaterole"-> , ScalarType "bool"-> )-> , ( "rolcreatedb"-> , ScalarType "bool"-> )-> , ( "rolcatupdate"-> , ScalarType "bool"-> )-> , ( "rolcanlogin"-> , ScalarType "bool"-> )-> , ( "rolconnlimit"-> , ScalarType "int4"-> )-> , ( "rolpassword"-> , ScalarType "text"-> )-> , ( "rolvaliduntil"-> , ScalarType "timestamptz"-> )-> , ( "rolconfig"-> , ArrayType ( ScalarType "text" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_cast"-> [ ( "castsource"-> , ScalarType "oid"-> )-> , ( "casttarget"-> , ScalarType "oid"-> )-> , ( "castfunc"-> , ScalarType "oid"-> )-> , ( "castcontext"-> , ScalarType "char"-> )-> , ( "castmethod"-> , ScalarType "char"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_class"-> [ ( "relname"-> , ScalarType "name"-> )-> , ( "relnamespace"-> , ScalarType "oid"-> )-> , ( "reltype"-> , ScalarType "oid"-> )-> , ( "relowner"-> , ScalarType "oid"-> )-> , ( "relam"-> , ScalarType "oid"-> )-> , ( "relfilenode"-> , ScalarType "oid"-> )-> , ( "reltablespace"-> , ScalarType "oid"-> )-> , ( "relpages"-> , ScalarType "int4"-> )-> , ( "reltuples"-> , ScalarType "float4"-> )-> , ( "reltoastrelid"-> , ScalarType "oid"-> )-> , ( "reltoastidxid"-> , ScalarType "oid"-> )-> , ( "relhasindex"-> , ScalarType "bool"-> )-> , ( "relisshared"-> , ScalarType "bool"-> )-> , ( "relistemp"-> , ScalarType "bool"-> )-> , ( "relkind"-> , ScalarType "char"-> )-> , ( "relnatts"-> , ScalarType "int2"-> )-> , ( "relchecks"-> , ScalarType "int2"-> )-> , ( "relhasoids"-> , ScalarType "bool"-> )-> , ( "relhaspkey"-> , ScalarType "bool"-> )-> , ( "relhasrules"-> , ScalarType "bool"-> )-> , ( "relhastriggers"-> , ScalarType "bool"-> )-> , ( "relhassubclass"-> , ScalarType "bool"-> )-> , ( "relfrozenxid"-> , ScalarType "xid"-> )-> , ( "relacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> , ( "reloptions"-> , ArrayType ( ScalarType "text" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_constraint"-> [ ( "conname"-> , ScalarType "name"-> )-> , ( "connamespace"-> , ScalarType "oid"-> )-> , ( "contype"-> , ScalarType "char"-> )-> , ( "condeferrable"-> , ScalarType "bool"-> )-> , ( "condeferred"-> , ScalarType "bool"-> )-> , ( "conrelid"-> , ScalarType "oid"-> )-> , ( "contypid"-> , ScalarType "oid"-> )-> , ( "confrelid"-> , ScalarType "oid"-> )-> , ( "confupdtype"-> , ScalarType "char"-> )-> , ( "confdeltype"-> , ScalarType "char"-> )-> , ( "confmatchtype"-> , ScalarType "char"-> )-> , ( "conislocal"-> , ScalarType "bool"-> )-> , ( "coninhcount"-> , ScalarType "int4"-> )-> , ( "conkey"-> , ArrayType ( ScalarType "int2" )-> )-> , ( "confkey"-> , ArrayType ( ScalarType "int2" )-> )-> , ( "conpfeqop"-> , ArrayType ( ScalarType "oid" )-> )-> , ( "conppeqop"-> , ArrayType ( ScalarType "oid" )-> )-> , ( "conffeqop"-> , ArrayType ( ScalarType "oid" )-> )-> , ( "conbin"-> , ScalarType "text"-> )-> , ( "consrc"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_conversion"-> [ ( "conname"-> , ScalarType "name"-> )-> , ( "connamespace"-> , ScalarType "oid"-> )-> , ( "conowner"-> , ScalarType "oid"-> )-> , ( "conforencoding"-> , ScalarType "int4"-> )-> , ( "contoencoding"-> , ScalarType "int4"-> )-> , ( "conproc"-> , ScalarType "regproc"-> )-> , ( "condefault"-> , ScalarType "bool"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_database"-> [ ( "datname"-> , ScalarType "name"-> )-> , ( "datdba"-> , ScalarType "oid"-> )-> , ( "encoding"-> , ScalarType "int4"-> )-> , ( "datcollate"-> , ScalarType "name"-> )-> , ( "datctype"-> , ScalarType "name"-> )-> , ( "datistemplate"-> , ScalarType "bool"-> )-> , ( "datallowconn"-> , ScalarType "bool"-> )-> , ( "datconnlimit"-> , ScalarType "int4"-> )-> , ( "datlastsysoid"-> , ScalarType "oid"-> )-> , ( "datfrozenxid"-> , ScalarType "xid"-> )-> , ( "dattablespace"-> , ScalarType "oid"-> )-> , ( "datconfig"-> , ArrayType ( ScalarType "text" )-> )-> , ( "datacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_depend"-> [ ( "classid"-> , ScalarType "oid"-> )-> , ( "objid"-> , ScalarType "oid"-> )-> , ( "objsubid"-> , ScalarType "int4"-> )-> , ( "refclassid"-> , ScalarType "oid"-> )-> , ( "refobjid"-> , ScalarType "oid"-> )-> , ( "refobjsubid"-> , ScalarType "int4"-> )-> , ( "deptype"-> , ScalarType "char"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_description"-> [ ( "objoid"-> , ScalarType "oid"-> )-> , ( "classoid"-> , ScalarType "oid"-> )-> , ( "objsubid"-> , ScalarType "int4"-> )-> , ( "description"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_enum"-> [ ( "enumtypid"-> , ScalarType "oid"-> )-> , ( "enumlabel"-> , ScalarType "name"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_foreign_data_wrapper"-> [ ( "fdwname"-> , ScalarType "name"-> )-> , ( "fdwowner"-> , ScalarType "oid"-> )-> , ( "fdwvalidator"-> , ScalarType "oid"-> )-> , ( "fdwacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> , ( "fdwoptions"-> , ArrayType ( ScalarType "text" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_foreign_server"-> [ ( "srvname"-> , ScalarType "name"-> )-> , ( "srvowner"-> , ScalarType "oid"-> )-> , ( "srvfdw"-> , ScalarType "oid"-> )-> , ( "srvtype"-> , ScalarType "text"-> )-> , ( "srvversion"-> , ScalarType "text"-> )-> , ( "srvacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> , ( "srvoptions"-> , ArrayType ( ScalarType "text" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_index"-> [ ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "indrelid"-> , ScalarType "oid"-> )-> , ( "indnatts"-> , ScalarType "int2"-> )-> , ( "indisunique"-> , ScalarType "bool"-> )-> , ( "indisprimary"-> , ScalarType "bool"-> )-> , ( "indisclustered"-> , ScalarType "bool"-> )-> , ( "indisvalid"-> , ScalarType "bool"-> )-> , ( "indcheckxmin"-> , ScalarType "bool"-> )-> , ( "indisready"-> , ScalarType "bool"-> )-> , ( "indkey"-> , ScalarType "int2vector"-> )-> , ( "indclass"-> , ScalarType "oidvector"-> )-> , ( "indoption"-> , ScalarType "int2vector"-> )-> , ( "indexprs"-> , ScalarType "text"-> )-> , ( "indpred"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_inherits"-> [ ( "inhrelid"-> , ScalarType "oid"-> )-> , ( "inhparent"-> , ScalarType "oid"-> )-> , ( "inhseqno"-> , ScalarType "int4"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_language"-> [ ( "lanname"-> , ScalarType "name"-> )-> , ( "lanowner"-> , ScalarType "oid"-> )-> , ( "lanispl"-> , ScalarType "bool"-> )-> , ( "lanpltrusted"-> , ScalarType "bool"-> )-> , ( "lanplcallfoid"-> , ScalarType "oid"-> )-> , ( "lanvalidator"-> , ScalarType "oid"-> )-> , ( "lanacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_largeobject"-> [ ( "loid"-> , ScalarType "oid"-> )-> , ( "pageno"-> , ScalarType "int4"-> )-> , ( "data"-> , ScalarType "bytea"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_listener"-> [ ( "relname"-> , ScalarType "name"-> )-> , ( "listenerpid"-> , ScalarType "int4"-> )-> , ( "notification"-> , ScalarType "int4"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_namespace"-> [ ( "nspname"-> , ScalarType "name"-> )-> , ( "nspowner"-> , ScalarType "oid"-> )-> , ( "nspacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_opclass"-> [ ( "opcmethod"-> , ScalarType "oid"-> )-> , ( "opcname"-> , ScalarType "name"-> )-> , ( "opcnamespace"-> , ScalarType "oid"-> )-> , ( "opcowner"-> , ScalarType "oid"-> )-> , ( "opcfamily"-> , ScalarType "oid"-> )-> , ( "opcintype"-> , ScalarType "oid"-> )-> , ( "opcdefault"-> , ScalarType "bool"-> )-> , ( "opckeytype"-> , ScalarType "oid"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_operator"-> [ ( "oprname"-> , ScalarType "name"-> )-> , ( "oprnamespace"-> , ScalarType "oid"-> )-> , ( "oprowner"-> , ScalarType "oid"-> )-> , ( "oprkind"-> , ScalarType "char"-> )-> , ( "oprcanmerge"-> , ScalarType "bool"-> )-> , ( "oprcanhash"-> , ScalarType "bool"-> )-> , ( "oprleft"-> , ScalarType "oid"-> )-> , ( "oprright"-> , ScalarType "oid"-> )-> , ( "oprresult"-> , ScalarType "oid"-> )-> , ( "oprcom"-> , ScalarType "oid"-> )-> , ( "oprnegate"-> , ScalarType "oid"-> )-> , ( "oprcode"-> , ScalarType "regproc"-> )-> , ( "oprrest"-> , ScalarType "regproc"-> )-> , ( "oprjoin"-> , ScalarType "regproc"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_opfamily"-> [ ( "opfmethod"-> , ScalarType "oid"-> )-> , ( "opfname"-> , ScalarType "name"-> )-> , ( "opfnamespace"-> , ScalarType "oid"-> )-> , ( "opfowner"-> , ScalarType "oid"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_pltemplate"-> [ ( "tmplname"-> , ScalarType "name"-> )-> , ( "tmpltrusted"-> , ScalarType "bool"-> )-> , ( "tmpldbacreate"-> , ScalarType "bool"-> )-> , ( "tmplhandler"-> , ScalarType "text"-> )-> , ( "tmplvalidator"-> , ScalarType "text"-> )-> , ( "tmpllibrary"-> , ScalarType "text"-> )-> , ( "tmplacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_proc"-> [ ( "proname"-> , ScalarType "name"-> )-> , ( "pronamespace"-> , ScalarType "oid"-> )-> , ( "proowner"-> , ScalarType "oid"-> )-> , ( "prolang"-> , ScalarType "oid"-> )-> , ( "procost"-> , ScalarType "float4"-> )-> , ( "prorows"-> , ScalarType "float4"-> )-> , ( "provariadic"-> , ScalarType "oid"-> )-> , ( "proisagg"-> , ScalarType "bool"-> )-> , ( "proiswindow"-> , ScalarType "bool"-> )-> , ( "prosecdef"-> , ScalarType "bool"-> )-> , ( "proisstrict"-> , ScalarType "bool"-> )-> , ( "proretset"-> , ScalarType "bool"-> )-> , ( "provolatile"-> , ScalarType "char"-> )-> , ( "pronargs"-> , ScalarType "int2"-> )-> , ( "pronargdefaults"-> , ScalarType "int2"-> )-> , ( "prorettype"-> , ScalarType "oid"-> )-> , ( "proargtypes"-> , ScalarType "oidvector"-> )-> , ( "proallargtypes"-> , ArrayType ( ScalarType "oid" )-> )-> , ( "proargmodes"-> , ArrayType ( ScalarType "char" )-> )-> , ( "proargnames"-> , ArrayType ( ScalarType "text" )-> )-> , ( "proargdefaults"-> , ScalarType "text"-> )-> , ( "prosrc"-> , ScalarType "text"-> )-> , ( "probin"-> , ScalarType "bytea"-> )-> , ( "proconfig"-> , ArrayType ( ScalarType "text" )-> )-> , ( "proacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_rewrite"-> [ ( "rulename"-> , ScalarType "name"-> )-> , ( "ev_class"-> , ScalarType "oid"-> )-> , ( "ev_attr"-> , ScalarType "int2"-> )-> , ( "ev_type"-> , ScalarType "char"-> )-> , ( "ev_enabled"-> , ScalarType "char"-> )-> , ( "is_instead"-> , ScalarType "bool"-> )-> , ( "ev_qual"-> , ScalarType "text"-> )-> , ( "ev_action"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_shdepend"-> [ ( "dbid"-> , ScalarType "oid"-> )-> , ( "classid"-> , ScalarType "oid"-> )-> , ( "objid"-> , ScalarType "oid"-> )-> , ( "objsubid"-> , ScalarType "int4"-> )-> , ( "refclassid"-> , ScalarType "oid"-> )-> , ( "refobjid"-> , ScalarType "oid"-> )-> , ( "deptype"-> , ScalarType "char"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_shdescription"-> [ ( "objoid"-> , ScalarType "oid"-> )-> , ( "classoid"-> , ScalarType "oid"-> )-> , ( "description"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_statistic"-> [ ( "starelid"-> , ScalarType "oid"-> )-> , ( "staattnum"-> , ScalarType "int2"-> )-> , ( "stanullfrac"-> , ScalarType "float4"-> )-> , ( "stawidth"-> , ScalarType "int4"-> )-> , ( "stadistinct"-> , ScalarType "float4"-> )-> , ( "stakind1"-> , ScalarType "int2"-> )-> , ( "stakind2"-> , ScalarType "int2"-> )-> , ( "stakind3"-> , ScalarType "int2"-> )-> , ( "stakind4"-> , ScalarType "int2"-> )-> , ( "staop1"-> , ScalarType "oid"-> )-> , ( "staop2"-> , ScalarType "oid"-> )-> , ( "staop3"-> , ScalarType "oid"-> )-> , ( "staop4"-> , ScalarType "oid"-> )-> , ( "stanumbers1"-> , ArrayType ( ScalarType "float4" )-> )-> , ( "stanumbers2"-> , ArrayType ( ScalarType "float4" )-> )-> , ( "stanumbers3"-> , ArrayType ( ScalarType "float4" )-> )-> , ( "stanumbers4"-> , ArrayType ( ScalarType "float4" )-> )-> , ( "stavalues1"-> , Pseudo AnyArray-> )-> , ( "stavalues2"-> , Pseudo AnyArray-> )-> , ( "stavalues3"-> , Pseudo AnyArray-> )-> , ( "stavalues4"-> , Pseudo AnyArray-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_tablespace"-> [ ( "spcname"-> , ScalarType "name"-> )-> , ( "spcowner"-> , ScalarType "oid"-> )-> , ( "spclocation"-> , ScalarType "text"-> )-> , ( "spcacl"-> , ArrayType ( ScalarType "aclitem" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_trigger"-> [ ( "tgrelid"-> , ScalarType "oid"-> )-> , ( "tgname"-> , ScalarType "name"-> )-> , ( "tgfoid"-> , ScalarType "oid"-> )-> , ( "tgtype"-> , ScalarType "int2"-> )-> , ( "tgenabled"-> , ScalarType "char"-> )-> , ( "tgisconstraint"-> , ScalarType "bool"-> )-> , ( "tgconstrname"-> , ScalarType "name"-> )-> , ( "tgconstrrelid"-> , ScalarType "oid"-> )-> , ( "tgconstraint"-> , ScalarType "oid"-> )-> , ( "tgdeferrable"-> , ScalarType "bool"-> )-> , ( "tginitdeferred"-> , ScalarType "bool"-> )-> , ( "tgnargs"-> , ScalarType "int2"-> )-> , ( "tgattr"-> , ScalarType "int2vector"-> )-> , ( "tgargs"-> , ScalarType "bytea"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_ts_config"-> [ ( "cfgname"-> , ScalarType "name"-> )-> , ( "cfgnamespace"-> , ScalarType "oid"-> )-> , ( "cfgowner"-> , ScalarType "oid"-> )-> , ( "cfgparser"-> , ScalarType "oid"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_ts_config_map"-> [ ( "mapcfg"-> , ScalarType "oid"-> )-> , ( "maptokentype"-> , ScalarType "int4"-> )-> , ( "mapseqno"-> , ScalarType "int4"-> )-> , ( "mapdict"-> , ScalarType "oid"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_ts_dict"-> [ ( "dictname"-> , ScalarType "name"-> )-> , ( "dictnamespace"-> , ScalarType "oid"-> )-> , ( "dictowner"-> , ScalarType "oid"-> )-> , ( "dicttemplate"-> , ScalarType "oid"-> )-> , ( "dictinitoption"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_ts_parser"-> [ ( "prsname"-> , ScalarType "name"-> )-> , ( "prsnamespace"-> , ScalarType "oid"-> )-> , ( "prsstart"-> , ScalarType "regproc"-> )-> , ( "prstoken"-> , ScalarType "regproc"-> )-> , ( "prsend"-> , ScalarType "regproc"-> )-> , ( "prsheadline"-> , ScalarType "regproc"-> )-> , ( "prslextype"-> , ScalarType "regproc"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_ts_template"-> [ ( "tmplname"-> , ScalarType "name"-> )-> , ( "tmplnamespace"-> , ScalarType "oid"-> )-> , ( "tmplinit"-> , ScalarType "regproc"-> )-> , ( "tmpllexize"-> , ScalarType "regproc"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_type"-> [ ( "typname"-> , ScalarType "name"-> )-> , ( "typnamespace"-> , ScalarType "oid"-> )-> , ( "typowner"-> , ScalarType "oid"-> )-> , ( "typlen"-> , ScalarType "int2"-> )-> , ( "typbyval"-> , ScalarType "bool"-> )-> , ( "typtype"-> , ScalarType "char"-> )-> , ( "typcategory"-> , ScalarType "char"-> )-> , ( "typispreferred"-> , ScalarType "bool"-> )-> , ( "typisdefined"-> , ScalarType "bool"-> )-> , ( "typdelim"-> , ScalarType "char"-> )-> , ( "typrelid"-> , ScalarType "oid"-> )-> , ( "typelem"-> , ScalarType "oid"-> )-> , ( "typarray"-> , ScalarType "oid"-> )-> , ( "typinput"-> , ScalarType "regproc"-> )-> , ( "typoutput"-> , ScalarType "regproc"-> )-> , ( "typreceive"-> , ScalarType "regproc"-> )-> , ( "typsend"-> , ScalarType "regproc"-> )-> , ( "typmodin"-> , ScalarType "regproc"-> )-> , ( "typmodout"-> , ScalarType "regproc"-> )-> , ( "typanalyze"-> , ScalarType "regproc"-> )-> , ( "typalign"-> , ScalarType "char"-> )-> , ( "typstorage"-> , ScalarType "char"-> )-> , ( "typnotnull"-> , ScalarType "bool"-> )-> , ( "typbasetype"-> , ScalarType "oid"-> )-> , ( "typtypmod"-> , ScalarType "int4"-> )-> , ( "typndims"-> , ScalarType "int4"-> )-> , ( "typdefaultbin"-> , ScalarType "text"-> )-> , ( "typdefault"-> , ScalarType "text"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "pg_user_mapping"-> [ ( "umuser"-> , ScalarType "oid"-> )-> , ( "umserver"-> , ScalarType "oid"-> )-> , ( "umoptions"-> , ArrayType ( ScalarType "text" )-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "oid"-> , ScalarType "oid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_features"-> [ ( "feature_id"-> , DomainType "information_schema.character_data"-> )-> , ( "feature_name"-> , DomainType "information_schema.character_data"-> )-> , ( "sub_feature_id"-> , DomainType "information_schema.character_data"-> )-> , ( "sub_feature_name"-> , DomainType "information_schema.character_data"-> )-> , ( "is_supported"-> , DomainType "information_schema.character_data"-> )-> , ( "is_verified_by"-> , DomainType "information_schema.character_data"-> )-> , ( "comments"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_implementation_info"-> [ ( "implementation_info_id"-> , DomainType "information_schema.character_data"-> )-> , ( "implementation_info_name"-> , DomainType "information_schema.character_data"-> )-> , ( "integer_value"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_value"-> , DomainType "information_schema.character_data"-> )-> , ( "comments"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_languages"-> [ ( "sql_language_source"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_language_year"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_language_conformance"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_language_integrity"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_language_implementation"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_language_binding_style"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_language_programming_language"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_packages"-> [ ( "feature_id"-> , DomainType "information_schema.character_data"-> )-> , ( "feature_name"-> , DomainType "information_schema.character_data"-> )-> , ( "is_supported"-> , DomainType "information_schema.character_data"-> )-> , ( "is_verified_by"-> , DomainType "information_schema.character_data"-> )-> , ( "comments"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_parts"-> [ ( "feature_id"-> , DomainType "information_schema.character_data"-> )-> , ( "feature_name"-> , DomainType "information_schema.character_data"-> )-> , ( "is_supported"-> , DomainType "information_schema.character_data"-> )-> , ( "is_verified_by"-> , DomainType "information_schema.character_data"-> )-> , ( "comments"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_sizing"-> [ ( "sizing_id"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "sizing_name"-> , DomainType "information_schema.character_data"-> )-> , ( "supported_value"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "comments"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateTable-> "information_schema.sql_sizing_profiles"-> [ ( "sizing_id"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "sizing_name"-> , DomainType "information_schema.character_data"-> )-> , ( "profile_id"-> , DomainType "information_schema.character_data"-> )-> , ( "required_value"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "comments"-> , DomainType "information_schema.character_data"-> )-> ]-> [ ( "tableoid"-> , ScalarType "oid"-> )-> , ( "cmax"-> , ScalarType "cid"-> )-> , ( "xmax"-> , ScalarType "xid"-> )-> , ( "cmin"-> , ScalarType "cid"-> )-> , ( "xmin"-> , ScalarType "xid"-> )-> , ( "ctid"-> , ScalarType "tid"-> )-> ]-> , EnvCreateView-> "information_schema._pg_foreign_data_wrappers"-> [ ( "oid"-> , ScalarType "oid"-> )-> , ( "fdwowner"-> , ScalarType "oid"-> )-> , ( "fdwoptions"-> , ArrayType ( ScalarType "text" )-> )-> , ( "foreign_data_wrapper_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_language"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema._pg_foreign_servers"-> [ ( "oid"-> , ScalarType "oid"-> )-> , ( "srvoptions"-> , ArrayType ( ScalarType "text" )-> )-> , ( "foreign_server_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_type"-> , DomainType "information_schema.character_data"-> )-> , ( "foreign_server_version"-> , DomainType "information_schema.character_data"-> )-> , ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema._pg_user_mappings"-> [ ( "oid"-> , ScalarType "oid"-> )-> , ( "umoptions"-> , ArrayType ( ScalarType "text" )-> )-> , ( "umuser"-> , ScalarType "oid"-> )-> , ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "srvowner"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.administrable_role_authorizations"-> [ ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "role_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.applicable_roles"-> [ ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "role_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.attributes"-> [ ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "attribute_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "ordinal_position"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "attribute_default"-> , DomainType "information_schema.character_data"-> )-> , ( "is_nullable"-> , DomainType "information_schema.character_data"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "character_maximum_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "attribute_udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "attribute_udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "attribute_udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "is_derived_reference_attribute"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.check_constraint_routine_usage"-> [ ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.check_constraints"-> [ ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "check_clause"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.column_domain_usage"-> [ ( "domain_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.column_privileges"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.column_udt_usage"-> [ ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.columns"-> [ ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "ordinal_position"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "column_default"-> , DomainType "information_schema.character_data"-> )-> , ( "is_nullable"-> , DomainType "information_schema.character_data"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "character_maximum_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "is_self_referencing"-> , DomainType "information_schema.character_data"-> )-> , ( "is_identity"-> , DomainType "information_schema.character_data"-> )-> , ( "identity_generation"-> , DomainType "information_schema.character_data"-> )-> , ( "identity_start"-> , DomainType "information_schema.character_data"-> )-> , ( "identity_increment"-> , DomainType "information_schema.character_data"-> )-> , ( "identity_maximum"-> , DomainType "information_schema.character_data"-> )-> , ( "identity_minimum"-> , DomainType "information_schema.character_data"-> )-> , ( "identity_cycle"-> , DomainType "information_schema.character_data"-> )-> , ( "is_generated"-> , DomainType "information_schema.character_data"-> )-> , ( "generation_expression"-> , DomainType "information_schema.character_data"-> )-> , ( "is_updatable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.constraint_column_usage"-> [ ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.constraint_table_usage"-> [ ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.data_type_privileges"-> [ ( "object_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_type"-> , DomainType "information_schema.character_data"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.domain_constraints"-> [ ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "is_deferrable"-> , DomainType "information_schema.character_data"-> )-> , ( "initially_deferred"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.domain_udt_usage"-> [ ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.domains"-> [ ( "domain_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "domain_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "character_maximum_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "domain_default"-> , DomainType "information_schema.character_data"-> )-> , ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.element_types"-> [ ( "object_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_type"-> , DomainType "information_schema.character_data"-> )-> , ( "collection_type_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "character_maximum_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "domain_default"-> , DomainType "information_schema.character_data"-> )-> , ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.enabled_roles"-> [ ( "role_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.foreign_data_wrapper_options"-> [ ( "foreign_data_wrapper_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "option_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "option_value"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.foreign_data_wrappers"-> [ ( "foreign_data_wrapper_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "library_name"-> , DomainType "information_schema.character_data"-> )-> , ( "foreign_data_wrapper_language"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.foreign_server_options"-> [ ( "foreign_server_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "option_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "option_value"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.foreign_servers"-> [ ( "foreign_server_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_data_wrapper_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_type"-> , DomainType "information_schema.character_data"-> )-> , ( "foreign_server_version"-> , DomainType "information_schema.character_data"-> )-> , ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.information_schema_catalog_name"-> [ ( "catalog_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.key_column_usage"-> [ ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "ordinal_position"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "position_in_unique_constraint"-> , DomainType "information_schema.cardinal_number"-> )-> ]-> , EnvCreateView-> "information_schema.parameters"-> [ ( "specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "ordinal_position"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "parameter_mode"-> , DomainType "information_schema.character_data"-> )-> , ( "is_result"-> , DomainType "information_schema.character_data"-> )-> , ( "as_locator"-> , DomainType "information_schema.character_data"-> )-> , ( "parameter_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "character_maximum_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "pg_cursors"-> [ ( "name"-> , ScalarType "text"-> )-> , ( "statement"-> , ScalarType "text"-> )-> , ( "is_holdable"-> , ScalarType "bool"-> )-> , ( "is_binary"-> , ScalarType "bool"-> )-> , ( "is_scrollable"-> , ScalarType "bool"-> )-> , ( "creation_time"-> , ScalarType "timestamptz"-> )-> ]-> , EnvCreateView-> "pg_group"-> [ ( "groname"-> , ScalarType "name"-> )-> , ( "grosysid"-> , ScalarType "oid"-> )-> , ( "grolist"-> , ArrayType ( ScalarType "oid" )-> )-> ]-> , EnvCreateView-> "pg_indexes"-> [ ( "schemaname"-> , ScalarType "name"-> )-> , ( "tablename"-> , ScalarType "name"-> )-> , ( "indexname"-> , ScalarType "name"-> )-> , ( "tablespace"-> , ScalarType "name"-> )-> , ( "indexdef"-> , ScalarType "text"-> )-> ]-> , EnvCreateView-> "pg_locks"-> [ ( "locktype"-> , ScalarType "text"-> )-> , ( "database"-> , ScalarType "oid"-> )-> , ( "relation"-> , ScalarType "oid"-> )-> , ( "page"-> , ScalarType "int4"-> )-> , ( "tuple"-> , ScalarType "int2"-> )-> , ( "virtualxid"-> , ScalarType "text"-> )-> , ( "transactionid"-> , ScalarType "xid"-> )-> , ( "classid"-> , ScalarType "oid"-> )-> , ( "objid"-> , ScalarType "oid"-> )-> , ( "objsubid"-> , ScalarType "int2"-> )-> , ( "virtualtransaction"-> , ScalarType "text"-> )-> , ( "pid"-> , ScalarType "int4"-> )-> , ( "mode"-> , ScalarType "text"-> )-> , ( "granted"-> , ScalarType "bool"-> )-> ]-> , EnvCreateView-> "pg_prepared_statements"-> [ ( "name"-> , ScalarType "text"-> )-> , ( "statement"-> , ScalarType "text"-> )-> , ( "prepare_time"-> , ScalarType "timestamptz"-> )-> , ( "parameter_types"-> , ArrayType ( ScalarType "regtype" )-> )-> , ( "from_sql"-> , ScalarType "bool"-> )-> ]-> , EnvCreateView-> "pg_prepared_xacts"-> [ ( "transaction"-> , ScalarType "xid"-> )-> , ( "gid"-> , ScalarType "text"-> )-> , ( "prepared"-> , ScalarType "timestamptz"-> )-> , ( "owner"-> , ScalarType "name"-> )-> , ( "database"-> , ScalarType "name"-> )-> ]-> , EnvCreateView-> "pg_roles"-> [ ( "rolname"-> , ScalarType "name"-> )-> , ( "rolsuper"-> , ScalarType "bool"-> )-> , ( "rolinherit"-> , ScalarType "bool"-> )-> , ( "rolcreaterole"-> , ScalarType "bool"-> )-> , ( "rolcreatedb"-> , ScalarType "bool"-> )-> , ( "rolcatupdate"-> , ScalarType "bool"-> )-> , ( "rolcanlogin"-> , ScalarType "bool"-> )-> , ( "rolconnlimit"-> , ScalarType "int4"-> )-> , ( "rolpassword"-> , ScalarType "text"-> )-> , ( "rolvaliduntil"-> , ScalarType "timestamptz"-> )-> , ( "rolconfig"-> , ArrayType ( ScalarType "text" )-> )-> , ( "oid"-> , ScalarType "oid"-> )-> ]-> , EnvCreateView-> "pg_rules"-> [ ( "schemaname"-> , ScalarType "name"-> )-> , ( "tablename"-> , ScalarType "name"-> )-> , ( "rulename"-> , ScalarType "name"-> )-> , ( "definition"-> , ScalarType "text"-> )-> ]-> , EnvCreateView-> "pg_settings"-> [ ( "name"-> , ScalarType "text"-> )-> , ( "setting"-> , ScalarType "text"-> )-> , ( "unit"-> , ScalarType "text"-> )-> , ( "category"-> , ScalarType "text"-> )-> , ( "short_desc"-> , ScalarType "text"-> )-> , ( "extra_desc"-> , ScalarType "text"-> )-> , ( "context"-> , ScalarType "text"-> )-> , ( "vartype"-> , ScalarType "text"-> )-> , ( "source"-> , ScalarType "text"-> )-> , ( "min_val"-> , ScalarType "text"-> )-> , ( "max_val"-> , ScalarType "text"-> )-> , ( "enumvals"-> , ArrayType ( ScalarType "text" )-> )-> , ( "boot_val"-> , ScalarType "text"-> )-> , ( "reset_val"-> , ScalarType "text"-> )-> , ( "sourcefile"-> , ScalarType "text"-> )-> , ( "sourceline"-> , ScalarType "int4"-> )-> ]-> , EnvCreateView-> "pg_shadow"-> [ ( "usename"-> , ScalarType "name"-> )-> , ( "usesysid"-> , ScalarType "oid"-> )-> , ( "usecreatedb"-> , ScalarType "bool"-> )-> , ( "usesuper"-> , ScalarType "bool"-> )-> , ( "usecatupd"-> , ScalarType "bool"-> )-> , ( "passwd"-> , ScalarType "text"-> )-> , ( "valuntil"-> , ScalarType "abstime"-> )-> , ( "useconfig"-> , ArrayType ( ScalarType "text" )-> )-> ]-> , EnvCreateView-> "pg_stat_activity"-> [ ( "datid"-> , ScalarType "oid"-> )-> , ( "datname"-> , ScalarType "name"-> )-> , ( "procpid"-> , ScalarType "int4"-> )-> , ( "usesysid"-> , ScalarType "oid"-> )-> , ( "usename"-> , ScalarType "name"-> )-> , ( "current_query"-> , ScalarType "text"-> )-> , ( "waiting"-> , ScalarType "bool"-> )-> , ( "xact_start"-> , ScalarType "timestamptz"-> )-> , ( "query_start"-> , ScalarType "timestamptz"-> )-> , ( "backend_start"-> , ScalarType "timestamptz"-> )-> , ( "client_addr"-> , ScalarType "inet"-> )-> , ( "client_port"-> , ScalarType "int4"-> )-> ]-> , EnvCreateView-> "pg_stat_all_indexes"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "indexrelname"-> , ScalarType "name"-> )-> , ( "idx_scan"-> , ScalarType "int8"-> )-> , ( "idx_tup_read"-> , ScalarType "int8"-> )-> , ( "idx_tup_fetch"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stat_all_tables"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "seq_scan"-> , ScalarType "int8"-> )-> , ( "seq_tup_read"-> , ScalarType "int8"-> )-> , ( "idx_scan"-> , ScalarType "int8"-> )-> , ( "idx_tup_fetch"-> , ScalarType "int8"-> )-> , ( "n_tup_ins"-> , ScalarType "int8"-> )-> , ( "n_tup_upd"-> , ScalarType "int8"-> )-> , ( "n_tup_del"-> , ScalarType "int8"-> )-> , ( "n_tup_hot_upd"-> , ScalarType "int8"-> )-> , ( "n_live_tup"-> , ScalarType "int8"-> )-> , ( "n_dead_tup"-> , ScalarType "int8"-> )-> , ( "last_vacuum"-> , ScalarType "timestamptz"-> )-> , ( "last_autovacuum"-> , ScalarType "timestamptz"-> )-> , ( "last_analyze"-> , ScalarType "timestamptz"-> )-> , ( "last_autoanalyze"-> , ScalarType "timestamptz"-> )-> ]-> , EnvCreateView-> "pg_stat_bgwriter"-> [ ( "checkpoints_timed"-> , ScalarType "int8"-> )-> , ( "checkpoints_req"-> , ScalarType "int8"-> )-> , ( "buffers_checkpoint"-> , ScalarType "int8"-> )-> , ( "buffers_clean"-> , ScalarType "int8"-> )-> , ( "maxwritten_clean"-> , ScalarType "int8"-> )-> , ( "buffers_backend"-> , ScalarType "int8"-> )-> , ( "buffers_alloc"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stat_database"-> [ ( "datid"-> , ScalarType "oid"-> )-> , ( "datname"-> , ScalarType "name"-> )-> , ( "numbackends"-> , ScalarType "int4"-> )-> , ( "xact_commit"-> , ScalarType "int8"-> )-> , ( "xact_rollback"-> , ScalarType "int8"-> )-> , ( "blks_read"-> , ScalarType "int8"-> )-> , ( "blks_hit"-> , ScalarType "int8"-> )-> , ( "tup_returned"-> , ScalarType "int8"-> )-> , ( "tup_fetched"-> , ScalarType "int8"-> )-> , ( "tup_inserted"-> , ScalarType "int8"-> )-> , ( "tup_updated"-> , ScalarType "int8"-> )-> , ( "tup_deleted"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stat_sys_indexes"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "indexrelname"-> , ScalarType "name"-> )-> , ( "idx_scan"-> , ScalarType "int8"-> )-> , ( "idx_tup_read"-> , ScalarType "int8"-> )-> , ( "idx_tup_fetch"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stat_sys_tables"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "seq_scan"-> , ScalarType "int8"-> )-> , ( "seq_tup_read"-> , ScalarType "int8"-> )-> , ( "idx_scan"-> , ScalarType "int8"-> )-> , ( "idx_tup_fetch"-> , ScalarType "int8"-> )-> , ( "n_tup_ins"-> , ScalarType "int8"-> )-> , ( "n_tup_upd"-> , ScalarType "int8"-> )-> , ( "n_tup_del"-> , ScalarType "int8"-> )-> , ( "n_tup_hot_upd"-> , ScalarType "int8"-> )-> , ( "n_live_tup"-> , ScalarType "int8"-> )-> , ( "n_dead_tup"-> , ScalarType "int8"-> )-> , ( "last_vacuum"-> , ScalarType "timestamptz"-> )-> , ( "last_autovacuum"-> , ScalarType "timestamptz"-> )-> , ( "last_analyze"-> , ScalarType "timestamptz"-> )-> , ( "last_autoanalyze"-> , ScalarType "timestamptz"-> )-> ]-> , EnvCreateView-> "pg_stat_user_functions"-> [ ( "funcid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "funcname"-> , ScalarType "name"-> )-> , ( "calls"-> , ScalarType "int8"-> )-> , ( "total_time"-> , ScalarType "int8"-> )-> , ( "self_time"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stat_user_indexes"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "indexrelname"-> , ScalarType "name"-> )-> , ( "idx_scan"-> , ScalarType "int8"-> )-> , ( "idx_tup_read"-> , ScalarType "int8"-> )-> , ( "idx_tup_fetch"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stat_user_tables"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "seq_scan"-> , ScalarType "int8"-> )-> , ( "seq_tup_read"-> , ScalarType "int8"-> )-> , ( "idx_scan"-> , ScalarType "int8"-> )-> , ( "idx_tup_fetch"-> , ScalarType "int8"-> )-> , ( "n_tup_ins"-> , ScalarType "int8"-> )-> , ( "n_tup_upd"-> , ScalarType "int8"-> )-> , ( "n_tup_del"-> , ScalarType "int8"-> )-> , ( "n_tup_hot_upd"-> , ScalarType "int8"-> )-> , ( "n_live_tup"-> , ScalarType "int8"-> )-> , ( "n_dead_tup"-> , ScalarType "int8"-> )-> , ( "last_vacuum"-> , ScalarType "timestamptz"-> )-> , ( "last_autovacuum"-> , ScalarType "timestamptz"-> )-> , ( "last_analyze"-> , ScalarType "timestamptz"-> )-> , ( "last_autoanalyze"-> , ScalarType "timestamptz"-> )-> ]-> , EnvCreateView-> "pg_statio_all_indexes"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "indexrelname"-> , ScalarType "name"-> )-> , ( "idx_blks_read"-> , ScalarType "int8"-> )-> , ( "idx_blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_all_sequences"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "blks_read"-> , ScalarType "int8"-> )-> , ( "blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_all_tables"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "heap_blks_read"-> , ScalarType "int8"-> )-> , ( "heap_blks_hit"-> , ScalarType "int8"-> )-> , ( "idx_blks_read"-> , ScalarType "int8"-> )-> , ( "idx_blks_hit"-> , ScalarType "int8"-> )-> , ( "toast_blks_read"-> , ScalarType "int8"-> )-> , ( "toast_blks_hit"-> , ScalarType "int8"-> )-> , ( "tidx_blks_read"-> , ScalarType "int8"-> )-> , ( "tidx_blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_sys_indexes"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "indexrelname"-> , ScalarType "name"-> )-> , ( "idx_blks_read"-> , ScalarType "int8"-> )-> , ( "idx_blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_sys_sequences"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "blks_read"-> , ScalarType "int8"-> )-> , ( "blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_sys_tables"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "heap_blks_read"-> , ScalarType "int8"-> )-> , ( "heap_blks_hit"-> , ScalarType "int8"-> )-> , ( "idx_blks_read"-> , ScalarType "int8"-> )-> , ( "idx_blks_hit"-> , ScalarType "int8"-> )-> , ( "toast_blks_read"-> , ScalarType "int8"-> )-> , ( "toast_blks_hit"-> , ScalarType "int8"-> )-> , ( "tidx_blks_read"-> , ScalarType "int8"-> )-> , ( "tidx_blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_user_indexes"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "indexrelid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "indexrelname"-> , ScalarType "name"-> )-> , ( "idx_blks_read"-> , ScalarType "int8"-> )-> , ( "idx_blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_user_sequences"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "blks_read"-> , ScalarType "int8"-> )-> , ( "blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_statio_user_tables"-> [ ( "relid"-> , ScalarType "oid"-> )-> , ( "schemaname"-> , ScalarType "name"-> )-> , ( "relname"-> , ScalarType "name"-> )-> , ( "heap_blks_read"-> , ScalarType "int8"-> )-> , ( "heap_blks_hit"-> , ScalarType "int8"-> )-> , ( "idx_blks_read"-> , ScalarType "int8"-> )-> , ( "idx_blks_hit"-> , ScalarType "int8"-> )-> , ( "toast_blks_read"-> , ScalarType "int8"-> )-> , ( "toast_blks_hit"-> , ScalarType "int8"-> )-> , ( "tidx_blks_read"-> , ScalarType "int8"-> )-> , ( "tidx_blks_hit"-> , ScalarType "int8"-> )-> ]-> , EnvCreateView-> "pg_stats"-> [ ( "schemaname"-> , ScalarType "name"-> )-> , ( "tablename"-> , ScalarType "name"-> )-> , ( "attname"-> , ScalarType "name"-> )-> , ( "null_frac"-> , ScalarType "float4"-> )-> , ( "avg_width"-> , ScalarType "int4"-> )-> , ( "n_distinct"-> , ScalarType "float4"-> )-> , ( "most_common_vals"-> , Pseudo AnyArray-> )-> , ( "most_common_freqs"-> , ArrayType ( ScalarType "float4" )-> )-> , ( "histogram_bounds"-> , Pseudo AnyArray-> )-> , ( "correlation"-> , ScalarType "float4"-> )-> ]-> , EnvCreateView-> "pg_tables"-> [ ( "schemaname"-> , ScalarType "name"-> )-> , ( "tablename"-> , ScalarType "name"-> )-> , ( "tableowner"-> , ScalarType "name"-> )-> , ( "tablespace"-> , ScalarType "name"-> )-> , ( "hasindexes"-> , ScalarType "bool"-> )-> , ( "hasrules"-> , ScalarType "bool"-> )-> , ( "hastriggers"-> , ScalarType "bool"-> )-> ]-> , EnvCreateView-> "pg_timezone_abbrevs"-> [ ( "abbrev"-> , ScalarType "text"-> )-> , ( "utc_offset"-> , ScalarType "interval"-> )-> , ( "is_dst"-> , ScalarType "bool"-> )-> ]-> , EnvCreateView-> "pg_timezone_names"-> [ ( "name"-> , ScalarType "text"-> )-> , ( "abbrev"-> , ScalarType "text"-> )-> , ( "utc_offset"-> , ScalarType "interval"-> )-> , ( "is_dst"-> , ScalarType "bool"-> )-> ]-> , EnvCreateView-> "pg_user"-> [ ( "usename"-> , ScalarType "name"-> )-> , ( "usesysid"-> , ScalarType "oid"-> )-> , ( "usecreatedb"-> , ScalarType "bool"-> )-> , ( "usesuper"-> , ScalarType "bool"-> )-> , ( "usecatupd"-> , ScalarType "bool"-> )-> , ( "passwd"-> , ScalarType "text"-> )-> , ( "valuntil"-> , ScalarType "abstime"-> )-> , ( "useconfig"-> , ArrayType ( ScalarType "text" )-> )-> ]-> , EnvCreateView-> "pg_user_mappings"-> [ ( "umid"-> , ScalarType "oid"-> )-> , ( "srvid"-> , ScalarType "oid"-> )-> , ( "srvname"-> , ScalarType "name"-> )-> , ( "umuser"-> , ScalarType "oid"-> )-> , ( "usename"-> , ScalarType "name"-> )-> , ( "umoptions"-> , ArrayType ( ScalarType "text" )-> )-> ]-> , EnvCreateView-> "pg_views"-> [ ( "schemaname"-> , ScalarType "name"-> )-> , ( "viewname"-> , ScalarType "name"-> )-> , ( "viewowner"-> , ScalarType "name"-> )-> , ( "definition"-> , ScalarType "text"-> )-> ]-> , EnvCreateView-> "information_schema.referential_constraints"-> [ ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "unique_constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "unique_constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "unique_constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "match_option"-> , DomainType "information_schema.character_data"-> )-> , ( "update_rule"-> , DomainType "information_schema.character_data"-> )-> , ( "delete_rule"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.role_column_grants"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.role_routine_grants"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.role_table_grants"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> , ( "with_hierarchy"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.role_usage_grants"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_type"-> , DomainType "information_schema.character_data"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.routine_privileges"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.routines"-> [ ( "specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_type"-> , DomainType "information_schema.character_data"-> )-> , ( "module_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "module_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "module_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "character_maximum_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "type_udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "type_udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "type_udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "routine_body"-> , DomainType "information_schema.character_data"-> )-> , ( "routine_definition"-> , DomainType "information_schema.character_data"-> )-> , ( "external_name"-> , DomainType "information_schema.character_data"-> )-> , ( "external_language"-> , DomainType "information_schema.character_data"-> )-> , ( "parameter_style"-> , DomainType "information_schema.character_data"-> )-> , ( "is_deterministic"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_data_access"-> , DomainType "information_schema.character_data"-> )-> , ( "is_null_call"-> , DomainType "information_schema.character_data"-> )-> , ( "sql_path"-> , DomainType "information_schema.character_data"-> )-> , ( "schema_level_routine"-> , DomainType "information_schema.character_data"-> )-> , ( "max_dynamic_result_sets"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "is_user_defined_cast"-> , DomainType "information_schema.character_data"-> )-> , ( "is_implicitly_invocable"-> , DomainType "information_schema.character_data"-> )-> , ( "security_type"-> , DomainType "information_schema.character_data"-> )-> , ( "to_sql_specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "to_sql_specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "to_sql_specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "as_locator"-> , DomainType "information_schema.character_data"-> )-> , ( "created"-> , DomainType "information_schema.time_stamp"-> )-> , ( "last_altered"-> , DomainType "information_schema.time_stamp"-> )-> , ( "new_savepoint_level"-> , DomainType "information_schema.character_data"-> )-> , ( "is_udt_dependent"-> , DomainType "information_schema.character_data"-> )-> , ( "result_cast_from_data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "result_cast_as_locator"-> , DomainType "information_schema.character_data"-> )-> , ( "result_cast_char_max_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_char_octet_length"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_char_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_char_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_collation_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_collation_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_collation_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_datetime_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_interval_type"-> , DomainType "information_schema.character_data"-> )-> , ( "result_cast_interval_precision"-> , DomainType "information_schema.character_data"-> )-> , ( "result_cast_type_udt_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_type_udt_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_type_udt_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_scope_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_scope_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_scope_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "result_cast_maximum_cardinality"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "result_cast_dtd_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.schemata"-> [ ( "catalog_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "schema_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "schema_owner"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "default_character_set_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "default_character_set_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "default_character_set_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "sql_path"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.sequences"-> [ ( "sequence_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "sequence_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "sequence_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "data_type"-> , DomainType "information_schema.character_data"-> )-> , ( "numeric_precision"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_precision_radix"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "numeric_scale"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "maximum_value"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "minimum_value"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "increment"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "cycle_option"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.table_constraints"-> [ ( "constraint_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "constraint_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_deferrable"-> , DomainType "information_schema.character_data"-> )-> , ( "initially_deferred"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.table_privileges"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> , ( "with_hierarchy"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.tables"-> [ ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_type"-> , DomainType "information_schema.character_data"-> )-> , ( "self_referencing_column_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "reference_generation"-> , DomainType "information_schema.character_data"-> )-> , ( "user_defined_type_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "user_defined_type_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "user_defined_type_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "is_insertable_into"-> , DomainType "information_schema.character_data"-> )-> , ( "is_typed"-> , DomainType "information_schema.character_data"-> )-> , ( "commit_action"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.triggered_update_columns"-> [ ( "trigger_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "trigger_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "trigger_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_object_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_object_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_object_table"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_object_column"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.triggers"-> [ ( "trigger_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "trigger_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "trigger_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_manipulation"-> , DomainType "information_schema.character_data"-> )-> , ( "event_object_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_object_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "event_object_table"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "action_order"-> , DomainType "information_schema.cardinal_number"-> )-> , ( "action_condition"-> , DomainType "information_schema.character_data"-> )-> , ( "action_statement"-> , DomainType "information_schema.character_data"-> )-> , ( "action_orientation"-> , DomainType "information_schema.character_data"-> )-> , ( "condition_timing"-> , DomainType "information_schema.character_data"-> )-> , ( "condition_reference_old_table"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "condition_reference_new_table"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "condition_reference_old_row"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "condition_reference_new_row"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "created"-> , DomainType "information_schema.time_stamp"-> )-> ]-> , EnvCreateView-> "information_schema.usage_privileges"-> [ ( "grantor"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "grantee"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "object_type"-> , DomainType "information_schema.character_data"-> )-> , ( "privilege_type"-> , DomainType "information_schema.character_data"-> )-> , ( "is_grantable"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.user_mapping_options"-> [ ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "option_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "option_value"-> , DomainType "information_schema.character_data"-> )-> ]-> , EnvCreateView-> "information_schema.user_mappings"-> [ ( "authorization_identifier"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "foreign_server_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.view_column_usage"-> [ ( "view_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "view_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "view_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "column_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.view_routine_usage"-> [ ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "specific_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.view_table_usage"-> [ ( "view_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "view_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "view_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> ]-> , EnvCreateView-> "information_schema.views"-> [ ( "table_catalog"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_schema"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "table_name"-> , DomainType "information_schema.sql_identifier"-> )-> , ( "view_definition"-> , DomainType "information_schema.character_data"-> )-> , ( "check_option"-> , DomainType "information_schema.character_data"-> )-> , ( "is_updatable"-> , DomainType "information_schema.character_data"-> )-> , ( "is_insertable_into"-> , DomainType "information_schema.character_data"-> )-> ]-> ]-
− Database/HsSqlPpp/AstInternals/Environment/EnvironmentInternal.lhs
@@ -1,465 +0,0 @@-Copyright 2009 Jake Wheat--This module contains the implementation of the Environment data types-and functions, and provides the api for the other type checking-modules.--> {-# LANGUAGE DeriveDataTypeable #-}-> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal-> (-> Environment-> ,CastContext(..)-> ,CompositeFlavour(..)-> ,relationComposites-> ,CompositeDef-> ,FunctionPrototype-> ,DomainDefinition-> ,FunFlav(..)-> ,emptyEnvironment-> ,defaultEnvironment-> ,EnvironmentUpdate(..)-> ,ppEnvUpdate-> ,updateEnvironment-> ,deconstructEnvironment-> -- type checker stuff-> ,envCompositeDef-> ,envCompositeAttrsPair-> ,envCompositeAttrs-> ,envCompositePublicAttrs-> ,envTypeCategory-> ,envPreferredType-> ,envCast-> ,envDomainBaseType-> ,envLookupFns-> ,envTypeExists-> ,envLookupType-> ,OperatorType(..)-> ,getOperatorType-> ,isOperatorName-> ) where--> import Control.Monad-> import Data.List-> import Data.Generics-> -- import Debug.Trace-> import Data.Char--> import Database.HsSqlPpp.AstInternals.TypeType-> import Database.HsSqlPpp.Utils--> -- | The main datatype, this holds the catalog and context-> -- information to type check against.-> data Environment = Environment-> {envTypeNames :: [(String, Type)]-> ,envDomainDefs :: [DomainDefinition]-> ,envCasts :: [(Type,Type,CastContext)]-> ,envTypeCategories :: [(Type,String,Bool)]-> ,envPrefixOperators :: [FunctionPrototype]-> ,envPostfixOperators :: [FunctionPrototype]-> ,envBinaryOperators :: [FunctionPrototype]-> ,envFunctions :: [FunctionPrototype]-> ,envAggregates :: [FunctionPrototype]-> ,envWindowFunctions :: [FunctionPrototype]-> ,envAttrDefs :: [CompositeDef]-> ,envUpdates :: [EnvironmentUpdate]}-> deriving Show--> -- | Represents an empty environment. This doesn't contain things-> -- like the \'and\' operator, and so if you try to use it it will-> -- almost certainly not work.-> emptyEnvironment :: Environment-> emptyEnvironment = Environment [] [] [] [] [] [] [] [] [] [] [] []--> -- | Represents what you probably want to use as a starting point if-> -- you are building an environment from scratch. It contains-> -- information on built in function like things that aren't in the-> -- PostgreSQL catalog, such as greatest, coalesce, keyword operators-> -- like \'and\', etc..-> defaultEnvironment :: Environment-> defaultEnvironment = emptyEnvironment {-> envTypeNames = pseudoTypes-> ,envBinaryOperators = ("=",[Pseudo AnyElement-> ,Pseudo AnyElement],-> typeBool, False):keywordOperatorTypes-> ,envFunctions = specialFunctionTypes}---> -- | Use to note what the flavour of a cast is, i.e. if/when it can-> -- be used implicitly.-> data CastContext = ImplicitCastContext-> | AssignmentCastContext-> | ExplicitCastContext-> deriving (Eq,Show,Ord,Typeable,Data)--> -- | Used to distinguish between standalone composite types, and-> -- automatically generated ones, generated from a table or view-> -- respectively.-> data CompositeFlavour = Composite | TableComposite | ViewComposite-> deriving (Eq,Ord,Show)--> relationComposites :: [CompositeFlavour]-> relationComposites = [TableComposite,ViewComposite]---> -- | Provides the definition of a composite type. The components are-> -- composite (or table or view) name, the flavour of the composite,-> -- the types of the composite attributes, and the types of the-> -- system columns iff the composite represents a table type (the-> -- third and fourth components are always 'CompositeType's).-> type CompositeDef = (String, CompositeFlavour, Type, Type)--> -- | The components are: function (or operator) name, argument-> -- types, return type and is variadic.-> type FunctionPrototype = (String, [Type], Type, Bool)--> -- | The components are domain type, base type (todo: add check-> -- constraint).-> type DomainDefinition = (Type,Type)--> data EnvironmentUpdate =-> -- | add a new scalar type with the name given, also creates-> -- an array type automatically-> EnvCreateScalar Type String Bool-> | EnvCreateDomain Type Type-> | EnvCreateComposite String [(String,Type)]-> | EnvCreateCast Type Type CastContext-> | EnvCreateTable String [(String,Type)] [(String,Type)]-> | EnvCreateView String [(String,Type)]-> | EnvCreateFunction FunFlav String [Type] Type Bool-> | EnvDropFunction Bool String [Type]-> deriving (Eq,Ord,Typeable,Data,Show)--> ppEnvUpdate :: EnvironmentUpdate -> String-> ppEnvUpdate (EnvCreateScalar t c p) = "EnvCreateScalar " ++ show t ++ "(" ++ c ++ "," ++ show p ++ ")"-> ppEnvUpdate (EnvCreateDomain t b) = "EnvCreateDomain " ++ show t ++ " as " ++ show b-> ppEnvUpdate (EnvCreateComposite nm flds) = "EnvCreateComposite " ++ nm ++ showFlds flds-> ppEnvUpdate (EnvCreateCast s t ctx) = "EnvCreateCast " ++ show s ++ "->" ++ show t ++ " " ++ show ctx-> ppEnvUpdate (EnvCreateTable nm flds1 flds2) = "EnvCreateTable " ++ nm ++ showFlds flds1 ++ showFlds flds2-> ppEnvUpdate (EnvCreateView nm flds) = "EnvCreateView " ++ nm ++ showFlds flds-> ppEnvUpdate (EnvCreateFunction flav nm args ret vdc) =-> "EnvCreateFunction " ++ show flav ++ " " ++ nm ++ " returns " ++ show ret ++-> "(" ++ intercalate "," (map show args) ++ ")" ++ if vdc then " variadic" else ""-> ppEnvUpdate (EnvDropFunction _ nm args) = "EnvDropFunction " ++ nm ++ "(" ++ show args ++ ")"--> showFlds :: [(String,Type)] -> String-> showFlds flds = "(\n" ++ sfs flds ++ ")"-> where-> sfs ((nm,t):fs) = " " ++ show nm ++ " " ++ show t ++ "\n" ++ sfs fs-> sfs [] = ""--> data FunFlav = FunPrefix | FunPostfix | FunBinary-> | FunName | FunAgg | FunWindow-> deriving (Eq,Show,Ord,Typeable,Data)--> -- | Applies a list of 'EnvironmentUpdate's to an 'Environment' value-> -- to produce a new Environment value.-> updateEnvironment :: Environment-> -> [EnvironmentUpdate]-> -> Either [TypeError] Environment-> updateEnvironment env' eus =-> foldM updateEnv' (env' {envUpdates = envUpdates env' ++ eus}) eus-> where-> updateEnv' env eu =-> case eu of-> EnvCreateScalar ty cat pref -> do-> errorWhen (not allowed)-> [BadEnvironmentUpdate $ "can only add scalar types\-> \this way, got " ++ show ty]-> let ScalarType nm = ty-> return $ addTypeWithArray env nm ty cat pref-> where-> allowed = case ty of-> ScalarType _ -> True-> _ -> False-> EnvCreateDomain ty baseTy -> do-> errorWhen (not allowed)-> [BadEnvironmentUpdate $ "can only add domain types\-> \this way, got " ++ show ty]-> errorWhen (not baseAllowed)-> [BadEnvironmentUpdate $ "can only add domain types\-> \based on scalars, got "-> ++ show baseTy]-> let DomainType nm = ty-> let cat = envTypeCategory env baseTy-> return (addTypeWithArray env nm ty cat False) {-> envDomainDefs =-> (ty,baseTy):envDomainDefs env-> ,envCasts =-> (ty,baseTy,ImplicitCastContext):envCasts env}-> where-> allowed = case ty of-> DomainType _ -> True-> _ -> False-> baseAllowed = case baseTy of-> ScalarType _ -> True-> _ -> False--> EnvCreateComposite nm flds ->-> return $ (addTypeWithArray env nm (NamedCompositeType nm) "C" False) {-> envAttrDefs =-> (nm,Composite,CompositeType flds, CompositeType [])-> : envAttrDefs env}-> EnvCreateCast src tgt ctx -> return $ env {envCasts = (src,tgt,ctx):envCasts env}-> EnvCreateTable nm attrs sysAttrs -> do-> checkTypeDoesntExist env nm (NamedCompositeType nm)-> return $ (addTypeWithArray env nm-> (NamedCompositeType nm) "C" False) {-> envAttrDefs =-> (nm,TableComposite,CompositeType attrs, CompositeType sysAttrs)-> : envAttrDefs env}-> EnvCreateView nm attrs -> {-trace ("create view:" ++ show nm) $-} do-> checkTypeDoesntExist env nm (NamedCompositeType nm)-> return $ (addTypeWithArray env nm-> (NamedCompositeType nm) "C" False) {-> envAttrDefs =-> (nm,ViewComposite,CompositeType attrs, CompositeType [])-> : envAttrDefs env}-> EnvCreateFunction f nm args ret vdc ->-> return $ case f of-> FunPrefix -> env {envPrefixOperators=(nm,args,ret,vdc):envPrefixOperators env}-> FunPostfix -> env {envPostfixOperators=(nm,args,ret,vdc):envPostfixOperators env}-> FunBinary -> env {envBinaryOperators=(nm,args,ret,vdc):envBinaryOperators env}-> FunAgg -> env {envAggregates=(nm,args,ret,vdc):envAggregates env}-> FunWindow -> env {envWindowFunctions=(nm,args,ret,vdc):envWindowFunctions env}-> FunName -> env {envFunctions=(nm,args,ret,vdc):envFunctions env}-> EnvDropFunction ifexists nm args -> do-> let matches = filter matchingFn (envFunctions env)-> errorWhen (null matches) [BadEnvironmentUpdate $-> "couldn't find function to drop " ++-> show nm ++ "(" ++ show args++")"]-> errorWhen (length matches > 1) [BadEnvironmentUpdate $-> "multiple matching functions to drop " ++-> show nm ++ "(" ++ show args++")"]-> return env {envFunctions = filter (not . matchingFn) (envFunctions env)-> ,envUpdates = filter (not.matchingUpdate) (envUpdates env)}-> where-> matchingFn (nm1,a1,_,_) = map toLower nm == map toLower nm1 && args == a1-> matchingUpdate (EnvDropFunction _ nm2 a2) | map toLower nm2 == map toLower nm-> && a2 == args = True-> matchingUpdate (EnvCreateFunction _ nm2 a2 _ _) | map toLower nm2 == map toLower nm-> && a2 == args = True-> matchingUpdate _ = False--todo:-look for matching function in list, if not found then error-remove from list, and remove from update list---> addTypeWithArray env nm ty cat pref =-> env {envTypeNames =-> ('_':nm,ArrayType ty)-> : (nm,ty)-> : envTypeNames env-> ,envTypeCategories =-> (ArrayType ty,"A",False)-> : (ty,cat,pref)-> : envTypeCategories env}-> checkTypeDoesntExist env nm ty = do-> errorWhen (any (==nm) $ map fst $ envTypeNames env)-> [TypeAlreadyExists ty]-> errorWhen (any (==ty) $ map snd $ envTypeNames env)-> [TypeAlreadyExists ty]-> return ()---> {--> | Takes part an 'Environment' value to produce a list of 'EnvironmentUpdate's.-> You can use this to look inside the Environment data type e.g. if you want to-> examine a catalog. It should be the case that:-> @-> updateEnvironment emptyEnvironment (deconstructEnvironment env) = env-> @ -}-> deconstructEnvironment :: Environment -> [EnvironmentUpdate]-> deconstructEnvironment = envUpdates---================================================================================--= type checking stuff--> envCompositeDef :: Environment -> [CompositeFlavour] -> String -> Either [TypeError] (CompositeDef)-> envCompositeDef env flvs nm = do-> let c = filter (\(n,t,_,_) -> n == nm && (null flvs || t `elem` flvs)) $ envAttrDefs env-> errorWhen (null c)-> [UnrecognisedRelation nm]-> case c of-> (_,fl1,r,s):[] -> return (nm,fl1,r,s)-> _ -> error $ "problem getting attributes for: " ++ show nm ++ ", " ++ show c--> envCompositeAttrsPair :: Environment -> [CompositeFlavour] -> String-> -> Either [TypeError] ([(String,Type)],[(String,Type)])-> envCompositeAttrsPair env flvs ty = do-> (_,_,CompositeType a,CompositeType b) <- envCompositeDef env flvs ty-> return (a,b)--> envCompositeAttrs :: Environment -> [CompositeFlavour] -> String-> -> Either [TypeError] [(String,Type)]-> envCompositeAttrs env flvs ty = do-> (a,b) <- envCompositeAttrsPair env flvs ty-> return $ a ++ b--> envCompositePublicAttrs :: Environment -> [CompositeFlavour] -> String-> -> Either [TypeError] [(String,Type)]-> envCompositePublicAttrs env flvs ty = do-> (a,_) <- envCompositeAttrsPair env flvs ty-> return a---> envTypeCategory :: Environment -> Type -> String-> envTypeCategory env ty =-> let (c,_) = envGetCategoryInfo env ty-> in c--> envPreferredType :: Environment -> Type -> Bool-> envPreferredType env ty =-> let (_,p) = envGetCategoryInfo env ty-> in p--> envCast :: Environment -> CastContext -> Type -> Type -> Bool-> envCast env ctx from to = {-trace ("check cast " ++ show from ++ show to) $-}-> case from of-> t@(DomainType _) -> let baseType = envDomainBaseType env t-> in (baseType == to) ||-> (envCast env ctx baseType to ||-> any (== (from, to, ctx)) (envCasts env))-> _ -> any (==(from,to,ctx)) (envCasts env)---> envDomainBaseType :: Environment -> Type -> Type-> envDomainBaseType env ty =-> --check type is domain, check it exists in main list-> case lookup ty (envDomainDefs env) of-> Nothing -> error "domain not found" -- Left [DomainDefNotFound ty]-> Just t -> t---> envLookupFns :: Environment -> String -> [FunctionPrototype]-> envLookupFns env name =-> filter (\(nm,_,_,_) -> map toLower nm == map toLower name) envGetAllFns-> where-> envGetAllFns =-> concat [envPrefixOperators env-> ,envPostfixOperators env-> ,envBinaryOperators env-> ,envFunctions env-> ,envAggregates env-> ,envWindowFunctions env]--== internal support for type checker fns above--> envGetCategoryInfo :: Environment -> Type -> (String, Bool)-> envGetCategoryInfo env ty =-> case ty of-> SetOfType _ -> ("", False)-> AnonymousRecordType _ -> ("", False)-> ArrayType (Pseudo _) -> ("A",False)-> Pseudo _ -> ("P",False)-> _ -> let l = filter (\(t,_,_) -> ty == t) $ envTypeCategories env-> in if null l-> then error $ "no type category for " ++ show ty-> else let (_,c,p):_ =l-> in (c,p)--> envTypeExists :: Environment -> Type -> Either [TypeError] Type-> envTypeExists env t =-> errorWhen (t `notElem` map snd (envTypeNames env))-> [UnknownTypeError t] >>-> Right t--> envLookupType :: Environment -> String -> Either [TypeError] Type-> envLookupType env name =-> liftME [UnknownTypeName name] $-> lookup name (envTypeNames env)---================================================================================--= built in stuff--keyword operators, all of these are built in and don't appear in any-postgresql catalog--This is wrong, these need to be separated into prefix, postfix, binary--> keywordOperatorTypes :: [FunctionPrototype]-> keywordOperatorTypes = [-> ("!and", [typeBool, typeBool], typeBool, False)-> ,("!or", [typeBool, typeBool], typeBool, False)-> ,("!like", [ScalarType "text", ScalarType "text"], typeBool, False)-> ,("!not", [typeBool], typeBool, False)-> ,("!isnull", [Pseudo AnyElement], typeBool, False)-> ,("!isnotnull", [Pseudo AnyElement], typeBool, False)-> ,("!arrayctor", [ArrayType $ Pseudo AnyElement], Pseudo AnyArray, True)-> ,("!between", [Pseudo AnyElement-> ,Pseudo AnyElement-> ,Pseudo AnyElement], Pseudo AnyElement, False)-> ,("!substring", [ScalarType "text",typeInt,typeInt], ScalarType "text", False)-> ,("!arraysub", [Pseudo AnyArray,typeInt], Pseudo AnyElement, False)-> ]--these look like functions, but don't appear in the postgresql catalog.--> specialFunctionTypes :: [FunctionPrototype]-> specialFunctionTypes = [-> ("coalesce", [ArrayType $ Pseudo AnyElement], Pseudo AnyElement, True)-> ,("nullif", [Pseudo AnyElement, Pseudo AnyElement], Pseudo AnyElement,False)-> ,("greatest", [ArrayType $ Pseudo AnyElement], Pseudo AnyElement,True)-> ,("least", [ArrayType $ Pseudo AnyElement], Pseudo AnyElement,True)-> ]--> pseudoTypes :: [(String, Type)]-> pseudoTypes =-> [("any",Pseudo Any)-> ,("anyarray",Pseudo AnyArray)-> ,("anyelement",Pseudo AnyElement)-> ,("anyenum",Pseudo AnyEnum)-> ,("anynonarray",Pseudo AnyNonArray)-> ,("cstring",Pseudo Cstring)-> ,("record",Pseudo Record)-> ,("trigger",Pseudo Trigger)-> ,("void",Pseudo Void)-> ,("_cstring",ArrayType $ Pseudo Cstring)-> ,("_record",ArrayType $ Pseudo Record)-> --,Pseudo Internal-> --,Pseudo LanguageHandler-> --,Pseudo Opaque-> ]--================================================================================--= getOperatorType--used by the pretty printer, not sure this is a very good design--for now, assume that all the overloaded operators that have the-same name are all either binary, prefix or postfix, otherwise the-getoperatortype would need the types of the arguments to determine-the operator type, and the parser would have to be a lot cleverer-although, parsec handles - being unary and binary without breaking-a sweat, so maybe this isn't too difficult?--this is why binary @ operator isn't currently supported--> data OperatorType = BinaryOp | PrefixOp | PostfixOp-> deriving (Eq,Show)--> getOperatorType :: Environment -> String -> OperatorType-> getOperatorType env s = case () of-> _ | s `elem` ["!and", "!or","!like"] -> BinaryOp-> | s `elem` ["!not"] -> PrefixOp-> | s `elem` ["!isnull", "!isnotnull"] -> PostfixOp-> | any (\(x,_,_,_) -> x == s) (envBinaryOperators env) ->-> BinaryOp-> | any (\(x,_,_,_) -> x == s ||-> (x=="-" && s=="u-"))-> (envPrefixOperators env) ->-> PrefixOp-> | any (\(x,_,_,_) -> x == s) (envPostfixOperators env) ->-> PostfixOp-> | otherwise ->-> error $ "don't know flavour of operator " ++ s--> isOperatorName :: String -> Bool-> isOperatorName = any (`elem` "+-*/<>=~!@#%^&|`?")
− Database/HsSqlPpp/AstInternals/Environment/EnvironmentReader.lhs
@@ -1,258 +0,0 @@-Copyright 2009 Jake Wheat--This module contains the code to read a set of environment updates-from a database.--The code here hasn't been tidied up since the Environment data type-was heavily changed so it's a bit messy.--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.Environment.EnvironmentReader-> (readEnvironmentFromDatabase) where--> import qualified Data.Map as M-> import Data.Maybe-> import Control.Applicative-> --import Debug.Trace--> import Database.HsSqlPpp.Dbms.DBAccess-> import Database.HsSqlPpp.AstInternals.TypeType-> import Database.HsSqlPpp.Utils-> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal--> -- | Creates an 'EnvironmentUpdate' list by reading the database given.-> -- To create an Environment value from this, use-> ---> -- @-> -- env <- readEnvironmentFromDatabase 'something'-> -- let newEnv = updateEnvironment defaultEnvironment env-> -- @-> readEnvironmentFromDatabase :: String -- ^ name of the database to read-> -> IO [EnvironmentUpdate]-> readEnvironmentFromDatabase dbName = withConn ("dbname=" ++ dbName) $ \conn -> do-> typeInfo <- selectRelation conn-> "select t.oid as oid,\n\-> \ t.typtype,\n\-> \ case nspname\n\-> \ when 'public' then t.typname\n\-> \ when 'pg_catalog' then t.typname\n\-> \ else nspname || '.' || t.typname\n\-> \ end as typname,\n\-> \ t.typarray,\n\-> \ coalesce(e.typtype,'0') as atyptype,\n\-> \ e.oid as aoid,\n\-> \ e.typname as atypname\n\-> \ from pg_catalog.pg_type t\n\-> \ left outer join pg_type e\n\-> \ on t.typarray = e.oid\n\-> \ inner join pg_namespace ns\n\-> \ on t.typnamespace = ns.oid\n\-> \ and ns.nspname in ('pg_catalog', 'public', 'information_schema')\n\-> \ where /*pg_catalog.pg_type_is_visible(t.oid)\n\-> \ and */not exists(select 1 from pg_catalog.pg_type el\n\-> \ where el.typarray = t.oid)\n\-> \ order by t.typname;" []-> let typeStuff = concatMap convTypeInfoRow typeInfo-> typeAssoc = map (\(a,b,_) -> (a,b)) typeStuff-> typeMap = M.fromList typeAssoc-> cts <- map (\(nm:cat:pref:[]) ->-> EnvCreateScalar (ScalarType nm) cat ( read pref :: Bool)) <$>-> selectRelation conn-> "select t.typname,typcategory,typispreferred\n\-> \from pg_type t\n\-> \ inner join pg_namespace ns\n\-> \ on t.typnamespace = ns.oid\n\-> \ and ns.nspname in ('pg_catalog', 'public', 'information_schema')\n\-> \where t.typarray<>0 and\n\-> \ typtype='b' /*and\n\-> \ pg_catalog.pg_type_is_visible(t.oid)*/;" []-> domainDefInfo <- selectRelation conn-> "select pg_type.oid, typbasetype\n\-> \ from pg_type\n\-> \ inner join pg_namespace ns\n\-> \ on pg_type.typnamespace = ns.oid\n\-> \ and ns.nspname in ('pg_catalog', 'public', 'information_schema')\n\-> \ where typtype = 'd'\n\-> \ /*and pg_catalog.pg_type_is_visible(oid)*/;" []-> let jlt k = fromJust $ M.lookup k typeMap-> let domainDefs = map (\l -> (jlt (l!!0), jlt (l!!1))) domainDefInfo-> --let domainCasts = map (\(t,b) ->(t,b,ImplicitCastContext)) domainDefs-> castInfo <- selectRelation conn-> "select castsource,casttarget,castcontext from pg_cast;" []-> let casts = {- domainCasts ++ -} flip map castInfo-> (\l -> (jlt (l!!0), jlt (l!!1),-> case (l!!2) of-> "a" -> AssignmentCastContext-> "i" -> ImplicitCastContext-> "e" -> ExplicitCastContext-> _ -> error $ "internal error: unknown cast context " ++ (l!!2)))-> operatorInfo <- selectRelation conn-> "select oprname,\n\-> \ oprleft,\n\-> \ oprright,\n\-> \ oprresult\n\-> \from pg_operator\n\-> \ where not (oprleft <> 0 and oprright <> 0\n\-> \ and oprname = '@') --hack for now\n\-> \ order by oprname;" []-> let getOps a b c [] = (a,b,c)-> getOps pref post bin (l:ls) =-> let bit = (\a -> (l!!0, a, jlt(l!!3)))-> in case () of-> _ | l!!1 == "0" -> getOps (bit [jlt (l!!2)]:pref) post bin ls-> | l!!2 == "0" -> getOps pref (bit [jlt (l!!1)]:post) bin ls-> | otherwise -> getOps pref post (bit [jlt (l!!1), jlt (l!!2)]:bin) ls-> let (prefixOps, postfixOps, binaryOps) = getOps [] [] [] operatorInfo-> functionInfo <- selectRelation conn-> "select proname,\n\-> \ array_to_string(proargtypes,','),\n\-> \ proretset,\n\-> \ prorettype\n\-> \from pg_proc\n\-> \where pg_catalog.pg_function_is_visible(pg_proc.oid)\n\-> \ and provariadic = 0\n\-> \ and not proisagg\n\-> \ and not proiswindow\n\-> \order by proname,proargtypes;" []-> let fnProts = map (convFnRow jlt) functionInfo--> aggregateInfo <- selectRelation conn-> "select proname,\n\-> \ array_to_string(proargtypes,','),\n\-> \ proretset,\n\-> \ prorettype\n\-> \from pg_proc\n\-> \where pg_catalog.pg_function_is_visible(pg_proc.oid)\n\-> \ and provariadic = 0\n\-> \ and proisagg\n\-> \order by proname,proargtypes;" []-> let aggProts = map (convFnRow jlt) aggregateInfo--> windowInfo <- selectRelation conn-> "select proname,\n\-> \ array_to_string(proargtypes,','),\n\-> \ proretset,\n\-> \ prorettype\n\-> \from pg_proc\n\-> \where pg_catalog.pg_function_is_visible(pg_proc.oid)\n\-> \ and provariadic = 0\n\-> \ and proiswindow\n\-> \order by proname,proargtypes;" []-> let winProts = map (convFnRow jlt) windowInfo---> comps <- map (\(kind:nm:atts:sysatts:nsp:[]) ->-> let nm1 = case nsp of-> "pg_catalog" -> nm-> "public" -> nm-> n -> n ++ "." ++ nm-> in case kind of-> "c" -> EnvCreateComposite nm1 (convertAttString jlt atts)-> "r" -> EnvCreateTable nm1 (convertAttString jlt atts) (convertAttString jlt sysatts)-> "v" -> EnvCreateView nm1 (convertAttString jlt atts)-> _ -> error $ "unrecognised relkind: " ++ kind) <$>-> selectRelation conn-> "with att1 as (\n\-> \ select\n\-> \ attrelid,\n\-> \ attname,\n\-> \ attnum,\n\-> \ atttypid\n\-> \ from pg_attribute\n\-> \ inner join pg_class cls\n\-> \ on cls.oid = attrelid\n\-> \ inner join pg_namespace ns\n\-> \ on cls.relnamespace = ns.oid\n\-> \ and ns.nspname in ('pg_catalog', 'public', 'information_schema')\n\-> \ where /*pg_catalog.pg_table_is_visible(cls.oid)\n\-> \ and*/ cls.relkind in ('r','v','c')\n\-> \ and not attisdropped),\n\-> \ sysAtt as (\n\-> \ select attrelid,\n\-> \ array_to_string(\n\-> \ array_agg(attname || ';' || atttypid)\n\-> \ over (partition by attrelid order by attnum\n\-> \ range between unbounded preceding\n\-> \ and unbounded following)\n\-> \ ,',') as sysAtts\n\-> \ from att1\n\-> \ where attnum < 0),\n\-> \ att as (\n\-> \ select attrelid,\n\-> \ array_to_string(\n\-> \ array_agg(attname || ';' || atttypid)\n\-> \ over (partition by attrelid order by attnum\n\-> \ range between unbounded preceding\n\-> \ and unbounded following)\n\-> \ ,',') as atts\n\-> \ from att1\n\-> \ where attnum > 0)\n\-> \ select distinct\n\-> \ cls.relkind,\n\-> \ cls.relname,\n\-> \ atts,\n\-> \ coalesce(sysAtts,''),\n\-> \ nspname\n\-> \ from att left outer join sysAtt using (attrelid)\n\-> \ inner join pg_class cls\n\-> \ on cls.oid = attrelid\n\-> \ inner join pg_namespace ns\n\-> \ on cls.relnamespace = ns.oid\n\-> \ order by relkind,relname;" []---> return $ concat [-> cts-> ,map (uncurry EnvCreateDomain) domainDefs-> ,map (\(a,b,c) -> EnvCreateCast a b c) casts-> ,map (\(a,b,c) -> EnvCreateFunction FunPrefix a b c False) prefixOps-> ,map (\(a,b,c) -> EnvCreateFunction FunPostfix a b c False) postfixOps-> ,map (\(a,b,c) -> EnvCreateFunction FunBinary a b c False) binaryOps-> ,map (\(a,b,c) -> EnvCreateFunction FunName a b c False) fnProts-> ,map (\(a,b,c) -> EnvCreateFunction FunAgg a b c False) aggProts-> ,map (\(a,b,c) -> EnvCreateFunction FunWindow a b c False) winProts-> ,comps]-> where-> convertAttString jlt s =-> let ps = split ',' s-> ps1 = map (split ';') ps-> in map (\pl -> (head pl, jlt (pl!!1))) ps1-> convFnRow jlt l =-> (head l,fnArgs,fnRet)-> where-> fnRet = let rt1 = jlt (l!!3)-> in if read (l!!2)::Bool-> then SetOfType rt1-> else rt1-> fnArgs = if (l!!1) == ""-> then []-> else let a = split ',' (l!!1)-> in map jlt a-> convTypeInfoRow l =-> let name = (l!!2)-> ctor = case (l!!1) of-> "b" -> ScalarType-> "c" -> NamedCompositeType-> "d" -> DomainType-> "e" -> EnumType-> "p" -> (\t -> Pseudo (case t of-> "any" -> Any-> "anyarray" -> AnyArray-> "anyelement" -> AnyElement-> "anyenum" -> AnyEnum-> "anynonarray" -> AnyNonArray-> "cstring" -> Cstring-> "internal" -> Internal-> "language_handler" -> LanguageHandler-> "opaque" -> Opaque-> "record" -> Record-> "trigger" -> Trigger-> "void" -> Void-> _ -> error $ "internal error: unknown pseudo " ++ t))-> _ -> error $ "internal error: unknown type type: " ++ (l !! 1)-> scType = (head l, ctor name, name)-> in if (l!!4) /= "0"-> then [(l!!5,ArrayType $ ctor name, '_':name), scType]-> else [scType]-
− Database/HsSqlPpp/AstInternals/Environment/LocalIdentifierBindings.lhs
@@ -1,240 +0,0 @@-Copyright 2009 Jake Wheat--This module contains the code to manage local identifier bindings-during the type checking process.--Main areas to support are parameters and variables--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.Environment.LocalIdentifierBindings-> (-> QualifiedIDs-> ,LocalIdentifierBindings-> ,emptyBindings-> ,updateBindings-> ,LocalIdentifierBindingsUpdate(..)-> ,libExpandStar-> ,libLookupID-> ) where--> import Control.Monad-> import Data.List-> import Debug.Trace-> import Data.Char--> import Database.HsSqlPpp.AstInternals.TypeType-> import Database.HsSqlPpp.Utils-> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal--> -- | The main datatype, this holds the catalog and context-> -- information to type check against.-> data LocalIdentifierBindings = LocalIdentifierBindings-> {identifierTypes :: [[QualifiedIDs]]-> ,starTypes :: [QualifiedIDs]}----> -- | Represents an empty environment. This doesn't contain things-> -- like the \'and\' operator, and so if you try to use it it will-> -- almost certainly not work.-> emptyBindings :: LocalIdentifierBindings-> emptyBindings = LocalIdentifierBindings [] []--> -- | Represents the types of the ids available, currently used for-> -- resolving identifiers inside select expressions. Will probably-> -- change as this is fixed to support more general contexts. The-> -- components represent the qualifying name (empty string for no-> -- qualifying name), the list of identifier names with their types,-> -- and the list of system column identifier names with their types.-> type QualifiedIDs = (String, [(String,Type)])--> instance Show LocalIdentifierBindings where-> show (LocalIdentifierBindings idTypes starEx) =-> "ID Types:\n" ++ concatMap (flip showQList 0) idTypes ++-> "Star Exp:\n" ++ concatMap showQuals starEx-> where-> showQList :: [QualifiedIDs] -> Int -> String-> showQList (x:xs) n = show n ++ ":\n" ++-> showQuals x ++ "\n" ++ showQList xs (n + 1)-> showQList [] _ = ""-> showQuals :: QualifiedIDs -> String-> showQuals (co, idList) = "qual: " ++ co ++ ":\n" ++ concatMap (\(n,t) -> n ++ "::" ++ show t ++ "\n") idList----= Attribute identifier scoping--The way this scoping works is we have a list of prefixes/namespaces,-which is generally the table/view name, or the alias given to it, and-then a list of identifiers (with no dots) and their types. When we-look up the type of an identifier, if it has an correlation name we-try to match that against a table name or alias in that list, if it is-not present or not unique then throw an error. Similarly with no-correlation name, we look at all the lists, if the id is not present-or not unique then throw an error.--envIdentifierTypes is for expanding *. If we want to access the-common attributes from one of the tables in a using or natural join,-this attribute can be qualified with either of the table names/-aliases. But when we expand the *, we only output these common fields-once, so keep a separate list of these fields used just for expanding-the star. The other twist is that these common fields appear first in-the resultant field list.--System columns: pg also has these - they have names and types like-other attributes, but are not included when expanding stars, so you-only get them when you explicitly ask for them. The main use is using-the oid system column which is heavily used as a target for foreign-key references in the pg catalog.--This system still isn't working right. Subqueries are a-problem. Aspects which don't work right now are:--consider this query:-select relname as relvar_name- from pg_class- where ((relnamespace =- (select oid- from pg_namespace- where (nspname = 'public'))) and (relkind = 'r'));--we need to be able to access attributes from pg_class inside the subquery,-but 1) they aren't inserted if you use * in the inner query-2) they can't make an identifier ambiguous, so the oid here in the subquery-is ok even though both the oid from pg_namespace and the oid from pg_class-are in scope.--So there are two problems with the current code:-it's too aggressive at throwing ambiguous identifier errors-it pulls in too many identifiers when expanding star--Solution ideas:-for the ambiguous errors, create a stack of identifiers, then split-the EnvUpdateIDs into two, one to replace the current set, and one to-push a new set on the stack. Then fix the lookup to walk the stack level by level.--for the *, we already have special cases for system columns, and for-join ids. I think the best solution is to provide a separate list of *-columns and types, with a separate env update ctor, and get the type-checker to resolve the list for * expansion rather than doing it here.--This should also handle parameters and variable declarations in plpgsql-functions too, these stack in the same way, with one complication to-do with parameters:--there is an additional complication with plpgsql, which isn't going to-be handled for now: instead of stacking like everything else, for-variable references inside select, insert, update and delete-statements only, which aren't qualified and match a parameter name,-then the parameter is used in lieu of variable declarations or-attributes inside a select expression. This will be handled at some-point.--this is something the lint checker should flag when it's written, it-will also flag any ambiguous identifiers which resolve ok only because-of stacking, this is a standard warning in many flavours of lint-checkers.--One last thing is that we need to make sure identifiers availability doesn't-get inherited too far: e.g. a create function inside a create function-can't access ids from the outer create function. This is pretty easy:-the following things generate identifier bindings:-select expressions, inside the expression-parameter defs-variable defs--since select expressions can't contain statements, we don't need to-worry about e.g. if statements, they want to inherit ids from params-and variable defs, so the default is good.--For environments being updated sequentially: since the environment is-updated in a statement list (i.e. environment updates stack from one-statement to the next within a single statement list), any var defs-can't break out of the containing list, so we are covered e.g. for a-variable def leaking from an inner block to an outer block.--With ids going into select expressions: we want the default which is-parameters, vardefs and ids from containing select expressions to be-inherited. So, in the end the only case to deal with is a create-function inside another create function. This isn't dealt with at the-moment.----> libExpandStar :: LocalIdentifierBindings -> String -> Either [TypeError] [(String,Type)]-> libExpandStar env correlationName =-> case lookup correlationName $ starTypes env of-> Nothing -> errorWhen (correlationName == "")-> [InternalError "no star expansion found?"] >>-> Left [UnrecognisedCorrelationName correlationName]-> Just l -> Right l--> splitIdentifier :: String -> (String,String)-> splitIdentifier s = let (a,b) = span (/= '.') s-> in if b == ""-> then ("", a)-> else (a,tail b)--> libLookupID :: LocalIdentifierBindings -> String -> Either [TypeError] Type-> libLookupID env iden1 =-> envLookupID' $ identifierTypes env-> where-> (correlationName,iden) = splitIdentifier $ map toLower iden1-> envLookupID' (its:itss) =-> case lookup correlationName its of-> Nothing -> envLookupID' itss-> Just s -> case filter (\(n,_) -> map toLower n==iden) s of-> [] -> if correlationName == ""-> then envLookupID' itss-> else Left [UnrecognisedIdentifier $ correlationName ++ "." ++ iden]-> (_,t):[] -> Right t-> _ -> Left [AmbiguousIdentifier iden]-> envLookupID' [] =-> Left [if correlationName == ""-> then UnrecognisedIdentifier iden-> else UnrecognisedCorrelationName correlationName]--> -- | Applies a list of 'EnvironmentUpdate's to an 'Environment' value-> -- to produce a new Environment value.-> updateBindings :: LocalIdentifierBindings-> -> Environment-> -> [LocalIdentifierBindingsUpdate]-> -> Either [TypeError] LocalIdentifierBindings-> updateBindings lbs' env eus =-> let r = foldM updateEnv' lbs' eus-> in {-trace ("*********************************************\nupdatebindings from " ++ show lbs' ++ "\nto\n" ++ show r) -} r-> where-> updateEnv' lbs eu =-> case eu of-> LibStackIDs qids -> return $ lbs {identifierTypes = expandComposites qids : identifierTypes lbs}-> LibSetStarExpansion sids -> return $ lbs {starTypes = sids}-> --take all the composite typed ids, and expand them out-> expandComposites :: [(String, [(String,Type)])] -> [(String, [(String,Type)])]-> expandComposites ((q,attrs):qis) =-> ec attrs ++ (q, map (\(n,t) -> (n,wrapIfRecord n t)) attrs) : expandComposites qis-> where-> ec :: [(String,Type)] -> [(String, [(String,Type)])]-> ec [] = []-> ec ((nm,NamedCompositeType t):xs) = (nm,compFields t):ec xs-> ec ((nm,SetOfType(NamedCompositeType t)):xs) = (nm,compFields t):ec xs-> ec ((nm,CompositeType t):xs) = (nm, t):ec xs-> ec ((nm,SetOfType(CompositeType t)):xs) = (nm, t):ec xs-> ec (_:xs) = ec xs-> wrapIfRecord n t =-> case libLookupID lbs' n of-> Right (PgRecord _) -> PgRecord (Just t)-> _ -> t-> expandComposites [] = []-> compFields = fromRight [] . envCompositePublicAttrs env []--> data LocalIdentifierBindingsUpdate =-> -- | to allow an unqualified identifier reference to work you need to-> -- supply an extra entry with \"\" as the alias, and all the fields,-> -- in the case of joins, these unaliased fields need to have the-> -- duplicates removed and the types resolved-> LibStackIDs [QualifiedIDs]-> -- | to allow an unqualified star to work you need to-> -- supply an extra entry with \"\" as the alias, and all the fields-> | LibSetStarExpansion [QualifiedIDs]-
− Database/HsSqlPpp/AstInternals/TypeChecking/CreateFunction.ag
@@ -1,135 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the ag code for create function statements. This-includes producing the function prototype, and passing the parameter-and variable declaration bindings into the statement body.--== function prototype--all we do here is type check enough to produce the prototype-information which is added to the catalog, this means the function-name, parameter types, and the return type.--type checking failure is contained so that the function prototype is-produced iff the parameter and return types check ok. Any type errors-in the function body (including the top level variable declarations-don't affect the prototype, and hence callers of the function).---}--SEM Statement- | CreateFunction- loc.tpe = dependsOnRTpe- (@rettype.namedType : @loc.parameterTypes) $- Right $ Pseudo Void- loc.envUpdates = dependsOn [tpeToT @loc.tpe] []- [EnvCreateFunction FunName- (map toLower @name)- @loc.parameterTypes- @rettype.namedType- False]- loc.parameterTypes = (map snd @params.params)-- loc.backTree = CreateFunction @ann- @name- @params.annotatedTree- @rettype.annotatedTree- @lang.annotatedTree- @bodyQuote- @body.annotatedTree- @vol.annotatedTree- loc.statementType = []- body.env = @lhs.inProducedEnv--{--== parameters--}--ATTR ParamDef [||paramName : String- namedType : Type]--ATTR ParamDefList [||params : {[(String, Type)]}]--SEM ParamDef- | ParamDef ParamDefTp- lhs.namedType = @typ.namedType- | ParamDef- lhs.paramName = @name- | ParamDefTp- lhs.paramName = ""--SEM ParamDefList- | Nil lhs.params = []- | Cons lhs.params = ((@hd.paramName, @hd.namedType) : @tl.params)---{--ISSUE:--when writing an sql file, you can put a create function which refers-to a table definition that is given later. As long as the function-isn't called before the table definition is given, this is ok. To-handle this, need to gather the function prototype, but delay checking-the contents until either a) all the other type checking has been-done, or b) the function is needed (list ways this can happen: used in-a view (even then, not needed until view is used), function can be-called directly, or indirectly in another function call, ...)--No thoughts on how to do this - but at some point want to support-'declarative' sql source code, where the order doesn't matter, and-this code figures out an order to load it into the database which will-get past pgs checks, so hopefully the solution will move towards this-goal also. One additional consideration is that the error message in a-situation like this would be really helpful if it could tell that a-problem like this could be fixed with a reordering, and suggest that-reordering.--New plan: do two passes, type check everything but the bodies of-functions in first pass, then type check bodies of functions in second-pass. Not perfect, but better than current situation. This will be-achieved by using a separate env attribute which is the same as the env-value which gets returned from the annotation functions in AstInternal.ag---}--SEM Statement- | CreateFunction- --add the parameters to the environment for the contained statements- body.lib = let p = @params.params- ++ (zip posNames $ map snd @params.params)- in fromRight @lhs.lib $- updateBindings @lhs.lib @lhs.env- [LibStackIDs [("", p)- ,(@name, @params.params)]]- where- posNames :: [String]- posNames = map (\l -> '$':show l) [1..]-{--TODO: using fromRight on it's own for identifier bindings or env-updates is wrong, if an error is produced then this needs to be added-to an annotation somewhere. Some of the code uses error instead of fromRight-which is even worse.--}--SEM FnBody- | PlpgsqlFnBody- --make the variable names available in the body of the- --function this needs to be generalised to begin/end blocks- --which can nest inside plpgsql functions (they aren't even- --supported by the parser at the moment)- sts.lib = fromRight @lhs.lib $- updateBindings @lhs.lib @lhs.env- [LibStackIDs [("", @vars.defs)]]--ATTR VarDef [||def : {(String,Type)}]--ATTR VarDefList [||defs : {[(String,Type)]}]----slightly hacky, should fix this better-SEM VarDef- | VarDef lhs.def = (@name, if @typ.namedType == Pseudo Record then PgRecord Nothing else @typ.namedType)--SEM VarDefList- | Cons lhs.defs = @hd.def : @tl.defs- | Nil lhs.defs = []
− Database/HsSqlPpp/AstInternals/TypeChecking/CreateTable.ag
@@ -1,101 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the code for typechecking create table statements-(and also create table as statements). It's pretty limited at the-moment, the bits that work are:--gathers enough information to add the table attributes types to the-catalog--typechecks row check constraints properly, but table check constraints-and all other constraints are not checked at all.--doesn't check for duplicate attribute names. doesn't check if the-types are valid for a table (e.g. disallow setof types)--We produce a valid environment update if the types of the attributes-check ok, any errors in the constraints aren't leaked.---}---SEM Statement- | CreateTable- loc.tpe = dependsOnRTpe @loc.attrTypes $ Right $ Pseudo Void- loc.envUpdates = dependsOn @loc.attrTypes []- [EnvCreateTable @name @atts.attrs defaultSystemColumns]- loc.attrTypes : {[Type]}- loc.attrTypes = map snd @atts.attrs-- loc.statementType = []- loc.backTree = CreateTable @ann- @name- @atts.annotatedTree- @cons.annotatedTree- cons.lib = case updateBindings @lhs.lib @lhs.env- [LibStackIDs [("", @atts.attrs)]] of- Left x -> error $ show x- Right e -> e-{-defaultSystemColumns :: [(String,Type)]-defaultSystemColumns = [("tableoid", ScalarType "oid")- ,("cmax", ScalarType "cid")- ,("xmax", ScalarType "xid")- ,("cmin", ScalarType "cid")- ,("xmin", ScalarType "xid")- ,("ctid", ScalarType "tid")]-}---SEM Statement- | CreateTableAs- loc.tpe =- dependsOnRTpe [@loc.selType] $ do- @loc.attrs- Right @loc.selType- loc.envUpdates =- leftToEmpty (\as -> [EnvCreateTable @name as defaultSystemColumns]) $ do- ats <- @loc.attrs- return $ dependsOn (tpeToT @loc.tpe :- (map snd ats)) [] ats-- loc.selType = getTypeAnnotation @expr.annotatedTree- -- type of the columns in the select expression- loc.attrs = unwrapSetOfComposite @loc.selType-- loc.backTree = CreateTableAs @ann @name @expr.annotatedTree- loc.statementType = []--{--attribute name and type gathering--}--ATTR AttributeDef [||attrName : String- namedType : Type]--SEM AttributeDef- | AttributeDef- lhs.attrName = map toLower @name- lhs.namedType = @typ.namedType--ATTR AttributeDefList [||attrs : {[(String, Type)]}]--SEM AttributeDefList- | Cons lhs.attrs = (@hd.attrName, @hd.namedType) : @tl.attrs- | Nil lhs.attrs = []--{--row check constraint:-inject the column name and type into the column constraints--}--SEM AttributeDef- | AttributeDef- cons.lib =- case updateBindings @lhs.lib @lhs.env- [LibStackIDs [("", [(@name, @typ.namedType)])]] of- Left x -> error $ show x- Right e -> e--
− Database/HsSqlPpp/AstInternals/TypeChecking/Dml.ag
@@ -1,208 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the type checking code for dml, currently insert,-update and delete.--================================================================================--= insert--check the insert data is the correct type. Doesn't cope with columns-with default values at the moment.---}--SEM Statement- | Insert- loc.tpe =- dependsOnRTpe [getTypeAnnotation @insData.annotatedTree] $ do- @loc.columnTypes- Right $ Pseudo Void- loc.statementType =- leftToEmpty (\ct -> [StatementType [] (fromMaybe [] @returning.listType)]) @loc.columnTypes-- loc.columnTypes =- do- tys <- unwrapSetOfComposite $- getTypeAnnotation @insData.annotatedTree- checkColumnConsistency @lhs.env- @table- @targetCols.strings- tys-- loc.backTree = Insert @ann @table @targetCols.annotatedTree- @insData.annotatedTree @returning.annotatedTree- loc.envUpdates = []---- inject the ids into the returning part--SEM Statement- | Insert- returning.lib =- fromRight @lhs.lib $ do- atts <- envCompositeAttrs @lhs.env relationComposites @table- updateBindings @lhs.lib @lhs.env [LibStackIDs [("", atts)]]--{--================================================================================--= update--check the set clause assignments are ok, and inject ids into the where part---}--SEM Statement- | Update- loc.tpe =- do- checkRelationExists @lhs.env @table- dependsOnRTpe (map snd @assigns.pairs) $ do- @loc.columnTypes- liftErrors @assigns.rowSetErrors- return $ Pseudo Void- loc.statementType =- leftToEmpty (\ct -> [StatementType [] (fromMaybe [] @returning.listType)]) @loc.columnTypes-- loc.columnTypes =- checkColumnConsistency @lhs.env- @table- (map fst @assigns.pairs)- @assigns.pairs-- loc.backTree = Update @ann- @table- @assigns.annotatedTree- @whr.annotatedTree- @returning.annotatedTree- loc.envUpdates = []----- local identifier bindings: pass the table attribute names and types--- into the where expression, and the set clause expressions--SEM Statement- | Update- loc.lib =- fromRight @lhs.lib $ do- ct <- envCompositeAttrs @lhs.env- relationComposites- @table- updateBindings @lhs.lib @lhs.env [LibStackIDs [("", ct)]]- whr.lib = @loc.lib- assigns.lib = @loc.lib- returning.lib = @loc.lib--{--== set clauses--small complication is slightly hacky code to deal with row set-assignments, where we assign from a multiple attribute subselect into-multiple columns - todo: check if we need so much special casing for-this: should be able to reuse the funcall typing of row set equality-(trade one hack for another, squinting so that assignment looks like-an equality check - since it type checks the same we might be ok). If-we do this, we only need to expand the row sets out to produce a-single string,type list at the end.---}--ATTR SetClauseList [||pairs : {[(String,Type)]}- rowSetErrors : {[TypeError]}]--SEM SetClauseList- | Cons lhs.pairs = @hd.pairs ++ @tl.pairs- lhs.rowSetErrors = maybeToList @hd.rowSetError ++ @tl.rowSetErrors- | Nil lhs.pairs = []- lhs.rowSetErrors = []--ATTR SetClause [||pairs : {[(String,Type)]}- rowSetError : {Maybe TypeError}]--SEM SetClause- | SetClause- lhs.pairs = [(@att, getTypeAnnotation @val.annotatedTree)]- lhs.rowSetError = Nothing- | RowSetClause- loc.rowSetError =- let atts = @atts.strings- types = getRowTypes @vals.typeList- in if length atts /= length types- then Just WrongNumberOfColumns- else Nothing- lhs.pairs = zip @atts.strings $ getRowTypes @vals.typeList--{-getRowTypes :: [Type] -> [Type]-getRowTypes [AnonymousRecordType ts] = ts-getRowTypes ts = ts-}--{--================================================================================--= delete--pretty simple, mainly just need to inject ids into the where part---}--SEM Statement- | Delete- loc.tpe =- checkRelationExists @lhs.env @table >>- Right (Pseudo Void)- loc.statementType = [StatementType [] (fromMaybe [] @returning.listType)]-- loc.backTree = Delete @ann @table @whr.annotatedTree @returning.annotatedTree- loc.envUpdates = []---SEM Statement- | Delete- loc.lib =- fromRight @lhs.lib $ do- columnTypes <- envCompositeAttrs @lhs.env relationComposites @table- updateBindings @lhs.lib @lhs.env [LibStackIDs [("", columnTypes)]]- whr.lib = @loc.lib- returning.lib = @loc.lib--{--================================================================================--}-{----small shortcut to help produce better errors?-checkRelationExists :: Environment -> String -> Either [TypeError] ()-checkRelationExists env tbl =- envCompositeDef env relationComposites tbl >>- return ()----used by both insert and update-checkColumnConsistency :: Environment -> String -> [String] -> [(String,Type)]- -> Either [TypeError] [(String,Type)]-checkColumnConsistency env tbl cols' insNameTypePairs = do- ttcols <- lowerize <$> envCompositePublicAttrs env [] tbl- let cols = if null cols'- then map fst ttcols- else map (map toLower) cols'- errorWhen (length insNameTypePairs /= length cols) [WrongNumberOfColumns]- let nonMatchingColumns = cols \\ map fst ttcols- errorWhen (not $ null nonMatchingColumns) $- map UnrecognisedIdentifier nonMatchingColumns- let targetNameTypePairs = map (\l -> (l,fromJust $ lookup l ttcols)) cols- --check the types of the insdata match the column targets- --name datatype columntype- typeTriples = map (\((a,b),c) -> (a,b,c)) $- zip targetNameTypePairs $- map snd insNameTypePairs- errs :: [TypeError]- errs = concat $ lefts $- map (\(_,b,c) -> checkAssignmentValid env c b) typeTriples- liftErrors errs- return targetNameTypePairs- where- lowerize = map (\(a,b) -> (map toLower a,b))--}
− Database/HsSqlPpp/AstInternals/TypeChecking/Drops.ag
@@ -1,31 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the code for drop statements, only does drop function at the moment---}--SEM Statement- | DropFunction- loc.tpe = Right $ Pseudo Void- loc.backTree = DropFunction @ann @ifE.annotatedTree @sigs.annotatedTree @cascade.annotatedTree- loc.envUpdates = flip map @sigs.fnSigs $ \(nm,args) ->- EnvDropFunction ifE nm args- where- ifE = @ifE.annotatedTree == IfExists- loc.statementType = []--ATTR StringTypeNameListPairList [||fnSigs:{[(String,[Type])]}]-SEM StringTypeNameListPairList- | Cons lhs.fnSigs = @hd.fnSig : @tl.fnSigs- | Nil lhs.fnSigs = []--ATTR StringTypeNameListPair [||fnSig:{(String,[Type])}]-SEM StringTypeNameListPair- | Tuple lhs.fnSig = (@x1, @x2.namedTypes)--ATTR TypeNameList [||namedTypes:{[Type]}]--SEM TypeNameList- | Cons lhs.namedTypes = @hd.namedType : @tl.namedTypes- | Nil lhs.namedTypes = []
− Database/HsSqlPpp/AstInternals/TypeChecking/ErrorUtils.lhs
@@ -1,59 +0,0 @@-Copyright 2009 Jake Wheat--This file contains a bunch of small low level utilities to help with-type checking.--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.TypeChecking.ErrorUtils-> (-> dependsOn-> ,dependsOnRTpe-> ,dependsOnT-> ,tpeToT-> ,liftErrors-> ,getErrors-> ) where--> import Data.List--> import Database.HsSqlPpp.AstInternals.TypeType--================================================================================--= type checking utils--== checkErrors--if we find a typecheckfailed in the list, then propagate that, else-use the final argument.--> dependsOn :: [Type] -> t -> t -> t-> dependsOn ts bad ok =-> if any (==TypeCheckFailed) ts-> then bad-> else ok--> dependsOnRTpe :: [Type] -> Either a Type -> Either a Type-> dependsOnRTpe ts = dependsOn ts (Right TypeCheckFailed)--> dependsOnT :: [Type] -> Type -> Type-> dependsOnT ts = dependsOn ts TypeCheckFailed--convert an 'either [typeerror] type' to a type--> tpeToT :: Either [TypeError] Type -> Type-> tpeToT tpe = case tpe of-> Left _ -> TypeCheckFailed-> Right t -> t--> liftErrors :: [TypeError] -> Either [TypeError] ()-> liftErrors es = if null es-> then Right ()-> else Left es--extract errors from an either, gives empty list if right--> getErrors :: Either [TypeError] Type -> [TypeError]-> getErrors = either id (const [])-
− Database/HsSqlPpp/AstInternals/TypeChecking/Expressions.ag
@@ -1,310 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the type checking code for the expression ast data-type.---}----gather the backtree, type errors and types together and add annotations-SEM Expression- | IntegerLit StringLit FloatLit BooleanLit NullLit FunCall Identifier- Exists Case CaseSimple Cast InPredicate ScalarSubQuery LiftOperator- PositionalArg Placeholder WindowFn- lhs.annotatedTree = annTypesAndErrors @loc.backTree- (tpeToT @loc.tpe)- (getErrors @loc.tpe)- Nothing--{--== literals--pretty straightforward--}--SEM Expression- | IntegerLit loc.tpe = Right typeInt- | StringLit loc.tpe = Right UnknownType- | FloatLit loc.tpe = Right typeNumeric- | BooleanLit loc.tpe = Right typeBool- -- I think a null has the same type resolution as an unknown string lit- | NullLit loc.tpe = Right UnknownType--SEM Expression- | IntegerLit- loc.backTree = IntegerLit @ann @i- | StringLit- loc.backTree = StringLit @ann @quote @value- | FloatLit- loc.backTree = FloatLit @ann @d- | BooleanLit- loc.backTree = BooleanLit @ann @b- | NullLit- loc.backTree = NullLit @ann---{---== cast expression--all the work is done in the typename node--}--SEM Expression- | Cast loc.tpe = Right $ @tn.namedType- loc.backTree = Cast @ann @expr.annotatedTree @tn.annotatedTree--{--== operators and functions--}-SEM Expression- | FunCall- loc.tpe = dependsOnRTpe @args.typeList $- typeCheckFunCall- @lhs.env- @funName- @args.typeList- loc.backTree = FunCall @ann @funName @args.annotatedTree--- | WindowFn- loc.tpe = Right (getTypeAnnotation @fn.annotatedTree)- loc.backTree = WindowFn @ann- @fn.annotatedTree- @partitionBy.annotatedTree- @orderBy.annotatedTree- @dir.annotatedTree- @frm.annotatedTree-{-{---small shim in front of findCallMatch in the type conversion code, to-handle some special cases.--Some of the special cases will no longer be needed when variadic-support is added.--between, greatest and least are treated as syntactic sugar so we-delegate the function lookups to the <=/>= operators.--the row comparison should be more general than this, since it supports-any operator satisfying some properties---TODO: move all of this into find call match. Don't know why it's separate--}-typeCheckFunCall :: Environment -> String -> [Type] -> Either [TypeError] Type-typeCheckFunCall env fnName' argsType =- {-trace ("typecheckfncall " ++ fnName' ++ show argsType) $-}- dependsOnRTpe argsType $- case fnName of- "count" -> -- not quite sure how this is suppose to work,- -- the counts in the pg catalog accept either- -- no args, or one arg of type any, but you can call- -- count with multiple arguments?- return typeBigInt- "!between" -> do- f1 <- lookupFn ">=" [argsType !! 0, argsType !! 1]- f2 <- lookupFn "<=" [argsType !! 0, argsType !! 2]- lookupFn "!and" [f1,f2]- --"coalesce" -> resolveResultSetType env argsType- "greatest" -> do- t <- lookupFn fnName argsType -- t <- resolveResultSetType env argsType- lookupFn ">=" [t,t]- return t- "least" -> do- t <- lookupFn fnName argsType -- resolveResultSetType env argsType- lookupFn "<=" [t,t]- return t- "!rowctor" -> return $ AnonymousRecordType argsType- -- special case the row comparison ops- -- this needs to be fixed: we want to match- -- any implicit casts to functions on composite types- -- first, then we can use the anonymous record type on- -- any composite- _ | fnName `elem` ["=", "<>", "<=", ">=", "<", ">"]- && length argsType == 2- && all isCompositeOrSetOfCompositeType argsType- && compositesCompatible env (head argsType) (head $ tail argsType) -> Right typeBool- --checked for all special cases, so run general case now- s -> lookupFn s argsType- where- lookupFn :: String -> [Type] -> Either [TypeError] Type- lookupFn s1 args = do- (_,_,r,_) <- findCallMatch env- (if s1 == "u-" then "-" else s1) args- return r- checkRowTypesMatch (AnonymousRecordType t1s) (AnonymousRecordType t2s) = do- when (length t1s /= length t2s) $ Left [ValuesListsMustBeSameLength]- let errs = map (resolveResultSetType env . (\(a,b) -> [a,b])) $- zip t1s t2s- liftErrors $ concat $ lefts errs- return typeBool- checkRowTypesMatch x y =- error $ "internal error: checkRowTypesMatch called with " ++- show x ++ "," ++ show y- fnName = map toLower fnName'-}--{--lifted operator:-pretty much the same as haskell 'any (lhs [op]) rhss' (or all instead of any)-where lhs is the first argument and rhss is the second argument-which must be an array--pg allows the rhss to also be a subselect, this is a todo---}--SEM Expression- | LiftOperator- loc.tpe = dependsOnRTpe @args.typeList $ do- let args = @args.annotatedTree- errorWhen (length args /= 2)- [AnyAllError $ "must have two args, got " ++ show args]- let [a,b] = args- aType = getTypeAnnotation a- bType = getTypeAnnotation b- dependsOnRTpe [aType,bType] $ do- errorWhen (not $ isArrayType bType)- [AnyAllError $ "second arg must be array, got " ++ show args]- elemType <- unwrapArray $ bType- resType <- typeCheckFunCall- @lhs.env- @oper- [aType,elemType]- errorWhen (resType /= typeBool)- [AnyAllError $ "operator must have bool return, got " ++ show resType]- return resType- loc.backTree = LiftOperator @ann @oper @flav.annotatedTree @args.annotatedTree---{--== case expression--for non simple cases, we need all the when expressions to be bool, and-then to collect the types of the then parts to see if we can resolve a-common type--for simple cases, we need to check all the when parts have the same type-as the value to check against, then we collect the then parts as above.---}--SEM Expression- | Case CaseSimple- loc.whenTypes = map getTypeAnnotation $ concatMap fst $- @cases.annotatedTree- loc.thenTypes = map getTypeAnnotation $- (map snd $ @cases.annotatedTree) ++- maybeToList @els.annotatedTree--SEM Expression- | Case- loc.tpe =- dependsOnRTpe @loc.whenTypes $ do- errorWhen (any (/= typeBool) @loc.whenTypes) $- [WrongTypes typeBool @loc.whenTypes]- dependsOnRTpe @loc.thenTypes $- resolveResultSetType @lhs.env @loc.thenTypes- loc.backTree = Case @ann @cases.annotatedTree @els.annotatedTree---SEM Expression- | CaseSimple- loc.tpe =- dependsOnRTpe @loc.whenTypes $ do- let valueType = getTypeAnnotation @value.annotatedTree- checkWhenTypes <-- resolveResultSetType @lhs.env (valueType : @loc.whenTypes)- dependsOnRTpe @loc.thenTypes $- resolveResultSetType @lhs.env @loc.thenTypes- loc.backTree = CaseSimple @ann- @value.annotatedTree- @cases.annotatedTree- @els.annotatedTree--{--== identifiers-pull id types out of env for identifiers---}--SEM Expression- | Identifier- loc.tpe = libLookupID @lhs.lib @i- loc.backTree = Identifier @ann @i---SEM Expression- | PositionalArg- loc.tpe = libLookupID @lhs.lib ('$':show @p)- loc.backTree = PositionalArg @ann @p---SEM Expression- | Placeholder- loc.tpe = Right UnknownType- loc.backTree = Placeholder @ann---- exists: will work on any subselect so we don't need to do any checking-SEM Expression- | Exists- loc.tpe = Right typeBool- loc.backTree = Exists @ann @sel.annotatedTree---{--== scalar subquery-1 col -> type of that col-2 + cols -> row type--}--SEM Expression- | ScalarSubQuery- loc.tpe =- do- let selType = getTypeAnnotation @sel.annotatedTree- dependsOnRTpe [selType] $ do- f <- map snd <$> unwrapSetOfComposite selType- case length f of- 0 -> Left [InternalError "no columns in scalar subquery?"]- 1 -> Right $ head f- _ -> Right $ AnonymousRecordType f-- loc.backTree = ScalarSubQuery @ann @sel.annotatedTree-{--== inlist-todo: make the ast and typechecking a special case of lifted operator--}--SEM Expression- | InPredicate- loc.tpe = do- lt <- @list.listType- ty <- resolveResultSetType- @lhs.env- [getTypeAnnotation @expr.annotatedTree, lt]- return typeBool- loc.backTree = InPredicate @ann- @expr.annotatedTree- @i- @list.annotatedTree---ATTR InList [||listType : {Either [TypeError] Type}]--SEM InList- | InList- lhs.listType = resolveResultSetType @lhs.env @exprs.typeList- | InSelect- lhs.listType =- do- attrs <- map snd <$> (unwrapSetOfComposite $- getTypeAnnotation @sel.annotatedTree)- typ <- case length attrs of- 0 -> Left [InternalError- "got subquery with no columns? in inselect"]- 1 -> Right $ head attrs- _ -> Right $ AnonymousRecordType attrs- dependsOnRTpe attrs $ Right typ
− Database/HsSqlPpp/AstInternals/TypeChecking/Misc.ag
@@ -1,109 +0,0 @@-{--Copyright 2009 Jake Wheat--Contains bit and pieces of type checking which don't fit anywhere else--================================================================================--= type names--Types with type modifiers (called PrecTypeName here, to be changed),-are not supported at the moment.---}--ATTR TypeName [||namedType : Type]--SEM TypeName- | SimpleTypeName ArrayTypeName SetOfTypeName PrecTypeName- lhs.namedType = tpeToT @loc.tpe- lhs.annotatedTree = updateAnnotation- ((map TypeErrorA $ getErrors @loc.tpe) ++)- @loc.backTree---SEM TypeName- | SimpleTypeName- loc.tpe = envLookupType @lhs.env $ canonicalizeTypeName @tn- loc.backTree = SimpleTypeName @ann @tn- | ArrayTypeName- loc.tpe = dependsOnRTpe [@typ.namedType] $ Right $ ArrayType @typ.namedType- loc.backTree = ArrayTypeName @ann @typ.annotatedTree- | SetOfTypeName- loc.tpe = dependsOnRTpe [@typ.namedType] $ Right $ SetOfType @typ.namedType- loc.backTree = SetOfTypeName @ann @typ.annotatedTree- | PrecTypeName- loc.tpe = envLookupType @lhs.env $ canonicalizeTypeName @tn- loc.backTree = PrecTypeName @ann @tn @prec---{--================================================================================--= generic node types---}----expression list and list list - just collect up the types--ATTR ExpressionList [||typeList : {[Type]}]--SEM ExpressionList- | Cons lhs.typeList = getTypeAnnotation @hd.annotatedTree : @tl.typeList- | Nil lhs.typeList = []---ATTR ExpressionListList [||typeListList : {[[Type]]}]--SEM ExpressionListList- | Cons lhs.typeListList = @hd.typeList : @tl.typeListList- | Nil lhs.typeListList = []----- stringlist: collect the strings-ATTR StringList [||strings : {[String]}]--SEM StringList- | Cons lhs.strings = @hd : @tl.strings- | Nil lhs.strings = []---- maybe bool expression: if present, then check its type is bool--SEM MaybeBoolExpression- | Just- lhs.annotatedTree =- if getTypeAnnotation @just.annotatedTree `notElem` [typeBool, TypeCheckFailed]- then Just $ updateAnnotation ((TypeErrorA ExpressionMustBeBool) :)- @just.annotatedTree- else Just $ @just.annotatedTree---{-{--================================================================================--= couple of small utils--I think this should be alright, an identifier referenced in an-expression can only have zero or one dot in it.--}--splitIdentifier :: String -> (String,String)-splitIdentifier s = let (a,b) = span (/= '.') s- in if b == ""- then ("", a)- else (a,tail b)--{--helper to make adding annotations a bit easier--}--annTypesAndErrors :: Data a => a -> Type -> [TypeError]- -> Maybe [AnnotationElement] -> a-annTypesAndErrors item nt errs add =- updateAnnotation modifier item- where- modifier = (([TypeAnnotation nt] ++ fromMaybe [] add ++- map TypeErrorA errs) ++)--}
− Database/HsSqlPpp/AstInternals/TypeChecking/MiscCreates.ag
@@ -1,71 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the ddl checking, apart from create function and-create table which have their own files.--= create view--pretty simple, just forwards the select expression type---}--SEM Statement- | CreateView- loc.tpe = dependsOnRTpe [getTypeAnnotation @expr.annotatedTree] $- Right $ Pseudo Void- loc.backTree = CreateView @ann @name @expr.annotatedTree- loc.attrs = case getTypeAnnotation @expr.annotatedTree of- SetOfType (CompositeType c) -> c- _ -> [] --TODO: error ignored- loc.envUpdates = [EnvCreateView @name @loc.attrs]- loc.statementType = []--{--================================================================================--= create type--might move this to create table since they have a fair bit in common--main shortcomings are the names and types aren't checked---}--ATTR TypeAttributeDef [||attrName : String- namedType : Type]--SEM TypeAttributeDef- | TypeAttDef- lhs.attrName = @name- lhs.namedType = @typ.namedType--ATTR TypeAttributeDefList [||attrs : {[(String, Type)]}]--SEM TypeAttributeDefList- | Cons lhs.attrs = (@hd.attrName, @hd.namedType) : @tl.attrs- | Nil lhs.attrs = []--SEM Statement- | CreateType- loc.tpe = Right $ Pseudo Void- loc.backTree = CreateType @ann @name @atts.annotatedTree- loc.statementType = []- loc.envUpdates = [EnvCreateComposite @name @atts.attrs]--{---= create domain---}--SEM Statement- | CreateDomain- loc.tpe = Right $ Pseudo Void- loc.backTree = CreateDomain @ann @name @typ.annotatedTree @checkName @check.annotatedTree- loc.statementType = []- loc.envUpdates = [EnvCreateDomain (DomainType @name) @typ.namedType]- --allow refering to value as 'value' in check expression- check.lib = fromRight @lhs.lib $- updateBindings @lhs.lib @lhs.env- [LibStackIDs [("", [("value", @typ.namedType)])]]
− Database/HsSqlPpp/AstInternals/TypeChecking/Plpgsql.ag
@@ -1,87 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the checking code for a few plpgsql statements.----}----todo: check return type consistent with function return type-SEM Statement- | Return- loc.tpe =- dependsOnRTpe [maybe typeBool- getTypeAnnotation- @value.annotatedTree] $ Right $ Pseudo Void- loc.backTree = Return @ann @value.annotatedTree- loc.envUpdates = []- loc.statementType = []---SEM Statement- | Assignment- loc.tpe =- do- let fromType = getTypeAnnotation @value.annotatedTree- toType <- libLookupID @lhs.lib @target- dependsOnRTpe [getTypeAnnotation @value.annotatedTree, toType] $ do- checkAssignmentValid @lhs.env fromType toType- return $ Pseudo Void- loc.backTree = Assignment @ann @target @value.annotatedTree- loc.envUpdates = []- loc.statementType = []--SEM Statement- | ForIntegerStatement- loc.varTypeE = libLookupID @lhs.lib @var- loc.tpe =- do- let fromType = getTypeAnnotation @from.annotatedTree- toType = getTypeAnnotation @to.annotatedTree- dependsOnRTpe [fromType,toType] $ do- --probably a bit too strict:- errorWhen (fromType /= toType) [FromToTypesNotSame fromType toType]- case @loc.varTypeE of- Right t -> checkAssignmentValid @lhs.env fromType t- Left _ -> return ()- return $ Pseudo Void- sts.lib =- case @loc.varTypeE of- Left [UnrecognisedIdentifier @var] ->- fromRight @lhs.lib $- updateBindings @lhs.lib @lhs.env- [LibStackIDs [("", [(@var,getTypeAnnotation @from.annotatedTree)])]]- _ -> @lhs.lib-- loc.backTree = ForIntegerStatement @ann @var @from.annotatedTree @to.annotatedTree @sts.annotatedTree- loc.envUpdates = []- loc.statementType = []---SEM Statement- | ForSelectStatement- loc.selType = getTypeAnnotation @sel.annotatedTree- loc.tpe =- do- dependsOnRTpe [@loc.selType] $ do- toType <- libLookupID @lhs.lib @var- dependsOnRTpe [toType] $ do- checkAssignmentValid @lhs.env @loc.selType toType- return $ Pseudo Void- --just handles assigning to a record type for now- --one thing that isn't quite right is that the record variable- --holds the last row in it after the for statement, which isn't- --supported here- sts.lib =- if okToUpdate- then fromRight @lhs.lib $- updateBindings @lhs.lib @lhs.env [LibStackIDs [("", [(@var,@loc.selType)])]]- -- todo:ignoring error- else @lhs.lib- where- okToUpdate = isRight @loc.tpe && @loc.selType /= TypeCheckFailed-- loc.backTree = ForSelectStatement @ann @var @sel.annotatedTree @sts.annotatedTree- loc.envUpdates = []- loc.statementType = []-
− Database/HsSqlPpp/AstInternals/TypeChecking/SelectLists.ag
@@ -1,184 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the code that handles the select list part of a-select expression.--TODO: stop wrapping string,type lists in unnamedcompositetypes, pointless---}--SEM SelectItem- | SelExp- loc.annotatedTree = SelExp @ann $ fixStar @ex.annotatedTree- | SelectItem- loc.annotatedTree = SelectItem @ann (fixStar @ex.annotatedTree) @name--ATTR MaybeSelectList [||listType : {Maybe [(String,Type)]}]--ATTR SelectItemList SelectList [||listType : {[(String,Type)]}]-ATTR SelectItem [||itemType : Type]--ATTR SelectList [||libUpdates : {[LocalIdentifierBindingsUpdate]}]--SEM MaybeSelectList- | Just lhs.listType = Just @just.listType- | Nothing lhs.listType = Nothing--SEM SelectItemList- | Cons lhs.listType = expandStar @lhs.lib @hd.columnName @hd.itemType @tl.listType- | Nil lhs.listType = []---SEM SelectItem- | SelExp SelectItem- lhs.itemType = getTypeAnnotation @ex.annotatedTree----SEM SelectList- | SelectList- lhs.listType = @items.listType--- check the into types- loc.errs = case @loc.stuff of- (er,_) -> er- loc.stuff =- case () of- _ | null sl -> ([],Nothing)- | not (null targetTypeErrs) -> (targetTypeErrs,Nothing)- | (case targetTypes of- [PgRecord _] -> True- _ -> False) -> ([],Just (head sl, CompositeType @items.listType))- | matchingComposite /= Left [] -> (fromLeft [] matchingComposite,Nothing)- | length sl /= length @items.listType -> ([WrongNumberOfColumns],Nothing)- | not (null assignErrs) -> (assignErrs,Nothing)- | otherwise -> ([],Nothing)- where- targetTypeEithers = map (libLookupID @lhs.lib) sl- targetTypeErrs = concat $ lefts $ targetTypeEithers- targetTypes = rights $ targetTypeEithers- typePairs = zip (map snd @items.listType) targetTypes- assignErrs = concat $ lefts $ map (uncurry $ checkAssignmentValid @lhs.env) typePairs- sl = @into.strings- matchingComposite =- case targetTypes of- [t] | isCompositeType t -> checkAssignmentValid @lhs.env (AnonymousRecordType (map snd @items.listType)) t- _ -> Left []-- lhs.annotatedTree = SelectList (@ann ++ map TypeErrorA @loc.errs)- @items.annotatedTree- @into.annotatedTree- lhs.libUpdates =- case @loc.stuff of- (_,Just r) -> [LibStackIDs [("", [r])]]- _ -> []---[(@var,@loc.selType)]--SEM Statement- | SelectStatement- loc.libUpdates = @ex.libUpdates--ATTR SelectExpression [||libUpdates : {[LocalIdentifierBindingsUpdate]}]--SEM SelectExpression- | Select- lhs.libUpdates = @selSelectList.libUpdates- | CombineSelect Values- lhs.libUpdates = []---- utils to handle a star, bit hacky, maybe should use a separate pass--- or something?--{-expandStar :: LocalIdentifierBindings- -> String- -> Type- -> [(String,Type)]- -> [(String,Type)]-expandStar env colName colType types =- fromRight types $ do- let (correlationName,iden) = splitIdentifier colName- newCols <- if iden == "*"- then libExpandStar env correlationName- else return [(iden, colType)]- return $ newCols ++ types--fixStar :: Expression -> Expression-fixStar =- everywhere (mkT fixStar')- where- fixStar' :: Annotation -> Annotation- fixStar' a =- if TypeAnnotation TypeCheckFailed `elem` a- && any (\an ->- case an of- TypeErrorA (UnrecognisedIdentifier x) |- let (_,iden) = splitIdentifier x- in iden == "*" -> True- _ -> False) a- then filter (\an -> case an of- TypeAnnotation TypeCheckFailed -> False- TypeErrorA (UnrecognisedIdentifier _) -> False- _ -> True) a- else a-}---{---================================================================================--= attribute names--columnName is used to collect the column names that the select list-produces, it is combined into an unnamedcompositetype in-selectitemlist, which is also where star expansion happens.---}--ATTR SelectItem [||columnName : String]--{--if the select item is just an identifier, then that column is named-after the identifier-e.g. select a, b as c, b + c from d, gives three columns one named-a, one named c, and one unnamed, even though only one has an alias-if the select item is a function or aggregate call at the top level,-then it is named after that function or aggregate--if it is a cast, the column is named after the target data type name-iff it is a simple type name---}----default value for non identifier nodes--{--override for identifier nodes, this only makes it out to the selectitem-node if the identifier is not wrapped in parens, function calls, etc.--}--ATTR Expression [||liftedColumnName : String]--SEM Expression- | Identifier lhs.liftedColumnName = @i- | FunCall lhs.liftedColumnName =- if isOperatorName @funName- then ""- else @funName- | Cast lhs.liftedColumnName = case @tn.annotatedTree of- SimpleTypeName _ tn -> tn- _ -> ""---SEM Expression- | BooleanLit Case Exists FloatLit IntegerLit LiftOperator- NullLit PositionalArg Placeholder ScalarSubQuery StringLit- lhs.liftedColumnName = ""---- collect the aliases and column names for use by the selectitemlist nodes-SEM SelectItem- | SelExp lhs.columnName = case @ex.liftedColumnName of- "" -> "?column?"- s -> s- | SelectItem lhs.columnName = @name
− Database/HsSqlPpp/AstInternals/TypeChecking/SelectStatement.ag
@@ -1,191 +0,0 @@-{--Copyright 2009 Jake Wheat--= basic select statements--This is a bit of a mess, will be rewritten with a proper literate-flavour once all the different bits are type checking ok, which should-make it much more readable.---}--SEM Statement- | SelectStatement- loc.tpe = dependsOnRTpe [getTypeAnnotation @ex.annotatedTree] $ Right $ Pseudo Void- loc.statementType = [StatementType ph $ leftToEmpty id $- unwrapSetOfComposite $- getTypeAnnotation @ex.annotatedTree]- where- ph = flip map (getPlaceholders @ex.annotatedTree)- $ const $ ScalarType "text"- loc.backTree = SelectStatement @ann @ex.annotatedTree- loc.envUpdates = []--SEM SelectExpression- | Values Select CombineSelect- lhs.annotatedTree = annTypesAndErrors @loc.backTree- (tpeToT @loc.tpe)- (getErrors @loc.tpe)- Nothing-{---================================================================================--Type checking select expressions--The main issue is the complicated flow of identifier bindings through the-various parts. This is the rough order in which this happens:--with-from-where-groupby-having-select-combine-orderby-limit--if a type error occurs, we want to give up on any following stages,-rather than create loads of type errors (maybe this could be refined-more).--The select list produces the final type which the selectexpression has.--inside the from, if we have any join expressions we need to pass the types-from the joined trefs to the join expressions.--So, the basic plan is to propagate the iden bindings in the env attribute-as elsewhere, and also pass along a flag to say whether the previous stage-type checked or not, so we can bail if it has failed.--alternative idea: explore transforming the ast for a select expression into-something using relational algebra-like operations - can then follow the flow-of ids easily. The problem might be with updating the annotations in the original-tree though.--== env passing current bodge--env flow:-current simple version:-from tref -> select list- -> where--(so we take the identifiers and types from the tref part, and send-them into the selectlist and where parts)--full order of identifier passing:- 1. from- 2. where- 3. group by- 4. having- 5. select---group by notes, from the pg manual:-group by expressions can be an input column name, or the name or-ordinal number of an output column (SELECT list item), or an arbitrary-expression formed from input-column values. In case of ambiguity, a-GROUP BY name will be interpreted as an input-column name rather than-an output column name.--For now, just send the input columns in as identifiers--}--SEM SelectExpression- | Select- loc.newLib = case updateBindings @lhs.lib @lhs.env @selTref.libUpdates of- Left x -> error $ show x -- @lhs.env- Right e -> e- selSelectList.lib = @loc.newLib- selWhere.lib = @loc.newLib- selGroupBy.lib = @loc.newLib- selOrderBy.lib = @loc.newLib----SEM SelectExpression- | Values- loc.tpe = typeCheckValuesExpr- @lhs.env- @vll.typeListList- loc.backTree = Values @ann @vll.annotatedTree- | Select- loc.tpe =- do- --let trefType = fromMaybe typeBool $ fmap getTypeAnnotation- -- @selTref.annotatedTree- Right $ case @selSelectList.listType of- [(_,Pseudo Void)] -> Pseudo Void- _ -> SetOfType $ CompositeType @selSelectList.listType- loc.backTree = Select @ann- @selDistinct.annotatedTree- @selSelectList.annotatedTree- @selTref.annotatedTree- @selWhere.annotatedTree- @selGroupBy.annotatedTree- @selHaving.annotatedTree- @selOrderBy.annotatedTree- @selLimit.annotatedTree- @selOffset.annotatedTree- | CombineSelect- loc.tpe =- let sel1t = getTypeAnnotation @sel1.annotatedTree- sel2t = getTypeAnnotation @sel2.annotatedTree- in dependsOnRTpe [sel1t, sel2t] $- typeCheckCombineSelect @lhs.env sel1t sel2t- loc.backTree = CombineSelect @ann @ctype.annotatedTree- @sel1.annotatedTree- @sel2.annotatedTree--{--typeCheckValuesExpr :: Environment -> [[Type]] -> Either [TypeError] Type-typeCheckValuesExpr env rowsTs =- let colNames = zipWith (++)- (repeat "column")- (map show [1..length $ head rowsTs])- in unionRelTypes env rowsTs colNames---typeCheckCombineSelect :: Environment -> Type -> Type -> Either [TypeError] Type-typeCheckCombineSelect env v1 v2 = do- u1 <- unwrapSetOfComposite v1- let colNames = map fst u1- u2 <- unwrapSetOfComposite v2- let colTypes1 = map snd u1- let colTypes2 = map snd u2- unionRelTypes env [colTypes1,colTypes2] colNames--unionRelTypes :: Environment -> [[Type]] -> [String] -> Either [TypeError] Type-unionRelTypes env rowsTs colNames =- let lengths = map length rowsTs- in case () of- _ | null rowsTs ->- Left [NoRowsGivenForValues]- | not (all (==head lengths) lengths) ->- Left [ValuesListsMustBeSameLength]- | otherwise ->- --i don't think this propagates all the errors, just the first set- mapM (resolveResultSetType env) (transpose rowsTs) >>=- (return . SetOfType . CompositeType . zip colNames)--}--INCLUDE "TypeChecking/TableRefs.ag"--INCLUDE "TypeChecking/SelectLists.ag"---{-getPlaceholders :: Data a => a -> [Expression]-getPlaceholders st =- filter isPlaceholder $ everything (++) (mkQ [] ga) st- where- ga :: Expression -> [Expression]- ga s = [s]- isPlaceholder e = case e of- PositionalArg _ _ -> True- Placeholder _ -> True- _ -> False-}
− Database/HsSqlPpp/AstInternals/TypeChecking/Statements.ag
@@ -1,122 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the general code for statements and statement-lists, and includes the ag files for various flavours of statement.--The attributes and sem statements in this file are for chaining the-env updates as we progress through a statement list, and for producing-the resultant env after we've checked a whole ast, this can be used-e.g. to type check multiple files in a row which depend on eachother.---}---- env updates syn attr is used by each statement to report--- what changes it makes to the catalog, we use this to update--- the env to feed into the next statement--ATTR Statement [||envUpdates : {[EnvironmentUpdate]}- libUpdates : {[LocalIdentifierBindingsUpdate]}]---ATTR StatementList [envUpdates : {[EnvironmentUpdate]}- libUpdates : {[LocalIdentifierBindingsUpdate]}||]-----producedenv is used to pass the final updated env out-ATTR StatementList Root [|| producedEnv : Environment- producedLib : LocalIdentifierBindings]--ATTR Statement [inProducedEnv: Environment||]--SEM StatementList- | Cons Nil- --newenv is the environment passed into the head statement- --updated with any catalog changes that that statement has made- loc.newEnv = fromRight @lhs.env $ updateEnvironment @lhs.env @lhs.envUpdates- loc.newLib = fromRight @lhs.lib $ updateBindings @lhs.lib @lhs.env @lhs.libUpdates- | Cons- hd.env = @loc.newEnv- tl.env = @loc.newEnv- hd.lib = @loc.newLib- tl.lib = @loc.newLib- --produced env is used to chain the final updated environment from the last- --element of the list and pass it back up the list so in can be pushed up- -- to the root element and sent out from there- lhs.producedEnv = @tl.producedEnv- lhs.producedLib = @tl.producedLib- --this is probably a bit inefficient: it creates a new environment from scratch- --on each statement instead of chaining on the last updated env- tl.envUpdates = @hd.envUpdates- tl.libUpdates = @hd.libUpdates- | Nil- lhs.producedEnv = @loc.newEnv- lhs.producedLib = @loc.newLib--SEM Statement- | SelectStatement Insert Update Delete CreateView CreateDomain- CreateFunction CreateType CreateTable CreateTableAs Return Assignment- ForSelectStatement ForIntegerStatement DropFunction- loc.tpe : {Either [TypeError] Type}- lhs.annotatedTree = annTypesAndErrors @loc.backTree- (tpeToT @loc.tpe)- (getErrors @loc.tpe)- $ Just (map StatementTypeA @loc.statementType ++- [EnvUpdates @loc.envUpdates])- loc.envUpdates : {[EnvironmentUpdate]}- lhs.envUpdates = @loc.envUpdates- lhs.libUpdates = @loc.libUpdates- | Insert Update Delete CreateView CreateDomain- CreateFunction CreateType CreateTable CreateTableAs Return- Assignment ForSelectStatement ForIntegerStatement Set CreateLanguage- Notify CreateSequence AlterSequence DropFunction- loc.libUpdates = []--SEM StatementList- | Cons hd.inProducedEnv = @tl.producedEnv---SEM Root- | Root statements.envUpdates = []- statements.libUpdates = []--SEM Statement- | CaseStatement ContinueStatement Copy CopyData- DropSomething Execute ExecuteInto- If NullStatement Perform Raise ReturnNext ReturnQuery Truncate- WhileStatement Set CreateLanguage Notify CreateSequence- AlterSequence AlterTable CreateTrigger- lhs.envUpdates = []- lhs.libUpdates = []--SEM ExpressionListStatementListPair- | Tuple- x2.envUpdates = []- x2.libUpdates = []-SEM ExpressionStatementListPair- | Tuple- x2.envUpdates = []- x2.libUpdates = []-SEM FnBody- | PlpgsqlFnBody SqlFnBody- sts.envUpdates = []- sts.libUpdates = []-SEM Statement- | CaseStatement If- els.envUpdates = []- els.libUpdates = []-SEM Statement- | ForIntegerStatement ForSelectStatement WhileStatement- sts.envUpdates = []- sts.libUpdates = []----INCLUDE "TypeChecking/SelectStatement.ag"-INCLUDE "TypeChecking/Dml.ag"-INCLUDE "TypeChecking/CreateTable.ag"-INCLUDE "TypeChecking/MiscCreates.ag"-INCLUDE "TypeChecking/CreateFunction.ag"-INCLUDE "TypeChecking/Drops.ag"-INCLUDE "TypeChecking/Plpgsql.ag"-
− Database/HsSqlPpp/AstInternals/TypeChecking/TableRefs.ag
@@ -1,270 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the checking for tablerefs (the from part of a-select expression).---}---- lib update contains the updated id and star expansions coming out--- of the tableref part of a select expression. These updates aren't--- used for chaining these things for nested table refs (in join--- statements) - use attributes for them--ATTR TableRef TableRefList [|| libUpdates: {[LocalIdentifierBindingsUpdate]}]---- use these attributes which contain a copy of the info in lib--- updates in a form more digestible to the join attributes resolution--- the main advantages is we don't have to pull the ids out of a list--- of update wrappers, and we don't have to split the id bindings into--- qualified and unqualified parts. We could do it just using the--- libupdates in principle, but this way seems to be a bit more direct--- and clear to write and read (i.e. when I tried to to it using--- libupdates I failed and gave up several times).-ATTR TableRef [|| idLookups : {[(String,Type)]}- starExpansion : {[(String,Type)]}- qidLookups : {[(String,[(String,Type)])]}- qstarExpansion : {[(String,[(String,Type)])]}]---- set the annotations, just need to pick up any type errors whilst--- calculating the new bindings-SEM TableRef- | SubTref Tref TrefFun JoinedTref- lhs.annotatedTree =- updateAnnotation (map TypeErrorA @loc.errs ++) @loc.backTree--SEM TableRefList- | Nil- lhs.libUpdates = []- | Cons- lhs.libUpdates = @hd.libUpdates--{---in the individual sem parts, we set four values:-idlookups : [(string,type)] pairs for all the unqualified ids which will be in scope coming out of the tref-qidlookups: [(string, [(string,type)])] for all the qualified ids-starexpansion: to expand unqualified *-qstarexpansion: to expand qualified *-(we need idlookups and starexpansion because of pg system columns,-which are a serious pain to deal with).--These are set as local vars, because we need to feed the resultant lib-update into the on expressions in joins lower down, which we can't do-directly with a syn attribute, so we collect them in locals, the-combined the in a local for libupdates. We copy all the parts and the-lib updates to regular attributes so we can access them from other-sems (the components (idlookups, etc.) are needed in working out joins-attributes, and the libupdate is used in the join expression, so all-this extra copying is only needed to support joins).--in each part, we collect errors in the errs local which we can then-add to the annotation for the node. when this happens, further type-checking in the select statement should stop but this isn't properly-implemented yet (this is to avoid too many type errors all over the-tree resulting from one mistake - a user friendliness consideration)---}--SEM TableRef- | SubTref Tref TrefFun JoinedTref- loc.idLookups : {[(String,Type)]}- loc.qidLookups : {[(String,[(String,Type)])]}- loc.starExpansion : {[(String,Type)]}- loc.qstarExpansion : {[(String,[(String,Type)])]}- loc.libUpdates = if null @errs- then [LibStackIDs $ ("", @loc.idLookups): @loc.qidLookups- ,LibSetStarExpansion $ ("", @loc.starExpansion): @loc.qstarExpansion]- else []--ATTR TableRef [jlibUpdates: {[LocalIdentifierBindingsUpdate]}||]--{---similar sort of pattern for each sem:-forward the errs-get the information we need to fill in the lookups and expansions as an either-fill in the lookups and expansions---}-SEM TableRef- | SubTref- loc.errs = case @loc.selectAttrs of- Left e -> e- Right _ -> []- loc.selectAttrs : {Either [TypeError] [(String,Type)]}- loc.selectAttrs = unwrapSetOfComposite (getTypeAnnotation @sel.annotatedTree)-- loc.idLookups = fromRight [] @loc.selectAttrs- loc.qidLookups = [(getAlias "" @alias.annotatedTree, @loc.idLookups)]- loc.starExpansion = @loc.idLookups- loc.qstarExpansion = @loc.qidLookups-- | Tref- loc.errs = case @loc.relType of- Left e -> e- Right _ -> []- loc.relType : {Either [TypeError] ([(String, Type)], [(String, Type)])}- loc.relType = envCompositeAttrsPair @lhs.env [] @tbl- loc.relType1 = fromRight ([],[]) @loc.relType- loc.pAttrs = fst @loc.relType1- loc.sAttrs = snd @loc.relType1-- loc.idLookups = @loc.pAttrs ++ @loc.sAttrs- loc.alias = getAlias @tbl @alias.annotatedTree- loc.qidLookups = [(@loc.alias, @loc.idLookups)]- loc.starExpansion = @loc.pAttrs- loc.qstarExpansion = [(@loc.alias, @loc.pAttrs)]-- | TrefFun- loc.errs = case @eqfunIdens of- Left e -> e- Right _ -> []- loc.eqfunIdens : {Either [TypeError] (String,[(String,Type)])}- loc.eqfunIdens = funIdens @lhs.env @loc.alias @fn.annotatedTree- loc.qfunIdens = fromRight ("",[]) @loc.eqfunIdens- loc.alias2 = fst @loc.qfunIdens- loc.funIdens = snd @loc.qfunIdens- loc.alias = getAlias "" @alias.annotatedTree-- loc.idLookups = @loc.funIdens- loc.qidLookups = [(@alias2, @loc.idLookups)]- loc.starExpansion = @loc.idLookups- loc.qstarExpansion = @loc.qidLookups- | JoinedTref- loc.errs = fromLeft [] @loc.ejoinAttrs- loc.removeJoinAttrs = filter (\(n,_) -> n `notElem` @loc.joinNames)- --the main meat: find out the name and types of all the common- -- join attributes that need to be combined in the result- -- (this is all the attributes which appear in both tables in- -- the case of a natural join, or all the attributes appearing- -- in the join list in the case of a using join. for other- -- joins, this list is empty- -- all the attributes which don't appear in this list just- -- get added together so we don't need to worry about them- loc.ejoinAttrs : {Either [TypeError] [(String,Type)]}- loc.ejoinAttrs =- do- -- get the names of the join columns- let jns = case (@nat.annotatedTree, @onExpr.originalTree) of- (Natural, _) -> commonFieldNames- (_,Just (JoinUsing _ s)) -> s- _ -> []- --make sure these columns appear in both tables- tjtsm = map (flip lookup @tbl.idLookups) jns- t1jtsm = map (flip lookup @tbl1.idLookups) jns- errorWhen (not $ null $ filter (==Nothing) $ tjtsm ++ t1jtsm)- [MissingJoinAttribute]- let tjts = catMaybes tjtsm -- should be no nothings at this stage- t1jts = catMaybes t1jtsm- -- find the types of these columns - this uses the result set- -- type resolution (see typeconversion.lhs for more details- -- and the relevant link to the pg manual- resolvedTypes :: [Either [TypeError] Type]- resolvedTypes = map (\(a,b) -> resolveResultSetType @lhs.env [a,b]) $ zip tjts t1jts- liftErrors $ concat $ lefts resolvedTypes- return $ zip jns $ rights resolvedTypes- where- commonFieldNames = intersect (f @tbl.starExpansion) (f @tbl1.starExpansion)- where f = map fst- loc.joinNames = map fst @loc.joinAttrs- loc.joinAttrs = fromRight [] @loc.ejoinAttrs-- --this is where we use the joinAttrs to filter the lookups and- --expansions: stick the joinattrs at the start- -- and add the other two lists minus the join attributes- loc.idLookups = @loc.joinAttrs ++- @loc.removeJoinAttrs @tbl.idLookups ++- @loc.removeJoinAttrs @tbl1.idLookups- loc.qidLookups = @tbl.qidLookups ++ @tbl1.qidLookups- loc.starExpansion = @loc.joinAttrs ++- @loc.removeJoinAttrs @tbl.starExpansion ++- @loc.removeJoinAttrs @tbl1.starExpansion- loc.qstarExpansion = @tbl.qstarExpansion ++ @tbl1.qstarExpansion-- -- we need the attributes from the joined tables to be available- -- in the join expression.- loc.newLib = case updateBindings @lhs.lib @lhs.env (@loc.libUpdates ++ @lhs.jlibUpdates) of- Left x -> error $ show x- Right e -> {-trace ("on expr lib:" ++ show e)-} e- onExpr.lib = @loc.newLib- --need to pass this into nested joins also- tbl.jlibUpdates = @loc.libUpdates- tbl1.jlibUpdates = @loc.libUpdates---SEM TableRefList- | Cons hd.jlibUpdates = []---{-{--convert a function call into a [String,[(string,type)]] list for use-in a tableref context-first consideration is the alias: if there is an alias in the select,-e.g. select * from generate_series(1,2) x; (alias is x)-we use that, otherwise we use the name of the function-second consideration is the attributes coming out, roughly speaking-we have to convert an arbitrary type to a relation type-if we have a relation valued function, we don't need to do anything-if we have a setof non composite, we lift the single type to an-attribute, using the function name for the attribute name-if we have a non setof, we lift the single type to an attribute and-then relation, using the function name for the attribute name-need to check to see what should happen with arrayof---}-funIdens :: Environment -> String -> Expression -> Either [TypeError] (String,[(String,Type)])-funIdens env alias fnVal = do- errorWhen (case fnVal of- FunCall _ _ _ -> False- _ -> True)- [ContextError "FunCall"]- let (FunCall _ fnName _) = fnVal- correlationName = if alias /= ""- then alias- else fnName- attrs <- do- case getTypeAnnotation fnVal of- SetOfType (NamedCompositeType t) -> envCompositePublicAttrs env [] t- SetOfType x -> return [(correlationName,x)]- y -> return [(correlationName,y)]- return (correlationName, attrs)--getAlias :: String -> TableAlias -> String-getAlias def alias =- case alias of- NoAlias -> def- TableAlias t -> t- FullAlias t _ -> t--}---- boilerplate--- copying the locals to syn attrs--SEM TableRef- | SubTref Tref TrefFun JoinedTref- lhs.libUpdates = @loc.libUpdates- lhs.idLookups = @loc.idLookups- lhs.qidLookups = @loc.qidLookups- lhs.starExpansion = @loc.starExpansion- lhs.qstarExpansion = @loc.qstarExpansion---- backtrees--SEM TableRef- | SubTref- loc.backTree = SubTref @ann @sel.annotatedTree @alias.annotatedTree- | Tref- loc.backTree = Tref @ann @tbl @alias.annotatedTree- | TrefFun- loc.backTree = TrefFun @ann @fn.annotatedTree @alias.annotatedTree- | JoinedTref- loc.backTree = JoinedTref @ann- @tbl.annotatedTree- @nat.annotatedTree- @joinType.annotatedTree- @tbl1.annotatedTree- @onExpr.annotatedTree- @alias.annotatedTree
− Database/HsSqlPpp/AstInternals/TypeChecking/TypeChecking.ag
@@ -1,213 +0,0 @@-{--Copyright 2009 Jake Wheat--This file contains the attr and sem definitions, which do the type-checking, etc..--A lot of the haskell code has been moved into other files:-TypeCheckingH, AstUtils.lhs, it is intended that only small amounts of-code appear (i.e. one-liners) inline in this file, and larger bits go-in AstUtils.lhs. These are only divided because the attribute grammar-system uses a custom syntax with a custom preprocessor. These-guidelines aren't followed very well.--The current type checking approach doesn't quite match how SQL-works. The main problem is that you can e.g. exec create table-statements inside a function. This is something that the type checker-will probably not be able to deal for a while if ever. (Will need-hooks into postgresql to do this properly, which might not be-impossible...).--Once most of the type checking is working, all the code and-documentation will be overhauled quite a lot. Alternatively put, this-code is in need of better documentation and organisation, and serious-refactoring.--An unholy mixture of Maybe, Either, Either/Error Monad and TypeCheckFailed-is used to do error handling.--One of the common patterns is when type checking a node:--first check any types of subnodes which it depends on, if any are-typecheckfailed, then this node's type is typecheckfailed and we stop-there.--otherwise, calculate the type of this node, or get an error if there-is a problem, this is put into loc.tpe which is Either TypeError-Type. Then some common code takes this value and sets the node type to-the type or typecheckfailed if tpe is left, and if it is left add a-type error annotation also.--================================================================================--= main attributes used--Here are the main attributes used in the type checking:--env is used to chain the environments up and down the tree, to allow-access to the catalog information, and to store the in environment-identifier names and types e.g. inside a select expression.--annotatedTree is used to create a copy of the ast with the type,-etc. annotations.---}-ATTR AllNodes Root ExpressionRoot- [ env : Environment- lib : LocalIdentifierBindings || annotatedTree : SELF- -- workaround: avoid bogus cycle- -- detections search for this,- -- replace with annotated tree- -- and uuagc can't tell that- -- there aren't any real cycles- originalTree : SELF]----INCLUDE "TypeChecking/Misc.ag"-INCLUDE "TypeChecking/Expressions.ag"-INCLUDE "TypeChecking/Statements.ag"---{---old stuff:--================================================================================--= static tests--Try to use a list of message data types to hold all sorts of-information which works its way out to the top level where the client-code gets it. Want to have the lists concatenated together-automatically from subnodes to parent node, and then to be able to add-extra messages to this list at each node also.--Problem 1: can't have two sem statements for the same node type which-both add messages, and then the messages get combined to provide the-final message list attribute value for that node. You want this so-that e.g. that different sorts of checks appear in different-sections. Workaround is instead of having each check in it's own-section, to combine them all into one SEM. Can work around this-without too much difficulty by using local attributes. Not sure if-something more clever would be an improvement.--Problem 2: no shorthand to combine what the default rule for messages-would be and then add a bit extra - so if you want all the children-messages, plus possibly an extra message or two, have to write out the-default rule in full explicitly. Can get round this by writing out-loads of code, which is error prone. Don't know if there is a better way--================================================================================--= inloop testing--inloop - use to check continue, exit, and other commands that can only-appear inside loops (for, while, loop)--the only nodes that really need this attribute are the ones which can-contain statements--The inloop test is the only thing which uses the messages atm. It-shouldn't, at some point inloop testing will become part of the type-checking.--This is just some example code, will probably do something a lot more-heavy weight like symbolic interpretation - want to do all sorts of-loop, return, nullability, etc. analysis.---}-{--ATTR AllNodes Root ExpressionRoot [||messages USE {++} {[]} : {[Message]}]--ATTR AllNodes- [ inLoop: Bool||]--SEM Root- | Root statements.inLoop = False--SEM ExpressionRoot- | ExpressionRoot expr.inLoop = False---- set the inloop stuff which nests, it's reset inside a create--- function statement, in case you have a create function inside a--- loop, seems unlikely you'd do this though--SEM Statement- | ForSelectStatement ForIntegerStatement WhileStatement sts.inLoop = True- | CreateFunction body.inLoop = False---- now we can check when we hit a continue statement if it is in the--- right context-SEM Statement- | ContinueStatement lhs.messages = if not @lhs.inLoop- then [Error ContinueNotInLoop]- else []--}-{--================================================================================--= notes and todo---containment guide for select expressions:-combineselect 2 selects-insert ?select-createtableas 1 select-createview 1 select-return query 1 select-forselect 1 select-select->subselect select-expression->exists select- scalarsubquery select- inselect select--containment guide for statements:-forselect [statement]-forinteger [statement]-while [statement]-casestatement [[statement]]-if [[statement]]-createfunction->fnbody [Statement]--TODO--some non type-check checks:-check plpgsql only in plpgsql function-orderby in top level select only-copy followed immediately by copydata iff stdin, copydata only follows- copy from stdin-count args to raise, etc., check same number as placeholders in string-no natural with onexpr in joins-typename -> setof (& fix parsing), what else like this?-expressions: positionalarg in function, window function only in select- list top level--review all ast checks, and see if we can also catch them during-parsing (e.g. typeName parses setof, but this should only be allowed-for a function return, and we can make this a parse error when parsing-from source code rather than checking a generated ast. This needs-judgement to say whether a parse error is better than a check error, I-think for setof it is, but e.g. for a continue not in a loop (which-could be caught during parsing) works better as a check error, looking-at the error message the user will get. This might be wrong, haven't-thought too carefully about it yet).---TODO: canonicalize ast process, as part of type checking produces a-canonicalized ast which:-all implicit casts appear explicitly in the ast (maybe distinguished-from explicit casts?)-all names fully qualified-all types use canonical names-literal values and selectors in one form (use row style?)-nodes are tagged with types-what else?--Canonical form only defined for type consistent asts.--This canonical form should pretty print and parse back to the same-form, and type check correctly.----}
− Database/HsSqlPpp/AstInternals/TypeChecking/TypeConversion.lhs
@@ -1,571 +0,0 @@-Copyright 2009 Jake Wheat--This file contains the functions for resolving types and-function/operator resolution. See the pg manual chapter 10:--http://www.postgresql.org/docs/8.4/interactive/typeconv.html--This code is really spaghettified.--findCallMatch - pass in a name and a list of arguments, and it returns-the matching function. (pg manual 10.2,10.3)--resolveResultSetType - pass in a set of types, and it tries to find-the common type they can all be cast to. (pg manual 10.5)--checkAssignmentValid - pass in source type and target type, returns- typelist[] if ok, otherwise error, pg manual 10.4- Value Storage--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.AstInternals.TypeChecking.TypeConversion (-> findCallMatch-> ,resolveResultSetType-> ,checkAssignmentValid-> ,compositesCompatible-> ) where--> import Data.Maybe-> import Data.List-> import Debug.Trace--> import Database.HsSqlPpp.AstInternals.TypeType-> import Database.HsSqlPpp.AstInternals.TypeChecking.ErrorUtils-> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal-> import Database.HsSqlPpp.Utils-- > traceIt :: Show a => String -> a -> a- > traceIt s t = trace (s ++ ": " ++ show t) t--= findCallMatch--findCallMatch - partially implements the type conversion rules for-finding an operator or function match given a name and list of-arguments with partial or fully specified types--TODO:, qualifiers-namespaces-function style casts not in catalog-variadic args-default args-domains -> base type-what about aggregates and window functions?--Algo:--cands = all fns with matching names- and same number of args--if exact match on types in this list, use it- (if binary operator being matched, and one arg is typed and one is- unknown, also match an operator by assuming the unknown is the same- as the typed arg)--best match part:--filter cands with args which don't exactly match input args, and input-args cannot be converted by an implicit cast. unknowns count as-matching anything-if one left: use it--filter for preferred types:--for each cand, count each arg at each position which needs conversion,-and the cand type is a preferred type at that position.-if there are cands with count>0, keep only cands with the max count,-if one return it-if there are no cands with count>0, keep them all--check unknowns:-if any input args are unknown, and any cand accepts string at that-position, fix that arg's category as string, otherwise if all cands-accept same category at that position, fix that input args as that-category.-if we still have unknowns, then fail--discard cands which don't match the new input arg/category list--for each categorised input arg, if any cand accepts preferred type at-that position, get rid of cands which don't accept preferred type at-that position--if one left: use-else fail--polymorphic matching:-want to create a set of matches to insert into the cast pairs list-so:--find all matches on name, num args and have polymorphic parameters--for each one, check the polymorphic categories - eliminate fns that-have params in wrong category - array, non array, enum.-work out the base types for the polymorphic args at each spot based on-the args passed - so each arg is unchanged except arrays which have-the array part stripped off--now we have a list of types to match against the polymorphic params,-use resolveResultSetType to see if we can produce a match, if so,-create a new prototype which is the same as the polymorphic function-but with this matching arg swapped in, work out the casts and add it-into cand cast pairs, after exact match has been run.---findCallMatch is a bit of a mess--todos:--rewrite this to try to make it a bit clearer--find some way to draw a data flow diagram of the code easily--add a logging facility so the function can explain what has happened-at each state, so you can provide a detailed explanation e.g. if the-code can't find an operator match to see what it has tried to match-against.--> type ProtArgCast = (FunctionPrototype, [ArgCastFlavour])--> findCallMatch :: Environment -> String -> [Type] -> Either [TypeError] FunctionPrototype-> findCallMatch env f inArgs =-> returnIfOnne [-> exactMatch-> ,binOp1UnknownMatch-> ,polymorpicExactMatches-> ,reachable-> ,mostExactMatches-> ,filteredForPreferred-> ,unknownMatchesByCat]-> [NoMatchingOperator f inArgs]-> where-> -- basic lists which roughly mirror algo-> -- get the possibly matching candidates-> initialCandList :: [FunctionPrototype]-> initialCandList = filter (\(_,candArgs,_,_) ->-> length candArgs == length inArgs) $-> map expandVariadic $ envLookupFns env f->-> expandVariadic fp@(fn,a,r,v) =-> if v-> then case last a of-> ArrayType t -> (fn, na,r,v)-> where na = init a ++ replicate (length inArgs - length a + 1) t-> _ -> fp --should be error-> else fp->-> -- record what casts are needed for each candidate-> castPairs :: [[ArgCastFlavour]]-> castPairs = map (listCastPairs . getFnArgs) initialCandList->-> candCastPairs :: [ProtArgCast]-> candCastPairs = {-traceIt "candCastPairs" $-} zip initialCandList castPairs->-> -- see if we have an exact match-> exactMatch :: [ProtArgCast]-> exactMatch = filterCandCastPairs (all (==ExactMatch)) candCastPairs->-> -- implement the one known, one unknown resolution for binary operators-> binOp1UnknownMatch :: [ProtArgCast]-> binOp1UnknownMatch = getBinOp1UnknownMatch candCastPairs->-> --collect possible polymorphic matches-> polymorphicMatches :: [ProtArgCast]-> polymorphicMatches = filterPolymorphics candCastPairs->-> polymorpicExactMatches :: [ProtArgCast]-> polymorpicExactMatches = filterCandCastPairs (all (==ExactMatch)) polymorphicMatches->-> -- eliminate candidates for which the inargs cannot be casted to-> reachable :: [ProtArgCast]-> reachable = mergePolys (filterCandCastPairs (none (==CannotCast)) candCastPairs)-> polymorphicMatches->-> mostExactMatches :: [ProtArgCast]-> mostExactMatches =-> let inArgsBase = map (replaceWithBase env) inArgs-> exactCounts :: [Int]-> exactCounts =-> map ((length-> . filter (\(a1,a2) -> a1==replaceWithBase env a2)-> . zip inArgsBase)-> . (\((_,a,_,_),_) -> a)) reachable-> pairs = zip reachable exactCounts-> maxm = maximum exactCounts-> in case () of-> _ | null reachable -> []-> | maxm > 0 -> map fst $ filter (\(_,b) -> b == maxm) pairs-> | otherwise -> []->-> -- keep the cands with the most casts to preferred types-> preferredTypesCounts = countPreferredTypeCasts reachable-> keepCounts = maximum preferredTypesCounts-> itemCountPairs :: [(ProtArgCast,Int)]-> itemCountPairs = zip reachable preferredTypesCounts-> filteredForPreferred :: [ProtArgCast]-> filteredForPreferred = map fst $ filter (\(_,i) -> i == keepCounts) itemCountPairs->-> -- collect the inArg type categories to do unknown inArg resolution-> argCats :: [Either () String]-> argCats = getCastCategoriesForUnknowns filteredForPreferred-> unknownMatchesByCat :: [ProtArgCast]-> unknownMatchesByCat = getCandCatMatches filteredForPreferred argCats->-> -------------->-> listCastPairs :: [Type] -> [ArgCastFlavour]-> listCastPairs l = listCastPairs' inArgs l-> where-> listCastPairs' :: [Type] -> [Type] -> [ArgCastFlavour]-> listCastPairs' (ia:ias) (ca:cas) =-> (case () of-> _ | ia == ca -> ExactMatch-> | castableFromTo env ImplicitCastContext ia ca ->-> if envPreferredType env ca-> then ImplicitToPreferred-> else ImplicitToNonPreferred-> | otherwise -> CannotCast-> ) : listCastPairs' ias cas-> listCastPairs' [] [] = []-> listCastPairs' _ _ = error "internal error: mismatched num args in implicit cast algorithm"->->-> getBinOp1UnknownMatch :: [ProtArgCast] -> [ProtArgCast]-> getBinOp1UnknownMatch cands =-> if not (isOperatorName f &&-> length inArgs == 2 &&-> count (==UnknownType) inArgs == 1)-> then []-> else let newInArgs =-> replicate 2 (if head inArgs == UnknownType-> then inArgs !! 1-> else head inArgs)-> in filter (\((_,a,_,_),_) -> a == newInArgs) cands->-> filterPolymorphics :: [ProtArgCast] -> [ProtArgCast]-> filterPolymorphics cl =-> let ms :: [ProtArgCast]-> ms = filter canMatch polys-> polyTypes :: [Maybe Type]-> polyTypes = map resolvePolyType ms-> polyTypePairs :: [(Maybe Type, ProtArgCast)]-> polyTypePairs = zip polyTypes ms-> keepPolyTypePairs :: [(Type, ProtArgCast)]-> keepPolyTypePairs =-> mapMaybe (\(t,p) -> case t of-> Nothing -> Nothing-> Just t' -> Just (t',p))-> polyTypePairs-> finalRows = map (\(t,p) -> instantiatePolyType p t)-> keepPolyTypePairs-> --create the new cast lists-> cps :: [[ArgCastFlavour]]-> cps = map (listCastPairs . getFnArgs . fst) finalRows-> in zip (map fst finalRows) cps-> where-> polys :: [ProtArgCast]-> polys = filter (\((_,a,_,_),_) -> any (`elem`-> [Pseudo Any-> ,Pseudo AnyArray-> ,Pseudo AnyElement-> ,Pseudo AnyEnum-> ,Pseudo AnyNonArray]) a) cl-> canMatch :: ProtArgCast -> Bool-> canMatch pac =-> let ((_,fnArgs,_,_),_) = pac-> in canMatch' inArgs fnArgs-> where-> canMatch' [] [] = True-> canMatch' (ia:ias) (pa:pas) =-> case pa of-> Pseudo Any -> nextMatch-> Pseudo AnyArray -> isArrayType ia && nextMatch-> Pseudo AnyElement -> nextMatch-> Pseudo AnyEnum -> False-> Pseudo AnyNonArray -> if isArrayType ia-> then False-> else nextMatch-> _ -> True-> where-> nextMatch = canMatch' ias pas-> canMatch' _ _ = error "internal error: mismatched lists in canMatch'"-> resolvePolyType :: ProtArgCast -> Maybe Type-> resolvePolyType ((_,fnArgs,_,_),_) =-> {-trace ("\nresolving " ++ show fnArgs ++ " against " ++ show inArgs ++ "\n") $-}-> let argPairs = zip inArgs fnArgs-> typeList :: [Type]-> typeList = catMaybes $ flip map argPairs-> (\(ia,fa) -> case fa of-> Pseudo Any -> if isArrayType ia-> then eitherToMaybe $ unwrapArray ia-> else Just ia-> Pseudo AnyArray -> eitherToMaybe $ unwrapArray ia-> Pseudo AnyElement -> if isArrayType ia-> then eitherToMaybe $ unwrapArray ia-> else Just ia-> Pseudo AnyEnum -> Nothing-> Pseudo AnyNonArray -> Just ia-> _ -> Nothing)-> in {-trace ("\nresolve types: " ++ show typeList ++ "\n") $-}-> case resolveResultSetType env typeList of-> Left _ -> Nothing-> Right t -> Just t-> instantiatePolyType :: ProtArgCast -> Type -> ProtArgCast-> instantiatePolyType pac t =-> let ((fn,a,r,v),_) = pac-> instArgs = swapPolys t a-> p1 = (fn, instArgs, swapPoly t r,v)-> in let x = (p1,listCastPairs instArgs)-> in {-trace ("\nfixed:" ++ show x ++ "\n")-} x-> where-> swapPolys :: Type -> [Type] -> [Type]-> swapPolys = map . swapPoly-> swapPoly :: Type -> Type -> Type-> swapPoly pit at =-> case at of-> Pseudo Any -> if isArrayType at-> then ArrayType pit-> else pit-> Pseudo AnyArray -> ArrayType pit-> Pseudo AnyElement -> if isArrayType at-> then ArrayType pit-> else pit-> Pseudo AnyEnum -> pit-> Pseudo AnyNonArray -> pit-> _ -> at-> --merge in the instantiated poly functions, with a twist:-> -- if we already have the exact same set of args in the non poly list-> -- as a poly, then don't include that poly-> mergePolys :: [ProtArgCast] -> [ProtArgCast] -> [ProtArgCast]-> mergePolys orig polys =-> let origArgs = map (\((_,a,_,_),_) -> a) orig-> filteredPolys = filter (\((_,a,_,_),_) -> a `notElem` origArgs) polys-> in orig ++ filteredPolys->-> countPreferredTypeCasts :: [ProtArgCast] -> [Int]-> countPreferredTypeCasts =-> map (\(_,cp) -> count (==ImplicitToPreferred) cp)->-> -- Left () is used for inArgs which aren't unknown,-> -- and for unknowns which we don't have a-> -- unique category-> -- Right s -> s is the single letter category at-> -- that position-> getCastCategoriesForUnknowns :: [ProtArgCast] -> [Either () String]-> getCastCategoriesForUnknowns cands =-> filterArgN 0-> where-> candArgLists :: [[Type]]-> candArgLists = map (\((_,a,_,_), _) -> a) cands-> filterArgN :: Int -> [Either () String]-> filterArgN n =-> if n == length inArgs-> then []-> else let targType = inArgs !! n-> in ((if targType /= UnknownType-> then Left ()-> else getCandsCatAt n) : filterArgN (n+1))-> where-> getCandsCatAt :: Int -> Either () String-> getCandsCatAt n' =-> let typesAtN = map (!!n') candArgLists-> catsAtN = map (envTypeCategory env) typesAtN-> in case () of-> --if any are string choose string-> _ | any (== "S") catsAtN -> Right "S"-> -- if all are same cat choose that-> | all (== head catsAtN) catsAtN -> Right $ head catsAtN-> -- otherwise no match, this will be-> -- picked up as complete failure to match-> -- later on-> | otherwise -> Left ()->-> getCandCatMatches :: [ProtArgCast] -> [Either () String] -> [ProtArgCast]-> getCandCatMatches candsA cats = getMatches candsA 0-> where-> getMatches :: [ProtArgCast] -> Int -> [ProtArgCast]-> getMatches cands n =-> case () of-> _ | n == length inArgs -> cands-> | (inArgs !! n) /= UnknownType -> getMatches cands (n + 1)-> | otherwise ->-> let catMatches :: [ProtArgCast]-> catMatches = filter (\c -> Right (getCatForArgN n c) ==-> (cats !! n)) cands-> prefMatches :: [ProtArgCast]-> prefMatches = filter (envPreferredType env .-> getTypeForArgN n) catMatches-> keepMatches :: [ProtArgCast]-> keepMatches = if length prefMatches > 0-> then prefMatches-> else catMatches-> in getMatches keepMatches (n + 1)-> getTypeForArgN :: Int -> ProtArgCast -> Type-> getTypeForArgN n ((_,a,_,_),_) = a !! n-> getCatForArgN :: Int -> ProtArgCast -> String-> getCatForArgN n = envTypeCategory env . getTypeForArgN n->-> -- utils-> -- filter a candidate/cast flavours pair by a predicate on each-> -- individual cast flavour-> filterCandCastPairs :: ([ArgCastFlavour] -> Bool)-> -> [ProtArgCast]-> -> [ProtArgCast]-> filterCandCastPairs predi = filter (\(_,cp) -> predi cp)->-> getFnArgs :: FunctionPrototype -> [Type]-> getFnArgs (_,a,_,_) = a-> returnIfOnne [] e = Left e-> returnIfOnne (l:ls) e = if length l == 1-> then Right $ getHeadFn l-> else returnIfOnne ls e->-> getHeadFn :: [ProtArgCast] -> FunctionPrototype-> getHeadFn l = let ((hdFn, _):_) = l-> in hdFn-> none p = not . any p-> count p = length . filter p->-> data ArgCastFlavour = ExactMatch-> | CannotCast-> | ImplicitToPreferred-> | ImplicitToNonPreferred-> deriving (Eq,Show)->--resolveResultSetType --partially implement the typing of results sets where the types aren't-all the same and not unknown-used in union,except,intersect columns, case, array ctor, values, greatest and least--algo:-if all inputs are same and not unknown -> that type-replace domains with base types-if all inputs are unknown then text-if the non unknown types aren't all in same category then fail-choose first input type that is a preferred type if there is one-choose last non unknown type that has implicit casts from all preceding inputs-check all can convert to selected type else fail--code is not as much of a mess as findCallMatch--> resolveResultSetType :: Environment -> [Type] -> Either [TypeError] Type-> resolveResultSetType env inArgs =-> dependsOnRTpe inArgs $ do-> errorWhen (null inArgs) [TypelessEmptyArray]-> returnWhen allSameType (head inArgs) $ do-> returnWhen allSameBaseType (head inArgsBase) $ do-> returnWhen allUnknown (ScalarType "text") $ do-> errorWhen (not allSameCat) [IncompatibleTypeSet inArgs]-> returnWhen (isJust targetType &&-> allConvertibleToFrom (fromJust targetType) inArgs)-> (fromJust targetType) $ do-> Left [IncompatibleTypeSet inArgs]-> where-> allSameType = all (== head inArgs) inArgs &&-> head inArgs /= UnknownType-> allSameBaseType = all (== head inArgsBase) inArgsBase &&-> head inArgsBase /= UnknownType-> inArgsBase = map (replaceWithBase env) inArgs-> allUnknown = all (==UnknownType) inArgsBase-> allSameCat = let firstCat = envTypeCategory env (head knownTypes)-> in all (\t -> envTypeCategory env t == firstCat)-> knownTypes-> targetType = case catMaybes [firstPreferred, lastAllConvertibleTo] of-> [] -> Nothing-> (x:_) -> Just x-> firstPreferred = find (envPreferredType env) knownTypes-> lastAllConvertibleTo = firstAllConvertibleTo (reverse knownTypes)-> firstAllConvertibleTo (x:xs) = if allConvertibleToFrom x xs-> then Just x-> else firstAllConvertibleTo xs-> firstAllConvertibleTo [] = Nothing-> knownTypes = filter (/=UnknownType) inArgsBase-> allConvertibleToFrom = all . flip (castableFromTo env ImplicitCastContext)--todo:-cast empty array, where else can an empty array work?--================================================================================--= checkAssignmentValue--> checkAssignmentValid :: Environment -> Type -> Type -> Either [TypeError] ()-> checkAssignmentValid env from to =-> if castableFromTo env AssignmentCastContext from to-> then Right ()-> else Left [IncompatibleTypes to from]--> compositesCompatible :: Environment -> Type -> Type -> Bool-> compositesCompatible env =-> castableFromTo env ImplicitCastContext--================================================================================--= castable function--wrapper around the catalog to add a bunch of extra valid casts--> castableFromTo :: Environment -> CastContext -> Type -> Type -> Bool-> castableFromTo env cc from to =-> {-trace ("check cast " ++ show from ++ "->" ++ show to) $-}-> -- put this here to avoid having to write it everywhere else-> from == to-> -- unknown can be implicitly cast to anything (is this completely true?)-> || from == UnknownType-> --hack?-> || to == UnknownType-> -- check base types of domains-> || ((isDomainType from || isDomainType to)-> && castableFromTo env cc (replaceWithBase env from)-> (replaceWithBase env to))-> -- check the casts listed in the catalog-> || envCast env cc from to-> -- implicitcast => assignment cast-> || (cc == AssignmentCastContext-> && envCast env ImplicitCastContext from to)-> -- can assign composite to record-> || (cc == AssignmentCastContext-> && isCompOrSetoOfComp from-> && case to of-> PgRecord _ -> True-> _ -> False)-> -- check unboxing: wrapped single attribute-> || recurseTransFrom (unboxedSingleType from)-> || recurseTransTo (unboxedSingleType to)-> -- check unboxing: wrapped composite-> || recurseTransFrom (unboxedSetOfType from)-> || recurseTransTo (unboxedSetOfType to)-> -- check composites compatible by comparing attribute types-> || case (getCompositeTypes from-> ,getCompositeTypes to) of-> -- zip almost does the right thing here, needs a bit of tweaking-> (Just ft, Just tt) | length ft == length tt -> all (uncurry $ castableFromTo env cc) $ zip ft tt-> _ -> False-> where--> getCompositeTypes (NamedCompositeType n) =-> Just $ map snd $ fromRight [] $ envCompositePublicAttrs env [] n-> getCompositeTypes (CompositeType t) = Just $ map snd t-> getCompositeTypes (AnonymousRecordType t) = Just t-> getCompositeTypes (PgRecord Nothing) = Nothing-> getCompositeTypes (PgRecord (Just t)) = getCompositeTypes t-> getCompositeTypes _ = Nothing--> isCompOrSetoOfComp (SetOfType c) = isCompositeType c-> isCompOrSetoOfComp c = isCompositeType c--> unboxedSingleType (SetOfType (CompositeType [(_,t)])) = Just t-> unboxedSingleType (PgRecord (Just t)) = unboxedSingleType t-> unboxedSingleType _ = Nothing--> unboxedSetOfType (SetOfType a) = Just a-> unboxedSetOfType (PgRecord (Just t)) = unboxedSetOfType t-> unboxedSetOfType _ = Nothing--> recurseTransFrom = maybe False (flip (castableFromTo env cc) to)-> recurseTransTo = maybe False (castableFromTo env cc from)--> replaceWithBase :: Environment -> Type -> Type-> replaceWithBase env t@(DomainType _) = envDomainBaseType env t-> replaceWithBase _ t = t
− Database/HsSqlPpp/AstInternals/TypeType.lhs
@@ -1,380 +0,0 @@-Copyright 2009 Jake Wheat--This file contains the data type Type. It is kept separate so we can-compile the types and function information from the database-separately to AstInternal.ag.--Types overview:--Regular types: scalarType, arrayType, composite type, domaintype-we can use these anywhere.--semi first class types: row, unknownstringlit (called unknown in pg) --these can be used in some places, but not others, in particular an-expression can have this type or select can have a row with these-type, but a view can't have a column with this type (so a select can-be valid on it's own but not as a view. Not sure if Row types can be-variables, unknownstringlit definitely can't. (Update, seems a view-can have a column with type unknown.)--pseudo types - mirror pg pseudo types-Internal, LanguageHandler, Opaque probably won't ever be properly supported-Not sure exactly what Any is, can't use it in functions like the other any types?- - update: seems that Any is like AnyElement, but multiple Anys don't- have to have the same type.-AnyElement, AnyArray, AnyEnum, AnyNonArray - used to implement polymorphic functions,- can only be used in these functions as params, return type (and local vars?).-Cstring - treated as variant of text?-record -dynamically typed, depends where it is used, i think is used-for type inference in function return types (so you don't have to-write the correct type, the compiler fills it in), and as a dynamically-typed variable in functions, where it can take any composite typed-value.-void is used for functions which return nothing-trigger is a tag to say a function is used in triggers, used as a-return type only-typecheckfailed is used to represent the type of anything which the code-is currently unable to type check, this usage should disappear at some-point, and then it will only represent code which doesn't type check-because of a mistake.--The Type type identifies the type of a node, but doesn't necessarily-describe the type.-Arraytype, setoftype and row are treated as type generators, and are-unnamed so have structural equality. Other types sometimes effectively-have structural equality depending on the context... (SQL/ PostGreSQL-wasn't designed by ML programmers!)--Typing relational valued expressions:-use SetOfType combined with composite type for now, see if it works-out. If not, will have to add another type.--> {-# OPTIONS_HADDOCK hide #-}--> {-# LANGUAGE FlexibleInstances,DeriveDataTypeable #-}---> module Database.HsSqlPpp.AstInternals.TypeType where--> import Control.Monad.Error--> import Data.Generics-- > import Data.Binary--> data Type = ScalarType String-> | ArrayType Type-> | SetOfType Type-> --three variations, choose better name for rowctor-> --refer to composite type in catalog-> | NamedCompositeType String-> --refer to composite type either in catalog or one generated on fly-> | CompositeType [(String,Type)]-> --refer to anonymous composite type: the fields have no names-> --these three types are equality and assign compatible if the fields-> --are ignoring the names, so the fields have to be in the same order.-> | AnonymousRecordType [Type] -- was rowctor-> | PgRecord (Maybe Type) -- can only hold namedcomposite, composite or anonymousrecord-> | DomainType String-> | EnumType String-> | Pseudo PseudoType-> | TypeCheckFailed -- represents something which the type checker-> -- doesn't know how to type check-> -- or it cannot work the type out because of errors-> | UnknownType -- represents a string literal-> -- token whose type isn't yet-> -- determined-> deriving (Eq,Show,Ord,Typeable,Data)--> data PseudoType = Any-> | AnyArray-> | AnyElement-> | AnyEnum-> | AnyNonArray-> | Cstring-> | Record-> | Trigger-> | Void-> | Internal-> | LanguageHandler-> | Opaque-> deriving (Eq,Show,Ord,Typeable,Data)--this list will need reviewing, probably refactor to a completely-different set of infos, also will want to add more information to-these, and to provide a way of converting into a user friendly-string. It is intended for this code to produce highly useful errors-later on down the line.--> -- mostly expected,got-> data TypeError = WrongTypes Type [Type]-> | UnknownTypeError Type-> | UnknownTypeName String-> | NoMatchingOperator String [Type]-> | TypelessEmptyArray-> | IncompatibleTypeSet [Type]-> | IncompatibleTypes Type Type-> | ValuesListsMustBeSameLength-> | NoRowsGivenForValues-> | UnrecognisedIdentifier String-> | UnrecognisedRelation String-> | UnrecognisedCorrelationName String-> | AmbiguousIdentifier String-> | ContextError String-> | MissingJoinAttribute-> | ExpressionMustBeBool-> | WrongNumberOfColumns-> | ExpectedDomainType Type-> | DomainDefNotFound Type-> | BadEnvironmentUpdate String-> | TypeAlreadyExists Type-> | AnyAllError String-> | InternalError String-> | FromToTypesNotSame Type Type-> --shoved in to humour the Either Monad-> | MiscError String-> deriving (Eq,Show,Ord,Typeable,Data)--> instance Error ([TypeError]) where-> noMsg = [MiscError "Unknown error"]-> strMsg str = [MiscError str]--=== canonical type name support--Introduce some aliases to protect client code if/when the ast-canonical names are changed:--> typeSmallInt,typeBigInt,typeInt,typeNumeric,typeFloat4,-> typeFloat8,typeVarChar,typeChar,typeBool :: Type-> typeSmallInt = ScalarType "int2"-> typeBigInt = ScalarType "int8"-> typeInt = ScalarType "int4"-> typeNumeric = ScalarType "numeric"-> typeFloat4 = ScalarType "float4"-> typeFloat8 = ScalarType "float8"-> typeVarChar = ScalarType "varchar"-> typeChar = ScalarType "char"-> typeBool = ScalarType "bool"--this converts the name of a type to its canonical name--> canonicalizeTypeName :: String -> String-> canonicalizeTypeName s =-> case () of-> _ | s `elem` smallIntNames -> "int2"-> | s `elem` intNames -> "int4"-> | s `elem` bigIntNames -> "int8"-> | s `elem` numericNames -> "numeric"-> | s `elem` float4Names -> "float4"-> | s `elem` float8Names -> "float8"-> | s `elem` varcharNames -> "varchar"-> | s `elem` charNames -> "char"-> | s `elem` boolNames -> "bool"-> | otherwise -> s-> where-> smallIntNames = ["int2", "smallint"]-> intNames = ["int4", "integer", "int", "serial"]-> bigIntNames = ["int8", "bigint"]-> numericNames = ["numeric", "decimal"]-> float4Names = ["real", "float4"]-> float8Names = ["double precision", "float"]-> varcharNames = ["character varying", "varchar"]-> charNames = ["character", "char"]-> boolNames = ["boolean", "bool"]--random notes on pg types:--== domains:-the point of domains is you can't put constraints on types, but you-can wrap a type up in a domain and put a constraint on it there.--== literals/selectors--source strings are parsed as unknown type: they can be implicitly cast-to almost any type in the right context.--rows ctors can also be implicitly cast to any composite type matching-the elements (now sure how exactly are they matched? - number of-elements, type compatibility of elements, just by context?).--string literals are not checked for valid syntax currently, but this-will probably change so we can type check string literals statically.-Postgres defers all checking to runtime, because it has to cope with-custom data types. This code will allow adding a grammar checker for-each type so you can optionally check the string lits statically.--== notes on type checking types--=== basic type checking-Currently can lookup type names against a default template1 list of-types, or against the current list in a database (which is read before-processing and sql code).--todo: collect type names from current source file to check against-A lot of the infrastructure to do this is already in place. We also-need to do this for all other definitions, etc.--=== Type aliases--Some types in postgresql have multiple names. I think this is-hardcoded in the pg parser.--For the canonical name in this code, we use the name given in the-postgresql pg_type catalog relvar.--TODO: Change the ast canonical names: where there is a choice, prefer-the sql standard name, where there are multiple sql standard names,-choose the most concise or common one, so the ast will use different-canonical names to postgresql.--planned ast canonical names:-numbers:-int2, int4/integer, int8 -> smallint, int, bigint-numeric, decimal -> numeric-float(1) to float(24), real -> float(24)-float, float(25) to float(53), double precision -> float-serial, serial4 -> int-bigserial, serial8 -> bigint-character varying(n), varchar(n)-> varchar(n)-character(n), char(n) -> char(n)--TODO:--what about PrecTypeName? - need to fix the ast and parser (found out-these are called type modifiers in pg)--also, what can setof be applied to - don't know if it can apply to an-array or setof type--array types have to match an exact array type in the catalog, so we-can't create an arbitrary array of any type. Not sure if this is-handled quite correctly in this code.--================================================================================--utilities for working with Types--These may indicate that the haskell type system isn't being used very well.--> isArrayType :: Type -> Bool-> isArrayType (ArrayType _) = True-> isArrayType _ = False--> isDomainType :: Type -> Bool-> isDomainType (DomainType _) = True-> isDomainType _ = False---> isCompositeType :: Type -> Bool-> isCompositeType (CompositeType _) = True-> isCompositeType (NamedCompositeType _) = True-> isCompositeType (AnonymousRecordType _) = True-> isCompositeType (PgRecord _) = True-> isCompositeType _ = False--> isCompositeOrSetOfCompositeType :: Type -> Bool-> isCompositeOrSetOfCompositeType (SetOfType a) = isCompositeType a-> isCompositeOrSetOfCompositeType a = isCompositeType a--> unwrapArray :: Type -> Either [TypeError] Type-> unwrapArray (ArrayType t) = Right t-> unwrapArray x = Left [InternalError $ "can't get types from non array " ++ show x]--> unwrapSetOfWhenComposite :: Type -> Either [TypeError] Type-> unwrapSetOfWhenComposite (SetOfType a@(CompositeType _)) = Right a-> unwrapSetOfWhenComposite x = Left [InternalError $ "tried to unwrapSetOfWhenComposite on " ++ show x]--> unwrapSetOfComposite :: Type -> Either [TypeError] [(String,Type)]-> unwrapSetOfComposite (SetOfType (CompositeType a)) = Right a-> unwrapSetOfComposite x = Left [InternalError $ "tried to unwrapSetOfComposite on " ++ show x]---> unwrapSetOf :: Type -> Either [TypeError] Type-> unwrapSetOf (SetOfType a) = Right a-> unwrapSetOf x = Left [InternalError $ "tried to unwrapSetOf on " ++ show x]--> unwrapComposite :: Type -> Either [TypeError] [(String,Type)]-> unwrapComposite (CompositeType a) = Right a-> unwrapComposite x = Left [InternalError $ "cannot unwrapComposite on " ++ show x]--> consComposite :: (String,Type) -> Type -> Either [TypeError] Type-> consComposite l (CompositeType a) = Right $ CompositeType (l:a)-> consComposite a b = Left [InternalError $ "called consComposite on " ++ show (a,b)]--> unwrapRowCtor :: Type -> Either [TypeError] [Type]-> unwrapRowCtor (AnonymousRecordType a) = Right a-> unwrapRowCtor x = Left [InternalError $ "cannot unwrapRowCtor on " ++ show x]--================================================================================--new plan for types:--The type annotations attached to nodes will be either typecheckfailed 'type'-this will allow chaining type check failed more robustly. Type errors don't change.--the sql type type will be changed so we can track the different-contexts where different sql types can be used, split to use different-sets of types so we can use the haskell type system to enforce these-contexts.--rename type to sqltype, too confusing otherwise-new set of sqltypes: (these aren't in one haskell type anymore)-scalar type - corresponds to sqltypes in pg which aren't one of the- other types (no easy way to define this)-array type-setof type : can be applied to scalar, domain, ... but not all types-composite types are changed:-namedcomposite string-composite [(string,type)] -> what types can appear in the attribute list?-anonymousrecord [type] -> what types can appear here? -> this-represents a row expression type, which can be returned in select-expressions (but not as a column in a view), and is used in other places-domaintype : what types are allowable as the base type?-pseudo types: these are used for arguments and return values for function prototypes only-any*, record - just means pg infers the return type which will be a composite type (namedcomposite, composite or anonymousrecord), trigger: just a tag, void: just a tag, any*: polymorphic functions, ignore cstring, internal, language handler and opaque.-issue: a variable declaration can be a polymorphic type in a polymorphic function, but we can't use the other pseudo types so need to split these-a variable declared as type record IS NOT the same thing as the pseudo record type, I've finally worked out.-so our plpgsqlrecordtype is plpgsqlrecordtype (Nothing|one of the three composite types)--typechecking polymorphic functions: will have to relax the type-checking to some degree. want to check against each usage of the-polymorphic function in the source, so substitute in the actual types-and check the function.--contexts:-function prototypes: args and return type-function calls: args and return-variable declaration in plpgsql-attribute in a select expression-attribute in a view (less permissive than a select expression), also create table as?-attribute in a table, type (is this the same list as for composite and anonymous records? - can nest anonymous records)-base type for domain-cast expression-insert: targetatts are same set of types as attributes in a table-update: targets can be attr types or anonymous records of attr types for rowset style assign (x,y) = selectexp-assignment statement: type on left same set as type in a for, types in select into, etc?-return statement-return query statement-expressions in a raise statement-expressions in execute, anything else?-types used inside select expression checking:- selectlist, trefs, groupby, orderby, limit, offset, where, having-expressions:-what can an identifiers type be?-what can the type of an Expression node be?- scalar: integerlit,floatlit- stringlit: what can an unknown resolve to (not quite everything)- booleanlit: scalar- nulllit: same as stringlit?- positionalarg: any type that a function arg can have- cast: any type you can cast to- identifier: ?- case, casesimple: any type in the rhs expressions, what are these?- exists: scalar- funcall: any type a function return type can have- inpredicate: scalar- windowfn: ?- liftoperator: booleans only?--problem: can't get types using gettypeannotation function and support-different valid combinations of types
− Database/HsSqlPpp/Commands/CommandComponents.lhs
@@ -1,420 +0,0 @@-Copyright 2009 Jake Wheat--Wrappers used in the command line program--> {-# LANGUAGE FlexibleContexts #-}---> {- | This module contains all the functions used in the hssqlsystem-> exe. Mainly a set of wrappers to lift other functions into an-> ErrorT monad. See HsSqlSystem.lhs for example use.-> -}-> module Database.HsSqlPpp.Commands.CommandComponents-> (-> -- * errort wrapper-> wrapET-> -- * parsing-> ,lexSql-> ,parseSql1-> ,parseExpression1-> -- * show and pretty print-> ,printList-> ,ppSh-> ,ppSql-> ,ppAnnOrig-> ,ppTypeErrors-> -- * annotations-> ,stripAnn-> ,typeCheckC-> ,typeCheckExpressionC-> ,getTEs-> ,Database.HsSqlPpp.Commands.CommandComponents.getTopLevelTypes-> -- * dbms access-> ,readCatalog-> ,clearDB-> ,loadAst-> ,loadSqlUsingPsqlFromFile-> ,loadSqlUsingPsql-> ,pgDump-> -- catalog diffs-> ,compareCatalogs-> ,ppCatDiff-> ,CatDiff(..)-> -- extensions-> ,runExtensions-> -- docs-> ,pandoc-> ,hsTextize-> -- testing-> ,wrapperGen1-> -- * utils-> ,message-> ,putStrLnList-> ,readInput-> ,Database.HsSqlPpp.Commands.CommandComponents.writeFile-> ,lconcat-> ,lfst-> ,lsnd-> ,AllErrors(..)-> ) where--> import Control.Monad.Error-> import System-> import Data.List-> import System.IO-> import Data.Generics--> import Text.Show.Pretty-> import System.Process.Pipe-> --import Text.Pandoc--> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.Parsing.Lexer--> import Database.HsSqlPpp.Ast.TypeChecker as A-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Ast.Environment-> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Ast.SqlTypes--> import Database.HsSqlPpp.PrettyPrinter.PrettyPrinter-> import Database.HsSqlPpp.PrettyPrinter.AnnotateSource--> import Database.HsSqlPpp.Dbms.DBAccess-> import Database.HsSqlPpp.Dbms.DatabaseLoader--> import Database.HsSqlPpp.Extensions.ChaosExtensions--> import Database.HsSqlPpp.Utils-> import Database.HsSqlPpp.HsText.HsText--> import Database.HsSqlPpp.Dbms.WrapperGen--===============================================================================--parsing--> -- | Lex a string to a list of tokens.-> lexSql :: Monad m => String -> String -> ErrorT AllErrors m [Token]-> lexSql f = throwEEEither . lexSqlText f--> -- | Parse a string to an ast.-> parseSql1 :: Monad m => String -> String -> ErrorT AllErrors m StatementList-> parseSql1 f = throwEEEither . parseSql f--> -- | Parse an expression to an ast.-> parseExpression1 :: Monad m => String -> String -> ErrorT AllErrors m Expression-> parseExpression1 f = throwEEEither . parseExpression f--================================================================================--> -- | Transform an ast using the chaos syntax extensions.-> runExtensions :: (Monad m, Error e) => StatementList -> ErrorT e m StatementList-> runExtensions = return . extensionize--================================================================================--annotation ish--> -- | Take an ast and remove all the annotations. Can be used to view-> -- an ast without all the source position annotations cluttering-> -- it up.-> stripAnn :: (Monad m, Error e, Data a) => a -> ErrorT e m a-> stripAnn = return . stripAnnotations--> -- | Type check an ast against a catalog, return the annotated ast-> -- and the updated catalog.-> typeCheckC :: (Monad m, Error e) => Environment -> StatementList-> -> ErrorT e m (Environment, StatementList)-> typeCheckC cat = return . typeCheck cat--> -- | Type check an expression ast against a catalog-> typeCheckExpressionC :: (Monad m, Error e) => Environment -> Expression-> -> ErrorT e m Expression-> typeCheckExpressionC cat = return . typeCheckExpression cat--could probably make this more general, so can run an arbitrary filter-on annotations and then get a list of them with source positions--> -- | Take an ast and return a list of type errors with source position-> -- if available.-> getTEs :: (Monad m, Error e, Data d) =>-> d -> ErrorT e m [(Maybe AnnotationElement,[TypeError])]-> getTEs = return . getTypeErrors--> -- | Pretty print list of type errors with optional source position-> -- in emacs readable format.-> ppTypeErrors :: Monad m =>-> [(Maybe AnnotationElement, [TypeError])] -> m [String]-> ppTypeErrors tes =-> return $ map showSpTe tes-> where-> showSpTe (Just (SourcePos fn l c), e) =-> fn ++ ":" ++ show l ++ ":" ++ show c ++ ":\n" ++ show e-> showSpTe (_,e) = "unknown:0:0:\n" ++ show e--> -- | Get the top level type annotation from the ast passed.-> getTopLevelTypes :: (Monad m, Error e, Data d) =>-> d -> ErrorT e m [Type]-> getTopLevelTypes ast = return $ A.getTopLevelTypes [ast]---================================================================================--pretty printing--todo: change the naming convention, so fns which produce haskell-syntax start with show, human readable stuff starts with pp, not sure-where printsql comes in system though--> -- | use ppshow to pretty print a value.-> ppSh :: (Monad m, Error e, Show a) => a -> ErrorT e m String-> ppSh = return . ppShow--> -- | pretty print an ast.-> ppSql :: (Monad m, Error e) => StatementList -> ErrorT e m String-> ppSql = return . printSql--> -- | take a source text and annotated ast and interpolate annotations into the source-> -- as comments-> ppAnnOrig :: (Monad m, Error e) => Bool -> String -> StatementList -> ErrorT e m String-> ppAnnOrig doErrs src = return . annotateSource doErrs src--================================================================================--dbms utilities--> -- | get the catalog from the database-> readCatalog :: MonadIO m => String -> ErrorT AllErrors m Environment-> readCatalog dbName =-> liftIO (readEnvironmentFromDatabase dbName) >>=-> throwTESEither . updateEnvironment defaultEnvironment--> -- | run psql to load the sql text into a database.-> loadSqlUsingPsql :: MonadIO m => String -> String -> ErrorT AllErrors m String-> loadSqlUsingPsql dbName =-> liftIO . pipeString [("psql", [dbName-> ,"-q"-> ,"--set"-> ,"ON_ERROR_STOP=on"-> ,"--file=-"])]--> -- | run psql to load sql from the filename given into a database.-> loadSqlUsingPsqlFromFile :: MonadIO m => String -> FilePath -> ErrorT AllErrors m String-> loadSqlUsingPsqlFromFile dbName fn = do-> ex <- liftIO $ system ("psql " ++ dbName ++-> " -q --set ON_ERROR_STOP=on" ++-> " --file=" ++ fn)-> case ex of-> ExitFailure e -> throwError $ AEMisc $ "psql failed with " ++ show e-> ExitSuccess -> return ""--> -- | use the hssqlppp code to load the sql into a database directly-> -- (this parses and pretty prints the sql to load it)-> loadAst :: (MonadIO m, Error e) => String -> String -> StatementList -> ErrorT e m ()-> loadAst db fn = liftIO . loadIntoDatabase db fn--> -- | use a dodgy hack to clear the database given-> clearDB :: MonadIO m => String -> ErrorT AllErrors m ()-> clearDB db =-> liftIO $ withConn ("dbname=" ++ db) $ \conn ->-> runSqlCommand conn "drop owned by jake cascade;"--> -- | dump the given database to sql source using pg_dump-> pgDump :: MonadIO m => String -> ErrorT AllErrors m String-> pgDump db = liftIO $ pipeString [("pg_dump", [db-> ,"--schema-only"-> ,"--no-owner"-> ,"--no-privileges"])] ""--================================================================================--catalog stuff - just a diff to compare two catalogs--> -- | items in first catalog and not second, items in second and not first.-> data CatDiff = CatDiff [EnvironmentUpdate] [EnvironmentUpdate]-> deriving Show--> -- | find differences between two catalogs-> compareCatalogs :: (Monad m, Error e) => Environment -> Environment -> Environment -> ErrorT e m CatDiff-> compareCatalogs base start end =-> let baseEnvBits = deconstructEnvironment base-> startEnvBits = deconstructEnvironment start \\ baseEnvBits-> endEnvBits = deconstructEnvironment end \\ baseEnvBits-> missing = sort $ endEnvBits \\ startEnvBits-> extras = sort $ startEnvBits \\ endEnvBits-> in return $ CatDiff missing extras--> -- | print a catdiff in a more human readable way than show.-> ppCatDiff :: (Monad m, Error e) => CatDiff -> ErrorT e m String-> ppCatDiff (CatDiff missing extra) =-> return $ "\nmissing:\n"-> ++ intercalate "\n" (map ppEnvUpdate missing)-> ++ "\nextra:\n"-> ++ intercalate "\n" (map ppEnvUpdate extra)--================================================================================--> -- | Documentation command to produce some hssqlppp docs, takes a-> -- pandoc source file and converts to html, can run and insert-> -- commands embedded in the source-> pandoc :: MonadIO m => String -> ErrorT AllErrors m String-> pandoc txt = return txt {--> liftM (writeHtmlString wopt . readMarkdown defaultParserState)-> (hsTextize txt)-> where-> wopt = defaultWriterOptions {-> writerStandalone = True-> ,writerTitlePrefix = "HsSqlPpp documentation"-> ,writerTableOfContents = True-> ,writerHeader = "<style>\n\-> \pre {\n\-> \ border: 1px dotted gray;\n\-> \ background-color: #ececec;\n\-> \ color: #1111111;\n\-> \ padding: 0.5em;\n\-> \}\n\-> \</style>"-> }-}---writerStandalone :: Bool Include header and footer-writerHeader :: String Header for the document-writerTitlePrefix :: String Prefix for HTML titles-writerTabStop :: Int Tabstop for conversion btw spaces and tabs-writerTableOfContents :: Bool Include table of contents-writerS5 :: Bool We're writing S5-writerHTMLMathMethod :: HTMLMathMethod How to print math in HTML-writerIgnoreNotes :: Bool Ignore footnotes (used in making toc)-writerIncremental :: Bool Incremental S5 lists-writerNumberSections :: Bool Number sections in LaTeX-writerIncludeBefore :: String String to include before the body-writerIncludeAfter :: String String to include after the body-writerStrictMarkdown :: Bool Use strict markdown syntax-writerReferenceLinks :: Bool Use reference links in writing markdown, rst-writerWrapText :: Bool Wrap text to line length-writerLiterateHaskell :: Bool Write as literate haskell-writerEmailObfuscation :: ObfuscationMethod How to obfu--> {-ex <- liftIO $ system ("pandoc -s -f markdown -t html "-> ++ src ++ " -o " ++ tgt)-> case ex of-> ExitFailure e -> throwError $ AEMisc $ "psql failed with " ++ show e-> ExitSuccess -> return ()-}--================================================================================--process doc commands--> -- | read a text file, and pull out the commands, run them and insert-> -- the results into the text-> hsTextize :: MonadIO m => String -> ErrorT AllErrors m String-> hsTextize s =-> liftIO (hsTextify-> (("hssqlsystem", hsSqlSystemCommand):defaultCommands)-> "docs/build"-> s) >>= throwEither . mapLeft AEMisc--> -- | run hssqlsystem using shell-> hsSqlSystemCommand :: String -> IO String-> hsSqlSystemCommand s = shell ("HsSqlSystem " ++ s) >>= \m ->-> return $ "$ HsSqlSystem " ++ s-> ++ "\n\n~~~~~~~~~~\n"-> ++ m-> ++ "\n~~~~~~~~~~\n\n"--================================================================================--> wrapperGen1 :: (MonadIO m, Error e) => String -> String -> ErrorT e m String-> wrapperGen1 db fn = liftIO $ wrapperGen db fn---================================================================================--errort stuff--wrap all our errors in an algebraic data type, not sure if there is a-more elegant way of doing this but it does the job for now--> data AllErrors = AEExtendedError ParseErrorExtra-> | AETypeErrors [TypeError]-> | AEMisc String-> deriving (Show)--> instance Error AllErrors where-> noMsg = AEMisc "Unknown error"-> strMsg = AEMisc--> throwEEEither :: (MonadError AllErrors m) => Either ParseErrorExtra a -> m a-> throwEEEither = throwEither . mapLeft AEExtendedError--> throwTESEither :: (MonadError AllErrors m) => Either [TypeError] a -> m a-> throwTESEither = throwEither . mapLeft AETypeErrors--> throwEither :: (MonadError t m) => Either t a -> m a-> throwEither (Left err) = throwError err-> throwEither (Right val) = return val--================================================================================--read file as string - issues are:--want to support reading from stdin, and reading from a string passed-as an argument to the exe--> -- | read a file as text, will read from stdin if filename is '-'.-> readInput :: (Error e, MonadIO m) => FilePath -> ErrorT e m String-> readInput f =-> liftIO $ case f of-> "-" -> getContents-> _ | length f >= 2 &&-> head f == '"' && last f == '"'-> -> return $ drop 1 $ take (length f - 1) f-> | otherwise -> readFile f--================================================================================--> -- | write text to a file-> writeFile :: (Error e, MonadIO m) => FilePath -> String -> ErrorT e m ()-> writeFile fn =-> liftIO . System.IO.writeFile fn--================================================================================--Utilities--> -- | wrapper for putstrln-> message :: MonadIO m => String -> m ()-> message = liftIO . putStrLn--run in errort monad-should think of something better to do here than just rethrow as io error1--> -- wrapper to run in errorT monad and return right or error on left-> wrapET :: (Show e, Monad m) => ErrorT e m a -> m a-> wrapET c = runErrorT c >>= \x ->-> case x of-> Left er -> error $ show er-> Right l -> return l--> -- | print a list, using newlines instead of commas, no outer []-> printList :: (MonadIO m, Show a) => [a] -> m ()-> printList = mapM_ (liftIO . print)--> -- | run putstrln over each element of a list-> putStrLnList :: MonadIO m => [String]-> m ()-> putStrLnList = mapM_ (liftIO . putStrLn)--> -- | lifted fst-> lfst :: (Monad m, Error e) => (a,b) -> ErrorT e m a-> lfst = return . fst--> -- | lifted snd-> lsnd :: (Monad m, Error e) => (a,b) -> ErrorT e m b-> lsnd = return . snd--> -- | lifted concat-> lconcat :: (Monad m, Error e) => [[a]] -> ErrorT e m [a]-> lconcat = return . concat--
− Database/HsSqlPpp/Dbms/DBAccess.lhs
@@ -1,59 +0,0 @@-Copyright 2009 Jake Wheat--This file contains a few (almost pointlessly) lightweight wrappers-around hdbc for running commands and queries.--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Dbms.DBAccess (runSqlCommand-> ,withConn-> ,selectValue-> ,catchSql-> ,seErrorMsg-> ,selectRelation) where--> import qualified Database.HDBC.PostgreSQL as Pg-> import Database.HDBC-> import Control.Monad-> import Control.Exception--> runSqlCommand :: (IConnection conn) =>-> conn -> String -> IO ()-> runSqlCommand conn query = do-> run conn query []-> commit conn--> withConn :: String -> (Pg.Connection -> IO c) -> IO c-> withConn cs = bracket (Pg.connectPostgreSQL cs) disconnect--> selectValue :: (IConnection conn) =>-> conn -> String -> IO String-> selectValue conn query = do-> r <- quickQuery' conn query []-> case length r of-> 0 -> error $ "select value on " ++ query ++-> " returned 0 rows, expected 1"-> 1 -> do-> let t = head r-> when (length t /= 1)-> (error $ "select value on " ++ query ++-> " returned " ++ show (length t) ++ " attributes, expected 1.")-> return $ toS $ head t-> _ -> error $ "select value on " ++ query ++-> " returned " ++ show (length r) ++ " tuples, expected 0 or 1."-> where-> toS a = fromSql a :: String--> selectRelation ::(IConnection conn) =>-> conn -> String -> [String] -> IO [[String]]-> selectRelation conn query args = do-> sth <- prepare conn query-> execute sth $ map sToSql args-> v <- fetchAllRows' sth-> return $ map (map sqlToS) v--> sToSql :: String -> SqlValue-> sToSql s = toSql (s::String)--> sqlToS :: SqlValue -> String-> sqlToS = fromSql
− Database/HsSqlPpp/Dbms/DatabaseLoader.lhs
@@ -1,220 +0,0 @@-Copyright 2009 Jake Wheat--This module mainly contains the function to take a statement list and-load it into the database.--The loading system works by parsing a sql file then passing the-[Statement] to this module which pretty prints each Statement. (There-is no fundamental reason why it loads each statement one at a time-instead of pretty printing the whole lot, just that the run command-from hdbc only supports one command at a time. This might be a-postgresql limitation.)--The next todo to help this code move along is to use the source-position information in the ast when error (and notice, etc.)-messages come back from the database whilst loading the sql, can try to show the source position from the original file, which will be different to what postgresql reports.--This seems like a whole lot of effort for nothing, but will then allow-using transforming the ast so it no longer directly corresponds to the-source sql, and loading the transformed sql into the database. For-generated code, some thought will be needed on how to link any errors-back to the original source text.--One option for some of the code is to use the original source code-when it hasn't been changed for a given statement, instead of the-pretty printed stuff, don't know how much help this will be.--This code is currently on the backburner, and is a mess.--> {- | Routine load SQL into a database. Should work alright, but if-> you get any errors from PostgreSQL it won't be easy to track them-> down in the original source.-}-> module Database.HsSqlPpp.Dbms.DatabaseLoader-> (-> loadIntoDatabase-> ) where--> import System.IO-> import System.Directory-> import Control.Monad-> import Control.Exception-> import Text.Regex.Posix-> import Data.List-> import Data.Maybe--> import Database.HsSqlPpp.PrettyPrinter.PrettyPrinter-> import Database.HsSqlPpp.Ast.Ast as Ast-> import Database.HsSqlPpp.Dbms.DBAccess-> import Database.HsSqlPpp.Ast.Annotation--> loadIntoDatabase :: String -- ^ database name-> -> FilePath -- ^ filename to include in error messages-> -- (this file is not accessed)-> -> StatementList -- ^ ast to load into database-> -> IO ()-> loadIntoDatabase dbName fn ast =-> withConn ("dbname=" ++ dbName) $ \conn -> do-> --loadPlpgsqlIntoDatabase conn-> mapM_ (\st ->-> loadStatement conn st-> >> putStr ".") (filterStatements ast)-> where-> loadStatement conn st = case st of-> Skipit -> return ()-> VanillaStatement vs ->-> putStrLn (printSql [vs]) >>-> handleError fn (getSourcePos vs) vs (runSqlCommand conn-> (printSql [vs]))-> CopyStdin a b -> runCopy conn a b (getSourcePos a)-> getSourcePos st = let a = getAnnotation st-> in sp a-> where-> sp (x:xs) = case x of-> SourcePos s l c -> (s,l,c)-> _ -> sp xs-> sp [] = ("",0,0)-> --hack cos we don't have support in hdbc for copy from stdin-> --(which libpq does support - adding this properly should be a todo)-> --we need the copy from stdin and the copydata to be processed in one go,-> --so filter the list to replace instances of these with a replacement-> --and a dummy statement following. Well dodgy, don't really know-> --how it manages to work correctly.-> filterStatements sts =-> map (\(x,y) ->-> case (x,y) of-> (a@(Copy _ _ _ Stdin), b@(CopyData _ _)) -> (CopyStdin a b)-> (CopyData _ _, _) -> Skipit-> (vs,_) -> VanillaStatement vs)-> statementWithNextStatement-> where-> statementWithNextStatement =-> zip sts (tail sts ++ [NullStatement []])-> runCopy conn a b _ = case (a,b) of-> (Copy _ tb cl Stdin, CopyData _ s) ->-> withTemporaryFile (\tfn -> do-> writeFile tfn s-> tfn1 <- canonicalizePath tfn-> loadStatement conn-> (VanillaStatement (Copy [] tb cl-> (CopyFilename tfn1))))-> _ -> error "internal error: pattern match fail in runCopy in loadIntoDatabase"-> {-loadPlpgsqlIntoDatabase conn = do-> -- first, check plpgsql is in the database-> x <- selectValue conn-> "select count(1) from pg_language where lanname='plpgsql';"-> when (readInt x == 0) $-> runSqlCommand conn "create procedural language plpgsql;"-> readInt x = read x :: Int-}--> data Wrapper = CopyStdin Ast.Statement Ast.Statement-> | Skipit-> | VanillaStatement Ast.Statement-> deriving Show--================================================================================--= Error reporting--The goal is to give a position in the original source when an error-occurs as best as possible.--For now, all statements in the ast correspond 1:1 with statement text-in the source code, so each line,col pair coming from pg should-correspond to onne line,col pair in the original source text.--The lines load in one at a time, so there needs to be a fair bit of-translation to ultimately output the original line and source number.--(For code with no source information, e.g. stuff which is generated-programmatically from scratch, plan is to give a index (the statement-position in the [Statement] arg, and then pretty print this statement-and provide a line and column just for this statement text.--Later on, when working with generated code may need to make guesses as-to which line, and possibly supply multiple references (e.g. for a-template you might want to see the part of the template which is-causing the error, plus the arguments being passed to that template-instantiation call (if nested, you want to see all of them back up to the-top level).--So, for now: want to get the line number and column number from the-error message text--If there is a line and column number in the error coming from-postgresql, they should appear something like this:--execute: PGRES_FATAL_ERROR: ERROR: column "object_name" of relation "system_implementation_objects" does not exist-LINE 1: insert into system_implementation_objects (object_name,objec...- ^--So we are looking at the LINE x: part, and the line with a bunch of-blanks preceding the ^--Parse the line number out : easy-Parse the number of spaces before the ^ easy--Problem: the text following the LINE 1: is a arbitrary snippet of the-source so the column number of the ^ doesn't relate to the column-number in the source in any straightforward way at all...--Probably a better way of doing this, might need alterations to HDBC-though--> getLineAndColumnFromErrorText :: String -> (Int, Int)-> getLineAndColumnFromErrorText errorText =-> let ls = lines errorText-> lineLine = find isLineLine ls-> lineNo = case lineLine of-> Nothing -> 0-> Just ll -> getLineNo ll-> column = 0 --(case find isHatLine ls of-> -- Nothing -> 0-> -- Just ll -> getHatPos ll 0)-> prestuff = 0 --case lineLine of-> -- Nothing -> 0-> -- Just l -> getLineStuffLength l-> in (column - prestuff,lineNo)-> -- wish I knew how to get haskell regexes working...-> -- can't find a way to get just the () part out-> where-> isLineLine l = l =~ "^LINE ([0-9]+):" :: Bool-> getLineNo l = read (stripCrap (l =~ "^LINE ([0-9]+):" :: String)) :: Int-> stripCrap = reverse . drop 1 . reverse . drop 5-- > isHatLine l = l =~ "^[ ]*\\^" :: Bool- > getHatPos l i = case l of- > (x:xs) | x == ' ' -> getHatPos xs (i + 1)- > | otherwise -> i- > _ -> 0- > getLineStuffLength l = length (l =~ "^LINE ([0-9]+):" :: String) + 1--> handleError :: String -> (String,Int,Int) -> Ast.Statement -> IO () -> IO ()-> handleError fn (_, sl,sc) _ f = catchSql f-> (\e -> do-> --s <- readFile fn-> let (l,c) = getLineAndColumnFromErrorText (seErrorMsg e)-> --let (sl,sc) = getStatementPos st-> error $ "ERROR!!!!\n"-> ++ show l ++ ":" ++ show c ++ ":\n"-> ++ "from here:\n"-> ++ fn ++ ":" ++ show sl ++ ":" ++ show sc ++ ":\n"-> ++ seErrorMsg e)-- > getStatementPos (Insert (Just (SourcePos x y)) _ _ _ _) = (x,y)-- > getStatementPos :: t -> (Integer, Integer)- > getStatementPos _ = (0::Integer,0::Integer)--================================================================================--withtemporaryfile, part of the copy from stdin hack--can't use opentempfile since it gets locked and then pg program can't-open the file for reading--proper dodgy, needs fixing:--> withTemporaryFile :: (String -> IO c) -> IO c-> withTemporaryFile f = bracket (return ())-> (\_ -> removeFile "hssqlppptemp.temp")-> (\_ -> f "hssqlppptemp.temp")
− Database/HsSqlPpp/Dbms/WrapLib.lhs
@@ -1,16 +0,0 @@-Copyright 2010 Jake Wheat--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Dbms.WrapLib where--> import Database.HDBC--> selectRelation :: (IConnection conn) =>-> conn -> String -> [SqlValue] -> IO [[SqlValue]]-> selectRelation conn query args = do-> sth <- prepare conn query-> execute sth args-> v <- fetchAllRows' sth-> return v-
− Database/HsSqlPpp/Dbms/WrapperGen.lhs
@@ -1,173 +0,0 @@-Copyright 2010 Jake Wheat--demo code for using the hssqlppp typechecker to generate typesafe-database access code--could probably use some quasi quotation--> {-# LANGUAGE FlexibleContexts #-}--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Dbms.WrapperGen-> (wrapperGen) where--> import Text.Show.Pretty (ppShow)-> import Language.Haskell.Exts hiding (String)-> import qualified Language.Haskell.Exts as Exts-> import Data.Generics.PlateData-> import Data.Generics hiding (Prefix,Infix)-> import Control.Monad.Error-> import Data.Maybe--> import Database.HsSqlPpp.Ast.SqlTypes as Sql-> import Database.HsSqlPpp.Ast.Environment-> import Database.HsSqlPpp.Ast.TypeChecker-> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.Ast.Annotation--> wrapperGen :: String -> String -> IO String-> wrapperGen db fn = do-> p <- parseFile fn-> case p of-> ParseOk ast -> do-> envU <- readEnvironmentFromDatabase db-> case updateEnvironment defaultEnvironment envU of-> Left er -> return $ show er-> Right env ->-> return $ {-ppShow ast ++ "\n\n" ++ -} prettyPrint (processTree env (addImports ast))-> x -> return $ ppShow x--> processTree :: Data a => Environment -> a -> a-> processTree env =-> transformBi $ \x ->-> case x of-> (PatBind _-> (PVar (Ident fnName))-> Nothing-> (UnGuardedRhs(Lit (Exts.String sqlSrc)))-> (BDecls [])) : tl-> -> createWrapper env fnName sqlSrc ++ tl-> x1 -> x1--> addImports :: Data a => a -> a-> addImports =-> transformBi $ \x ->-> case x of-> Module sl mn o wt es im d -> Module sl mn o wt es (imports ++ im) d---> noSrcLoc :: SrcLoc-> noSrcLoc = (SrcLoc "" 0 0)--> imports :: [ImportDecl]-> imports = [ImportDecl {importLoc = noSrcLoc-> ,importModule = ModuleName "Database.HDBC"-> ,importQualified = False-> ,importSrc = False-> ,importPkg = Nothing-> ,importAs = Nothing-> ,importSpecs = Nothing-> }-> ,ImportDecl {importLoc = noSrcLoc-> ,importModule = ModuleName "Database.HsSqlPpp.Dbms.WrapLib"-> ,importQualified = False-> ,importSrc = False-> ,importPkg = Nothing-> ,importAs = Nothing-> ,importSpecs = Nothing-> }]---> createWrapper :: Environment-> -> String-> -> String-> -> [Decl]-> createWrapper env fnName sql =-> let rt = getStatementType env sql-> in case rt of-> Left e -> error e-> Right (StatementType pt ts) ->-> let pts = map sqlTypeToHaskellTypeName pt-> tns = map (sqlTypeToHaskellTypeName . snd) ts-> in [makeTypeSig fnName pts tns-> ,makeFn fnName sql pts tns]--> makeFn :: String -> String -> [String] -> [String] -> Decl-> makeFn fnName sql pts typeNames = FunBind-> [ Match noSrcLoc(-> Ident fnName )-> (PVar (Ident "conn") : map (PVar . Ident) pNames)-> Nothing (-> UnGuardedRhs (-> Do-> [ Generator noSrcLoc (-> PVar ( Ident "r" ) ) (-> App (-> App (-> App (-> Var ( UnQual ( Ident "selectRelation" ) ) ) (-> Var ( UnQual ( Ident "conn" ) ) ) ) (-> Lit ( Exts.String sql ) ) ) (-> List $ map (\l -> App (-> Var ( UnQual ( Ident "toSql" ) ) ) (-> Var ( UnQual ( Ident l ) ) )) pNames-> ))-> , Qualifier (-> InfixApp (-> Var ( UnQual ( Ident "return" ) ) ) (-> QVarOp ( UnQual ( Symbol "$" ) ) ) (-> InfixApp (-> App (-> App (-> Var ( UnQual ( Ident "flip" ) ) ) (-> Var ( UnQual ( Ident "map" ) ) ) ) (-> Var ( UnQual ( Ident "r" ) ) ) ) (-> QVarOp ( UnQual ( Symbol "$" ) ) ) (-> Lambda noSrcLoc-> [ PList (map (PVar . Ident) vns)-> ] (-> Tuple (map (\n -> App (vui "fromSql") (vui n)) vns)-> ) ) ) )-> ] ) ) (-> BDecls [] )-> ]-> where-> varName n = "a" ++ show n-> vns = map varName [0..length typeNames - 1]-> vui = Var . UnQual . Ident-> pName n = "b" ++ show n-> pNames = map pName [0..length pts - 1]----> makeTypeSig :: String -> [String] -> [String] -> Decl-> makeTypeSig fnName argTypes typeNames =-> TypeSig noSrcLoc [Ident fnName] $-> TyForall Nothing [ClassA (UnQual (Ident "IConnection")) [TyVar(Ident "conn")]] $-> foldr TyFun lastArg args-> where-> tc = TyCon . UnQual . Ident-> tntt = (TyApp (tc "Maybe")) . tc-> args = ((TyVar (Ident "conn")) : map tntt argTypes)-> lastArg = (TyApp (tc "IO") (TyList (TyTuple Boxed $ map tntt typeNames)))--> sqlTypeToHaskellTypeName :: Sql.Type -> String-> sqlTypeToHaskellTypeName t =-> case t of-> ScalarType "text" -> "String"-> ScalarType "int4" -> "Int"-> _ -> "a"---> getStatementType :: Environment -> String -> Either String StatementType-> getStatementType env sql = do-> ast <- tsl $ parseSql "" sql-> let (_,aast) = typeCheck env ast-> let a = getTopLevelInfos aast-> return $ fromJust $ head a--> tsl :: (MonadError String m, Show t) => Either t a -> m a-> tsl x = case x of-> Left s -> throwError $ show s-> Right b -> return b
− Database/HsSqlPpp/Extensions/ChaosExtensions.lhs
@@ -1,489 +0,0 @@-Copyright 2009 Jake Wheat--Experimental code to use uniplate to implement extensions--> {-# LANGUAGE ViewPatterns #-}--> {- | Experimental code to half implement some simple syntax-> extensions for plpgsql. Eventually, want to use this to write-> macro type things for plpgsql, have implementation of all these-> in pure plpgsql code but it's a mess, and the plpgsql-> implementation is opaque to the hssqlppp type checker.-> -}--> module Database.HsSqlPpp.Extensions.ChaosExtensions-> (-> extensionize-> ,addReadonlyTriggers-> ,rewriteCreateVars-> ,createClientActionWrapper-> ,addNotifyTriggers-> ,addConstraint-> ,addKey-> ,addForeignKey-> ,zeroOneTuple-> ,noDelIns-> ,transitionConstraints-> ,replaceGenerateSpellChoiceActions-> ) where--> import Data.Generics-> import Data.Generics.PlateData-> import Debug.Trace--> import Text.Parsec hiding(many, optional, (<|>))-> import qualified Text.Parsec.Token as P-> import Text.Parsec.Language--> import Control.Applicative-> import Control.Monad.Identity-> import Data.List--> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Parsing.Lexer-> import Database.HsSqlPpp.Parsing.Parser----> data FunCallView = FUnit-> | FunCallView Annotation String [Expression]--> funCallView :: Statement -> FunCallView-> funCallView (SelectStatement an (Select _ _ (SelectList _ [SelExp _ (FunCall _ fnName-> args)] []) [] Nothing [] Nothing [] Nothing Nothing)) = FunCallView an fnName args-> funCallView _ = FUnit--> -- | run all the extensions in this module on the given ast-> extensionize :: Data a => a -> a-> extensionize = addReadonlyTriggers .-> rewriteCreateVars .-> createClientActionWrapper .-> addNotifyTriggers .-> addConstraint .-> addKey .-> addForeignKey .-> zeroOneTuple .-> noDelIns .-> transitionConstraints .-> replaceGenerateSpellChoiceActions---================================================================================--My dodgy SQL code uses a function called create_var to create a table-with a single attribute, which can hold 0 or 1 tuples (it adds the-constraints to handle all this), a bit like a global maybe-variable. It also creates a wrapper function to return the value from-the table which is sometimes more convenient to use in expressions-instead of e.g. a join.-e.g.-select create_var('name', 'type');-->-create table name_table (- name type-);--create function get_name() returns type as $a$- select * from name_table;-$a$ language sql stable;-[missing constraint stuff...]--When trying to type check these files, my code can't work out that the-create_var invocation changes the catalog in this way, as a hack to-get round this tried to write a little generic function which-transforms the create var invocation to the create table and create-function by transforming the ast tree before it is type checked. With-this in place, the code can type check these tables.--The future plan is to get rid of the create var function definition in-the sql entirely, and just use this macro feature instead. (so we-still call create_var in the same way). The main motivation is to make-type checking the code easier (the other obvious alternative is to-write a partial interpreter for pl/pgsql which sounds like an immense-amount of work in comparison).--> -- | short cut for creating a table with exactly one attribute whose-> -- cardinality is restricted to 0 or 1. Also provides a get_var function shortcut.-> rewriteCreateVars :: Data a => a -> a-> rewriteCreateVars =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "create_var" [StringLit _ _ tableName,StringLit _ _ typeName]):tl-> -> [(CreateTable an-> (tableName ++ "_table")-> [AttributeDef an-> tableName-> (SimpleTypeName an typeName)-> Nothing-> []]-> [])-> ,(CreateFunction an ("get_" ++ tableName) []-> (SimpleTypeName an typeName) Sql "$a$"-> (SqlFnBody an-> [SelectStatement an-> (Select an Dupes-> (SelectList an-> [SelExp an-> (Identifier an "*")] [])-> [Tref an (tableName ++ "_table") NoAlias]-> Nothing [] Nothing [] Nothing Nothing)]) Stable)]-> ++ createKey an (tableName ++ "_table") [tableName]-> ++ createConstraint True an [tableName ++ "_table"] (tableName ++ "_table_01_tuple") "true"-> ++ tl-> x1 -> x1--================================================================================--> -- | looks for calls to function set_relvar_type and adds triggers to prevent the-> -- referenced table from being updated-> addReadonlyTriggers :: Data a => a -> a-> addReadonlyTriggers =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "set_relvar_type" [StringLit _ _ tableName,StringLit _ _ "readonly"]):tl-> -> (flip map "diu" ( \t ->-> (CreateFunction an ("check_" ++ tableName ++ "_" ++ [t] ++ "_readonly") []-> (SimpleTypeName an "trigger") Plpgsql-> "$a$"-> (PlpgsqlFnBody an [] [-> If an-> [(FunCall an "!not" [BooleanLit an False]-> ,[Raise an RException-> "delete on base_relvar_metadata \-> \violates transition constraint \-> \base_relvar_metadata_d_readonly" []])] []-> ,Return an $ Just $ NullLit an])-> Volatile)) ++ tl)-> x1 -> x1--================================================================================--> -- | a numpty currying type thing for plpgsql functions-> createClientActionWrapper :: Data a => a -> a-> createClientActionWrapper =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "create_client_action_wrapper" [StringLit _ _ actname,StringLit _ _ actcall]):tl-> -> (CreateFunction an ("action_" ++ actname) []-> (SimpleTypeName an "void") Plpgsql-> "$a$"-> (PlpgsqlFnBody an [] [-> let (n,as) = parseActionCall actcall-> in Perform an (FunCall an ("action_" ++ n) (map (StringLit an "'") as))-> ]) Volatile : tl)-> x1 -> x1-> where-> parseActionCall :: String -> (String,[String])-> parseActionCall = parseCcawac--> parseCcawac :: String -> (String,[String])-> parseCcawac s = case runParser ccawac [] "" s of-> Left e -> trace ("failed to parse " ++ s) $ error $ show e-> Right r -> r--> ccawac :: ParsecT String LexState Identity (String, [String])-> ccawac = (,)-> <$> identifierString-> <*> parens (sepBy ccawacarg (symbol ","))--> ccawacarg :: ParsecT String LexState Identity String-> ccawacarg = (symbol "'" *> many (noneOf "'") <* symbol "'")-> <|> identifierString--> parens :: ParsecT String LexState Identity a -> ParsecT String LexState Identity a-> parens = between (symbol "(") (symbol ")")--> symbol :: String -> ParsecT String LexState Identity String-> symbol = P.symbol lexer--> lexer :: P.GenTokenParser String LexState Identity-> lexer = P.makeTokenParser emptyDef--================================================================================--> -- | add a trigger to each data table to raise a notify signal when changed-> addNotifyTriggers :: Data a => a -> a-> addNotifyTriggers =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "set_relvar_type" [StringLit _ _ tableName,StringLit _ _ "data"]):tl-> -> (CreateFunction an (tableName ++ "_changed") []-> (SimpleTypeName an "trigger") Plpgsql-> "$a$"-> (PlpgsqlFnBody an [] [-> Notify an tableName-> ,Return an $ Just $ NullLit an-> ]) Volatile : tl)-> x1 -> x1--================================================================================--> -- | wrapped for the extended constraint system - allows adding constraints-> -- which refer to multiple rows/ multiple tables.-> addConstraint :: Data a => a -> a-> addConstraint =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "add_constraint"-> [StringLit _ _ conName-> ,StringLit _ _ expr-> ,FunCall _ "!arrayctor" tbls]):tl-> -> createConstraint True an (getStrings tbls) conName expr ++ tl-> x1 -> x1--> parseExpressionWrap :: String -> Expression-> parseExpressionWrap s = case parseExpression "" s of-> Left e -> trace ("parsing expression: " ++ s) $ error $ show e-> Right ast -> ast--> createConstraint :: Bool-> -> Annotation-> -> [String]-> -> String-> -> String-> -> [Statement]-> createConstraint tr an tbls name expr =-> CreateFunction an ("check_con_" ++ name) []-> (SimpleTypeName an "boolean") Plpgsql "$a$"-> (PlpgsqlFnBody an [] [-> Return an $ Just $-> stripAnnotations (parseExpressionWrap expr)-> ]) Stable :-> if tr-> then concatMap (\t -> [DropFunction an IfExists [(t ++ "_constraint_trigger_operator",[])] Restrict-> ,CreateFunction an (t ++ "_constraint_trigger_operator") []-> (SimpleTypeName an "trigger") Plpgsql "$a$"-> (PlpgsqlFnBody an [] [-> NullStatement an]) Volatile]-> ) tbls-> else []--> -- | implement key constraints so that they are integrated with the extended constraint-> -- system, uses pg keys internally.-> addKey :: Data a => a -> a-> addKey =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "add_key"-> [StringLit _ _ tableName-> ,StringLit _ _ columnName]):tl-> -> createKey an tableName [columnName] ++ tl-> (funCallView -> FunCallView an "add_key"-> [StringLit _ _ tableName-> ,FunCall _ "!arrayctor" cols]):tl-> -> createKey an tableName (getStrings cols) ++ tl-> x1 -> x1--> getStrings :: [Expression] -> [String]-> getStrings = map (\(StringLit _ _ c) -> c)--> createKey :: Annotation-> -> String-> -> [String]-> -> [Statement]-> createKey an tableName colNames =-> let cn = take 49 (tableName ++ "_" ++ intercalate "_" colNames) ++ "_key"-> in createConstraint False an [tableName] cn "true"--> -- | extended inclusion dependency (I think that is the fashionable term these days).-> -- to allow 'foreign keys' to non key attributes, as well as regular foreign keys-> addForeignKey :: Data a => a -> a-> addForeignKey =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "add_foreign_key"-> [StringLit _ _ tableName-> ,StringLit _ _ colName-> ,StringLit _ _ ttableName]):tl-> -> createFk an tableName [colName] ttableName [colName] ++ tl-> (funCallView -> FunCallView an "add_foreign_key"-> [StringLit _ _ tableName-> ,FunCall _ "!arrayctor" cols-> ,StringLit _ _ ttableName]):tl-> -> createFk an tableName (getStrings cols) ttableName (getStrings cols) ++ tl-> (funCallView -> FunCallView an "add_foreign_key"-> [StringLit _ _ tableName-> ,StringLit _ _ colName-> ,StringLit _ _ ttableName-> ,StringLit _ _ tcolName]):tl-> -> createFk an tableName [colName] ttableName [tcolName] ++ tl-> (funCallView -> FunCallView an "add_foreign_key"-> [StringLit _ _ tableName-> ,FunCall _ "!arrayctor" cols-> ,StringLit _ _ ttableName-> ,FunCall _ "!arrayctor" tcols]):tl-> -> createFk an tableName (getStrings cols) ttableName (getStrings tcols) ++ tl-> x1 -> x1-> where-> createFk an tbl atts _ _ =-> createConstraint False an [tbl] (tbl ++ "_" ++ intercalate "_" atts ++ "_fkey") "true"--> -- | convert calls to zero or one tuple to constraint-> zeroOneTuple :: Data a => a -> a-> zeroOneTuple =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "constrain_to_zero_or_one_tuple"-> [StringLit _ _ tableName]):tl-> -> createConstraint True an [tableName] (tableName ++ "_01_tuple") "true" ++ tl-> x1 -> x1--================================================================================--> noDelIns :: Data a => a -> a-> noDelIns =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "no_deletes_inserts_except_new_game"-> [StringLit _ _ tbl]):tl-> -> flip map ["_no_delete","_no_insert"] (\n ->-> CreateFunction an ("check_" ++ tbl ++ n) []-> (SimpleTypeName an "trigger") Plpgsql "$a$"-> (PlpgsqlFnBody an [] [-> NullStatement an-> ]) Stable) ++ tl-> x1 -> x1--================================================================================--> transitionConstraints :: Data a => a -> a-> transitionConstraints =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "create_update_transition_tuple_constraint"-> [StringLit _ _ _-> ,StringLit _ _ cn-> ,StringLit _ _ _]):tl-> -> addTrigger an cn ++ tl-> (funCallView -> FunCallView an "create_insert_transition_tuple_constraint"-> [StringLit _ _ _-> ,StringLit _ _ cn-> ,StringLit _ _ _]):tl-> -> addTrigger an cn ++ tl-> (funCallView -> FunCallView an "create_delete_transition_tuple_constraint"-> [StringLit _ _ _-> ,StringLit _ _ cn-> ,StringLit _ _ _]):tl-> -> addTrigger an cn ++ tl-> x1 -> x1-> where-> addTrigger an n =-> [CreateFunction an ("check_" ++ n) []-> (SimpleTypeName an "trigger") Plpgsql "$a$"-> (PlpgsqlFnBody an [] [-> NullStatement an-> ]) Stable]--================================================================================--generate_spell_choice_actions--quite dynamic: need to read the data from the spells_mr table to-generate the names of the functions--approach:-first: remove the create function generate_spell_choice_actions, the-select generate_spel..., and the drop function so these aren't used at-all-second: at the point where generate_spell_choice_actions was called,-insert the create functions. To do this need to get the copydata for-the copy statement which set up the data in spells_mr, then read the-first cell from each line in the copy data string.--additional hack: just hardcode the spell names here since they are-unlikely to change for quite a while--> getSpellNames :: Data a => a -> [String]-> getSpellNames _ = ["chaos"-> ,"dark_citadel"-> ,"dark_power"-> ,"decree"-> ,"disbelieve"-> ,"eagle"-> ,"elf"-> ,"faun"-> ,"ghost"-> ,"giant_rat"-> ,"giant"-> ,"goblin"-> ,"golden_dragon"-> ,"gooey_blob"-> ,"gorilla"-> ,"green_dragon"-> ,"gryphon"-> ,"harpy"-> ,"horse"-> ,"hydra"-> ,"justice"-> ,"king_cobra"-> ,"large_chaos"-> ,"large_law"-> ,"law"-> ,"lightning"-> ,"lion"-> ,"magic_armour"-> ,"magic_bolt"-> ,"magic_bow"-> ,"magic_castle"-> ,"magic_fire"-> ,"magic_knife"-> ,"magic_shield"-> ,"magic_sword"-> ,"magic_wings"-> ,"magic_wood"-> ,"manticore"-> ,"ogre"-> ,"orc"-> ,"pegasus"-> ,"raise_dead"-> ,"red_dragon"-> ,"shadow_form"-> ,"shadow_wood"-> ,"skeleton"-> ,"spectre"-> ,"subversion"-> ,"turmoil"-> ,"unicorn"-> ,"vampire"-> ,"vengeance"-> ,"wall"-> ,"wraith"-> ,"zombie"]---> replaceGenerateSpellChoiceActions :: Data a => a -> a-> replaceGenerateSpellChoiceActions d = let sn = getSpellNames d-> in replaceGenerateSpellChoiceActionsInt sn d--> replaceGenerateSpellChoiceActionsInt :: Data a => [String] -> a -> a-> replaceGenerateSpellChoiceActionsInt spellNames =-> transformBi $ \x ->-> case x of-> (funCallView -> FunCallView an "generate_spell_choice_actions" []):tl-> -> map (createChoiceFn an) spellNames ++ tl-> (CreateFunction _ "generate_spell_choice_actions" _ _ _ _ _ _):tl-> -> tl-> (DropFunction _ _ [("generate_spell_choice_actions",[])] _):tl-> -> tl-> x1 -> x1-> where-> createChoiceFn an sn =-> CreateFunction an ("action_choose_" ++ sn ++ "_spell")-> []-> (SimpleTypeName [] "void")-> Plpgsql-> "$$"-> (PlpgsqlFnBody an [] [-> NullStatement an-> ]) Volatile--CREATE FUNCTION action_choose_horse_spell() RETURNS void- LANGUAGE plpgsql- AS $$-begin- perform check_can_run_action('choose_horse_spell');- perform action_choose_spell('horse');-end;-$$;-
− Database/HsSqlPpp/Here.lhs
@@ -1,15 +0,0 @@--Multiline string support, mainly used to enter multiline sql strings--robbed from http://old.nabble.com/Multi-line-string-literals-are-both-easy--and--elegant-in-Haskell-td19959973.html--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Here where--> import Language.Haskell.TH.Quote-> --import Language.Haskell.TH.Syntax-> import Language.Haskell.TH.Lib--> here :: QuasiQuoter-> here = QuasiQuoter (litE . stringL) (litP . stringL)
− Database/HsSqlPpp/HsText/Commands.lhs
@@ -1,46 +0,0 @@--> module Database.HsSqlPpp.HsText.Commands-> (defaultCommands-> ,makeFile-> ,shell-> ,wrapCommand-> ) where--> import Data.Char-> import Data.List-> import System.Exit-> import System.Process (readProcessWithExitCode)-> import System.FilePath--> import Control.Monad.Error---> defaultCommands :: [(String,String -> IO String)]-> defaultCommands = [("file", makeFile)-> ,("shell", shell)]--> makeFile :: String -> IO String-> makeFile s =-> let (fn,content) = break ws $ dropWhile space s-> in do-> writeFile fn content-> return $-> "File " ++ fn ++ "\n\n"-> ++ "~~~~~~~~~~~~{" ++ takeExtension fn ++ "}"-> ++ content ++ "\n~~~~~~~~~~~~\n\n"-> where-> ws = (`elem` " \n\t")-> space = (==' ')--> shell :: String -> IO String-> shell s = {-let (c:as) = words s-> in -} do-> (ex,o,e) <- readProcessWithExitCode "bash" ["-c", ("PATH=$PATH:~/wd/hssqlppp/trunk " ++ s)] ""-> return $ o ++ e ++ case ex of-> ExitSuccess -> ""-> ExitFailure i -> "\nErrorCode: " ++ show i ++ "\n"--PATH=$PATH:~/wd/hssqlppp/trunk && HsSqlSystem--> wrapCommand :: String -> String -> (String -> IO String) -> (String -> IO String)-> wrapCommand pre post c l = c l >>= \m -> return $ pre ++ m ++ post
− Database/HsSqlPpp/HsText/HsText.lhs
@@ -1,72 +0,0 @@---> module Database.HsSqlPpp.HsText.HsText-> (hsTextify-> ,defaultCommands-> ,makeFile-> ,shell-> ,wrapCommand-> ) where--> import Text.Parsec hiding(many, optional, (<|>))--> import Data.Char-> import Data.List-> import System.Directory--> import Control.Applicative-> import Control.Monad.Identity-> import Control.Monad.Error-> import Control.Exception (bracket)--> import Database.HsSqlPpp.HsText.Commands--> data TextChunk = TextChunk String-> | CommandInfo String String-> deriving Show--> type Command = String -> IO String--> hsTextify :: [(String, Command)] -> String -> String -> IO (Either String String)-> hsTextify cmds folder txt = do-> cd <- getCurrentDirectory-> setCurrentDirectory folder-> bracket (return ())-> (\_ -> setCurrentDirectory cd)-> $ return $ runErrorT $-> liftM concat-> (either (throwError . show) return (parseText txt) >>=-> mapM (liftIO . processCommand cmds))--> processCommand :: [(String, Command)] -> TextChunk -> IO String-> processCommand _ (TextChunk s) = return s-> processCommand cmds (CommandInfo c a) = do-> let cr = lookup (map toLower c) cmds-> case cr of-> Nothing -> return $ "Command not found: " ++ c-> Just f -> catchEx (f a)--> catchEx :: IO String -> IO String-> catchEx s = catch s (\i -> return $ "ERROR: " ++ show i)--================================================================================--parsing--> parseText :: String -> Either ParseError [TextChunk]-> parseText = runParser (many textChunk) () ""--> textChunk :: ParsecT String () Identity TextChunk-> textChunk = command <|> nonCommand--> command :: ParsecT String () Identity TextChunk-> command = CommandInfo-> <$> (string "<%Command " *> many (noneOf " "))-> <*> manyTill anyChar (try (string "%>"))--> nonCommand :: ParsecT String () Identity TextChunk-> nonCommand = TextChunk-> <$> ((:) <$> anyChar <*>-> manyTill anyChar-> (try (lookAhead(string "<%Command ") >> return ())-> <|> eof))
− Database/HsSqlPpp/Parsing/Lexer.lhs
@@ -1,300 +0,0 @@-Copyright 2009 Jake Wheat--This file contains the lexer for sql source text.--Lexicon:--string-identifier or keyword-symbols - operators and ;,()[]-positional arg-int-float-copy payload (used to lex copy from stdin data)--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Parsing.Lexer (-> Token-> ,Tok(..)-> ,lexSqlFile-> ,lexSqlText-> ,lexSqlTextWithPosition-> ,identifierString-> ,LexState-> ) where--> import Text.Parsec hiding(many, optional, (<|>))-> import qualified Text.Parsec.Token as P-> import Text.Parsec.Language-> import Text.Parsec.String-> import Text.Parsec.Pos--> import Control.Applicative-> import Control.Monad.Identity--> import Data.Char--> import Database.HsSqlPpp.Parsing.ParseErrors-> import Database.HsSqlPpp.Utils--================================================================================--= data types--> type Token = (SourcePos, Tok)--> data Tok = StringTok String String --delim, value (delim will one of-> --', $$, $[stuff]$-> | IdStringTok String --includes . and x.y.* type stuff-> | SymbolTok String -- operators, and ()[],;:-> -- '*' is currently always lexed as an id-> -- rather than an operator-> -- this gets fixed in the parsing stage-> | PositionalArgTok Integer -- used for $1, etc.-> | FloatTok Double-> | IntegerTok Integer-> | CopyPayloadTok String -- support copy from stdin; with inline data-> deriving (Eq,Show)--> type LexState = [Tok]--> lexSqlFile :: FilePath -> IO (Either ParseErrorExtra [Token])-> lexSqlFile f = do-> te <- readFile f-> let x = runParser sqlTokens [] f te-> return $ toParseErrorExtra x Nothing te--> lexSqlText :: String -> String -> Either ParseErrorExtra [Token]-> lexSqlText f s = toParseErrorExtra (runParser sqlTokens [] f s) Nothing s--> lexSqlTextWithPosition :: String -> Int -> Int -> String -> Either ParseErrorExtra [Token]-> lexSqlTextWithPosition f l c s =-> toParseErrorExtra (runParser (do-> setPosition (newPos f l c)-> sqlTokens) [] f s) (Just (l,c)) s--================================================================================--= lexers--lexer for tokens, contains a hack for copy from stdin with inline-table data.--> sqlTokens :: ParsecT String LexState Identity [Token]-> sqlTokens =-> setState [] >>-> whiteSpace >>-> many sqlToken <* eof--Lexer for an individual token.--What we could do is lex lazily and when the lexer reads a copy from-stdin statement, it switches lexers to lex the inline table data, then-switches back. Don't know how to do this in parsec, or even if it is-possible, so as a work around, we use the state to trap if we've just-seen 'from stdin;', if so, we read the copy payload as one big token,-otherwise we read a normal token.--> sqlToken :: ParsecT String LexState Identity Token-> sqlToken = do-> sp <- getPosition-> sta <- getState-> t <- if sta == [ft,st,mt]-> then copyPayload-> else try sqlString-> <|> try idString-> <|> try positionalArg-> <|> try sqlSymbol-> <|> try sqlFloat-> <|> try sqlInteger-> updateState $ \stt ->-> case () of-> _ | stt == [] && t == ft -> [ft]-> | stt == [ft] && t == st -> [ft,st]-> | stt == [ft,st] && t == mt -> [ft,st,mt]-> | otherwise -> []--> return (sp,t)-> where-> ft = IdStringTok "from"-> st = IdStringTok "stdin"-> mt = SymbolTok ";"--== specialized token parsers--> sqlString :: ParsecT String LexState Identity Tok-> sqlString = stringQuotes <|> stringLD-> where-> --parse a string delimited by single quotes-> stringQuotes = StringTok "\'" <$> stringPar-> stringPar = optional (char 'E') *> char '\''-> *> readQuoteEscape <* whiteSpace-> --(readquoteescape reads the trailing ')--have to read two consecutive single quotes as a quote character-instead of the end of the string, probably an easier way to do this--other escapes (e.g. \n \t) are left unprocessed--> readQuoteEscape = do-> x <- anyChar-> if x == '\''-> then try ((x:) <$> (char '\'' *> readQuoteEscape))-> <|> return ""-> else (x:) <$> readQuoteEscape--parse a dollar quoted string--> stringLD = do-> -- cope with $$ as well as $[identifier]$-> tag <- try (char '$' *> ((char '$' *> return "")-> <|> (identifierString <* char '$')))-> s <- lexeme $ manyTill anyChar-> (try $ char '$' <* string tag <* char '$')-> return $ StringTok ("$" ++ tag ++ "$") s--> idString :: ParsecT String LexState Identity Tok-> idString = IdStringTok <$> identifierString--> positionalArg :: ParsecT String LexState Identity Tok-> positionalArg = char '$' >> PositionalArgTok <$> integer---Lexing symbols:--approach 1:-try to keep multi symbol operators as single lexical items-(e.g. "==", "~=="--approach 2:-make each character a separate element-e.g. == lexes to ['=', '=']-then the parser sorts this out--Sort of using approach 1 at the moment, see below--== notes on symbols in pg operators-pg symbols can be made from:--=_*/<>=~!@#%^&|`?--no --, /* in symbols--can't end in + or - unless contains-~!@#%^&|?--Most of this isn't relevant for the current lexer.--== sql symbols for this lexer:--sql symbol is one of-()[],; - single character-+-*/<>=~!@#%^&|`? string - one or more of these, parsed until hit char-which isn't one of these (including whitespace). This will parse some-standard sql expressions wrongly at the moment, work around is to add-whitespace e.g. i think 3*-4 is valid sql, should lex as '3' '*' '-'-'4', but will currently lex as '3' '*-' '4'. This is planned to be-fixed in the parser.-.. := :: : - other special cases-A single * will lex as an identifier rather than a symbol, the parser-deals with this.--> sqlSymbol :: ParsecT String LexState Identity Tok-> sqlSymbol =-> SymbolTok <$> lexeme (choice [-> replicate 1 <$> oneOf "()[],;"-> ,string ".."-> ,try $ string "::"-> ,try $ string ":="-> ,string ":"-> ,many1 (oneOf "+-*/<>=~!@#%^&|`?")-> ])--> sqlFloat :: ParsecT String LexState Identity Tok-> sqlFloat = FloatTok <$> float--> sqlInteger :: ParsecT String LexState Identity Tok-> sqlInteger = IntegerTok <$> integer--================================================================================--additional parser bits and pieces--include dots, * in all identifier strings during lexing. This parser-is also used for keywords, so identifiers and keywords aren't-distinguished until during proper parsing, and * and qualifiers aren't-really examined until type checking--> identifierString :: ParsecT String LexState Identity String-> identifierString = lexeme $ choice [-> "*" <$ symbol "*"-> ,do-> a <- nonStarPart-> b <- tryMaybeP ((++) <$> symbol "." <*> identifierString)-> case b of Nothing -> return a-> Just c -> return $ a ++ c]-> where-> nonStarPart = idpart <|> (char '"' *> many (noneOf "\"") <* char '"')-> where idpart = (letter <|> char '_') <:> secondOnwards-> secondOnwards = many (alphaNum <|> char '_')--parse the block of inline data for a copy from stdin, ends with \. on-its own on a line--> copyPayload :: ParsecT String LexState Identity Tok-> copyPayload = CopyPayloadTok <$> lexeme (getLinesTillMatches "\\.\n")-> where-> getLinesTillMatches s = do-> x <- getALine-> if x == s-> then return ""-> else (x++) <$> getLinesTillMatches s-> getALine = (++"\n") <$> manyTill anyChar (try newline)--> tryMaybeP :: GenParser tok st a-> -> ParsecT [tok] st Identity (Maybe a)-> tryMaybeP p = try (optionMaybe p) <|> return Nothing---================================================================================--= parsec pass throughs--> symbol :: String -> ParsecT String LexState Identity String-> symbol = P.symbol lexer--> integer :: ParsecT String LexState Identity Integer-> integer = lexeme $ P.integer lexer--> float :: ParsecT String LexState Identity Double-> float = lexeme $ P.float lexer--> whiteSpace :: ParsecT String LexState Identity ()-> whiteSpace= P.whiteSpace lexer--> lexeme :: ParsecT String LexState Identity a-> -> ParsecT String LexState Identity a-> lexeme = P.lexeme lexer--this lexer isn't really used as much as it could be, probably some of-the fields are not used at all (like identifier and operator stuff)--> lexer :: P.GenTokenParser String LexState Identity-> lexer = P.makeTokenParser (emptyDef {-> P.commentStart = "/*"-> ,P.commentEnd = "*/"-> ,P.commentLine = "--"-> ,P.nestedComments = False-> ,P.identStart = letter <|> char '_'-> ,P.identLetter = alphaNum <|> oneOf "_"-> ,P.opStart = P.opLetter emptyDef-> ,P.opLetter = oneOf opLetters-> ,P.reservedOpNames= []-> ,P.reservedNames = []-> ,P.caseSensitive = False-> })--> opLetters :: String-> opLetters = ".:^*/%+-<>=|!"-
− Database/HsSqlPpp/Parsing/ParseErrors.lhs
@@ -1,77 +0,0 @@-Copyright 2009 Jake Wheat--convert error messages to show source text fragment with little hat,-plus output error location in emacs friendly format.--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Parsing.ParseErrors-> (toParseErrorExtra-> ,ParseErrorExtra(..)) where--> import Text.Parsec-> import Control.Monad.Error-> import Data.Maybe--> showPE :: ParseError -> Maybe (Int,Int) -> String -> String-> showPE pe sp src = show pe ++ "\n" ++ pePosToEmacs pe ++ "\n" ++ peToContext pe sp src--> pePosToEmacs :: ParseError -> String-> pePosToEmacs pe = let p = errorPos pe-> f = sourceName p-> l = sourceLine p-> c = sourceColumn p-> in f ++ ":" ++ show l ++ ":" ++ show c ++ ":"--> peToContext :: ParseError -> Maybe (Int,Int) -> String -> String-> peToContext pe sp src =-> let ls = lines src-> line = safeGet ls(lineNo - 1)-> prelines = map (safeGet ls) [(lineNo - 5) .. (lineNo - 2)]-> postlines = map (safeGet ls) [lineNo .. (lineNo + 5)]-> caretLine = replicate (colNo - 1) ' ' ++ "^"-> errorHighlightText = prelines-> ++ [line, caretLine, "ERROR HERE"]-> ++ postlines-> in "\nContext:\n"-> ++ unlines (trimLines errorHighlightText) ++ "\n"-> where-> safeGet a i = if i < 0 || i >= length a-> then ""-> else a !! i-> trimLines = trimStartLines . reverse . trimStartLines . reverse-> trimStartLines = dropWhile (=="")-> pos = errorPos pe-> lineNo = sourceLine pos - adjLine-> colNo = sourceColumn pos-> adjLine = case sp of-> Just (l, _) -> l - 1-> Nothing -> 0--> -- | Simple wrapper to allow showing the source context of a ParseError-> data ParseErrorExtra = ParseErrorExtra {-> -- | wrapped error-> parseErrorError :: ParseError-> -- | source position-> -- adjustment to get the-> -- context bit in error-> -- messages right - this is-> -- the same as what is passed-> -- into parseSqlWithPosition-> ,parseErrorPosition :: (Maybe (Int, Int))-> -- | sql source-> ,parseErrorSqlSource :: String-> }--> instance Show ParseErrorExtra where-> show (ParseErrorExtra pe sp src) = showPE pe sp src--> instance Error ParseErrorExtra where-> noMsg = ParseErrorExtra undefined Nothing "unknown"-> strMsg = ParseErrorExtra undefined Nothing---> toParseErrorExtra :: Either ParseError b -> Maybe (Int,Int) -> String -> Either ParseErrorExtra b-> toParseErrorExtra a sp src = case a of-> Left pe -> Left $ ParseErrorExtra pe sp src-> Right x -> Right x
− Database/HsSqlPpp/Parsing/Parser.lhs
@@ -1,1510 +0,0 @@-Copyright 2009 Jake Wheat--The main file for parsing sql, uses parsec. Not sure if parsec is the-right choice, but it seems to do the job pretty well at the moment.--For syntax reference see-http://savage.net.au/SQL/sql-2003-2.bnf.html-and-http://savage.net.au/SQL/sql-92.bnf.html-for some online sql grammar guides-and-http://www.postgresql.org/docs/8.4/interactive/sql-syntax.html-for some notes on postgresql syntax (the rest of that manual is also helpful)--Some further reference/reading:--parsec tutorial:-http://legacy.cs.uu.nl/daan/download/parsec/parsec.html--parsec reference:-http://hackage.haskell.org/package/parsec-3.0.0--pdf about parsing, uses haskell and parser combinators for examples-and exercises:-http://www.cs.uu.nl/docs/vakken/gont/diktaat.pdf--The parsers are written top down as you go through the file, so the-top level sql text parsers appear first, then the statements, then the-fragments, then the utility parsers and other utilities at the bottom.--> {-# LANGUAGE RankNTypes,FlexibleContexts #-}--> {- | Functions to parse sql.-> -}-> module Database.HsSqlPpp.Parsing.Parser (-> -- * Main-> parseSql-> ,parseSqlWithPosition-> ,parseSqlFile-> -- * Testing-> ,parseExpression-> ,parsePlpgsql-> -- * errors-> ,ParseErrorExtra(..)-> )-> where--> import Text.Parsec hiding(many, optional, (<|>), string)-> import Text.Parsec.Expr-> import Text.Parsec.String-> import Text.Parsec.Perm-> --import Text.Parsec.Error--> import Control.Applicative-> import Control.Monad.Identity--> import Data.Maybe-> import Data.Char--> import Data.Generics.PlateData-> import Data.Generics hiding (Prefix,Infix)--> import Database.HsSqlPpp.Parsing.Lexer-> import Database.HsSqlPpp.Parsing.ParseErrors-> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Ast.Annotation as A-> import Database.HsSqlPpp.Utils-> import Database.HsSqlPpp.Ast.Environment--The parse state is used to keep track of source positions inside-function bodies, these bodies are parsed separately to the rest of the-code which is why we need to do this.--> type MySourcePos = (String,Int,Int)-> type ParseState = [MySourcePos]--> startState :: ParseState-> startState = []--> toMySp :: SourcePos -> MySourcePos-> toMySp sp = (sourceName sp, sourceLine sp, sourceColumn sp)--================================================================================--= Top level parsing functions--> parseSql :: String -- ^ filename to use in errors-> -> String -- ^ a string containing the sql to parse-> -> Either ParseErrorExtra StatementList-> parseSql f s = parseIt (lexSqlText f s) sqlStatements f Nothing s startState--> parseSqlWithPosition :: FilePath -- ^ filename to use in errors-> -> Int -- ^ adjust line number in errors by adding this-> -> Int -- ^ adjust column in errors by adding this-> -> String -- ^ a string containing the sql to parse-> -> Either ParseErrorExtra StatementList-> parseSqlWithPosition f l c s = parseIt (lexSqlTextWithPosition f l c s) sqlStatements f (Just (l,c)) s startState---> parseSqlFile :: FilePath -- ^ file name of file containing sql-> -> IO (Either ParseErrorExtra StatementList)-> parseSqlFile fn = do-> sc <- readFile fn-> x <- lexSqlFile fn-> return $ parseIt x sqlStatements fn Nothing sc startState--> -- | Parse expression fragment, used for testing purposes-> parseExpression :: String-> -> String -- ^ sql string containing a single expression, with no-> -- trailing ';'-> -> Either ParseErrorExtra Expression-> parseExpression f s = parseIt (lexSqlText f s) (expr <* eof) f Nothing s startState--> -- | Parse plpgsql statements, used for testing purposes --> -- this can be used to parse a list of plpgsql statements which-> -- aren't contained in a create function.-> -- (The produced ast won't pass a type check.)-> parsePlpgsql :: String-> -> String-> -> Either ParseErrorExtra StatementList-> parsePlpgsql f s = parseIt (lexSqlText f s) (many plPgsqlStatement <* eof) f Nothing s startState--utility function to do error handling in one place-TODO: support parsewithposition--> parseIt :: forall t s u b.(Stream s Identity t, Data b) =>-> Either ParseErrorExtra s-> -> Parsec s u b-> -> SourceName-> -> Maybe (Int,Int)-> -> String-> -> u-> -> Either ParseErrorExtra b-> parseIt lexed parser fn sp src ss =-> case lexed of-> Left er -> Left er-> Right toks -> let r1 = runParser parser ss fn toks-> in case toParseErrorExtra r1 sp src of-> Left er -> Left er-> Right t -> Right $ fixupTree t--================================================================================--= Parsing top level statements--> sqlStatements :: ParsecT [Token] ParseState Identity [Statement]-> sqlStatements = many (sqlStatement True) <* eof--parse a statement--> sqlStatement :: Bool -> ParsecT [Token] ParseState Identity Statement-> sqlStatement reqSemi =-> (choice [-> selectStatement-> ,insert-> ,update-> ,delete-> ,truncateSt-> ,copy-> ,set-> ,notify-> ,keyword "create" *>-> choice [-> createTable-> ,createSequence-> ,createType-> ,createFunction-> ,createView-> ,createDomain-> ,createLanguage-> ,createTrigger]-> ,keyword "alter" *>-> choice [-> alterSequence-> ,alterTable]-> ,keyword "drop" *>-> choice [-> dropSomething-> ,dropFunction]]-> <* (if reqSemi-> then symbol ";" >> return ()-> else optional (symbol ";") >> return ()))-> <|> copyData--================================================================================--statement flavour parsers--top level/sql statements first--= select--select parser, parses things starting with the keyword 'select'--supports plpgsql 'select into' only for the variants which look like-'select into ([targets]) [columnNames] from ...-or-'select [columnNames] into ([targets]) from ...-This should be changed so it can only parse an into clause when-expecting a plpgsql statement.--recurses to support parsing excepts, unions, etc.-this recursion needs refactoring cos it's a mess--> selectStatement :: ParsecT [Token] ParseState Identity Statement-> selectStatement = SelectStatement <$> pos <*> selectExpression--> selectExpression :: ParsecT [Token] ParseState Identity SelectExpression-> selectExpression =-> buildExpressionParser combTable selFactor-> where-> selFactor = try (parens selectExpression) <|> selQuerySpec <|> values-> combTable = [map (\(c,p) -> Infix (CombineSelect <$> pos <*> (c <$ p)) AssocLeft)-> [(Except, keyword "except")-> ,(Intersect, keyword "intersect")-> ,(UnionAll, try (keyword "union" *> keyword "all"))-> ,(Union, keyword "union")]]-> selQuerySpec = Select <$> (pos <* keyword "select")-> <*> option Dupes (Distinct <$ keyword "distinct")-> <*> selectList-> <*> option [] from-> <*> optionMaybe whereClause-> <*> option [] groupBy-> <*> optionMaybe having-> <*> option [] orderBy-> <*> optionMaybe limit-> <*> optionMaybe offset-> from = keyword "from" *> commaSep1 tref-> groupBy = keyword "group" *> keyword "by"-> *> commaSep1 expr-> having = keyword "having" *> expr-> orderBy = keyword "order" *> keyword "by"-> *> commaSep1 oneOrder-> oneOrder = (,) <$> expr-> <*> option Asc (choice [-> Asc <$ keyword "asc"-> ,Desc <$ keyword "desc"])-> limit = keyword "limit" *> expr-> offset = keyword "offset" *> expr--> -- table refs-> -- have to cope with:-> -- a simple tableref i.e just a name-> -- an aliased table ref e.g. select a.b from tbl as a-> -- a sub select e.g. select a from (select b from c)-> -- - these are handled in tref-> -- then cope with joins recursively using joinpart below-> tref = buildExpressionParser [] trefFactor-> trefFactor = threadOptionalSuffix (nonJoinTref <|> try (parens tref)) joinPart <|> parens tref-> --tref = optParens (threadOptionalSuffix (try (parens tref) <|> nonJoinTref) joinPart)-> nonJoinTref = try $ optParens $ do-> p2 <- pos-> choice [-> SubTref p2-> <$> parens selectExpression-> <*> palias-> ,TrefFun p2-> <$> try (identifier >>= functionCallSuffix)-> <*> palias-> ,Tref p2-> <$> nkwid-> <*> palias]-> --joinpart: parse a join after the first part of the tableref-> --(which is a table name, aliased table name or subselect) --> --takes this tableref as an arg so it can recurse to multiple-> --joins-> joinPart tr1 = threadOptionalSuffix (readOneJoinPart tr1) joinPart-> readOneJoinPart tr1 = do-> p2 <- pos-> JoinedTref p2 tr1-> --look for the join flavour first-> <$> option Unnatural (Natural <$ keyword "natural")-> <*> choice [-> LeftOuter <$ try (keyword "left" *> optional (keyword "outer"))-> ,RightOuter <$ try (keyword "right" *> optional (keyword "outer"))-> ,FullOuter <$ try (keyword "full" >> optional (keyword "outer"))-> ,Cross <$ keyword "cross"-> ,Inner <$ optional (keyword "inner")]-> --recurse back to tref to read the table-> <*> (keyword "join" *> tref)-> --now try and read the join condition-> <*> choice [-> Just <$> (JoinOn <$> pos <*> (keyword "on" *> expr))-> ,Just <$> (JoinUsing <$> pos <*> (keyword "using" *> columnNameList))-> ,return Nothing]-> <*> palias-> palias = option NoAlias-> (optionalSuffix-> TableAlias (optional (keyword "as") *> nkwid)-> FullAlias () (parens $ commaSep1 idString))-> nkwid = try $ do-> x <- idString-> --avoid all these keywords as aliases since they can-> --appear immediately following a tableref as the next-> --part of the statement, if we don't do this then lots-> --of things don't parse. Seems a bit inelegant but-> --works for the tests and the test sql files don't know-> --if these should be allowed as aliases without "" or-> --[]-> -- TODO find out what the correct behaviour here is.-> if map toLower x `elem` ["as"-> ,"where"-> ,"except"-> ,"union"-> ,"intersect"-> ,"loop"-> ,"inner"-> ,"on"-> ,"left"-> ,"right"-> ,"full"-> ,"cross"-> ,"join"-> ,"natural"-> ,"order"-> ,"group"-> ,"limit"-> ,"using"-> ,"from"]-> then fail "not keyword"-> else return x-> values = Values <$> (pos <* keyword "values") <*> commaSep1 (parens $ commaSep1 expr)--> optParens :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity a-> optParens p = try (parens p) <|> p--= insert, update and delete--insert statement: supports option column name list,-multiple rows to insert and insert from select statements--> insert :: ParsecT [Token] ParseState Identity Statement-> insert = Insert-> <$> pos <* keyword "insert" <* keyword "into"-> <*> idString-> <*> option [] (try columnNameList)-> <*> selectExpression-> <*> tryOptionMaybe returning--> update :: ParsecT [Token] ParseState Identity Statement-> update = Update-> <$> pos <* keyword "update"-> <*> idString-> <*> (keyword "set" *> commaSep1 setClause)-> <*> tryOptionMaybe whereClause-> <*> tryOptionMaybe returning-> where-> setClause = choice-> [RowSetClause <$> pos-> <*> parens (commaSep1 idString)-> <*> (symbol "=" *> parens (commaSep1 expr))-> ,SetClause <$> pos-> <*> idString-> <*> (symbol "=" *> expr)]--> delete :: ParsecT [Token] ParseState Identity Statement-> delete = Delete-> <$> pos <* keyword "delete" <* keyword "from"-> <*> idString-> <*> tryOptionMaybe whereClause-> <*> tryOptionMaybe returning--> truncateSt :: ParsecT [Token] ParseState Identity Statement-> truncateSt =-> Truncate-> <$> pos <* keyword "truncate" <* optional (keyword "table")-> <*> commaSep1 idString-> <*> option ContinueIdentity (choice [-> ContinueIdentity <$ (keyword "continue"-> <* keyword "identity")-> ,RestartIdentity <$ (keyword "restart"-> <* keyword "identity")])-> <*> cascade--> copy :: ParsecT [Token] ParseState Identity Statement-> copy = do-> p <- pos-> keyword "copy"-> tableName <- idString-> cols <- option [] (parens $ commaSep1 idString)-> keyword "from"-> src <- choice [-> CopyFilename <$> extrStr <$> stringLit-> ,Stdin <$ keyword "stdin"]-> return $ Copy p tableName cols src--> copyData :: ParsecT [Token] ParseState Identity Statement-> copyData = CopyData <$> pos <*> mytoken (\tok ->-> case tok of-> CopyPayloadTok n -> Just n-> _ -> Nothing)--> set :: ParsecT [Token] ParseState Identity Statement-> set = Set <$> pos-> <*> (keyword "set" *> idString)-> <*> ((keyword "to" <|> symbol "=") *>-> commaSep1 sv)-> where-> sv = choice [-> SetStr <$> pos <*> stringN-> ,SetId <$> pos <*> idString-> ,SetNum <$> pos <*> ((fromInteger <$> integer) <|> float)]--> notify :: ParsecT [Token] ParseState Identity Statement-> notify = Notify <$> pos-> <*> (keyword "notify" *> idString)--= ddl--> createTable :: ParsecT [Token] ParseState Identity Statement-> createTable = do-> p <- pos-> keyword "table"-> tname <- idString-> choice [-> CreateTableAs p tname <$> (keyword "as" *> selectExpression)-> ,uncurry (CreateTable p tname) <$> readAttsAndCons]-> where-> --parse our unordered list of attribute defs or constraints, for-> --each line want to try the constraint parser first, then the-> --attribute parser, so we need the swap to feed them in the-> --right order into createtable-> readAttsAndCons = parens (swap <$> multiPerm-> (try tableConstraint)-> tableAtt-> (symbol ","))-> where swap (a,b) = (b,a)-> tableAtt = AttributeDef-> <$> pos-> <*> idString-> <*> typeName-> <*> tryOptionMaybe (keyword "default" *> expr)-> <*> many rowConstraint-> rowConstraint = do-> p <- pos-> cn <- option "" (keyword "constraint" *> idString)-> choice [-> RowUniqueConstraint p cn <$ keyword "unique"-> ,RowPrimaryKeyConstraint p cn <$ keyword "primary" <* keyword "key"-> ,RowCheckConstraint p cn <$> (keyword "check" *> parens expr)-> ,NullConstraint p cn <$ keyword "null"-> ,NotNullConstraint p cn <$ (keyword "not" <* keyword "null")-> ,RowReferenceConstraint p cn-> <$> (keyword "references" *> idString)-> <*> option Nothing (try $ parens $ Just <$> idString)-> <*> onDelete-> <*> onUpdate-> ]--> onDelete,onUpdate :: ParsecT [Token] ParseState Identity Cascade-> onDelete = onSomething "delete"-> onUpdate = onSomething "update"-> onSomething :: String -> ParsecT [Token] ParseState Identity Cascade-> onSomething k = option Restrict $ try $ keyword "on"-> *> keyword k *> cascade--> tableConstraint :: ParsecT [Token] ParseState Identity Constraint-> tableConstraint = do-> p <- pos-> cn <- option "" (keyword "constraint" *> option "" conName)-> choice [-> UniqueConstraint p cn-> <$> try (keyword "unique" *> optParens columnNameList)-> ,PrimaryKeyConstraint p cn-> <$> try (keyword "primary" *> keyword "key"-> *> choice [-> (:[]) <$> idString-> ,parens (commaSep1 idString)])-> ,CheckConstraint p cn-> <$>try (keyword "check" *> parens expr)-> ,ReferenceConstraint p cn-> <$> try (keyword "foreign" *> keyword "key"-> *> parens (commaSep1 idString))-> <*> (keyword "references" *> idString)-> <*> option [] (parens $ commaSep1 idString)-> <*> onUpdate-> <*> onDelete]-> where-> conName = try $ do-> x <- idString-> if map toLower x `elem` [-> "unique"-> ,"primary"-> ,"check"-> ,"foreign"-> ,"references"]-> then fail "not keyword"-> else return x---> alterTable :: ParsecT [Token] ParseState Identity Statement-> alterTable = AlterTable <$> (pos <* keyword "table" <* optional (keyword "only"))-> <*> idString-> <*> many1 action-> where action = choice [-> AlterColumnDefault-> <$> (pos <* keyword "alter" <* keyword "column")-> <*> idString-> <*> (keyword "set" *> keyword "default" *> expr)-> ,AddConstraint-> <$> (pos <* keyword "add")-> <*> tableConstraint]--> createType :: ParsecT [Token] ParseState Identity Statement-> createType = CreateType-> <$> pos <* keyword "type"-> <*> idString-> <*> (keyword "as" *> parens (commaSep1 typeAtt))-> where-> typeAtt = TypeAttDef <$> pos <*> idString <*> typeName--> createSequence :: ParsecT [Token] ParseState Identity Statement-> createSequence = do-> p <- pos-> keyword "sequence"-> nm <- idString-> (stw, incr, mx, mn, c) <- permute ((,,,,) <$?> (1,startWith)-> <|?> (1,increment)-> <|?> ((2::Integer) ^ (63::Integer) - 1, maxi)-> <|?> (1, mini)-> <|?> (1, cache))-> return $ CreateSequence p nm incr mn mx stw c-> where-> startWith = keyword "start" *> optional (keyword "with") *> integer-> increment = keyword "increment" *> optional (keyword "by") *> integer-> maxi = (2::Integer) ^ (63::Integer) - 1 <$ try (keyword "no" <* keyword "maxvalue")-> mini = 1 <$ try (keyword "no" <* keyword "minvalue")-> cache = keyword "cache" *> integer--> alterSequence :: ParsecT [Token] ParseState Identity Statement-> alterSequence = AlterSequence <$> pos-> <*> (keyword "sequence" *> idString)-> <*> (keyword "owned" *> keyword "by" *> idString)--create function, support sql functions and plpgsql functions. Parses-the body in both cases and provides a statement list for the body-rather than just a string.--> createFunction :: ParsecT [Token] ParseState Identity Statement-> createFunction = do-> p <- pos-> keyword "function"-> fnName <- idString-> params <- parens $ commaSep param-> retType <- keyword "returns" *> typeName-> ((bodypos,body), lang,vol) <--> permute ((,,) <$$> parseAs-> <||> readLang-> <|?> (Volatile,pVol))-> case parseBody lang body bodypos of-> Left er -> fail er-> Right (q,b) -> return $ CreateFunction p fnName params retType lang q b vol-> where-> parseAs = do-> keyword "as"-> bodypos <- getAdjustedPosition-> body <- stringLit-> return (bodypos,body)-> pVol = matchAKeyword [("volatile", Volatile)-> ,("stable", Stable)-> ,("immutable", Immutable)]-> readLang = keyword "language" *> matchAKeyword [("plpgsql", Plpgsql)-> ,("sql",Sql)]-> parseBody :: Language -> Expression -> MySourcePos -> Either String (String, FnBody)-> parseBody lang body bodypos@(fileName,line,col) =-> case (parseIt-> (lexSqlTextWithPosition fileName line col (extrStr body))-> (functionBody lang)-> fileName-> (Just (line,col))-> (extrStr body)-> [bodypos]) of-> Left er@(ParseErrorExtra _ _ _) -> Left $ show er-> Right body' -> Right (quoteOfString body, body')--sql function is just a list of statements, the last one has the-trailing semicolon optional--> functionBody Sql = do-> p <- pos-> a <- many (try $ sqlStatement True)-> -- this makes my head hurt, should probably write out-> -- more longhand-> SqlFnBody p <$> option a ((\b -> (a++[b])) <$> sqlStatement False)--plpgsql function has an optional declare section, plus the statements-are enclosed in begin ... end; (semi colon after end is optional(--> functionBody Plpgsql =-> PlpgsqlFnBody-> <$> pos-> <*> option [] declarePart-> <*> statementPart-> where-> statementPart = keyword "begin"-> *> many plPgsqlStatement-> <* keyword "end" <* optional (symbol ";") <* eof-> declarePart = keyword "declare"-> *> manyTill (try varDef) (lookAhead $ keyword "begin")--params to a function--> param :: ParsecT [Token] ParseState Identity ParamDef-> param = choice [-> try (ParamDef <$> pos <*> idString <*> typeName)-> ,ParamDefTp <$> pos <*> typeName]--variable declarations in a plpgsql function--> varDef :: ParsecT [Token] ParseState Identity VarDef-> varDef = VarDef-> <$> pos-> <*> idString-> <*> typeName-> <*> tryOptionMaybe ((symbol ":=" <|> symbol "=")*> expr) <* symbol ";"---> createView :: ParsecT [Token] ParseState Identity Statement-> createView = CreateView-> <$> pos <* keyword "view"-> <*> idString-> <*> (keyword "as" *> selectExpression)--> createDomain :: ParsecT [Token] ParseState Identity Statement-> createDomain = CreateDomain-> <$> pos <* keyword "domain"-> <*> idString-> <*> (tryOptionMaybe (keyword "as") *> typeName)-> <*> option "" (keyword "constraint" *> idString)-> <*> tryOptionMaybe (keyword "check" *> parens expr)--> dropSomething :: ParsecT [Token] ParseState Identity Statement-> dropSomething = do-> p <- pos-> x <- try (choice [-> Domain <$ keyword "domain"-> ,Type <$ keyword "type"-> ,Table <$ keyword "table"-> ,View <$ keyword "view"-> ])-> (i,e,r) <- parseDrop idString-> return $ DropSomething p x i e r--> dropFunction :: ParsecT [Token] ParseState Identity Statement-> dropFunction = do-> p <- pos-> keyword "function"-> (i,e,r) <- parseDrop pFun-> return $ DropFunction p i e r-> where-> pFun = (,) <$> idString-> <*> parens (many typeName)--> parseDrop :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity (IfExists, [a], Cascade)-> parseDrop p = (,,)-> <$> ifExists-> <*> commaSep1 p-> <*> cascade-> where-> ifExists = option Require-> (try $ IfExists <$ (keyword "if"-> *> keyword "exists"))--> createLanguage :: ParsecT [Token] ParseState Identity Statement-> createLanguage =-> CreateLanguage <$> pos-> <*> (optional (keyword "procedural") *>-> keyword "language" *>-> idString)--> createTrigger :: ParsecT [Token] ParseState Identity Statement-> createTrigger =-> CreateTrigger <$> pos-> <*> (keyword "trigger" *> idString)-> <*> twhen-> <*> tevents-> <*> (keyword "on" *> idString)-> <*> tfiring-> <*> (keyword "execute" *> keyword "procedure"-> *> idString)-> <*> parens (commaSep expr)-> where-> twhen = choice [TriggerBefore <$ keyword "before"-> ,TriggerAfter <$ keyword "after"]-> tevents :: ParsecT [Token] ParseState Identity [TriggerEvent]-> tevents = sepBy1 (choice [-> TInsert <$ keyword "insert"-> ,TUpdate <$ keyword "update"-> ,TDelete <$ keyword "delete"]) (keyword "or")-> tfiring = option EachStatement-> (keyword "for" *> optional (keyword "each") *>-> choice [-> EachRow <$ keyword "row"-> ,EachStatement <$ keyword "statement"])--[ FOR [ EACH ] { ROW | STATEMENT } ]-- | CreateTrigger ann:Annotation- name:String- wh : TriggerWhen- events: {[TriggerEvent]}- tbl : String- firing : TriggerFire- fnName : String- fnArgs : {[Expression]}--================================================================================--= component parsers for sql statements--> whereClause :: ParsecT [Token] ParseState Identity Expression-> whereClause = keyword "where" *> expr--selectlist and selectitem: the bit between select and from-check for into either before the whole list of select columns-or after the whole list--> selectList :: ParsecT [Token] ParseState Identity SelectList-> selectList =-> pos >>= \p ->-> choice [-> flip (SelectList p) <$> readInto <*> itemList-> ,SelectList p <$> itemList <*> option [] readInto]-> where-> readInto = keyword "into" *> commaSep1 idString-> itemList = commaSep1 selectItem-> selectItem = pos >>= \p ->-> optionalSuffix-> (SelExp p) expr-> (SelectItem p) () (keyword "as" *> idString)--> returning :: ParsecT [Token] ParseState Identity SelectList-> returning = keyword "returning" *> selectList--> columnNameList :: ParsecT [Token] ParseState Identity [String]-> columnNameList = parens $ commaSep1 idString--> typeName :: ParsecT [Token] ParseState Identity TypeName-> typeName = choice [-> SetOfTypeName <$> pos <*> (keyword "setof" *> typeName)-> ,do-> p <- pos-> s <- map toLower <$> pTypeNameString-> choice [-> PrecTypeName p s <$> parens integer-> ,ArrayTypeName p (SimpleTypeName p s) <$ symbol "[" <* symbol "]"-> ,return $ SimpleTypeName p s]]-> where-> --todo: add special cases for the other type names with spaces in them-> pTypeNameString = ("double precision" <$ try (keyword "double"-> <* keyword "precision"))-> <|> idString--> cascade :: ParsecT [Token] ParseState Identity Cascade-> cascade = option Restrict (choice [-> Restrict <$ keyword "restrict"-> ,Cascade <$ keyword "cascade"])--================================================================================--= plpgsql statements--> plPgsqlStatement :: ParsecT [Token] ParseState Identity Statement-> plPgsqlStatement =-> sqlStatement True-> <|> (choice [-> continue-> ,execute-> ,caseStatement-> ,assignment-> ,ifStatement-> ,returnSt-> ,raise-> ,forStatement-> ,whileStatement-> ,perform-> ,nullStatement]-> <* symbol ";")--> nullStatement :: ParsecT [Token] ParseState Identity Statement-> nullStatement = NullStatement <$> (pos <* keyword "null")--> continue :: ParsecT [Token] ParseState Identity Statement-> continue = ContinueStatement <$> (pos <* keyword "continue")--> perform :: ParsecT [Token] ParseState Identity Statement-> perform = Perform <$> (pos <* keyword "perform") <*> expr--> execute :: ParsecT [Token] ParseState Identity Statement-> execute = pos >>= \p -> keyword "execute" >>-> optionalSuffix-> (Execute p) expr-> (ExecuteInto p) () readInto-> where-> readInto = keyword "into" *> commaSep1 idString--> assignment :: ParsecT [Token] ParseState Identity Statement-> assignment = Assignment-> <$> pos-> -- put the := in the first try to attempt to get a-> -- better error if the code looks like malformed-> -- assignment statement-> <*> try (idString <* (symbol ":=" <|> symbol "="))-> <*> expr--> returnSt :: ParsecT [Token] ParseState Identity Statement-> returnSt = pos >>= \p -> keyword "return" >>-> choice [-> ReturnNext p <$> (keyword "next" *> expr)-> ,ReturnQuery p <$> (keyword "query" *> selectExpression)-> ,Return p <$> tryOptionMaybe expr]--> raise :: ParsecT [Token] ParseState Identity Statement-> raise = pos >>= \p -> keyword "raise" >>-> Raise p-> <$> raiseType-> <*> (extrStr <$> stringLit)-> <*> option [] (symbol "," *> commaSep1 expr)-> where-> raiseType = matchAKeyword [("notice", RNotice)-> ,("exception", RException)-> ,("error", RError)]--> forStatement :: ParsecT [Token] ParseState Identity Statement-> forStatement = do-> p <- pos-> keyword "for"-> start <- idString-> keyword "in"-> choice [(ForSelectStatement p start <$> try selectExpression <*> theRest)-> ,(ForIntegerStatement p start-> <$> expr-> <*> (symbol ".." *> expr)-> <*> theRest)]-> where-> theRest = keyword "loop" *> many plPgsqlStatement-> <* keyword "end" <* keyword "loop"--> whileStatement :: ParsecT [Token] ParseState Identity Statement-> whileStatement = WhileStatement-> <$> (pos <* keyword "while")-> <*> (expr <* keyword "loop")-> <*> many plPgsqlStatement <* keyword "end" <* keyword "loop"--> ifStatement :: ParsecT [Token] ParseState Identity Statement-> ifStatement = If-> <$> (pos <* keyword "if")-> <*> (ifPart <:> elseifParts)-> <*> (elsePart <* endIf)-> where-> ifPart = expr <.> (thn *> many plPgsqlStatement)-> elseifParts = many ((elseif *> expr) <.> (thn *> many plPgsqlStatement))-> elsePart = option [] (keyword "else" *> many plPgsqlStatement)-> endIf = keyword "end" <* keyword "if"-> thn = keyword "then"-> elseif = keyword "elseif"-> --might as well throw this in as well after all that-> -- can't do <,> unfortunately, so use <.> instead-> (<.>) a b = (,) <$> a <*> b--> caseStatement :: ParsecT [Token] ParseState Identity Statement-> caseStatement =-> CaseStatement <$> (pos <* keyword "case")-> <*> expr-> <*> many whenSt-> <*> option [] (keyword "else" *> many plPgsqlStatement)-> <* keyword "end" <* keyword "case"-> where-> whenSt = keyword "when" >>-> (,) <$> commaSep1 expr-> <*> (keyword "then" *> many plPgsqlStatement)--================================================================================--= expressions--This is the bit that makes it the most obvious that I don't really-know haskell, parsing theory or parsec ... robbed a parsing example-from haskell-cafe and mainly just kept changing it until it seemed to-work--> expr :: ParsecT [Token] ParseState Identity Expression-> expr = buildExpressionParser table factor-> <?> "expression"--> factor :: ParsecT [Token] ParseState Identity Expression-> factor =--First job is to take care of forms which start as a regular-expression, and then add a suffix on--> threadOptionalSuffixes fct [castSuffix-> ,betweenSuffix-> ,arraySubSuffix]-> where-> fct = choice [--order these so the ones which can be valid prefixes of others appear-further down the list (used to be a lot more important when there-wasn't a separate lexer), probably want to refactor this to use the-optionalsuffix parsers to improve speed.--One little speed optimisation, to help with pretty printed code which-can contain a lot of parens - check for nested ((-This little addition speeds up ./ParseFile.lhs sqltestfiles/system.sql-on my system from ~4 minutes to ~4 seconds (most of the 4s is probably-compilation overhead).--> try (lookAhead (symbol "(" >> symbol "(")) >> parens expr--start with the factors which start with parens - eliminate scalar-subqueries since they're easy to distinguish from the others then do in-predicate before row constructor, since an in predicate can start with-a row constructor looking thing, then finally vanilla parens--> ,scalarSubQuery-> ,try $ threadOptionalSuffix rowCtor inPredicateSuffix-> ,parens expr--try a few random things which can't start a different expression--> ,positionalArg-> ,placeholder-> ,stringLit--> ,floatLit-> ,integerLit--put the factors which start with keywords before the ones which start-with a function, so we don't try an parse a keyword as a function name--> ,caseParse-> ,exists-> ,booleanLit-> ,nullLit-> ,arrayLit-> ,castKeyword-> ,substring--now do identifiers, functions, and window functions (each is a prefix-to the next one)--> ,threadOptionalSuffixes-> identifier-> [inPredicateSuffix-> ,\l -> threadOptionalSuffix (functionCallSuffix l) windowFnSuffix]]--== operator table--proper hacky, but sort of does the job-the 'missing' notes refer to pg operators which aren't yet supported,-or supported in a different way (e.g. cast uses the type name parser-for one of it's argument, not the expression parser - I don't know if-there is a better way of doing this but there usually is in parsec)--pg's operator table is on this page:-http://www.postgresql.org/docs/8.4/interactive/sql-syntax-lexical.html#SQL-SYNTAX-OPERATORS--will probably need something more custom to handle full range of sql-syntactical novelty, in particular the precedence rules mix these-operators up with irregular syntax operators, you can create new-operators during parsing, and some operators are prefix/postfix or-binary depending on the types of their operands (how do you parse-something like this?)--The full list of operators from a standard template1 database should-be used here.--> table :: [[Operator [Token] ParseState Identity Expression]]-> table = [--[binary "::" (BinOpCall Cast) AssocLeft]-> --missing [] for array element select-> [prefix "-" "u-"]-> ,[binary "^" AssocLeft]-> ,[binary "*" AssocLeft-> ,idHackBinary "*" AssocLeft-> ,binary "/" AssocLeft-> ,binary "%" AssocLeft]-> ,[binary "+" AssocLeft-> ,binary "-" AssocLeft]-> --should be is isnull and notnull-> ,[postfixks ["is", "not", "null"] "!isnotnull"-> ,postfixks ["is", "null"] "!isnull"]-> --other operators all added in this list according to the pg docs:-> ,[binary "<->" AssocNone-> ,binary "<=" AssocRight-> ,binary ">=" AssocRight-> ,binary "||" AssocLeft-> ,prefix "@" "@"-> ]-> --in should be here, but is treated as a factor instead-> --between-> --overlaps-> ,[binaryk "like" "!like" AssocNone-> ,binarycust (symbol "!=") "<>" AssocNone]-> --(also ilike similar)-> ,[binary "<" AssocNone-> ,binary ">" AssocNone]-> ,[binary "=" AssocRight-> ,binary "<>" AssocNone]-> ,[notNot-> ,prefixk "not" "!not"-> ]-> ,[binaryk "and" "!and" AssocLeft-> ,binaryk "or" "!or" AssocLeft]]-> where-> binary s = binarycust (symbol s) s-> -- '*' is lexed as an id token rather than a symbol token, so-> -- work around here-> idHackBinary s = binarycust (keyword s) s-> binaryk = binarycust . keyword-> prefix = unaryCust Prefix . symbol-> prefixk = unaryCust Prefix . keyword-> postfixks = unaryCust Postfix . mapM_ keyword-> binarycust opParse t =-> Infix $ try $ do-> f <- FunCall <$> pos <*> (t <$ opParse)-> return (\l -> \m -> f [l,m])-> unaryCust ctor opParse t =-> ctor $ try $ do-> f <- FunCall <$> pos <*> (t <$ opParse)-> return (\l -> f [l])-> --hack - haven't worked out why parsec buildexpression parser won't parse-> -- something like "not not EXPR" without parens so hack here-> notNot = Prefix (try $ do-> p1 <- pos-> keyword "not"-> p2 <- pos-> keyword "not"-> return (\l -> FunCall p1 "!not" [FunCall p2 "!not" [l]]))--== factor parsers--I think the lookahead is used in an attempt to help the error messages.--> scalarSubQuery :: ParsecT [Token] ParseState Identity Expression-> scalarSubQuery = try (symbol "(" *> lookAhead (keyword "select")) >>-> ScalarSubQuery-> <$> pos-> <*> selectExpression <* symbol ")"--in predicate - an identifier or row constructor followed by 'in'-then a list of expressions or a subselect--> inPredicateSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> inPredicateSuffix e =-> InPredicate-> <$> pos-> <*> return e-> <*> option True (False <$ keyword "not")-> <*> (keyword "in" *> parens ((InSelect <$> pos <*> selectExpression)-> <|>-> (InList <$> pos <*> commaSep1 expr)))--row ctor: one of-row ()-row (expr)-row (expr, expr1, ...)-(expr, expr2,...) [implicit (no row keyword) version, at least two elements- must be present]--(expr) parses to just expr rather than row(expr)-and () is a syntax error.--> rowCtor :: ParsecT [Token] ParseState Identity Expression-> rowCtor = FunCall-> <$> pos-> <*> return "!rowctor"-> <*> choice [-> keyword "row" *> parens (commaSep expr)-> ,parens $ commaSep2 expr]--> floatLit :: ParsecT [Token] ParseState Identity Expression-> floatLit = FloatLit <$> pos <*> float--> integerLit :: ParsecT [Token] ParseState Identity Expression-> integerLit = IntegerLit <$> pos <*> integer--case - only supports 'case when condition' flavour and not 'case-expression when value' currently--> caseParse :: ParsecT [Token] ParseState Identity Expression-> caseParse = do-> p <- pos-> keyword "case"-> choice [-> try $ CaseSimple p <$> expr-> <*> many whenParse-> <*> tryOptionMaybe (keyword "else" *> expr)-> <* keyword "end"-> ,Case p <$> many whenParse-> <*> tryOptionMaybe (keyword "else" *> expr)-> <* keyword "end"]-> where-> whenParse = (,) <$> (keyword "when" *> commaSep1 expr)-> <*> (keyword "then" *> expr)--> exists :: ParsecT [Token] ParseState Identity Expression-> exists = Exists <$> pos <* keyword "exists" <*> parens selectExpression--> booleanLit :: ParsecT [Token] ParseState Identity Expression-> booleanLit = BooleanLit <$> pos <*> (True <$ keyword "true"-> <|> False <$ keyword "false")--> nullLit :: ParsecT [Token] ParseState Identity Expression-> nullLit = NullLit <$> pos <* keyword "null"--> arrayLit :: ParsecT [Token] ParseState Identity Expression-> arrayLit = FunCall <$> pos <* keyword "array"-> <*> return "!arrayctor"-> <*> squares (commaSep expr)--> arraySubSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> arraySubSuffix e = case e of-> Identifier _ "array" -> fail "can't use array as identifier name"-> _ -> FunCall <$> pos-> <*> return "!arraysub"-> <*> ((e:) <$> squares (commaSep1 expr))--supports basic window functions of the form-fn() over ([partition bit]? [order bit]?)--frame clauses todo:-range unbounded preceding-range between unbounded preceding and current row-range between unbounded preceding and unbounded following-rows unbounded preceding-rows between unbounded preceding and current row-rows between unbounded preceding and unbounded following--> windowFnSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> windowFnSuffix e = WindowFn <$> pos <*> return e-> <*> (keyword "over" *> (symbol "(" *> option [] partitionBy))-> <*> option [] orderBy1-> <*> option Asc (try $ choice [-> Asc <$ keyword "asc"-> ,Desc <$ keyword "desc"])-> <*> frm-> <* symbol ")"-> where-> orderBy1 = keyword "order" *> keyword "by" *> commaSep1 expr-> partitionBy = keyword "partition" *> keyword "by" *> commaSep1 expr-> frm = option FrameUnboundedPreceding $ choice $ map (\(a,b) -> a <$ try (ks b)) [-> (FrameUnboundedPreceding, ["range","unbounded","preceding"])-> ,(FrameUnboundedPreceding, ["range","between","unbounded","preceding","and","current","row"])-> ,(FrameUnboundedFull, ["range","between","unbounded","preceding","and","unbounded","following"])-> ,(FrameUnboundedFull, ["rows","between","unbounded","preceding","and","unbounded","following"])-> ,(FrameRowsUnboundedPreceding, ["rows","unbounded","preceding"])-> ,(FrameRowsUnboundedPreceding, ["rows","between","unbounded","preceding","and","current","row"])]-> ks = mapM keyword--> betweenSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> betweenSuffix a = do-> p <- pos-> keyword "between"-> b <- dodgyParseElement-> keyword "and"-> c <- dodgyParseElement-> return $ FunCall p "!between" [a,b,c]-> --can't use the full expression parser at this time-> --because of a conflict between the operator 'and' and-> --the 'and' part of a between--From postgresql src/backend/parser/gram.y-- * We have two expression types: a_expr is the unrestricted kind, and- * b_expr is a subset that must be used in some places to avoid shift/reduce- * conflicts. For example, we can't do BETWEEN as "BETWEEN a_expr AND a_expr"- * because that use of AND conflicts with AND as a boolean operator. So,- * b_expr is used in BETWEEN and we remove boolean keywords from b_expr.- *- * Note that '(' a_expr ')' is a b_expr, so an unrestricted expression can- * always be used by surrounding it with parens.--TODO: copy this approach here.--> where-> dodgyParseElement = factor--> functionCallSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> functionCallSuffix (Identifier _ fnName) =-> pos >>= \p -> FunCall p fnName-> <$> parens (optional (keyword "all" <|> keyword "distinct") *> commaSep expr)-> functionCallSuffix s = error $ "internal error: cannot make functioncall from " ++ show s--> castKeyword :: ParsecT [Token] ParseState Identity Expression-> castKeyword = Cast-> <$> pos <* keyword "cast" <* symbol "("-> <*> expr-> <*> (keyword "as" *> typeName <* symbol ")")--> castSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> castSuffix ex = pos >>= \p -> Cast p ex <$> (symbol "::" *> typeName)--> substring :: ParsecT [Token] ParseState Identity Expression-> substring = do-> p <- pos-> keyword "substring"-> symbol "("-> a <- expr-> keyword "from"-> b <- expr-> keyword "for"-> c <- expr-> symbol ")"-> return $ FunCall p "!substring" [a,b,c]--> identifier :: ParsecT [Token] ParseState Identity Expression-> identifier = Identifier <$> pos <*> idString--try $ do- > p <- pos- > i <- idString- > if i `elem` ["not"]- > then fail "can't use keyword"- > else return $ Identifier p i--================================================================================--= Utility parsers--== tokeny things--keyword has to not be immediately followed by letters or numbers-(symbols and whitespace are ok) so we know that we aren't reading an-identifier which happens to start with a complete keyword--> keyword :: String -> ParsecT [Token] ParseState Identity String-> keyword k = mytoken (\tok ->-> case tok of-> IdStringTok i | lcase k == lcase i -> Just k-> _ -> Nothing)-> where-> lcase = map toLower--> idString :: MyParser String-> idString = mytoken (\tok -> case tok of-> IdStringTok "not" -> Nothing-> IdStringTok i -> Just i-> _ -> Nothing)--> symbol :: String -> ParsecT [Token] ParseState Identity String-> symbol c = mytoken (\tok -> case tok of-> SymbolTok s | c==s -> Just c-> _ -> Nothing)--> integer :: MyParser Integer-> integer = mytoken (\tok -> case tok of-> IntegerTok n -> Just n-> _ -> Nothing)--> positionalArg :: ParsecT [Token] ParseState Identity Expression-> positionalArg = PositionalArg [] <$> mytoken (\tok -> case tok of-> PositionalArgTok n -> Just n-> _ -> Nothing)--> placeholder :: ParsecT [Token] ParseState Identity Expression-> placeholder = Placeholder [] <$ symbol "?"---> float :: MyParser Double-> float = mytoken (\tok -> case tok of-> FloatTok n -> Just n-> _ -> Nothing)--> stringLit :: MyParser Expression-> stringLit = mytoken (\tok ->-> case tok of-> StringTok d s -> Just $ StringLit [] d s-> _ -> Nothing)--> stringN :: MyParser String-> stringN = mytoken (\tok ->-> case tok of-> StringTok _ s -> Just s-> _ -> Nothing)---couple of helper functions which extract the actual string-from a StringLD or StringL, and the delimiters which were used-(either ' or a dollar tag)--> extrStr :: Expression -> String-> extrStr (StringLit _ _ s) = s-> extrStr x = error $ "internal error: extrStr not supported for this type " ++ show x--> quoteOfString :: Expression -> String-> quoteOfString (StringLit _ tag _) = tag-> quoteOfString x = error $ "internal error: quoteType not supported for this type " ++ show x--== combinatory things--> parens :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity a-> parens = between (symbol "(") (symbol ")")--> squares :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity a-> squares = between (symbol "[") (symbol "]")--> tryOptionMaybe :: (Stream s m t) =>-> ParsecT s u m a -> ParsecT s u m (Maybe a)-> tryOptionMaybe p = try (optionMaybe p) <|> return Nothing--> commaSep2 :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity [a]-> commaSep2 p = sepBy2 p (symbol ",")--> sepBy2 :: (Stream s m t) =>-> ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m [a]-> sepBy2 p sep = (p <* sep) <:> sepBy1 p sep--> commaSep :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity [a]-> commaSep p = sepBy p (symbol ",")--> commaSep1 :: ParsecT [Token] ParseState Identity a-> -> ParsecT [Token] ParseState Identity [a]-> commaSep1 p = sepBy1 p (symbol ",")--pass a list of pairs of strings and values-try each pair k,v in turn,-if keyword k matches then return v-doesn't really add a lot of value--> matchAKeyword :: [(String, a)] -> ParsecT [Token] ParseState Identity a-> matchAKeyword [] = fail "no matches"-> matchAKeyword ((k,v):kvs) = v <$ keyword k <|> matchAKeyword kvs--parseOptionalSuffix--parse the start of something -> parseResultA,-then parse an optional suffix -> parseResultB-if this second parser succeeds, return fn2 parseResultA parseResultB-else return fn1 parseResultA--e.g.-parsing an identifier in a select list can be-fieldName-or-fieldName as alias-so we can pass-* IdentifierCtor-* identifier (returns aval)-* AliasedIdentifierCtor-* () - looks like a place holder, probably a crap idea-* parser for (as b) (returns bval)-as the args, which I like to ident like:-parseOptionalSuffix- IdentifierCtor identifierParser- AliasedIdentifierCtor () asAliasParser-and we get either-* IdentifierCtor identifierValue-or-* AliasedIdentifierCtor identifierValue aliasValue-as the result depending on whether the asAliasParser-succeeds or not.--probably this concept already exists under a better name in parsing-theory--> optionalSuffix :: (Stream s m t2) =>-> (t1 -> b)-> -> ParsecT s u m t1-> -> (t1 -> a -> b)-> -> ()-> -> ParsecT s u m a-> -> ParsecT s u m b-> optionalSuffix c1 p1 c2 _ p2 = do-> x <- p1-> option (c1 x) (c2 x <$> try p2)--threadOptionalSuffix--parse the start of something -> parseResultA,-then parse an optional suffix, passing parseResultA- to this parser -> parseResultB-return parseResultB is it succeeds, else return parseResultA--sort of like a suffix operator parser where the suffixisable part-is parsed, then if the suffix is there it wraps the suffixisable-part in an enclosing tree node.--parser1 -> tree1-(parser2 tree1) -> maybe tree2-tree2 isnothing ? tree1 : tree2--> threadOptionalSuffix :: ParsecT [tok] st Identity a-> -> (a -> GenParser tok st a)-> -> ParsecT [tok] st Identity a-> threadOptionalSuffix p1 p2 = do-> x <- p1-> option x (try $ p2 x)--I'm pretty sure this is some standard monad operation but I don't know-what. It's a bit like the maybe monad but when you get nothing it-returns the previous result instead of nothing-- if you take the parsing specific stuff out you get:--p1 :: (Monad m) =>- m b -> (b -> m (Maybe b)) -> m b-p1 = do- x <- p1- y <- p2 x- case y of- Nothing -> return x- Just z -> return z-=====--like thread optional suffix, but we pass a list of suffixes in, not-much of a shorthand--> threadOptionalSuffixes :: ParsecT [tok] st Identity a-> -> [a -> GenParser tok st a]-> -> ParsecT [tok] st Identity a-> threadOptionalSuffixes p1 p2s = do-> x <- p1-> option x (try $ choice (map (\l -> l x) p2s))--couldn't work how to to perms so just did this hack instead-e.g.-a1,a2,b1,b2,a2,b3,b4 parses to ([a1,a2,a3],[b1,b2,b3,b4])--> multiPerm :: (Stream s m t) =>-> ParsecT s u m a1-> -> ParsecT s u m a-> -> ParsecT s u m sep-> -> ParsecT s u m ([a1], [a])--> multiPerm p1 p2 sep = do-> (r1, r2) <- unzip <$> sepBy1 parseAorB sep-> return (catMaybes r1, catMaybes r2)-> where-> parseAorB = choice [-> (\x -> (Just x,Nothing)) <$> p1-> ,(\y -> (Nothing, Just y)) <$> p2]--== position stuff--getAdjustedPosition is used to modify the positions within a function-body, to absolute positions within the file being parsed.--> getAdjustedPosition :: ParsecT [Token] ParseState Identity MySourcePos-> getAdjustedPosition = do-> p <- toMySp <$> getPosition-> s <- getState-> case s of-> [] -> return p-> x:_ -> return $ adjustPosition x p--> adjustPosition :: MySourcePos -> MySourcePos -> MySourcePos-> adjustPosition (fn,pl,_) (_,l,c) = (fn,pl+l-1,c)--> pos :: ParsecT [Token] ParseState Identity Annotation-> pos = do-> p <- toSp <$> getPosition-> s <- getState-> case s of-> [] -> return [p]-> x:_ -> return [adjustPos x p]-> where-> toSp sp = A.SourcePos (sourceName sp) (sourceLine sp) (sourceColumn sp)-> adjustPos (fn,pl,_) (A.SourcePos _ l c) = A.SourcePos fn (pl+l-1) c-> adjustPos _ x = error $ "internal error - tried to adjust as sourcepos: " ++ show x--== lexer stuff--> type MyParser = GenParser Token ParseState--> mytoken :: (Tok -> Maybe a) -> MyParser a-> mytoken test-> = token showToken posToken testToken-> where-> showToken (_,tok) = show tok-> posToken (posi,_) = posi-> testToken (_,tok) = test tok--================================================================================--= fixup tree--this is where some generics code is used to transform the parse trees-to alter the nodes used where it's too difficult to do whilst-parsing. The only item at the moment that needs this treatment is te-any/some/all construct which looks like this:-expr operator [any|some|all] (expr)--This gets parsed as-funcall operator [expr1,funcall [any|some|all] [expr2,...]]-and we want to transform it to-liftoperator operator any|some|all [expr1, expr2,...]-not doing anything if the funcall name isn't any,some,all-any other checks are left to the type checking stage-(e.g. there can only be one expression in the expr2 part, and it must-be an array or subselect, etc)--> fixupTree :: Data a => a -> a-> fixupTree =-> transformBi $ \x ->-> case x of-> FunCall an op (expr1:FunCall _ nm expr2s:expr3s)-> | isOperatorName op && map toLower nm `elem` ["any", "some", "all"]-> -> LiftOperator an op flav (expr1:expr2s ++ expr3s)-> where flav = case (map toLower nm) of-> "any" -> LiftAny-> "some" -> LiftAny-> "all" -> LiftAll-> z -> error $ "internal error in parsing lift transform: " ++ z-> x1 -> x1
− Database/HsSqlPpp/PrettyPrinter/AnnotateSource.lhs
@@ -1,125 +0,0 @@-Copyright 2009 Jake Wheat--The purpose of this module is to add annotations in comments to the-original source code, so that we can preserve the original formatting-and comments.--A second goal will be to update these comments if they are already-present, so we can run this process repeatedly on a file and not fill-it with junk, or can e.g. make a few changes to the sql, run this-process, then use source control diff to view how the types, etc. have-changed.---Algorithm design--Get all the annotations ordered by source position. Split the original-text on these points, then zip it and output it.---> {- | Function to pretty print annotation information interspersed-> with original source file, so e.g. you can view types,-> etc. inline in the source whilst preserving the original-> formatting and comments. -}-> module Database.HsSqlPpp.PrettyPrinter.AnnotateSource-> (annotateSource) where--> import Data.List-> import Data.Maybe-> --import Debug.Trace--> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Ast.TypeChecker--> annotateSource :: Bool -> String -> StatementList -> String-> annotateSource doErrs src aast =--Details:--First need better syb so we can get two separate lists of annotations,-one for statements and one for non-statements. This will allow us to-output full information for each statement, but output reduced-information for other nodes - just want to output type error-annotations for now. (This could be made more general by allowing a-different kind of annotation pretty printer depending on the node-type, value or context?)--filter these two lists, mainly to strip all the annotations from the-non-statement annotation list except the source positions and the type-errors.--merge these two lists and sort by source position, then map to get-[(sourceposition, annotation without sourceposition)]--Now we have a list of sourcepositions that we can split the original source with:-0->firstsp, firstsp->secondsp, ... second last sp-> last sp, last sp -> eof--> this produces a [string] from the original source-use a zip:-zip splitSource $ ([]:map snd mungedAnnotationlist)-to get [(string,annotation)]-then do map second prettyPrint over this-to gives us a [(string,string)] which we can concatenate to produce-the output text.--To replace existing comments rather than repeatedly add them:-1) make sure the pretty printed comments have some marker--2) strip all the comments with this marker out after splitting the- string on the annotation source positions, i.e. when we get to- [(string,annotation)] or [(string,string)] stage.---> let allAnn = sortBy ordSps $ getStatementPosStringPairs ++ getTypeErrorPosPairs-> splitPoints = map ((\(SourcePos _ l _) -> l - 1) . fst) allAnn-> splitsSrc = splitAts src splitPoints-> anSrcPairs = zip splitsSrc $ map snd allAnn-> in concatMap (uncurry (++)) anSrcPairs-> -- make sure we get the last bit of the source code-> ++ last splitsSrc-> where-> ordSps :: (AnnotationElement,String) -> (AnnotationElement,String) -> Ordering-> ordSps a b = case (a,b) of-> ((SourcePos _ l c, _),(SourcePos _ l1 c1, _)) -> compare (l,c) (l1,c1)-> _ -> EQ-> getTypeErrorPosPairs :: [(AnnotationElement, String)]-> getTypeErrorPosPairs =-> if doErrs-> then map (\(a,b) -> (a,"\n/*ERROR:" ++ show b ++ "*/\n")) typeErrorsWithPositions-> else []-> where-> typeErrorsWithPositions = mapMaybe (\(a,b) -> case a of-> Nothing -> Nothing-> Just a1 -> Just (a1,b)) typeErrors-> typeErrors = getTypeErrors aast-> getStatementPosStringPairs :: [(AnnotationElement, String)]-> getStatementPosStringPairs =-> let statementAnnotations = map interestingAnn $ getStatementAnnotations aast-> split = mapMaybe (\l -> let notSp = filter (not.isSp) l-> in if notSp == []-> then Nothing-> else Just (find isSp l, notSp)) statementAnnotations-> splitsWithSps = mapMaybe (\(a,b) -> case a of-> Nothing -> Nothing-> Just a1 -> Just (a1,b)) split-> in map (\(a,b) -> (a, "\n/*" ++ show b ++ "*/\n")) splitsWithSps-> where-> interestingAnn anns =-> flip filter anns (\a ->-> case a of-> TypeAnnotation _ -> False-> EnvUpdates [] -> False-> _ -> True)--> isSp t = case t of-> SourcePos _ _ _ -> True-> _ -> False-> splitAts :: String -> [Int] -> [String]-> splitAts s splits =-> let slines = lines s-> --make sure we get from the last split to the end of the file-> splits1 = splits ++ [length slines]-> pairs :: [(Int,Int)]-> pairs = zip (0:splits) splits1-> in map (\(st,en) -> unlines $ take (en - st) $ drop st slines) pairs-
− Database/HsSqlPpp/PrettyPrinter/PrettyPrinter.lhs
@@ -1,684 +0,0 @@-Copyright 2009 Jake Wheat--The pretty printer which prints ast nodes from Ast.hs-It uses the hughes pj pretty printer--Produces sort of readable code, but mainly just written to produce-reparsable text. Could do with some work to make the outputted text-layout better.--Not much other comments, since it all should be pretty self evident.--> {- | Functions to convert sql asts to valid SQL source code. Includes-> a function - 'printSqlAnn' - to output the annotations from a tree-> in comments in the outputted SQL source.-> -}-> module Database.HsSqlPpp.PrettyPrinter.PrettyPrinter (-> --convert a sql ast to text-> printSql-> ,printSqlAnn-> --convert a single expression parse node to text-> ,printExpression-> )-> where--> import Text.PrettyPrint-> import Data.Maybe-> import Data.Char-> import Data.List--> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Ast.Environment-> import Database.HsSqlPpp.Utils--================================================================================--Public functions--> -- | convert an ast back to valid SQL source, it's also almost human readable.-> printSql :: StatementList -> String-> printSql = printSqlAnn (const "")--> -- | convert the ast back to valid source, and convert any annotations to-> -- text using the function provided and interpolate the output of this function-> -- (inside comments) with the SQL source.-> printSqlAnn :: (Annotation -> String) -> StatementList -> String-> printSqlAnn f ast = render $ vcat (map (convStatement f) ast) <> text "\n"--> -- | Testing function, pretty print an expression-> printExpression :: Expression -> String-> printExpression = render . convExp--================================================================================--Conversion routines - convert Sql asts into Docs-= Statements--> convStatement :: (Annotation -> String) -> Statement -> Doc--== selects--> convStatement ca (SelectStatement ann s) =-> convPa ca ann <+>-> convSelectExpression True True s <> statementEnd--== dml--> convStatement pa (Insert ann tb atts idata rt) =-> convPa pa ann <+>-> text "insert into" <+> text tb-> <+> ifNotEmpty (parens . hcatCsvMap text) atts-> $+$ convSelectExpression True True idata-> $+$ convReturning rt-> <> statementEnd--> convStatement ca (Update ann tb scs wh rt) =-> convPa ca ann <+>-> text "update" <+> text tb <+> text "set"-> <+> hcatCsvMap convSetClause scs-> <+> convWhere wh-> $+$ convReturning rt <> statementEnd-> where-> convSetClause (SetClause _ att ex) = text att <+> text "=" <+> convExp ex-> convSetClause (RowSetClause _ atts exs) =-> parens (hcatCsvMap text atts)-> <+> text "="-> <+> parens (hcatCsvMap convExp exs)--> convStatement ca (Delete ann tbl wh rt) =-> convPa ca ann <+>-> text "delete from" <+> text tbl-> <+> convWhere wh-> $+$ convReturning rt-> <> statementEnd--> convStatement ca (Truncate ann names ri casc) =-> convPa ca ann <+>-> text "truncate"-> <+> hcatCsvMap text names-> <+> text (case ri of-> RestartIdentity -> "restart identity"-> ContinueIdentity -> "continue identity")-> <+> convCasc casc-> <> statementEnd--== ddl--> convStatement ca (CreateTable ann tbl atts cns) =-> convPa ca ann <+>-> text "create table"-> <+> text tbl <+> lparen--> $+$ nest 2 (vcat (csv (map convAttDef atts ++ map convCon cns)))-> $+$ rparen <> statementEnd-> where-> convAttDef (AttributeDef _ n t def cons) =-> text n <+> convTypeName t-> <+> maybeConv (\e -> text "default" <+> convExp e) def-> <+> hsep (map (\e -> (case e of-> NullConstraint _ cn -> mname cn <+> text "null"-> NotNullConstraint _ cn -> mname cn <+> text "not null"-> RowCheckConstraint _ cn ew ->-> mname cn <+> text "check" <+> parens (convExp ew)-> RowUniqueConstraint _ cn -> mname cn <+> text "unique"-> RowPrimaryKeyConstraint _ cn -> mname cn <+> text "primary key"-> RowReferenceConstraint _ cn tb att ondel onupd ->-> mname cn <+>-> text "references" <+> text tb-> <+> maybeConv (parens . text) att-> <+> text "on delete" <+> convCasc ondel-> <+> text "on update" <+> convCasc onupd-> )) cons)--> convStatement ca (AlterTable ann name act) =-> convPa ca ann <+>-> text "alter table" <+> text name-> <+> hcatCsvMap convAct act <> statementEnd-> where-> convAct (AlterColumnDefault _ nm def) =-> text "alter column" <+> text nm <+> text "set default" <+> convExp def-> convAct (AddConstraint _ con) =-> text "add constraint" <+> convCon con--> convStatement ca (CreateSequence ann nm incr _ _ start cache) =-> convPa ca ann <+>-> text "create sequence" <+> text nm <+>-> text "increment" <+> text (show incr) <+>-> text "no minvalue" <+>-> text "no maxvalue" <+>-> text "start" <+> text (show start) <+>-> text "cache" <+> text (show cache) <> statementEnd--> convStatement ca (AlterSequence ann nm o) =-> convPa ca ann <+>-> text "alter sequence" <+> text nm-> <+> text "owned by" <+> text o <> statementEnd---> convStatement ca (CreateTableAs ann t sel) =-> convPa ca ann <+>-> text "create table"-> <+> text t <+> text "as"-> $+$ convSelectExpression True True sel-> <> statementEnd--> convStatement ca (CreateFunction ann name args retType lang qt body vol) =-> convPa ca ann <+>-> text "create function" <+> text name-> <+> parens (hcatCsvMap convParamDef args)-> <+> text "returns" <+> convTypeName retType <+> text "as" <+> text qt-> $+$ convFnBody body-> $+$ text qt <+> text "language"-> <+> text (case lang of-> Sql -> "sql"-> Plpgsql -> "plpgsql")-> <+> text (case vol of-> Volatile -> "volatile"-> Stable -> "stable"-> Immutable -> "immutable")-> <> statementEnd-> where-> convFnBody (SqlFnBody ann1 sts) =-> convPa ca ann1 <+>-> convNestedStatements ca sts-> convFnBody (PlpgsqlFnBody ann1 decls sts) =-> convPa ca ann1 <+>-> ifNotEmpty (\l -> text "declare"-> $+$ nest 2 (vcat $ map convVarDef l)) decls-> $+$ text "begin"-> $+$ convNestedStatements ca sts-> $+$ text "end;"-> convParamDef (ParamDef _ n t) = text n <+> convTypeName t-> convParamDef (ParamDefTp _ t) = convTypeName t-> convVarDef (VarDef _ n t v) =-> text n <+> convTypeName t-> <+> maybeConv (\x -> text ":=" <+> convExp x) v <> semi----> convStatement ca (CreateView ann name sel) =-> convPa ca ann <+>-> text "create view" <+> text name <+> text "as"-> $+$ nest 2 (convSelectExpression True True sel) <> statementEnd--> convStatement ca (CreateDomain ann name tp n ex) =-> convPa ca ann <+>-> text "create domain" <+> text name <+> text "as"-> <+> convTypeName tp <+> cname <+> checkExp ex <> statementEnd-> where-> checkExp = maybeConv (\e -> text "check" <+> parens (convExp e))-> cname = if n == ""-> then empty-> else text "constraint" <+> text n--> convStatement ca (DropFunction ann ifExists fns casc) =-> convPa ca ann <+>-> text "drop function"-> <+> convIfExists ifExists-> <+> hcatCsvMap doFunction fns-> <+> convCasc casc-> <> statementEnd-> where-> doFunction (name,types) = text name <> parens (hcatCsvMap convTypeName types)--> convStatement ca (DropSomething ann dropType ifExists names casc) =-> convPa ca ann <+>-> text "drop"-> <+> text (case dropType of-> Table -> "table"-> View -> "view"-> Domain -> "domain"-> Type -> "type")-> <+> convIfExists ifExists-> <+> hcatCsvMap text names-> <+> convCasc casc-> <> statementEnd--> convStatement ca (CreateType ann name atts) =-> convPa ca ann <+>-> text "create type" <+> text name <+> text "as" <+> lparen-> $+$ nest 2 (vcat (csv-> (map (\(TypeAttDef _ n t) -> text n <+> convTypeName t) atts)))-> $+$ rparen <> statementEnd--> convStatement ca (CreateLanguage ann name) =-> convPa ca ann <+>-> text "create language" <+> text name <> statementEnd--> convStatement ca (CreateTrigger ann name wh events tbl firing fnName fnArgs) =-> convPa ca ann <+>-> text "create trigger" <+> text name-> <+> text (case wh of-> TriggerBefore -> "before"-> TriggerAfter -> "after")-> <+> hcat (map text $ intersperse " or " $ map (\e -> case e of-> TInsert -> "insert"-> TUpdate -> "update"-> TDelete -> "delete") events)-> <+> text "on" <+> text tbl-> <+> text "for" <+> text (case firing of-> EachRow -> "row"-> EachStatement -> "statement")-> <+> text "execute procedure" <+> text fnName-> <> parens (hcatCsvMap convExp fnArgs) <> statementEnd--== plpgsql--> convStatement ca (NullStatement ann) = convPa ca ann <+> text "null" <> statementEnd--> convStatement ca (Assignment ann name val) =-> convPa ca ann <+>-> text name <+> text ":=" <+> convExp val <> statementEnd--> convStatement ca (Return ann ex) =-> convPa ca ann <+>-> text "return" <+> maybeConv convExp ex <> statementEnd--> convStatement ca (ReturnNext ann ex) =-> convPa ca ann <+>-> text "return" <+> text "next" <+> convExp ex <> statementEnd--> convStatement ca (ReturnQuery ann sel) =-> convPa ca ann <+>-> text "return" <+> text "query"-> <+> convSelectExpression True True sel <> statementEnd--> convStatement ca (Raise ann rt st exps) =-> convPa ca ann <+>-> text "raise"-> <+> case rt of-> RNotice -> text "notice"-> RException -> text "exception"-> RError -> text "error"-> <+> convExp (StringLit [] "'" st)-> <> ifNotEmpty (\e -> comma <+> csvExp e) exps-> <> statementEnd--> convStatement ca (ForSelectStatement ann i sel stmts) =-> convPa ca ann <+>-> text "for" <+> text i <+> text "in"-> <+> convSelectExpression True True sel <+> text "loop"-> $+$ convNestedStatements ca stmts-> $+$ text "end loop" <> statementEnd--> convStatement ca (ForIntegerStatement ann var st en stmts) =-> convPa ca ann <+>-> text "for" <+> text var <+> text "in"-> <+> convExp st <+> text ".." <+> convExp en <+> text "loop"-> $+$ convNestedStatements ca stmts-> $+$ text "end loop" <> statementEnd--> convStatement ca (WhileStatement ann ex stmts) =-> convPa ca ann <+>-> text "while" <+> convExp ex <+> text "loop"-> $+$ convNestedStatements ca stmts-> $+$ text "end loop" <> statementEnd--> convStatement ca (ContinueStatement ann) =-> convPa ca ann <+> text "continue" <> statementEnd--> convStatement ca (Perform ann f@(FunCall _ _ _)) =-> convPa ca ann <+>-> text "perform" <+> convExp f <> statementEnd-> convStatement _ (Perform _ x) =-> error $ "internal error: convStatement not supported for " ++ show x--> convStatement ca (Copy ann tb cols src) =-> convPa ca ann <+>-> text "copy" <+> text tb-> <+> ifNotEmpty (parens . hcatCsvMap text) cols-> <+> text "from" <+> case src of-> CopyFilename s -> quotes $ text s-> Stdin -> text "stdin"-> <> statementEnd--> convStatement ca (CopyData ann s) =-> convPa ca ann <+>-> text s <> text "\\." <> newline--> convStatement ca (If ann conds els) =-> convPa ca ann <+>-> text "if" <+> convCond (head conds)-> $+$ vcat (map (\c -> text "elseif" <+> convCond c) $ tail conds)-> $+$ ifNotEmpty (\e -> text "else" $+$ convNestedStatements ca e) els-> $+$ text "end if" <> statementEnd-> where-> convCond (ex, sts) = convExp ex <+> text "then"-> $+$ convNestedStatements ca sts-> convStatement ca (Execute ann s) =-> convPa ca ann <+>-> text "execute" <+> convExp s <> statementEnd--> convStatement ca (ExecuteInto ann s is) =-> convPa ca ann <+>-> text "execute" <+> convExp s-> <+> text "into" <+> hcatCsvMap text is-> <> statementEnd--> convStatement ca (CaseStatement ann c conds els) =-> convPa ca ann <+>-> text "case" <+> convExp c-> $+$ nest 2 (-> vcat (map (uncurry convWhenSt) conds)-> $+$ convElseSt els-> ) $+$ text "end case" <> statementEnd-> where-> convWhenSt ex sts = text "when" <+> hcatCsvMap convExp ex-> <+> text "then" $+$ convNestedStatements ca sts-> convElseSt = ifNotEmpty (\s -> text "else" $+$ convNestedStatements ca s)--== misc--> convStatement _ (Set _ n vs) =-> text "set" <+> text n <+> text "=" <+> hcatCsvMap (text . dv) vs <> statementEnd-> where-> dv (SetStr _ s) = "'" ++ s ++ "'"-> dv (SetId _ i) = i-> dv (SetNum _ nm) = show nm--> convStatement _ (Notify _ n) =-> text "notify" <+> text n <> statementEnd--> statementEnd :: Doc-> statementEnd = semi <> newline--================================================================================--= Statement components--== selects--> convSelectExpression :: Bool -> Bool -> SelectExpression -> Doc-> convSelectExpression writeSelect _ (Select _ dis l tb wh grp hav-> order lim off) =-> text (if writeSelect then "select" else "")-> <+> (case dis of-> Dupes -> empty-> Distinct -> text "distinct")-> <+> convSelList l-> $+$ nest 2 (-> (if null tb-> then empty-> else text "from" <+> hcatCsvMap convTref tb)-> $+$ convWhere wh)-> <+> ifNotEmpty (\g -> text "group by" <+> hcatCsvMap convExp g) grp-> <+> maybeConv (\h -> text "having" <+> convExp h) hav-> <+> ifNotEmpty (\o -> text "order by" <+> hcatCsvMap (\(oe,od) -> convExp oe-> <+> convDir od) o) order-> <+> maybeConv (\lm -> text "limit" <+> convExp lm) lim-> <+> maybeConv (\offs -> text "offset" <+> convExp offs) off-> where-> convTref (Tref _ f a) = text f <+> convTrefAlias a-> convTref (JoinedTref _ t1 nat jt t2 ex a) =-> parens (convTref t1-> $+$ (case nat of-> Natural -> text "natural"-> Unnatural -> empty)-> <+> text (case jt of-> Inner -> "inner"-> Cross -> "cross"-> LeftOuter -> "left outer"-> RightOuter -> "right outer"-> FullOuter -> "full outer")-> <+> text "join"-> <+> convTref t2-> <+> maybeConv (nest 2 . convJoinExpression) ex-> <+> convTrefAlias a)-> where-> convJoinExpression (JoinOn _ e) = text "on" <+> convExp e-> convJoinExpression (JoinUsing _ ids) =-> text "using" <+> parens (hcatCsvMap text ids)--> convTref (SubTref _ sub alias) =-> parens (convSelectExpression True True sub)-> <+> text "as" <+> convTrefAlias alias-> convTref (TrefFun _ f@(FunCall _ _ _) a) = convExp f <+> convTrefAlias a-> convTref (TrefFun _ x _) =-> error $ "internal error: node not supported in function tref: " ++ show x-> convTrefAlias NoAlias = empty-> convTrefAlias (TableAlias t) = text t-> convTrefAlias (FullAlias t s) = text t <+> parens (hcatCsvMap text s)--> convSelectExpression writeSelect topLev (CombineSelect _ tp s1 s2) =-> let p = convSelectExpression writeSelect False s1-> $+$ (case tp of-> Except -> text "except"-> Union -> text "union"-> UnionAll -> text "union" <+> text "all"-> Intersect -> text "intersect")-> $+$ convSelectExpression True False s2-> in if topLev then p else parens p-> convSelectExpression _ _ (Values _ expss) =-> text "values" $$ nest 2 (vcat $ csv $ map (parens . csvExp) expss)--> convDir :: Direction -> Doc-> convDir d = text $ case d of-> Asc -> "asc"-> Desc -> "desc"---> convWhere :: (Maybe Expression) -> Doc-> convWhere (Just ex) = text "where" <+> convExp ex-> convWhere Nothing = empty--> convSelList :: SelectList -> Doc-> convSelList (SelectList _ ex into) =-> hcatCsvMap convSelItem ex-> <+> ifNotEmpty (\i -> text "into" <+> hcatCsvMap text i) into-> where-> convSelItem (SelectItem _ ex1 nm) = convExp ex1 <+> text "as" <+> text nm-> convSelItem (SelExp _ e) = convExp e--> convCasc :: Cascade -> Doc-> convCasc casc = text $ case casc of-> Cascade -> "cascade"-> Restrict -> "restrict"--== ddl--> convCon :: Constraint -> Doc-> convCon (UniqueConstraint _ n c) =-> mname n <+> text "unique"-> <+> parens (hcatCsvMap text c)-> convCon (PrimaryKeyConstraint _ n p) =-> mname n <+>-> text "primary key"-> <+> parens (hcatCsvMap text p)-> convCon (CheckConstraint _ n c) = mname n <+> text "check" <+> parens (convExp c)-> convCon (ReferenceConstraint _ n at tb rat ondel onupd) =-> mname n <+>-> text "foreign key" <+> parens (hcatCsvMap text at)-> <+> text "references" <+> text tb-> <+> ifNotEmpty (parens . hcatCsvMap text) rat-> <+> text "on update" <+> convCasc onupd-> <+> text "on delete" <+> convCasc ondel--> mname :: String -> Doc-> mname n = if n == ""-> then empty-> else text "constraint" <+> text n---> convReturning :: Maybe SelectList -> Doc-> convReturning l = case l of-> Nothing -> empty-> Just ls -> nest 2 (text "returning" <+> convSelList ls)--> convIfExists :: IfExists -> Doc-> convIfExists i = case i of-> Require -> empty-> IfExists -> text "if exists"--== plpgsql--> convNestedStatements :: (Annotation -> String) -> StatementList -> Doc-> convNestedStatements pa = nest 2 . vcat . map (convStatement pa)--> convTypeName :: TypeName -> Doc-> convTypeName (SimpleTypeName _ s) = text s-> convTypeName (PrecTypeName _ s i) = text s <> parens(integer i)-> convTypeName (ArrayTypeName _ t) = convTypeName t <> text "[]"-> convTypeName (SetOfTypeName _ t) = text "setof" <+> convTypeName t--= Expressions--> convExp :: Expression -> Doc-> convExp (Identifier _ i) =-> if quotesNeeded-> then text $ "\"" ++ i ++ "\""-> else text i-> where-> --needs some work - quotes needed if contains invalid unquoted-> --chars, or maybe if matches keyword or similar-> quotesNeeded = case i of-> x:_ | not (isLetter x || x `elem` "_*") -> True-> _ | all okChar i -> False-> | otherwise -> True-> where-> okChar x =isAlphaNum x || x `elem` "*_."-> convExp (IntegerLit _ n) = integer n-> convExp (FloatLit _ n) = double n-> convExp (StringLit _ tag s) = text tag <> text replaceQuotes <> text tag-> where-> replaceQuotes = if tag == "'"-> then replace "'" "''" s-> else s--> convExp (FunCall _ n es) =-> --check for special operators-> case n of-> "!arrayctor" -> text "array" <> brackets (csvExp es)-> "!between" -> convExp (head es) <+> text "between"-> <+> parens (convExp (es !! 1))-> <+> text "and"-> <+> parens (convExp (es !! 2))-> "!substring" -> text "substring"-> <> parens (convExp (head es)-> <+> text "from" <+> convExp (es !! 1)-> <+> text "for" <+> convExp (es !! 2))-> "!arraysub" -> case es of-> ((Identifier _ i):es1) -> text i <> brackets (csvExp es1)-> _ -> parens (convExp (head es)) <> brackets (csvExp (tail es))-> "!rowctor" -> text "row" <> parens (hcatCsvMap convExp es)-> _ | isOperatorName n ->-> case getOperatorType defaultTemplate1Environment n of-> BinaryOp ->-> parens (convExp (head es)-> <+> text (filterKeyword n)-> <+> convExp (es !! 1))-> PrefixOp -> parens (text (if n == "u-"-> then "-"-> else filterKeyword n)-> <+> parens (convExp (head es)))-> PostfixOp -> parens (convExp (head es) <+> text (filterKeyword n))-> | otherwise -> text n <> parens (csvExp es)-> where-> filterKeyword t = case t of-> "!and" -> "and"-> "!or" -> "or"-> "!not" -> "not"-> "!isnull" -> "is null"-> "!isnotnull" -> "is not null"-> "!like" -> "like"-> x -> x--> convExp (BooleanLit _ b) = bool b-> convExp (InPredicate _ att t lst) =-> convExp att <+> (if not t then text "not" else empty) <+> text "in"-> <+> parens (case lst of-> InList _ expr -> csvExp expr-> InSelect _ sel -> convSelectExpression True True sel)-> convExp (LiftOperator _ op flav args) =-> convExp (head args) <+> text op-> <+> text (case flav of-> LiftAny -> "any"-> LiftAll -> "all")-> <+> parens (convExp $ head $ tail args)-> convExp (ScalarSubQuery _ s) = parens (convSelectExpression True True s)-> convExp (NullLit _) = text "null"-> convExp (WindowFn _ fn part order asc frm) =-> convExp fn <+> text "over"-> <+> (if hp || ho-> then-> parens ((if hp-> then text "partition by" <+> csvExp part-> else empty)-> <+> (if ho-> then text "order by" <+> csvExp order-> <+> convDir asc-> else empty)-> <+> convFrm)-> else empty)-> where-> hp = not (null part)-> ho = not (null order)-> convFrm = case frm of-> FrameUnboundedPreceding -> text "range unbounded preceding"-> FrameUnboundedFull -> text "range between unbounded preceding and unbounded following"-> FrameRowsUnboundedPreceding -> text "rows unbounded preceding"--> convExp (Case _ whens els) =-> text "case"-> $+$ nest 2 (vcat (map convWhen whens)-> $+$ maybeConv (\e -> text "else" <+> convExp e) els)-> $+$ text "end"-> where-> convWhen (ex1, ex2) =-> text "when" <+> hcatCsvMap convExp ex1-> <+> text "then" <+> convExp ex2--> convExp (CaseSimple _ val whens els) =-> text "case" <+> convExp val-> $+$ nest 2 (vcat (map convWhen whens)-> $+$ maybeConv (\e -> text "else" <+> convExp e) els)-> $+$ text "end"-> where-> convWhen (ex1, ex2) =-> text "when" <+> hcatCsvMap convExp ex1-> <+> text "then" <+> convExp ex2--> convExp (PositionalArg _ a) = text "$" <> integer a-> convExp (Placeholder _) = text "?"-> convExp (Exists _ s) = text "exists" <+> parens (convSelectExpression True True s)-> convExp (Cast _ ex t) = text "cast" <> parens (convExp ex-> <+> text "as"-> <+> convTypeName t)--= Utils--convert a list of expressions to horizontal csv--> csvExp :: [Expression] -> Doc-> csvExp = hcatCsvMap convExp--> maybeConv :: (t -> Doc) -> Maybe t -> Doc-> maybeConv f c =-> case c of-> Nothing -> empty-> Just a -> f a--> csv :: [Doc] -> [Doc]-> csv = punctuate comma--> hcatCsv :: [Doc] -> Doc-> hcatCsv = hcat . csv--> ifNotEmpty :: ([a] -> Doc) -> [a] -> Doc-> ifNotEmpty c l = if null l then empty else c l--> hcatCsvMap :: (a -> Doc) -> [a] -> Doc-> hcatCsvMap ex = hcatCsv . map ex--> bool :: Bool -> Doc-> bool b = if b then text "true" else text "false"--> newline :: Doc-> newline = text "\n"--> convPa :: (Annotation -> String) -> Annotation -> Doc-> convPa ca a = let s = ca a-> in if s == ""-> then empty-> else text "/*\n" <+> text s-> <+> text "*/\n"
− Database/HsSqlPpp/Tests/DatabaseLoaderTests.lhs
@@ -1,33 +0,0 @@-Copyright 2009 Jake Wheat--TODO: the point of these tests will be to check the line and column-mapping from parsed and pretty printed sql back to the original source-text.-Will be revived when the DatabaseLoader code is being worked on again.--> module Database.HsSqlPpp.Tests.DatabaseLoaderTests (databaseLoaderTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit--> import Database.HsSqlPpp.Dbms.DatabaseLoader--> databaseLoaderTests :: Test.Framework.Test-> databaseLoaderTests = testGroup "databaseLoaderTests" [] {-testGroup "databaseLoaderTests" [-> t "execute: PGRES_FATAL_ERROR: ERROR: column \"object_name\" of relation \"system_implementation_objects\" does not exist\n\-> \LINE 1: insert into system_implementation_objects (object_name,objec...\n\-> \ ^\n"-> 0 1 --0 should be 43--> ,t "execute: PGRES_FATAL_ERROR: ERROR: column \"x\" does not exist\n\-> \LINE 3: (x,'base_relvar')\n\-> \ ^\n"-> 0 3---> ]-> where-> t et l c = testCase et $ do-> let (rl, rc) = getLineAndColumnFromErrorText et-> assertEqual "" (l,c) (rl,rc)-}
− Database/HsSqlPpp/Tests/ExtensionTests.lhs
@@ -1,182 +0,0 @@-Copyright 2009 Jake Wheat--Set of tests for the extensions--> {-# LANGUAGE RankNTypes,FlexibleContexts #-}--> module Database.HsSqlPpp.Tests.ExtensionTests (extensionTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Data.Char-> import Control.Monad.Error-> --import Debug.Trace--> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Extensions.ChaosExtensions-> import Database.HsSqlPpp.Ast.Ast-> --import Database.HsSqlPpp.PrettyPrinter.PrettyPrinter--> extensionTests :: Test.Framework.Test-> extensionTests =-> testGroup "extensionTests" (mapCheckExtension [-> t rewriteCreateVars-> "select create_var('varname','vartype');"-> "create table varname_table (\n\-> \ varname vartype);\n\-> \create function get_varname() returns vartype as $a$\n\-> \ select * from varname_table;\n\-> \$a$ language sql stable;\n\-> \create function check_con_varname_table_varname_key() returns boolean as $a$\n\-> \begin\n\-> \ return true;\n\-> \end;\n\-> \$a$ language plpgsql stable;\n\-> \/*drop function if exists varname_table_constraint_trigger_operator();\n\-> \create function varname_table_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;*/\n\-> \create function check_con_varname_table_01_tuple() returns boolean as $a$\n\-> \begin\n\-> \ return true;\n\-> \end;\n\-> \$a$ language plpgsql stable;\n\-> \drop function if exists varname_table_constraint_trigger_operator();\n\-> \create function varname_table_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;"--> ,t addReadonlyTriggers-> "select set_relvar_type('stuff','readonly');"-> "create function check_stuff_d_readonly() returns trigger as $a$\n\-> \begin\n\-> \ if (not (false)) then\n\-> \ raise exception 'delete on base_relvar_metadata violates transition constraint base_relvar_metadata_d_readonly';\n\-> \ end if;\n\-> \return null;\n\-> \end;\n\-> \$a$ language plpgsql volatile;\n\-> \create function check_stuff_i_readonly() returns trigger as $a$\n\-> \begin\n\-> \ if (not (false)) then\n\-> \ raise exception 'delete on base_relvar_metadata violates transition constraint base_relvar_metadata_d_readonly';\n\-> \ end if;\n\-> \ return null;\n\-> \end;\n\-> \$a$ language plpgsql volatile;\n\-> \create function check_stuff_u_readonly() returns trigger as $a$\n\-> \begin\n\-> \ if (not (false)) then\n\-> \ raise exception 'delete on base_relvar_metadata violates transition constraint base_relvar_metadata_d_readonly';\n\-> \ end if;\n\-> \ return null;\n\-> \end;\n\-> \$a$ language plpgsql volatile;"--> ,t createClientActionWrapper-> "select create_client_action_wrapper('actname', $$actcall()$$);"-> "create function action_actname() returns void as $a$\n\-> \begin\n\-> \ perform action_actcall();\n\-> \end;\n\-> \$a$ language plpgsql;"-> ,t createClientActionWrapper-> "select create_client_action_wrapper('actname', $$actcall('test')$$);"-> "create function action_actname() returns void as $a$\n\-> \begin\n\-> \ perform action_actcall('test');\n\-> \end;\n\-> \$a$ language plpgsql;"-> ,t addNotifyTriggers-> "select set_relvar_type('stuff','data');"-> "create function stuff_changed() returns trigger as $a$\n\-> \begin\n\-> \ notify stuff;\n\-> \ return null;\n\-> \end;\n\-> \$a$ language plpgsql;"-> ,t addConstraint-> "select add_constraint('name', 'true', array['t1', 't2']);"-> "create function check_con_name() returns boolean as $a$\n\-> \begin\n\-> \ return true;\n\-> \end;\n\-> \$a$ language plpgsql stable;\n\-> \drop function if exists t1_constraint_trigger_operator();\n\-> \create function t1_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;\n\-> \drop function if exists t2_constraint_trigger_operator();\n\-> \create function t2_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;"-> ,t addKey-> "select add_key('tbl', 'attr');"-> "create function check_con_tbl_attr_key() returns boolean as $a$\n\-> \begin\n\-> \ return true;\n\-> \end;\n\-> \$a$ language plpgsql stable;\n\-> \/*drop function if exists tbl_constraint_trigger_operator();\n\-> \create function tbl_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;*/"-> ,t addKey-> "select add_key('tbl', array['attr1','attr2']);"-> "create function check_con_tbl_attr1_attr2_key() returns boolean as $a$\n\-> \begin\n\-> \ return true;\n\-> \end;\n\-> \$a$ language plpgsql stable;\n\-> \/*drop function if exists tbl_constraint_trigger_operator();\n\-> \create function tbl_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;*/"-> ,t zeroOneTuple-> "select constrain_to_zero_or_one_tuple('tbl');"-> "create function check_con_tbl_01_tuple() returns boolean as $a$\n\-> \begin\n\-> \ return true;\n\-> \end;\n\-> \$a$ language plpgsql stable;\n\-> \drop function if exists tbl_constraint_trigger_operator();\n\-> \create function tbl_constraint_trigger_operator() returns trigger as $a$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$a$ language plpgsql;"---add_foreign_key-constrain zero one-add constraint--> ])--> where-> t a b c = (a,b,c)-> mapCheckExtension = map (\(a,b,c) -> checkExtension a b c)-> checkExtension :: (StatementList -> StatementList) -> String -> String -> Test.Framework.Test-> checkExtension f stxt ttxt = testCase ("check " ++ stxt) $-> case (do-> sast <- parseSql "" stxt-> let esast = f sast-> --trace (printSql esast) $ return ()-> tast <- parseSql "" ttxt-> return (tast,esast)) of-> Left e -> assertFailure $ show e-> Right (ts,es) -> assertEqual "" (stripAnnotations ts) (stripAnnotations es)
− Database/HsSqlPpp/Tests/ParameterizedStatementTests.lhs
@@ -1,76 +0,0 @@-Copyright 2010 Jake Wheat--Tests for the infrastructure to create type safe access to databases --the information needed is gathered during typechecking and exposed-in the StatementType annotation.--> module Database.HsSqlPpp.Tests.ParameterizedStatementTests (parameterizedStatementTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Data.Char--> import Database.HsSqlPpp.Ast.SqlTypes-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.Ast.TypeChecker-> import Database.HsSqlPpp.Ast.Environment--> data Item = Group String [Item]-> | Statements [(String, [EnvironmentUpdate], StatementType)]--> parameterizedStatementTests :: [Test.Framework.Test]-> parameterizedStatementTests = itemToTft testData--> testData :: Item-> testData =-> Group "parameterized statement tests" [-> Group "simple selects" [ Statements [-> ("select test();"-> ,[EnvCreateFunction FunName "test" [] (Pseudo Void) False]-> ,StatementType [] [])-> ,("select adnum,adbin from pg_attrdef;"-> ,[]-> ,StatementType [] [("adnum", ScalarType "int2")-> ,("adbin", ScalarType "text")])]-> ]-> ,Group "simple fn calls" [ Statements [-> ("select test($1);"-> ,[EnvCreateFunction FunName "test" [ScalarType "int4"] (ScalarType "text") False]-> ,StatementType [ScalarType "int4"] [("test",ScalarType "text")])-> ,("select test(?);"-> ,[EnvCreateFunction FunName "test" [ScalarType "int4"] (ScalarType "text") False]-> ,StatementType [ScalarType "int4"] [("test",ScalarType "text")])-> ]-> ]-> ]--select a,b from c where d=e group by f having g=h orderby i limit j offset k;-select function(a,b);-insert into a (b,c) values (d,e) returning f,g-update a set b=c,d=e where f=g returning h,i-delete from t where a=b returning c,d--> testStatementType :: String -> [EnvironmentUpdate] -> StatementType -> Test.Framework.Test-> testStatementType src eu st = testCase ("typecheck " ++ src) $-> let ast = case parseSql "" src of-> Left e -> error $ show e-> Right l -> l-> in case typeCheckPS makeEnv (head ast) of-> Left e -> error $ show e-> Right aast -> let is = getTopLevelInfos [aast]-> er = concatMap snd $ getTypeErrors [aast]-> in case is of-> _ | not (null er) -> assertFailure $ show er-> [Just is1] -> assertEqual ("typecheck " ++ src) st is1-> _ -> assertFailure ("expected onne statementinfo, got " ++ show is)-> where-> makeEnv = case updateEnvironment defaultTemplate1Environment eu of-> Left x -> error $ show x-> Right e -> e--> itemToTft :: Item -> [Test.Framework.Test]-> itemToTft (Statements es) = map (\(a,b,c) -> testStatementType a b c) es-> itemToTft (Group s is) = [testGroup s $ concatMap itemToTft is]-
− Database/HsSqlPpp/Tests/ParserTests.lhs
@@ -1,1260 +0,0 @@-Copyright 2009 Jake Wheat--The automated tests, uses hunit to check a bunch of text expressions-and sql statements parse to the correct tree, and then checks pretty-printing and then reparsing gives the same tree. The code was mostly-written in a tdd style, which the coverage of the tests reflects.--There are no tests for invalid sql at the moment.--temporarily disabled because of haddock issue:-{-# LANGUAGE QuasiQuotes #-}--> module Database.HsSqlPpp.Tests.ParserTests (parserTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Data.Char-> import Data.Generics--> -- import Database.HsSqlPpp.Here--> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.PrettyPrinter.PrettyPrinter---> data Item = Expressions [(String, Expression)]-> | Statements [(String, [Statement])]-> | PlpgsqlStatements [(String, [Statement])]-> | Group String [Item]--> parserTests :: [Test.Framework.Test]-> parserTests = itemToTft parserTestData--> parserTestData :: Item-> parserTestData =-> Group "parserTests" [--================================================================================--expressions--> Group "parse expressions" [-> Group "basic expressions" [Expressions [-> p "1" (IntegerLit [] 1)-> ,p "-1" (FunCall [] "u-" [IntegerLit [] 1])-> ,p "1.1" (FloatLit [] 1.1)-> ,p "-1.1" (FunCall [] "u-" [FloatLit [] 1.1])-> ,p " 1 + 1 " (FunCall [] "+" [IntegerLit [] 1-> ,IntegerLit [] 1])-> ,p "1+1+1" (FunCall [] "+" [FunCall [] "+" [IntegerLit [] 1-> ,IntegerLit [] 1]-> ,IntegerLit [] 1])-> ]]---> ,Group "parens" [Expressions [--check some basic parens use wrt naked values and row constructors-these tests reflect how pg seems to interpret the variants.--> p "(1)" (IntegerLit [] 1)-> ,p "row ()" (FunCall [] "!rowctor" [])-> ,p "row (1)" (FunCall [] "!rowctor" [IntegerLit [] 1])-> ,p "row (1,2)" (FunCall [] "!rowctor" [IntegerLit [] 1,IntegerLit [] 2])-> ,p "(1,2)" (FunCall [] "!rowctor" [IntegerLit [] 1,IntegerLit [] 2])-> ]]--> ,Group "more basic expressions" [Expressions [--test some more really basic expressions--> p "'test'" (stringQ "test")-> ,p "''" (stringQ "")-> ,p "hello" (Identifier [] "hello")-> ,p "helloTest" (Identifier [] "helloTest")-> ,p "hello_test" (Identifier [] "hello_test")-> ,p "\"this is an identifier\"" (Identifier [] "this is an identifier")-> ,p "hello1234" (Identifier [] "hello1234")-> ,p "true" (BooleanLit [] True)-> ,p "false" (BooleanLit [] False)-> ,p "null" (NullLit [])-> ]]--> ,Group "array ctor and selector" [Expressions [-> p "array[1,2]" (FunCall [] "!arrayctor" [IntegerLit [] 1, IntegerLit [] 2])-> ,p "a[1]" (FunCall [] "!arraysub" [Identifier [] "a", IntegerLit [] 1])--> ]]--> ,Group "simple operators" [Expressions [-> p "1 + tst1" (FunCall [] "+" [IntegerLit [] 1-> ,Identifier [] "tst1"])-> ,p "tst1 + 1" (FunCall [] "+" [Identifier [] "tst1"-> ,IntegerLit [] 1])-> ,p "tst + tst1" (FunCall [] "+" [Identifier [] "tst"-> ,Identifier [] "tst1"])-> ,p "'a' || 'b'" (FunCall [] "||" [stringQ "a"-> ,stringQ "b"])-> ,p "'stuff'::text" (Cast [] (stringQ "stuff") (SimpleTypeName [] "text"))-> ,p "245::float(24)" (Cast [] (IntegerLit [] 245) (PrecTypeName [] "float" 24))--> ,p "245::double precision" (Cast [] (IntegerLit [] 245) (SimpleTypeName [] "double precision"))--> ,p "a between 1 and 3"-> (FunCall [] "!between" [Identifier [] "a", IntegerLit [] 1, IntegerLit [] 3])-> ,p "cast(a as text)"-> (Cast [] (Identifier [] "a") (SimpleTypeName [] "text"))-> ,p "@ a"-> (FunCall [] "@" [Identifier [] "a"])--> ,p "substring(a from 0 for 3)"-> (FunCall [] "!substring" [Identifier [] "a", IntegerLit [] 0, IntegerLit [] 3])--> ,p "substring(a from 0 for (5 - 3))"-> (FunCall [] "!substring" [Identifier [] "a",IntegerLit [] 0,-> FunCall [] "-" [IntegerLit [] 5,IntegerLit [] 3]])-> ,p "a like b"-> (FunCall [] "!like" [Identifier [] "a", Identifier [] "b"])-> ]]--> ,Group "function calls" [Expressions [-> p "fn()" (FunCall [] "fn" [])-> ,p "fn(1)" (FunCall [] "fn" [IntegerLit [] 1])-> ,p "fn('test')" (FunCall [] "fn" [stringQ "test"])-> ,p "fn(1,'test')" (FunCall [] "fn" [IntegerLit [] 1, stringQ "test"])-> ,p "fn('test')" (FunCall [] "fn" [stringQ "test"])-> ]]--> ,Group "simple whitespace sanity checks" [Expressions [-> p "fn (1)" (FunCall [] "fn" [IntegerLit [] 1])-> ,p "fn( 1)" (FunCall [] "fn" [IntegerLit [] 1])-> ,p "fn(1 )" (FunCall [] "fn" [IntegerLit [] 1])-> ,p "fn(1) " (FunCall [] "fn" [IntegerLit [] 1])--> ]]--> ,Group "null stuff" [Expressions [-> p "not null" (FunCall [] "!not" [NullLit []])-> ,p "a is null" (FunCall [] "!isnull" [Identifier [] "a"])-> ,p "a is not null" (FunCall [] "!isnotnull" [Identifier [] "a"])--> ,p "not not true" (FunCall [] "!not"-> [FunCall [] "!not"-> [BooleanLit [] True]])-> ]]--> ,Group "case expressions" [Expressions [-> p -- [$here|-> "case when a,b then 3\n\-> \ when c then 4\n\-> \ else 5\n\-> \end"-> -- |]-> (Case [] [([Identifier [] "a", Identifier [] "b"], IntegerLit [] 3)-> ,([Identifier [] "c"], IntegerLit [] 4)]-> (Just $ IntegerLit [] 5))--> ,p "case 1 when 2 then 3 else 4 end"-> (CaseSimple [] (IntegerLit [] 1)-> [([IntegerLit [] 2], IntegerLit [] 3)]-> (Just $ IntegerLit [] 4))-> ]]--> ,Group "positional args" [Expressions [-> p "$1" (PositionalArg [] 1)-> ,p "?" (Placeholder [])-> ,p "a = ?" (FunCall [] "=" [Identifier [] "a",Placeholder []])-> ]]--> ,Group "exists" [Expressions [-> p "exists (select 1 from a)"-> (Exists [] (selectFrom [SelExp [] (IntegerLit [] 1)] (Tref [] "a" NoAlias)))-> ]]--> ,Group "in variants" [Expressions [-> p "t in (1,2)"-> (InPredicate [] (Identifier [] "t") True (InList [] [IntegerLit [] 1,IntegerLit [] 2]))-> ,p "t not in (1,2)"-> (InPredicate [] (Identifier [] "t") False (InList [] [IntegerLit [] 1,IntegerLit [] 2]))-> ,p "(t,u) in (1,2)"-> (InPredicate [] (FunCall [] "!rowctor" [Identifier [] "t",Identifier [] "u"]) True-> (InList [] [IntegerLit [] 1,IntegerLit [] 2]))-> ,p "3 = any (array[1,2])"-> (LiftOperator [] "=" LiftAny [IntegerLit [] 3-> ,FunCall [] "!arrayctor" [IntegerLit [] 1-> ,IntegerLit [] 2]])-> ,p "3 = all (array[1,2,4])"-> (LiftOperator [] "=" LiftAll [IntegerLit [] 3-> ,FunCall [] "!arrayctor" [IntegerLit [] 1-> ,IntegerLit [] 2-> ,IntegerLit [] 4]])-> ]]--> ,Group "comparison operators" [Expressions [-> p "a < b"-> (FunCall [] "<" [Identifier [] "a", Identifier [] "b"])-> ,p "a <> b"-> (FunCall [] "<>" [Identifier [] "a", Identifier [] "b"])-> ,p "a != b"-> (FunCall [] "<>" [Identifier [] "a", Identifier [] "b"])-> ]]--test some string parsing, want to check single quote behaviour,-and dollar quoting, including nesting.--> ,Group "string parsing" [Expressions [-> p "''" (stringQ "")-> ,p "''''" (stringQ "'")-> ,p "'test'''" (stringQ "test'")-> ,p "'''test'" (stringQ "'test")-> ,p "'te''st'" (stringQ "te'st")-> ,p "$$test$$" (StringLit [] "$$" "test")-> ,p "$$te'st$$" (StringLit [] "$$" "te'st")-> ,p "$st$test$st$" (StringLit [] "$st$" "test")-> ,p "$outer$te$$yup$$st$outer$" (StringLit [] "$outer$" "te$$yup$$st")-> ,p "'spl$$it'" (stringQ "spl$$it")-> ]]-> ]--================================================================================--select statements--> ,Group "simple select statements" [-> Group "select no table" [Statements [-> p "select 1;" [SelectStatement [] $ selectE (SelectList [] [SelExp [] (IntegerLit [] 1)] [])]-> ]]-> ,Group "select from table" [Statements [-> p "select * from tbl;"-> [SelectStatement [] $ selectFrom (selIL ["*"]) (Tref [] "tbl" NoAlias)]-> ,p "select a,b from tbl;"-> [SelectStatement [] $ selectFrom (selIL ["a", "b"]) (Tref [] "tbl" NoAlias)]--> ,p "select a,b from inf.tbl;"-> [SelectStatement [] $ selectFrom (selIL ["a", "b"]) (Tref [] "inf.tbl" NoAlias)]--> ,p "select distinct * from tbl;"-> [SelectStatement [] $ Select [] Distinct (SelectList [] (selIL ["*"]) []) [Tref [] "tbl" NoAlias]-> Nothing [] Nothing [] Nothing Nothing]--> ,p "select a from tbl where b=2;"-> [SelectStatement [] $ selectFromWhere-> (selIL ["a"])-> (Tref [] "tbl" NoAlias)-> (FunCall [] "="-> [Identifier [] "b", IntegerLit [] 2])]-> ,p "select a from tbl where b=2 and c=3;"-> [SelectStatement [] $ selectFromWhere-> (selIL ["a"])-> (Tref [] "tbl" NoAlias)-> (FunCall [] "!and"-> [FunCall [] "=" [Identifier [] "b", IntegerLit [] 2]-> ,FunCall [] "=" [Identifier [] "c", IntegerLit [] 3]])]--> ]]--> ,Group "more select statements" [Statements [-> p "select a from tbl\n\-> \except\n\-> \select a from tbl1;"-> [SelectStatement [] $ CombineSelect [] Except-> (selectFrom (selIL ["a"]) (Tref [] "tbl" NoAlias))-> (selectFrom (selIL ["a"]) (Tref [] "tbl1" NoAlias))]-> ,p "select a from tbl where true\n\-> \except\n\-> \select a from tbl1 where true;"-> [SelectStatement [] $ CombineSelect [] Except-> (selectFromWhere (selIL ["a"]) (Tref [] "tbl" NoAlias) (BooleanLit [] True))-> (selectFromWhere (selIL ["a"]) (Tref [] "tbl1" NoAlias) (BooleanLit [] True))]-> ,p "select a from tbl\n\-> \union\n\-> \select a from tbl1;"-> [SelectStatement [] $ CombineSelect [] Union-> (selectFrom (selIL ["a"]) (Tref [] "tbl" NoAlias))-> (selectFrom (selIL ["a"]) (Tref [] "tbl1" NoAlias))]-> ,p "select a from tbl\n\-> \union all\n\-> \select a from tbl1;"-> [SelectStatement [] $ CombineSelect [] UnionAll-> (selectFrom (selIL ["a"]) (Tref [] "tbl" NoAlias))-> (selectFrom (selIL ["a"]) (Tref [] "tbl1" NoAlias))]--> ,p "(select 1 union select 2) union select 3;"-> [SelectStatement []-> (CombineSelect [] Union-> (CombineSelect [] Union-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 1)] []))-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 2)] [])))-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 3)] [])))]--> ,p "select 1 union (select 2 union select 3);"-> [SelectStatement []-> (CombineSelect [] Union-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 1)] []))-> (CombineSelect [] Union-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 2)] []))-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 3)] []))))]--> ,p "select a as b from tbl;"-> [SelectStatement [] $ selectFrom [SelectItem [] (Identifier [] "a") "b"] (Tref [] "tbl" NoAlias)]-> ,p "select a + b as b from tbl;"-> [SelectStatement [] $ selectFrom-> [SelectItem []-> (FunCall [] "+"-> [Identifier [] "a", Identifier [] "b"]) "b"]-> (Tref [] "tbl" NoAlias)]-> ,p "select a.* from tbl a;"-> [SelectStatement [] $ selectFrom (selIL ["a.*"]) (Tref [] "tbl" (TableAlias "a"))]--> ,p "select a.* from tbl a(b,c);"-> [SelectStatement [] $ selectFrom (selIL ["a.*"]) (Tref [] "tbl" (FullAlias "a" ["b","c"]))]--> ,p "select * from t1 a, t2 b;"-> [SelectStatement []-> (Select [] Dupes-> (SelectList []-> [SelExp [] (Identifier [] "*")] [])-> [Tref [] "t1" (TableAlias "a"),Tref [] "t2" (TableAlias "b")]-> Nothing [] Nothing [] Nothing Nothing)]-> ,p "select a from b inner join c on b.a=c.a;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural Inner (Tref [] "c" NoAlias)-> (Just (JoinOn []-> (FunCall [] "=" [Identifier [] "b.a", Identifier [] "c.a"]))) NoAlias)]-> ,p "select a from b inner join c as d on b.a=d.a;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural Inner (Tref [] "c" (TableAlias "d"))-> (Just (JoinOn []-> (FunCall [] "=" [Identifier [] "b.a", Identifier [] "d.a"]))) NoAlias)]--> ,p "select a from b inner join c using(d,e);"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural Inner (Tref [] "c" NoAlias)-> (Just (JoinUsing [] ["d","e"])) NoAlias)]--> ,p "select a from b natural inner join c;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Natural Inner (Tref [] "c" NoAlias) Nothing NoAlias)]-> ,p "select a from b left outer join c;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural LeftOuter (Tref [] "c" NoAlias) Nothing NoAlias)]-> ,p "select a from b full outer join c;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural FullOuter (Tref [] "c" NoAlias) Nothing NoAlias)]-> ,p "select a from b right outer join c;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural RightOuter (Tref [] "c" NoAlias) Nothing NoAlias)]-> ,p "select a from b cross join c;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural Cross (Tref [] "c" NoAlias) Nothing NoAlias)]--> ,p "select a from (b natural join c);"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (JoinedTref [] (Tref [] "b" NoAlias) Natural Inner (Tref [] "c" NoAlias) Nothing NoAlias)]--> ,p "select x from ((a cross join b) cross join c);"-> [SelectStatement []-> (selectFrom (selIL ["x"])-> (JoinedTref []-> (JoinedTref []-> (Tref [] "a" NoAlias)-> Unnatural Cross-> (Tref [] "b" NoAlias)-> Nothing NoAlias)-> Unnatural Cross-> (Tref [] "c" NoAlias)-> Nothing NoAlias))]--> ,p "select x from (a cross join (b cross join c));"-> [SelectStatement []-> (selectFrom (selIL ["x"])-> (JoinedTref []-> (Tref [] "a" NoAlias)-> Unnatural Cross-> (JoinedTref []-> (Tref [] "b" NoAlias)-> Unnatural Cross-> (Tref [] "c" NoAlias)-> Nothing NoAlias)-> Nothing NoAlias))]--> ,p "select x from ((a cross join b) cross join c);"-> [SelectStatement []-> (selectFrom (selIL ["x"])-> (JoinedTref []-> (JoinedTref []-> (Tref [] "a" NoAlias)-> Unnatural Cross-> (Tref [] "b" NoAlias)-> Nothing NoAlias)-> Unnatural Cross-> (Tref [] "c" NoAlias)-> Nothing NoAlias))]--> ,p "select x from (a cross join b) cross join c;"-> [SelectStatement []-> (selectFrom (selIL ["x"])-> (JoinedTref []-> (JoinedTref []-> (Tref [] "a" NoAlias)-> Unnatural Cross-> (Tref [] "b" NoAlias)-> Nothing NoAlias)-> Unnatural Cross-> (Tref [] "c" NoAlias)-> Nothing NoAlias))]--> ,p "select x from ((a cross join b) cross join c) cross join d;"-> [SelectStatement []-> (selectFrom (selIL ["x"])-> (JoinedTref []-> (JoinedTref []-> (JoinedTref []-> (Tref [] "a" NoAlias)-> Unnatural Cross-> (Tref [] "b" NoAlias)-> Nothing NoAlias)-> Unnatural Cross-> (Tref [] "c" NoAlias)-> Nothing NoAlias)-> Unnatural Cross-> (Tref [] "d" NoAlias)-> Nothing NoAlias))]---> ,p "select a from b\n\-> \ inner join c\n\-> \ on true\n\-> \ inner join d\n\-> \ on 1=1;"-> [SelectStatement [] $ selectFrom-> [SelExp [] (Identifier [] "a")]-> (JoinedTref []-> (JoinedTref [] (Tref [] "b" NoAlias) Unnatural Inner (Tref [] "c" NoAlias)-> (Just $ JoinOn [] (BooleanLit [] True)) NoAlias)-> Unnatural Inner (Tref [] "d" NoAlias)-> (Just $ JoinOn [] (FunCall [] "="-> [IntegerLit [] 1, IntegerLit [] 1])) NoAlias)]--> ,p "select row_number() over(order by a) as place from tbl;"-> [SelectStatement [] $ selectFrom [SelectItem []-> (WindowFn []-> (FunCall [] "row_number" [])-> []-> [Identifier [] "a"] Asc FrameUnboundedPreceding)-> "place"]-> (Tref [] "tbl" NoAlias)]-> ,p "select row_number() over(order by a asc) as place from tbl;"-> [SelectStatement [] $ selectFrom [SelectItem []-> (WindowFn []-> (FunCall [] "row_number" [])-> []-> [Identifier [] "a"] Asc FrameUnboundedPreceding)-> "place"]-> (Tref [] "tbl" NoAlias)]-> ,p "select row_number() over(order by a desc) as place from tbl;"-> [SelectStatement [] $ selectFrom [SelectItem []-> (WindowFn []-> (FunCall [] "row_number" [])-> []-> [Identifier [] "a"] Desc FrameUnboundedPreceding)-> "place"]-> (Tref [] "tbl" NoAlias)]-> ,p "select row_number()\n\-> \over(partition by (a,b) order by c) as place\n\-> \from tbl;"-> [SelectStatement [] $ selectFrom [SelectItem []-> (WindowFn []-> (FunCall [] "row_number" [])-> [FunCall [] "!rowctor" [Identifier [] "a",Identifier [] "b"]]-> [Identifier [] "c"] Asc FrameUnboundedPreceding)-> "place"]-> (Tref [] "tbl" NoAlias)]--> ,p "select * from a natural inner join (select * from b) as a;"-> [SelectStatement [] $ selectFrom-> (selIL ["*"])-> (JoinedTref [] (Tref [] "a" NoAlias) Natural-> Inner (SubTref [] (selectFrom-> (selIL ["*"])-> (Tref [] "b" NoAlias)) (TableAlias "a"))-> Nothing NoAlias)]--> ,p "select * from a order by c;"-> [SelectStatement [] $ Select [] Dupes-> (sl (selIL ["*"]))-> [Tref [] "a" NoAlias]-> Nothing [] Nothing [(Identifier [] "c",Asc)] Nothing Nothing]--> ,p "select *\n\-> \from Adventure\n\-> \order by Clicks desc, AdventureID;"-> [SelectStatement [] $ Select [] Dupes-> (sl (selIL ["*"]))-> [Tref [] "Adventure" NoAlias]-> Nothing [] Nothing [(Identifier [] "Clicks",Desc)-> ,(Identifier [] "AdventureID",Asc)] Nothing Nothing]--> ,p "select * from a order by c,d asc;"-> [SelectStatement [] $ Select [] Dupes-> (sl (selIL ["*"]))-> [Tref [] "a" NoAlias]-> Nothing [] Nothing [(Identifier [] "c", Asc)-> ,(Identifier [] "d", Asc)] Nothing Nothing]--> ,p "select * from a order by c,d desc;"-> [SelectStatement [] $ Select [] Dupes-> (sl (selIL ["*"]))-> [Tref [] "a" NoAlias]-> Nothing [] Nothing [(Identifier [] "c", Asc)-> ,(Identifier [] "d", Desc)] Nothing Nothing]--> ,p "select * from a order by c limit 1;"-> [SelectStatement [] $ Select [] Dupes-> (sl (selIL ["*"]))-> [Tref [] "a" NoAlias]-> Nothing [] Nothing [(Identifier [] "c",Asc)] (Just (IntegerLit [] 1)) Nothing]--> ,p "select * from a order by c offset 3;"-> [SelectStatement [] $ Select [] Dupes-> (sl (selIL ["*"]))-> [Tref [] "a" NoAlias]-> Nothing [] Nothing [(Identifier [] "c",Asc)] Nothing (Just $ IntegerLit [] 3)]--> ,p "select a from (select b from c) as d;"-> [SelectStatement [] $ selectFrom-> (selIL ["a"])-> (SubTref [] (selectFrom-> (selIL ["b"])-> (Tref [] "c" NoAlias))-> (TableAlias "d"))]--> ,p "select * from gen();"-> [SelectStatement [] $ selectFrom (selIL ["*"]) (TrefFun [] (FunCall [] "gen" []) NoAlias)]-> ,p "select * from gen() as t;"-> [SelectStatement [] $ selectFrom-> (selIL ["*"])-> (TrefFun [] (FunCall [] "gen" [])(TableAlias "t"))]--> ,p "select a, count(b) from c group by a;"-> [SelectStatement [] $ Select [] Dupes-> (sl [selI "a", SelExp [] (FunCall [] "count" [Identifier [] "b"])])-> [Tref [] "c" NoAlias] Nothing [Identifier [] "a"]-> Nothing [] Nothing Nothing]--> ,p "select a, count(b) as cnt from c group by a having cnt > 4;"-> [SelectStatement [] $ Select [] Dupes-> (sl [selI "a", SelectItem [] (FunCall [] "count" [Identifier [] "b"]) "cnt"])-> [Tref [] "c" NoAlias] Nothing [Identifier [] "a"]-> (Just $ FunCall [] ">" [Identifier [] "cnt", IntegerLit [] 4])-> [] Nothing Nothing]--> ,p "select a from (select 1 as a, 2 as b) x;"-> [SelectStatement [] $ selectFrom-> [selI "a"]-> (SubTref [] (selectE $ SelectList []-> [SelectItem [] (IntegerLit [] 1) "a"-> ,SelectItem [] (IntegerLit [] 2) "b"] [])-> (TableAlias "x"))]-> ]]--> ,Group "multiple statements" [Statements [-> p "select 1;\nselect 2;" [SelectStatement [] $ selectE $ sl [SelExp [] (IntegerLit [] 1)]-> ,SelectStatement [] $ selectE $ sl [SelExp [] (IntegerLit [] 2)]]-> ]]--> ,Group "comments" [Statements [-> p "" []-> ,p "-- this is a test" []-> ,p "/* this is\n\-> \a test*/" []-> ,p "select 1;\n\-> \-- this is a test\n\-> \select -- this is a test\n\-> \2;" [SelectStatement [] $ selectE $ sl [SelExp [] (IntegerLit [] 1)]-> ,SelectStatement [] $ selectE $ sl [SelExp [] (IntegerLit [] 2)]-> ]-> ,p "select 1;\n\-> \/* this is\n\-> \a test*/\n\-> \select /* this is a test*/2;"-> [SelectStatement [] $ selectE $ sl [SelExp [] (IntegerLit [] 1)]-> ,SelectStatement [] $ selectE $ sl [SelExp [] (IntegerLit [] 2)]-> ]-> ]]-> ]--================================================================================--dml statements--> ,Group "dml" [-> Group "insert" [Statements [-> p "insert into testtable\n\-> \(columna,columnb)\n\-> \values (1,2);\n"-> [Insert []-> "testtable"-> ["columna", "columnb"]-> (Values [] [[IntegerLit [] 1, IntegerLit [] 2]])-> Nothing]--multi row insert, test the stand alone values statement first, maybe-that should be in the select section?--> ,p "values (1,2), (3,4);"-> [SelectStatement [] $ Values [] [[IntegerLit [] 1, IntegerLit [] 2]-> ,[IntegerLit [] 3, IntegerLit [] 4]]]--> ,p "insert into testtable\n\-> \(columna,columnb)\n\-> \values (1,2), (3,4);\n"-> [Insert []-> "testtable"-> ["columna", "columnb"]-> (Values [] [[IntegerLit [] 1, IntegerLit [] 2]-> ,[IntegerLit [] 3, IntegerLit [] 4]])-> Nothing]--insert from select--> ,p "insert into a\n\-> \ select b from c;"-> [Insert [] "a" []-> (selectFrom [selI "b"] (Tref [] "c" NoAlias))-> Nothing]--> ,p "insert into testtable\n\-> \(columna,columnb)\n\-> \values (1,2) returning id;\n"-> [Insert []-> "testtable"-> ["columna", "columnb"]-> (Values [] [[IntegerLit [] 1, IntegerLit [] 2]])-> (Just $ sl [selI "id"])]-> ]]--> ,Group "update" [Statements [-> p "update tb\n\-> \ set x = 1, y = 2;"-> [Update [] "tb" [SetClause [] "x" (IntegerLit [] 1)-> ,SetClause [] "y" (IntegerLit [] 2)]-> Nothing Nothing]-> ,p "update tb\n\-> \ set x = 1, y = 2 where z = true;"-> [Update [] "tb" [SetClause [] "x" (IntegerLit [] 1)-> ,SetClause [] "y" (IntegerLit [] 2)]-> (Just $ FunCall [] "="-> [Identifier [] "z", BooleanLit [] True])-> Nothing]-> ,p "update tb\n\-> \ set x = 1, y = 2 returning id;"-> [Update [] "tb" [SetClause [] "x" (IntegerLit [] 1)-> ,SetClause [] "y" (IntegerLit [] 2)]-> Nothing (Just $ sl [selI "id"])]-> ,p "update pieces\n\-> \set a=b returning tag into r.tag;"-> [Update [] "pieces" [SetClause [] "a" (Identifier [] "b")]-> Nothing (Just (SelectList []-> [SelExp [] (Identifier [] "tag")]-> ["r.tag"]))]-> ,p "update tb\n\-> \ set (x,y) = (1,2);"-> [Update [] "tb" [RowSetClause []-> ["x","y"]-> [IntegerLit [] 1,IntegerLit [] 2]]-> Nothing Nothing]-> ]]--> ,Group "delete" [Statements [-> p "delete from tbl1 where x = true;"-> [Delete [] "tbl1" (Just $ FunCall [] "="-> [Identifier [] "x", BooleanLit [] True])-> Nothing]-> ,p "delete from tbl1 where x = true returning id;"-> [Delete [] "tbl1" (Just $ FunCall [] "="-> [Identifier [] "x", BooleanLit [] True])-> (Just $ sl [selI "id"])]-> ]]--> ,Group "truncate" [Statements [-> p "truncate test;"-> [Truncate [] ["test"] ContinueIdentity Restrict]--> ,p "truncate table test, test2 restart identity cascade;"-> [Truncate [] ["test","test2"] RestartIdentity Cascade]-> ]]--copy, bit crap at the moment--> ,Group "copy" [Statements [-> p "copy tbl(a,b) from stdin;\n\-> \bat\tt\n\-> \bear\tf\n\-> \\\.\n"-> [Copy [] "tbl" ["a", "b"] Stdin-> ,CopyData [] "\-> \bat\tt\n\-> \bear\tf\n"]-> ]]--================================================================================--ddl statements--> ,Group "ddl" [-> Group "simple tables" [Statements [-> p "create table test (\n\-> \ fielda text,\n\-> \ fieldb int\n\-> \);"-> [CreateTable []-> "test"-> [att "fielda" "text"-> ,att "fieldb" "int"-> ]-> []]-> ,p "create table tbl (\n\-> \ fld boolean default false);"-> [CreateTable [] "tbl" [AttributeDef [] "fld" (SimpleTypeName [] "boolean")-> (Just $ BooleanLit [] False) []][]]--> ,p "create table tbl as select 1;"-> [CreateTableAs [] "tbl"-> (selectE (SelectList [] [SelExp [] (IntegerLit [] 1)] []))]---> ,p "alter table a alter column b set default 1;"-> [AlterTable [] "a" [AlterColumnDefault [] "b" (IntegerLit [] 1)]]--> ,p "alter table a add constraint unique(b);"-> [AlterTable [] "a" [AddConstraint [] (UniqueConstraint [] "" ["b"])]]-> ]]--> ,Group "others" [Statements [-> p "create view v1 as\n\-> \select a,b from t;"-> [CreateView []-> "v1"-> (selectFrom [selI "a", selI "b"] (Tref [] "t" NoAlias))]-> ,p "create domain td as text check (value in ('t1', 't2'));"-> [CreateDomain [] "td" (SimpleTypeName [] "text") ""-> (Just (InPredicate [] (Identifier [] "value") True-> (InList [] [stringQ "t1" ,stringQ "t2"])))]-> ,p "create type tp1 as (\n\-> \ f1 text,\n\-> \ f2 text\n\-> \);"-> [CreateType [] "tp1" [TypeAttDef [] "f1" (SimpleTypeName [] "text")-> ,TypeAttDef [] "f2" (SimpleTypeName [] "text")]]--> ,p "create sequence s start with 5 increment by 4 no maxvalue no minvalue cache 1;"-> [CreateSequence [] "s" 4 1 ((2::Integer) ^ (63::Integer) - 1) 5 1]--> ,p "alter sequence s owned by a.b;"-> [AlterSequence [] "s" "a.b"]--> ,p "create trigger tr\n\-> \after insert or delete on tb\n\-> \for each statement\n\-> \execute procedure fb();"-> [CreateTrigger [] "tr" TriggerAfter [TInsert,TDelete] "tb" EachStatement "fb" []]-> ]]--> ,Group "drops" [Statements [-> p "drop domain t;"-> [DropSomething [] Domain Require ["t"] Restrict]-> ,p "drop domain if exists t,u cascade;"-> [DropSomething [] Domain IfExists ["t", "u"] Cascade]-> ,p "drop domain t restrict;"-> [DropSomething [] Domain Require ["t"] Restrict]--> ,p "drop type t;"-> [DropSomething [] Type Require ["t"] Restrict]-> ,p "drop table t;"-> [DropSomething [] Table Require ["t"] Restrict]-> ,p "drop view t;"-> [DropSomething [] View Require ["t"] Restrict]--> ]]--> ,Group "constraints" [-> Group "nulls" [Statements [-> p "create table t1 (\n\-> \ a text null\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "a" (SimpleTypeName [] "text")-> Nothing [NullConstraint [] ""]]-> []]-> ,p "create table t1 (\n\-> \ a text not null\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "a" (SimpleTypeName [] "text")-> Nothing [NotNullConstraint [] ""]]-> []]-> ]]--> ,Group "unique" [Statements [-> p "create table t1 (\n\-> \ x int,\n\-> \ y int,\n\-> \ unique (x,y)\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [UniqueConstraint [] "" ["x","y"]]]--test arbitrary ordering--> ,p "create table t1 (\n\-> \ x int,\n\-> \ unique (x),\n\-> \ y int\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [UniqueConstraint [] "" ["x"]]]--unique row--> ,p "create table t1 (\n\-> \ x int unique\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowUniqueConstraint [] ""]][]]--> ,p "create table t1 (\n\-> \ x int unique not null\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowUniqueConstraint [] ""-> ,NotNullConstraint [] ""]][]]--quick sanity check--> ,p "create table t1 (\n\-> \ x int not null unique\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [NotNullConstraint [] ""-> ,RowUniqueConstraint [] ""]][]]-> ]]--> ,Group "primary key" [Statements [-> p "create table t1 (\n\-> \ x int primary key\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowPrimaryKeyConstraint [] ""]][]]--> ,p "create table t1 (\n\-> \ x int,\n\-> \ y int,\n\-> \ primary key (x,y)\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [PrimaryKeyConstraint [] "" ["x", "y"]]]--> ]]--> ,Group "check" [Statements [-> p "create table t (\n\-> \f text check (f in('a', 'b'))\n\-> \);"-> [CreateTable [] "t"-> [AttributeDef [] "f" (SimpleTypeName [] "text") Nothing-> [RowCheckConstraint [] "" (InPredicate []-> (Identifier [] "f") True-> (InList [] [stringQ "a", stringQ "b"]))]] []]--> ,p "create table t1 (\n\-> \ x int,\n\-> \ y int,\n\-> \ check (x>y)\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [CheckConstraint [] "" (FunCall [] ">" [Identifier [] "x", Identifier [] "y"])]]-> ]]--> ,Group "misc" [Statements [-> p "create table t (\n\-> \f text not null unique check (f in('a', 'b'))\n\-> \);"-> [CreateTable [] "t"-> [AttributeDef [] "f" (SimpleTypeName [] "text") Nothing-> [NotNullConstraint [] ""-> ,RowUniqueConstraint [] ""-> ,RowCheckConstraint [] "" (InPredicate []-> (Identifier [] "f") True-> (InList [] [stringQ "a"-> ,stringQ "b"]))]] []]--> ]]--> ,Group "references" [Statements [-> p "create table t1 (\n\-> \ x int references t2\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowReferenceConstraint [] "" "t2" Nothing-> Restrict Restrict]][]]--> ,p "create table t1 (\n\-> \ x int references t2(y)\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowReferenceConstraint [] "" "t2" (Just "y")-> Restrict Restrict]][]]---> ,p "create table t1 (\n\-> \ x int,\n\-> \ y int,\n\-> \ foreign key (x,y) references t2\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [ReferenceConstraint [] "" ["x", "y"] "t2" []-> Restrict Restrict]]--> ,p "create table t1 (\n\-> \ x int,\n\-> \ y int,\n\-> \ foreign key (x,y) references t2(z,w)\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [ReferenceConstraint [] "" ["x", "y"] "t2" ["z", "w"]-> Restrict Restrict]]--> ,p "create table t1 (\n\-> \ x int references t2 on delete cascade\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowReferenceConstraint [] "" "t2" Nothing-> Cascade Restrict]][]]--> ,p "create table t1 (\n\-> \ x int references t2 on update cascade\n\-> \);"-> [CreateTable [] "t1" [AttributeDef [] "x" (SimpleTypeName [] "int") Nothing-> [RowReferenceConstraint [] "" "t2" Nothing-> Restrict Cascade]][]]--> ,p "create table t1 (\n\-> \ x int,\n\-> \ y int,\n\-> \ foreign key (x,y) references t2 on update cascade on delete cascade\n\-> \);"-> [CreateTable [] "t1" [att "x" "int"-> ,att "y" "int"]-> [ReferenceConstraint [] "" ["x", "y"] "t2" []-> Cascade Cascade]]--> ]]-> ]]-> ,Group "functions" [-> Group "basics" [Statements [-> p "create function t1(text) returns text as $$\n\-> \select a from t1 where b = $1;\n\-> \$$ language sql stable;"-> [CreateFunction [] "t1" [ParamDefTp [] $ SimpleTypeName [] "text"]-> (SimpleTypeName [] "text") Sql "$$"-> (SqlFnBody []-> [SelectStatement [] $ selectFromWhere [SelExp [] (Identifier [] "a")] (Tref [] "t1" NoAlias)-> (FunCall [] "="-> [Identifier [] "b", PositionalArg [] 1])])-> Stable]-> ,p "create function fn() returns void as $$\n\-> \declare\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql volatile;"-> [CreateFunction [] "fn" [] (SimpleTypeName [] "void") Plpgsql "$$"-> (PlpgsqlFnBody [] [VarDef [] "a" (SimpleTypeName [] "int") Nothing-> ,VarDef [] "b" (SimpleTypeName [] "text") Nothing]-> [NullStatement []])-> Volatile]-> ,p "create function fn() returns void as $$\n\-> \declare\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql volatile;"-> [CreateFunction [] "fn" [] (SimpleTypeName [] "void") Plpgsql "$$"-> (PlpgsqlFnBody [] [VarDef [] "a" (SimpleTypeName [] "int") Nothing-> ,VarDef [] "b" (SimpleTypeName [] "text") Nothing]-> [NullStatement []])-> Volatile]-> ,p "create function fn(a text[]) returns int[] as $$\n\-> \declare\n\-> \ b xtype[] := '{}';\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql immutable;"-> [CreateFunction [] "fn"-> [ParamDef [] "a" $ ArrayTypeName [] $ SimpleTypeName [] "text"]-> (ArrayTypeName [] $ SimpleTypeName [] "int") Plpgsql "$$"-> (PlpgsqlFnBody []-> [VarDef [] "b" (ArrayTypeName [] $ SimpleTypeName [] "xtype") (Just $ stringQ "{}")]-> [NullStatement []])-> Immutable]-> ,p "create function fn() returns void as '\n\-> \declare\n\-> \ a int := 3;\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \' language plpgsql stable;"-> [CreateFunction [] "fn" [] (SimpleTypeName [] "void") Plpgsql "'"-> (PlpgsqlFnBody [] [VarDef [] "a" (SimpleTypeName [] "int") (Just $ IntegerLit [] 3)]-> [NullStatement []])-> Stable]-> ,p "create function fn() returns setof int as $$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> [CreateFunction [] "fn" []-> (SetOfTypeName [] $ SimpleTypeName [] "int") Plpgsql "$$"-> (PlpgsqlFnBody [] [] [NullStatement []])-> Stable]-> ,p "create function fn() returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end\n\-> \$$ language plpgsql stable;"-> [CreateFunction [] "fn" []-> (SimpleTypeName [] "void") Plpgsql "$$"-> (PlpgsqlFnBody [] [] [NullStatement []])-> Stable]-> ,p "drop function test(text);"-> [DropFunction [] Require [("test",[SimpleTypeName [] "text"])] Restrict]-> ,p "drop function if exists a(),test(text) cascade;"-> [DropFunction [] IfExists [("a",[])-> ,("test",[SimpleTypeName [] "text"])] Cascade]-> ]]--> ,Group "simple plpgsql statements" [PlpgsqlStatements [-> p "success := true;"-> [Assignment [] "success" (BooleanLit [] True)]-> ,p "success = true;"-> [Assignment [] "success" (BooleanLit [] True)]-> ,p "return true;"-> [Return [] $ Just (BooleanLit [] True)]-> ,p "return;"-> [Return [] Nothing]-> ,p "return next 1;"-> [ReturnNext [] $ IntegerLit [] 1]-> ,p "return query select a from b;"-> [ReturnQuery [] $ selectFrom [selI "a"] (Tref [] "b" NoAlias)]-> ,p "raise notice 'stuff %', 1;"-> [Raise [] RNotice "stuff %" [IntegerLit [] 1]]-> ,p "perform test();"-> [Perform [] $ FunCall [] "test" []]-> ,p "perform test(a,b);"-> [Perform [] $ FunCall [] "test" [Identifier [] "a", Identifier [] "b"]]-> ,p "perform test(r.relvar_name || '_and_stuff');"-> [Perform [] $ FunCall [] "test" [-> FunCall [] "||" [Identifier [] "r.relvar_name"-> ,stringQ "_and_stuff"]]]-> ,p "select into a,b c,d from e;"-> [SelectStatement [] $ Select [] Dupes (SelectList [] [selI "c", selI "d"] ["a", "b"])-> [Tref [] "e" NoAlias] Nothing [] Nothing [] Nothing Nothing]-> ,p "select c,d into a,b from e;"-> [SelectStatement [] $ Select [] Dupes (SelectList [] [selI "c", selI "d"] ["a", "b"])-> [Tref [] "e" NoAlias] Nothing [] Nothing [] Nothing Nothing]--> ,p "execute s;"-> [Execute [] (Identifier [] "s")]-> ,p "execute s into r;"-> [ExecuteInto [] (Identifier [] "s") ["r"]]--> ,p "continue;" [ContinueStatement []]-> ]]--> ,Group "other plpgsql statements" [PlpgsqlStatements [-> p "for r in select a from tbl loop\n\-> \null;\n\-> \end loop;"-> [ForSelectStatement [] "r" (selectFrom [selI "a"] (Tref [] "tbl" NoAlias))-> [NullStatement []]]-> ,p "for r in select a from tbl where true loop\n\-> \null;\n\-> \end loop;"-> [ForSelectStatement [] "r"-> (selectFromWhere [selI "a"] (Tref [] "tbl" NoAlias) (BooleanLit [] True))-> [NullStatement []]]-> ,p "for r in 1 .. 10 loop\n\-> \null;\n\-> \end loop;"-> [ForIntegerStatement [] "r"-> (IntegerLit [] 1) (IntegerLit [] 10)-> [NullStatement []]]--> ,p "if a=b then\n\-> \ update c set d = e;\n\-> \end if;"-> [If [] [((FunCall [] "=" [Identifier [] "a", Identifier [] "b"])-> ,[Update [] "c" [SetClause [] "d" (Identifier [] "e")] Nothing Nothing])]-> []]-> ,p "if true then\n\-> \ null;\n\-> \else\n\-> \ null;\n\-> \end if;"-> [If [] [((BooleanLit [] True),[NullStatement []])]-> [NullStatement []]]-> ,p "if true then\n\-> \ null;\n\-> \elseif false then\n\-> \ return;\n\-> \end if;"-> [If [] [((BooleanLit [] True), [NullStatement []])-> ,((BooleanLit [] False), [Return [] Nothing])]-> []]-> ,p "if true then\n\-> \ null;\n\-> \elseif false then\n\-> \ return;\n\-> \elseif false then\n\-> \ return;\n\-> \else\n\-> \ return;\n\-> \end if;"-> [If [] [((BooleanLit [] True), [NullStatement []])-> ,((BooleanLit [] False), [Return [] Nothing])-> ,((BooleanLit [] False), [Return [] Nothing])]-> [Return [] Nothing]]-> ,p "case a\n\-> \ when b then null;\n\-> \ when c,d then null;\n\-> \ else null;\n\-> \end case;"-> [CaseStatement [] (Identifier [] "a")-> [([Identifier [] "b"], [NullStatement []])-> ,([Identifier [] "c", Identifier [] "d"], [NullStatement []])]-> [NullStatement []]]--> ]]--> ,Group "misc" [Statements [-> p "SET search_path TO my_schema, public;"-> [Set [] "search_path" [SetId [] "my_schema"-> ,SetId [] "public"]]-> ,p "SET t1 = 3;"-> [Set [] "t1" [SetNum [] 3]]-> ,p "SET t1 = 'stuff';"-> [Set [] "t1" [SetStr [] "stuff"]]-> ,p "create language plpgsql;"-> [CreateLanguage [] "plpgsql"]--> ]]--> ]]]--================================================================================--shortcuts for constructing test data and asts--> p :: t -> t1 -> (t, t1)-> p a b = (a,b)--> stringQ :: String -> Expression-> stringQ = StringLit [] "'"--> selectFrom :: SelectItemList-> -> TableRef-> -> SelectExpression-> selectFrom selList frm = Select [] Dupes (SelectList [] selList [])-> [frm] Nothing [] Nothing [] Nothing Nothing--> selectE :: SelectList -> SelectExpression-> selectE selList = Select [] Dupes selList-> [] Nothing [] Nothing [] Nothing Nothing--> selIL :: [String] -> [SelectItem]-> selIL = map selI--> selI :: String -> SelectItem-> selI = SelExp [] . Identifier []--> sl :: SelectItemList -> SelectList-> sl a = SelectList [] a []--> selectFromWhere :: SelectItemList-> -> TableRef-> -> Expression-> -> SelectExpression-> selectFromWhere selList frm whr =-> Select [] Dupes (SelectList [] selList [])-> [frm] (Just whr) [] Nothing [] Nothing Nothing--> att :: String -> String -> AttributeDef-> att n t = AttributeDef [] n (SimpleTypeName [] t) Nothing []---================================================================================--Unit test helpers--> itemToTft :: Item -> [Test.Framework.Test]-> itemToTft (Expressions es) = map (uncurry testParseExpression) es-> itemToTft (PlpgsqlStatements es) = map (uncurry testParsePlpgsqlStatements) es-> itemToTft (Statements es) = map (uncurry testParseStatements) es-> itemToTft (Group s is) = [testGroup s $ concatMap itemToTft is]---> testParseExpression :: String -> Expression -> Test.Framework.Test-> testParseExpression src ast = parseUtil src ast-> (parseExpression "") printExpression--> testParseStatements :: String -> [Statement] -> Test.Framework.Test-> testParseStatements src ast = parseUtil src ast (parseSql "") printSql--> testParsePlpgsqlStatements :: String -> [Statement] -> Test.Framework.Test-> testParsePlpgsqlStatements src ast = parseUtil src ast (parsePlpgsql "") printSql--> parseUtil :: (Show t, Eq b, Show b, Data b) =>-> String-> -> b-> -> (String -> Either t b)-> -> (b -> String)-> -> Test.Framework.Test-> parseUtil src ast parser printer = testCase ("parse " ++ src) $-> case parser src of-> Left er -> assertFailure $ show er-> Right ast' -> do-> assertEqual ("parse " ++ src) ast $ stripAnnotations ast'-> case parser (printer ast) of-> Left er -> assertFailure $ "reparse\n" ++ show er ++ "\n" -- ++ pp ++ "\n"-> Right ast'' -> assertEqual ("reparse " ++ printer ast) ast $ stripAnnotations ast''--TODO-new idea for testing:-parsesql -> ast1-parse, pretty print, parse -> ast2-load into pg, pg_dump, parse -> ast3-parse, pretty print, load into pg, pg_dump, parse -> ast4-check all these asts are the same
− Database/HsSqlPpp/Tests/RoundtripTests.lhs
@@ -1,53 +0,0 @@-Copyright 2010 Jake Wheat--Test sql by typechecking it, then running it through Postgres and comparing.--Stage 1:-read sql files: produce catalog using type checker-load sql files into postgres using psql-read catalog from psql and compare with catalog from typechecker-stage 2:-as above, but load via databaseloader-stage 3:-load using database loader-dump using pg_dump-attempt to compare original ast to ast of dump---> module Database.HsSqlPpp.Tests.RoundtripTests (roundtripTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit--> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.Ast.Environment-> import Database.HsSqlPpp.Ast.TypeChecker-> import Database.HsSqlPpp.Commands.CommandComponents--> data Item = Group String [Item]-> | Src [(String,String)]--> roundtripTests :: [Test.Framework.Test]-> roundtripTests = itemToTft roundtripTestData--> roundtripTestData :: Item-> roundtripTestData =-> Group "round trip tests" []--> itemToTft :: Item -> [Test.Framework.Test]-> itemToTft (Group s is) = [testGroup s $ concatMap itemToTft is]-> itemToTft (Src ss) = map (uncurry testRoundtrip) ss--> testRoundtrip :: String -> String -> Test.Framework.Test-> testRoundtrip name sql = testCase ("test " ++ name) $-> checkStage1-> where-> checkStage1 = do-> cat1 <- getCatalog sql-> return ()-- > getCatalog :: String -> EitherEnvironment--> getCatalog sql = -> parseSql1 "" sql >>= typeCheckC defaultTemplate1Environment >>= lfst
− Database/HsSqlPpp/Tests/TypeCheckTests.lhs
@@ -1,1104 +0,0 @@-Copyright 2009 Jake Wheat--Set of tests to check the type checking code. Includes some tests for-sql which doesn't type check.---> module Database.HsSqlPpp.Tests.TypeCheckTests (typeCheckTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Data.Char-> import Data.List--> import Database.HsSqlPpp.Parsing.Parser-> import Database.HsSqlPpp.Ast.TypeChecker-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Ast.Environment-> import Database.HsSqlPpp.Ast.SqlTypes--> data Item = Expressions [(String, Either [TypeError] Type)]-> | StatementTypes [(String, Either [TypeError] [Maybe StatementType])]-> | EnvUpStatementTypes [(String-> ,[EnvironmentUpdate]-> ,Either [TypeError] [Maybe StatementType])]-> | DdlStatements [(String, [[EnvironmentUpdate]])]-> | DdlStatementsEnv [(String, [EnvironmentUpdate])]-> | Group String [Item]--> typeCheckTests :: [Test.Framework.Test]-> typeCheckTests = itemToTft typeCheckTestData--> typeCheckTestData :: Item-> typeCheckTestData =-> Group "astCheckTests" [--> Group "basic literal types" [ Expressions [-> p "1" $ Right typeInt-> ,p "1.0" $ Right typeNumeric-> ,p "'test'" $ Right UnknownType-> ,p "true" $ Right typeBool-> ,p "array[1,2,3]" $ Right (ArrayType typeInt)-> ,p "array['a','b']" $ Right (ArrayType (ScalarType "text"))-> ,p "array[1,'b']" $ Right (ArrayType typeInt)-> ,p "array[1,true]" $ Left [NoMatchingOperator "!arrayctor" [ScalarType "int4",ScalarType "bool"]]-> ]]--> ,Group "some expressions" [ Expressions [-> p "1=1" $ Right typeBool-> ,p "1=true" $ Left [NoMatchingOperator "=" [typeInt,typeBool]]-> ,p "substring('aqbc' from 2 for 2)" $ Right (ScalarType "text")--> ,p "substring(3 from 2 for 2)" $ Left-> [NoMatchingOperator "!substring"-> [ScalarType "int4"-> ,ScalarType "int4"-> ,ScalarType "int4"]]-> ,p "substring('aqbc' from 2 for true)" $ Left-> [NoMatchingOperator "!substring"-> [UnknownType-> ,ScalarType "int4"-> ,ScalarType "bool"]]--> ,p "3 between 2 and 4" $ Right typeBool-> ,p "3 between true and 4" $ Left-> [NoMatchingOperator ">="-> [typeInt-> ,typeBool]]--> ,p "array[1,2,3][2]" $ Right typeInt-> ,p "array['a','b'][1]" $ Right (ScalarType "text")-- > ,p "array['a','b'][true]" (TypeError ("",0,0)- > (WrongType- > typeInt- > UnknownType))--> ,p "not true" $ Right typeBool-> ,p "not 1" $ Left-> [NoMatchingOperator "!not" [typeInt]]--> ,p "@ 3" $ Right typeInt-> ,p "@ true" $ Left-> [NoMatchingOperator "@" [ScalarType "bool"]]--> ,p "-3" $ Right typeInt-> ,p "-'a'" $ Left-> [NoMatchingOperator "-" [UnknownType]]--> ,p "4-3" $ Right typeInt--> ,p "1 is null" $ Right typeBool-> ,p "1 is not null" $ Right typeBool--> ,p "1+1" $ Right typeInt-> ,p "1+1" $ Right typeInt-> ,p "31*511" $ Right typeInt-> ,p "5/2" $ Right typeInt-> ,p "2^10" $ Right typeFloat8-> ,p "17%5" $ Right typeInt--> ,p "3 and 4" $ Left-> [NoMatchingOperator "!and" [typeInt,typeInt]]--> ,p "True and False" $ Right typeBool-> ,p "false or true" $ Right typeBool--> ,p "lower('TEST')" $ Right (ScalarType "text")-> ,p "lower(1)" $ Left [NoMatchingOperator "lower" [typeInt]]-> ]]--> ,Group "special functions" [ Expressions [-> p "coalesce(null,1,2,null)" $ Right typeInt-> ,p "coalesce('3',1,2,null)" $ Right typeInt-> ,p "coalesce('3',1,true,null)"-> $ Left [NoMatchingOperator "coalesce" [UnknownType-> ,ScalarType "int4"-> ,ScalarType "bool"-> ,UnknownType]]-> ,p "nullif('hello','hello')" $ Right (ScalarType "text")-> ,p "nullif(3,4)" $ Right typeInt-> ,p "nullif(true,3)"-> $ Left [NoMatchingOperator "nullif" [ScalarType "bool"-> ,ScalarType "int4"]]-> ,p "greatest(3,5,6,4,3)" $ Right typeInt-> ,p "least(3,5,6,4,3)" $ Right typeInt-> ,p "least(5,true)"-> $ Left [NoMatchingOperator "least" [ScalarType "int4",ScalarType "bool"]]---> ]]--implicit casting and function/operator choice tests:-check when multiple implicit and one exact match on num args-check multiple matches with num args, only one with implicit conversions-check multiple implicit matches with one preferred-check multiple implicit matches with one preferred highest count-check casts from unknown string lits--> ,Group "some expressions" [ Expressions [-> p "3 + '4'" $ Right typeInt-> ,p "3.0 + '4'" $ Right typeNumeric-> ,p "'3' + '4'" $ Left [NoMatchingOperator "+" [UnknownType-> ,UnknownType]]--> ]]--> ,Group "exists expressions" [ Expressions [-> p "exists (select 1 from pg_type)" $ Right typeBool-> ,p "exists (select testit from pg_type)"-> $ Left [UnrecognisedIdentifier "testit"]-> ]]--> ,Group "row comparison expressions" [ Expressions [--rows different lengths-rows match types pairwise, same and different types-rows implicit cast from unknown-rows don't match types--> p "row(1)" $ Right (AnonymousRecordType [typeInt])-> ,p "row(1,2)" $ Right (AnonymousRecordType [typeInt,typeInt])-> ,p "row('t1','t2')" $ Right (AnonymousRecordType [UnknownType,UnknownType])-> ,p "row(true,1,'t3')" $ Right (AnonymousRecordType [typeBool, typeInt,UnknownType])-> ,p "(true,1,'t3',75.3)" $ Right (AnonymousRecordType [typeBool,typeInt-> ,UnknownType,typeNumeric])-> ,p "row(1) = row(2)" $ Right typeBool-> ,p "row(1,2) = row(2,1)" $ Right typeBool-> ,p "(1,2) = (2,1)" $ Right typeBool-> ,p "(1,2,3) = (2,1)" $ Left [NoMatchingOperator "="-> [AnonymousRecordType [ScalarType "int4"-> ,ScalarType "int4"-> ,ScalarType "int4"]-> ,AnonymousRecordType [ScalarType "int4"-> ,ScalarType "int4"]]]-> ,p "('1',2) = (2,'1')" $ Right typeBool-> ,p "(1,true) = (2,1)" $ Left [NoMatchingOperator "="-> [AnonymousRecordType [ScalarType "int4"-> ,ScalarType "bool"]-> ,AnonymousRecordType [ScalarType "int4"-> ,ScalarType "int4"]]]-> ,p "(1,2) <> (2,1)" $ Right typeBool-> ,p "(1,2) >= (2,1)" $ Right typeBool-> ,p "(1,2) <= (2,1)" $ Right typeBool-> ,p "(1,2) > (2,1)" $ Right typeBool-> ,p "(1,2) < (2,1)" $ Right typeBool-> ]]--> ,Group "case expressions" [ Expressions [-> p "case\n\-> \ when true then 1\n\-> \end" $ Right typeInt-> ,p "case\n\-> \ when 1=2 then 'stuff'\n\-> \ when 2=3 then 'blah'\n\-> \ else 'test'\n\-> \end" $ Right (ScalarType "text")-> ,p "case\n\-> \ when 1=2 then 'stuff'\n\-> \ when true=3 then 'blah'\n\-> \ else 'test'\n\-> \end" $ Left [NoMatchingOperator "=" [typeBool,typeInt]]-> ,p "case\n\-> \ when 1=2 then true\n\-> \ when 2=3 then false\n\-> \ else 1\n\-> \end" $ Left [IncompatibleTypeSet [typeBool-> ,typeBool-> ,typeInt]]-> ,p "case\n\-> \ when 1=2 then false\n\-> \ when 2=3 then 1\n\-> \ else true\n\-> \end" $ Left [IncompatibleTypeSet [typeBool-> ,typeInt-> ,typeBool]]--> ,p "case 1 when 2 then 3 else 4 end" $ Right typeInt-> ,p "case 1 when true then 3 else 4 end"-> $ Left [IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"]]-> ,p "case 1 when 2 then true else false end" $ Right typeBool-> ,p "case 1 when 2 then 3 else false end"-> $ Left [IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"]]-> ]]--> ,Group "polymorphic functions" [ Expressions [-> p "array_append(ARRAY[1,2], 3)"-> $ Right (ArrayType typeInt)-> ,p "array_append(ARRAY['a','b'], 'c')"-> $ Right (ArrayType $ ScalarType "text")-> ,p "array_append(ARRAY['a'::int,'b'], 'c')"-> $ Right (ArrayType typeInt)-> ]]--> ,Group "cast expressions" [ Expressions [-> p "cast ('1' as integer)"-> $ Right typeInt-> ,p "cast ('1' as baz)"-> $ Left [UnknownTypeName "baz"]-> ,p "array[]" -- this isn't quite right but not sure how to do it atm-> -- no point fixing this case since need a load of other-> -- test cases where the behaviour is different-> $ Right (Pseudo AnyArray) -- Left [TypelessEmptyArray]-> ,p "array[] :: text[]"-> $ Right (ArrayType (ScalarType "text"))-> ]]--> ,Group "simple selects" [ StatementTypes [-> p "select 1;" $ Right [Just $ StatementType [] [("?column?", typeInt)]]-> ,p "select 1 as a;" $-> Right [Just $ StatementType [] [("a", typeInt)]]-> ,p "select 1,2;" $-> Right [Just $ StatementType [] [("?column?", typeInt)-> ,("?column?", typeInt)]]-> ,p "select 1 as a, 2 as b;" $-> Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)]]-> ,p "select 1+2 as a, 'a' || 'b';" $-> Right [Just $ StatementType [] [("a", typeInt)-> ,("?column?", ScalarType "text")]]-> ,p "values (1,2);" $ Right [Just $ StatementType []-> [("column1", typeInt)-> ,("column2", typeInt)]]-> ,p "values (1,2),('3', '4');" $ Right [Just $ StatementType []-> [("column1", typeInt)-> ,("column2", typeInt)]]-> ,p "values (1,2),('a', true);" $ Left [IncompatibleTypeSet [typeInt-> ,typeBool]]-> ,p "values ('3', '4'),(1,2);" $ Right [Just $ StatementType []-> [("column1", typeInt)-> ,("column2", typeInt)]]-> ,p "values ('a', true),(1,2);" $ Left [IncompatibleTypeSet [typeBool-> ,typeInt]]-> ,p "values ('a'::text, '2'::int2),('1','2');" $ Right [Just $ StatementType []-> [("column1", ScalarType "text")-> ,("column2", typeSmallInt)]]-> ,p "values (1,2,3),(1,2);" $ Left [ValuesListsMustBeSameLength]--> ]]--> ,Group "simple combine selects" [ StatementTypes [-> p "select 1,2 union select '3', '4';" $ Right [Just $ StatementType []-> [("?column?", typeInt)-> ,("?column?", typeInt)]]-> ,p "select 1,2 intersect select 'a', true;" $ Left [IncompatibleTypeSet [typeInt-> ,typeBool]]-> ,p "select '3', '4' except select 1,2;" $ Right [Just $ StatementType []-> [("?column?", typeInt)-> ,("?column?", typeInt)]]-> ,p "select 'a', true union select 1,2;"-> $ Left [IncompatibleTypeSet [typeBool-> ,typeInt]]-> ,p "select 'a'::text, '2'::int2 intersect select '1','2';" $ Right [Just $ StatementType []-> [("text", ScalarType "text")-> ,("int2", typeSmallInt)]]-> ,p "select 1,2,3 except select 1,2;" $ Left [ValuesListsMustBeSameLength]-> ,p "select '3' as a, '4' as b except select 1,2;" $ Right [Just $ StatementType []-> [("a", typeInt)-> ,("b", typeInt)]]--> ]]--> ,Group "simple selects from" [ StatementTypes [-> p "select a from (select 1 as a, 2 as b) x;"-> $ Right [Just $ StatementType [] [("a", typeInt)]]-> ,p "select b from (select 1 as a, 2 as b) x;"-> $ Right [Just $ StatementType [] [("b", typeInt)]]-> ,p "select c from (select 1 as a, 2 as b) x;"-> $ Left [UnrecognisedIdentifier "c"]-> ,p "select typlen from pg_type;"-> $ Right [Just $ StatementType [] [("typlen", typeSmallInt)]]-> ,p "select oid from pg_type;"-> $ Right [Just $ StatementType [] [("oid", ScalarType "oid")]]-> ,p "select p.oid from pg_type p;"-> $ Right [Just $ StatementType [] [("oid", ScalarType "oid")]]-> ,p "select typlen from nope;"-> $ Left [UnrecognisedIdentifier "typlen",UnrecognisedRelation "nope"]-> ,p "select generate_series from generate_series(1,7);"-> $ Right [Just $ StatementType [] [("generate_series", typeInt)]]--check aliasing--> ,p "select generate_series.generate_series from generate_series(1,7);"-> $ Right [Just $ StatementType [] [("generate_series", typeInt)]]-> ,p "select g from generate_series(1,7) g;"-> $ Right [Just $ StatementType [] [("g", typeInt)]]-> ,p "select g.g from generate_series(1,7) g;"-> $ Right [Just $ StatementType [] [("g", typeInt)]]-> ,p "select generate_series.g from generate_series(1,7) g;"-> $ Left [UnrecognisedCorrelationName "generate_series"]-> ,p "select g.generate_series from generate_series(1,7) g;"-> $ Left [UnrecognisedIdentifier "g.generate_series"]---> ,p "select * from pg_attrdef;"-> $ Right [Just $ StatementType []-> [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")]]-> ,p "select abs from abs(3);"-> $ Right [Just $ StatementType [] [("abs", typeInt)]]-> --todo: these are both valid,-> --the second one means select 3+generate_series from generate_series(1,7)-> -- select generate_series(1,7);-> -- select 3 + generate_series(1,7);--> ]]--> ,Group "simple selects from 2" [ EnvUpStatementTypes [-> t "select a,b from testfunc();"-> [EnvCreateComposite "testType" [("a", ScalarType "text")-> ,("b", typeInt)-> ,("c", typeInt)]-> ,EnvCreateFunction FunName "testfunc" []-> (SetOfType $ NamedCompositeType "testType") False]-> $ Right [Just $ StatementType []-> [("a",ScalarType "text"),("b",ScalarType "int4")]]--> ,t "select testfunc();"-> [EnvCreateFunction FunName "testfunc" [] (Pseudo Void) False]-> $ Right [Just $ StatementType [] []]--> ]]--> ,Group "simple join selects" [ StatementTypes [-> p "select * from (select 1 as a, 2 as b) a\n\-> \ cross join (select true as c, 4.5 as d) b;"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)-> ,("c", typeBool)-> ,("d", typeNumeric)]]-> ,p "select * from (select 1 as a, 2 as b) a\n\-> \ inner join (select true as c, 4.5 as d) b on true;"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)-> ,("c", typeBool)-> ,("d", typeNumeric)]]-> ,p "select * from (select 1 as a, 2 as b) a\n\-> \ inner join (select 1 as a, 4.5 as d) b using(a);"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)-> ,("d", typeNumeric)]]-> ,p "select * from (select 1 as a, 2 as b) a\n\-> \ natural inner join (select 1 as a, 4.5 as d) b;"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)-> ,("d", typeNumeric)]]-> --check the attribute order-> ,p "select * from (select 2 as b, 1 as a) a\n\-> \ natural inner join (select 4.5 as d, 1 as a) b;"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)-> ,("d", typeNumeric)]]-> ,p "select * from (select 1 as a1, 2 as b) a\n\-> \ natural inner join (select true as a1, 4.5 as d) b;"-> $ Left [IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"]]-> ,p "select * from (select 1 as a1, 2 as b) a\n\-> \ natural inner join (select true as a1, 4.5 as d) b;"-> $ Left [IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"]]--> ,p "select * from (select 1 as a1) a, (select 2 as a2) b;"-> $ Right [Just $ StatementType [] [("a1", typeInt)-> ,("a2", typeInt)]]--> ,p "select * from (select 1 as a1) a, (select 2 as a1) b;"-> $ Right [Just $ StatementType [] [("a1", typeInt)-> ,("a1", typeInt)]]--> ,p "select a1 from (select 1 as a1) a, (select 2 as a1) b;"-> $ Left [AmbiguousIdentifier "a1"]-> ]]--> ,Group "simple scalar identifier qualification" [ StatementTypes [-> p "select a.* from \n\-> \(select 1 as a, 2 as b) a \n\-> \cross join (select 3 as c, 4 as d) b;"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("b", typeInt)]]-> ,p "select nothere.* from \n\-> \(select 1 as a, 2 as b) a \n\-> \cross join (select 3 as c, 4 as d) b;"-> $ Left [UnrecognisedCorrelationName "nothere"]-> ,p "select a.b,b.c from \n\-> \(select 1 as a, 2 as b) a \n\-> \natural inner join (select 3 as a, 4 as c) b;"-> $ Right [Just $ StatementType [] [("b", typeInt)-> ,("c", typeInt)]]-> ,p "select a.a,b.a from \n\-> \(select 1 as a, 2 as b) a \n\-> \natural inner join (select 3 as a, 4 as c) b;"-> $ Right [Just $ StatementType [] [("a", typeInt)-> ,("a", typeInt)]]--> ,p "select pg_attrdef.adsrc from pg_attrdef;"-> $ Right [Just $ StatementType [] [("adsrc", ScalarType "text")]]--> ,p "select a.adsrc from pg_attrdef a;"-> $ Right [Just $ StatementType [] [("adsrc", ScalarType "text")]]--> ,p "select pg_attrdef.adsrc from pg_attrdef a;"-> $ Left [UnrecognisedCorrelationName "pg_attrdef"]--> ,p "select a from (select 2 as b, 1 as a) a\n\-> \natural inner join (select 4.5 as d, 1 as a) b;"-> $ Right [Just $ StatementType [] [("a", typeInt)]]--select g.fn from fn() g--> ]]--> ,Group "aggregates" [ StatementTypes [-> p "select max(prorettype::int) from pg_proc;"-> $ Right [Just $ StatementType [] [("max", typeInt)]]-> ]]--> ,Group "simple wheres" [ StatementTypes [-> p "select 1 from pg_type where true;"-> $ Right [Just $ StatementType [] [("?column?", typeInt)]]-> ,p "select 1 from pg_type where 1;"-> $ Left [ExpressionMustBeBool]-> ,p "select typname from pg_type where typbyval;"-> $ Right [Just $ StatementType [] [("typname", ScalarType "name")]]-> ,p "select typname from pg_type where typtype = 'b';"-> $ Right [Just $ StatementType [] [("typname", ScalarType "name")]]-> ,p "select typname from pg_type where what = 'b';"-> $ Left [UnrecognisedIdentifier "what"]-> ]]--TODO: check identifier stacking working, then remove the pg_namespace-qualifier before oid and this should still work--> ,Group "subqueries" [ StatementTypes [-> p "select relname as relvar_name\n\-> \ from pg_class\n\-> \ where ((relnamespace =\n\-> \ (select oid\n\-> \ from pg_namespace\n\-> \ where (nspname = 'public'))) and (relkind = 'r'));"-> $ Right [Just $ StatementType [] [("relvar_name",ScalarType "name")]]-> ,p "select relname from pg_class where relkind in ('r', 'v');"-> $ Right [Just $ StatementType [] [("relname",ScalarType "name")]]-> ,p "select * from generate_series(1,7) g\n\-> \where g not in (select * from generate_series(3,5));"-> $ Right [Just $ StatementType [] [("g",typeInt)]]-> ,p "select 3 = any(array[1,2,3]);"-> $ Right [Just $ StatementType [] [("?column?",typeBool)]]-> ]]--identifiers in select parts-->{- ,testGroup "select part identifiers"-> (mapStatementTypes [-> p "select relname,attname from pg_class\n\-> \inner join pg_attribute\n\-> \on pg_attribute.attrelid = pg_class.oid;"-> $ Right [Just $ StatementType [] [("relvar_name",ScalarType "name")]]-> ])-}--> ,Group "insert" [ StatementTypes [-> p "insert into nope (a,b) values (c,d);"-> $ Left [UnrecognisedRelation "nope",UnrecognisedIdentifier "c",UnrecognisedIdentifier "d"]-> ,p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,2, 'a', 'b');"-> $ Right [Just $ StatementType [] [] {-InsertInfo "pg_attrdef"-> [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")]-}]-> ,p "insert into pg_attrdef\n\-> \values (1,2, 'a', 'b');"-> $ Right [Just $ StatementType [] [] {-InsertInfo "pg_attrdef"-> [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")]-}]-> ,p "insert into pg_attrdef (hello,adnum,adbin,adsrc)\n\-> \values (1,2, 'a', 'b');"-> $ Left [UnrecognisedIdentifier "hello"]-> ,p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,true, 'a', 'b');"-> $ Left [IncompatibleTypes (ScalarType "int2") (ScalarType "bool")]-> ,p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,true, 'a', 'b','c');"-> $ Left [WrongNumberOfColumns]-> ]]--> ,Group "update" [ StatementTypes [-> p "update nope set a = 1;"-> $ Left [UnrecognisedRelation "nope"]-> ,p "update pg_attrdef set adsrc = '' where 1;"-> $ Left [ExpressionMustBeBool]-> ,p "update pg_attrdef set (adbin,adsrc) = ('a','b','c');"-> $ Left [WrongNumberOfColumns]-> ,p "update pg_attrdef set (adrelid,adsrc) = (true,'b');"-> $ Left [IncompatibleTypes (ScalarType "oid") typeBool]-> ,p "update pg_attrdef set (shmadrelid,adsrc) = ('a','b');"-> $ Left [UnrecognisedIdentifier "shmadrelid"]-> ,p "update pg_attrdef set adsrc='';"-> $ Right [Just $ StatementType [] [] {-UpdateInfo "pg_attrdef" [("adsrc",ScalarType "text")]-}]-> ,p "update pg_attrdef set adsrc='' where 1=2;"-> $ Right [Just $ StatementType [] [] {-UpdateInfo "pg_attrdef" [("adsrc",ScalarType "text")]-}]-> -- TODO: actually, pg doesn't support this so need to generate error instead-> ,p "update pg_attrdef set (adbin,adsrc) = ((select 'a','b'));"-> $ Right [Just $ StatementType [] [] {-UpdateInfo "pg_attrdef" [("adbin",ScalarType "text"),("adsrc",ScalarType "text")]-}]-> --check where ids-> ,p "update pg_attrdef set adsrc='' where adsrc='';"-> $ Right [Just $ StatementType [] [] {-UpdateInfo "pg_attrdef" [("adsrc",ScalarType "text")]-}]-> ,p "update pg_attrdef set adnum = adnum + 1;"-> $ Right [Just $ StatementType [] [] {-UpdateInfo "pg_attrdef" [("adnum",ScalarType "int2")]-}]-> ]]--> ,Group "delete" [ StatementTypes [-> p "delete from nope;"-> $ Left [UnrecognisedRelation "nope"]-> ,p "delete from pg_attrdef where 1=2;"-> $ Right [Just $ StatementType [] []]-> ,p "delete from pg_attrdef where 1;"-> $ Left [ExpressionMustBeBool]-> ,p "delete from pg_attrdef where adsrc='';"-> $ Right [Just $ StatementType [] []]-> ]]--================================================================================--test the catalog updates from creates, etc.--> ,Group "creates" [DdlStatements [-> p "create table t1 (\n\-> \ a int,\n\-> \ b text\n\-> \);"-> [[EnvCreateTable "t1" [("a",ScalarType "int4")-> ,("b",ScalarType "text")]-> [("tableoid", ScalarType "oid")-> ,("cmax", ScalarType "cid")-> ,("xmax", ScalarType "xid")-> ,("cmin", ScalarType "cid")-> ,("xmin", ScalarType "xid")-> ,("ctid", ScalarType "tid")]]]-> ,p "create type t1 as (\n\-> \ a int,\n\-> \ b text\n\-> \);"-> [[EnvCreateComposite "t1" [("a",ScalarType "int4")-> ,("b",ScalarType "text")]]]--> ,p "create domain t1 as text;"-> [[EnvCreateDomain (DomainType "t1") (ScalarType "text")]]--> ,p "create domain t1 as text check (value in ('a', 'b'));\n\-> \select 'text'::t1;"-> [[EnvCreateDomain (DomainType "t1") (ScalarType "text")]]---> ,p "create view v1 as select * from pg_attrdef;"-> [[EnvCreateView "v1" [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")]]]--> ,p "create function t1(text) returns text as $$\n\-> \null;\n\-> \$$ language sql stable;"-> [[EnvCreateFunction FunName "t1" [ScalarType "text"]-> (ScalarType "text") False]]-> ]]---================================================================================--check the identifier resolution for functions:-parameters-variable declarations-select expressions inside these:-refer to param-refer to variable-override var with var-override var with select iden-todo: override var with param, override select iden with param--check var defs:-check type exists-check type of initial values--> ,Group "create function identifier resolution" [ StatementTypes [-> p "create function t1(stuff text) returns text as $$\n\-> \begin\n\-> \ return stuff || ' and stuff';\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])-> ,p "create function t1(stuff text) returns text as $$\n\-> \begin\n\-> \ return badstuff || ' and stuff';\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Left [UnrecognisedIdentifier "badstuff"])-> ,p "create function t1() returns text as $$\n\-> \declare\n\-> \ stuff text;\n\-> \begin\n\-> \ return stuff || ' and stuff';\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])-> ]]--================================================================================--> ,Group "plpgsqlbits" [ StatementTypes [-> p "create function t1(stuff text) returns text as $$\n\-> \begin\n\-> \ return stuff || ' and stuff';\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])-> ,p "create function t1(stuff text) returns text as $$\n\-> \begin\n\-> \ return badstuff || ' and stuff';\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Left [UnrecognisedIdentifier "badstuff"])-> ,p "create function t1() returns text as $$\n\-> \declare\n\-> \ stuff text;\n\-> \begin\n\-> \ return stuff || ' and stuff';\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])-> ]]--================================================================================--> ,Group "plpgsqlbits" [ StatementTypes [-> p "create function t1() returns void as $$\n\-> \declare\n\-> \ a bool;\n\-> \begin\n\-> \ a := 3;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Left [IncompatibleTypes (ScalarType "bool") (ScalarType "int4")])-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ a boolean;\n\-> \begin\n\-> \ a := true;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])-> ]]--================================================================================--> ,Group "for loops" [ StatementTypes [-> p "create function t1() returns void as $$\n\-> \declare\n\-> \ r record;\n\-> \ t int;\n\-> \begin\n\-> \ for r in select * from pg_attrdef loop\n\-> \ t := r.adnum;\n\-> \ end loop;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])---> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ r record;\n\-> \ t int;\n\-> \begin\n\-> \ for r in select adnum from pg_attrdef loop\n\-> \ t := r;\n\-> \ end loop;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Right [Nothing])--loop var already declared--> ,p "create function test() returns void as $$\n\-> \declare\n\-> \ i int;\n\-> \ i1 int;\n\-> \begin\n\-> \ for i in 0 .. 10 loop\n\-> \ i1 := i;\n\-> \ end loop;\n\-> \end;\n\-> \$$ language plpgsql volatile;"-> (Right [Nothing])--implicitly created loop var--> ,p "create function test() returns void as $$\n\-> \declare\n\-> \ i1 int;\n\-> \begin\n\-> \ for i in 0 .. 10 loop\n\-> \ i1 := i;\n\-> \ end loop;\n\-> \end;\n\-> \$$ language plpgsql volatile;"-> (Right [Nothing])--loop var already declared, wrong type--> ,p "create function test() returns void as $$\n\-> \declare\n\-> \ i bool;\n\-> \begin\n\-> \ for i in 0 .. 10 loop\n\-> \ null;\n\-> \ end loop;\n\-> \end;\n\-> \$$ language plpgsql volatile;"-> (Left [IncompatibleTypes (ScalarType "bool") (ScalarType "int4")])--loop var implicit check it's type--> ,p "create function test() returns void as $$\n\-> \declare\n\-> \ t bool;\n\-> \begin\n\-> \ for i in 0 .. 10 loop\n\-> \ t := i;\n\-> \ end loop;\n\-> \end;\n\-> \ $$ language plpgsql volatile;"-> (Left [IncompatibleTypes (ScalarType "bool") (ScalarType "int4")])-> ]]--================================================================================--> ,Group "check catalog chaining" [ StatementTypes [--create function then select-select then create function-then in two separate chained asts--> p "create function t1() returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql stable;\n\-> \select t1();"-> (Right [Nothing])-> ,p "select t1();\n\-> \create function t1() returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> (Left [NoMatchingOperator "t1" []])-> ]]--> {-,Group "check catalog chaining2" [ StatementTypes [-> p ["create function t1() returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> ,"select t1();"]-> (Right [Just (SelectInfo (Pseudo Void))])-> ,p ["select t1();"-> ,"create function t1() returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql stable;"]-> (Left [NoMatchingOperator "t1" []])-> ]]-}--================================================================================--test some casts-assign composite to record- then assign record to composite-assign row to composite- : check wrong cols, wrong types-check read and write fields in composite->record-check read and write fields in composite-check domain <-> base assigns-check call function with compatible composite, compatible row ctor-assign comp to comp--todo for chaos sql-for loop var = scalar, select = setof composite with one scalar--select into-composite assignment and equality-autocast from rowctor to composite when calling function-assignment to composite fields-read fields of composite--array_contains -> match anyelement-createtable as env update-window functions-assign domain <-> base-sql function not working--================================================================================--check insert returning, update returning, delete returning, one check each-check select into: multiple vars, record (then access fields to check),- composite var-check errors: select into wrong number of vars, wrong types, and into- composite wrong number and wrong type--> ,Group "select into" [ StatementTypes [-> p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,2, 'a', 'b') returning adnum,adbin;"-> $ Right [Just $ StatementType [] [("adnum", ScalarType "int2")-> ,("adbin", ScalarType "text")]]-> ,p "update pg_attrdef set adnum = adnum + 1 returning adnum;"-> $ Right [Just $ StatementType [] [("adnum", ScalarType "int2")]]-> ,p "delete from pg_attrdef returning adnum,adbin;"-> $ Right [Just $ StatementType [] [("adnum", ScalarType "int2")-> ,("adbin", ScalarType "text")]]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ select adnum,adbin into a,b from pg_attrdef;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Right [Nothing]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ select adnum,adbin into b,a from pg_attrdef;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Left [IncompatibleTypes (ScalarType "text") (ScalarType "int2")-> ,IncompatibleTypes (ScalarType "int4") (ScalarType "text")]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ select adnum,adbin into a,c from pg_attrdef;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Left [UnrecognisedIdentifier "c"]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ select adnum,adbin into a from pg_attrdef;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Left [WrongNumberOfColumns]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ r record;\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ select adnum,adbin into r from pg_attrdef;\n\-> \ a := r.adnum;\n\-> \ b := r.adbin;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Right [Nothing]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ r record;\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ select adnum,adbin into r from pg_attrdef;\n\-> \ a := r.adnum;\n\-> \ b := r.adsrc;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Left [UnrecognisedIdentifier "r.adsrc"]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ r pg_attrdef;\n\-> \begin\n\-> \ select * into r from pg_attrdef;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Right [Nothing]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ r pg_class;\n\-> \begin\n\-> \ select adnum,adbin into r from pg_attrdef;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Left [IncompatibleTypes (NamedCompositeType "pg_class") (AnonymousRecordType [ScalarType "int2",ScalarType "text"])]-> ,p "create function t1() returns void as $$\n\-> \declare\n\-> \ r record;\n\-> \begin\n\-> \ select adnum,adbin into r from pg_attrdef;\n\-> \ select relname into r from pg_class;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Right [Nothing]-> ]]--> ,Group "composite elements" [ StatementTypes [-> p "create function t1() returns void as $$\n\-> \declare\n\-> \ r pg_attrdef;\n\-> \ a int;\n\-> \ b text;\n\-> \begin\n\-> \ b = r.adsrc;\n\-> \ r.adnum := a;\n\-> \ b = r.adsrc;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> $ Right [Nothing]-> ]]--> ,Group "positional args" [ StatementTypes [-> p "create function distance(int, int, int, int) returns float(24) as $$\n\-> \ select (point($1, $2) <-> point($3, $4))::float(24) as result;\n\-> \$$ language sql immutable;"-> $ Right [Nothing]-> ,p "create function distance(int, int, int, int) returns float(24) as $$\n\-> \ select (point($1, $2) <-> point($3, $5))::float(24) as result;\n\-> \$$ language sql immutable;"-> $ Left [UnrecognisedIdentifier "$5"]-> ]]--> ,Group "window fns" [ StatementTypes [-> p "select *, row_number() over () from pg_attrdef;"-> $ Right [Just $ StatementType []-> [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")-> ,("row_number",ScalarType "int8")]]-> ]]--> ,Group "drop stuff" [ DdlStatementsEnv [-> p "create function test(a int) returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end\n\-> \$$ language plpgsql;"-> [EnvCreateFunction FunName "test" [typeInt] (Pseudo Void) False]-> ,p "create function test(a int) returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end\n\-> \$$ language plpgsql;\n\-> \drop function test(int);"-> []-> ,p "drop function test(int);" -- this should fail but doesn't-> []-> ,p "drop function if exists test(int);"-> []-> ]]-> ]--================================================================================--> p :: t -> t1 -> (t, t1)-> p a b = (a,b)--> t :: t -> u -> v -> (t,u,v)-> t a b c = (a,b,c)---> testExpressionType :: String -> Either [TypeError] Type -> Test.Framework.Test-> testExpressionType src typ = testCase ("typecheck " ++ src) $-> let ast = case parseExpression "" src of-> Left e -> error $ show e-> Right l -> l-> aast = typeCheckExpression defaultTemplate1Environment ast-> ty = getTopLevelTypes [aast]-> er = concatMap snd $ getTypeErrors aast-> in case (length er, length ty) of-> (0,0) -> assertFailure "didn't get any types?"-> (0,1) -> assertEqual ("typecheck " ++ src) typ $ Right $ head ty-> (0,_) -> assertFailure "got too many types"-> _ -> assertEqual ("typecheck " ++ src) typ $ Left er--> testStatementType :: String -> Either [TypeError] [Maybe StatementType] -> Test.Framework.Test-> testStatementType src sis = testCase ("typecheck " ++ src) $-> let ast = case parseSql "" src of-> Left e -> error $ show e-> Right l -> l-> aast = snd $ typeCheck defaultTemplate1Environment ast-> is = getTopLevelInfos aast-> er = concatMap snd $ getTypeErrors aast-> in {-trace (show aast) $-} case (length er, length is) of-> (0,0) -> assertFailure "didn't get any infos?"-> (0,_) -> assertEqual ("typecheck " ++ src) sis $ Right is-> _ -> assertEqual ("typecheck " ++ src) sis $ Left er---> testEnvUpStatementType :: String-> -> [EnvironmentUpdate]-> -> Either [TypeError] [Maybe StatementType]-> -> Test.Framework.Test-> testEnvUpStatementType src eu sis = testCase ("typecheck " ++ src) $-> let ast = case parseSql "" src of-> Left e -> error $ show e-> Right l -> l-> aast = snd $ typeCheck makeEnv ast-> is = getTopLevelInfos aast-> er = concatMap snd $ getTypeErrors aast-> in {-trace (show aast) $-} case (length er, length is) of-> (0,0) -> assertFailure "didn't get any infos?"-> (0,_) -> assertEqual ("typecheck " ++ src) sis $ Right is-> _ -> assertEqual ("typecheck " ++ src) sis $ Left er-> where-> makeEnv = case updateEnvironment defaultTemplate1Environment eu of-> Left x -> error $ show x-> Right e -> e--> testEnvUp :: String -> [[EnvironmentUpdate]] -> Test.Framework.Test-> testEnvUp src eu = testCase ("typecheck " ++ src) $-> let ast = case parseSql "" src of-> Left e -> error $ show e-> Right l -> l-> aast = snd $ typeCheck defaultTemplate1Environment ast-> er = concatMap snd $ getTypeErrors aast-> eu' = getTopLevelEnvUpdates aast-> in {-trace (show aast) $-} case (length er, length eu') of-> (0,0) -> assertFailure "didn't get any infos or envupdates?"-> (0,_) -> assertEqual ("eu " ++ src) eu eu'-> (_,_) -> assertFailure $ show er---> testEnv :: String -> [EnvironmentUpdate] -> Test.Framework.Test-> testEnv src eu = testCase ("check catalog: " ++ src) $-> let ast = case parseSql "" src of-> Left e -> error $ show e-> Right l -> l-> (nenv,aast) = typeCheck defaultTemplate1Environment ast-> er = concatMap snd $ getTypeErrors aast-> neu = deconstructEnvironment nenv \\ deconstructEnvironment defaultTemplate1Environment-> in if not (null er)-> then assertFailure $ show er-> else assertEqual "check eus" eu neu---> itemToTft :: Item -> [Test.Framework.Test]-> itemToTft (Expressions es) = map (uncurry testExpressionType) es-> itemToTft (StatementTypes es) = map (uncurry testStatementType) es-> itemToTft (EnvUpStatementTypes es) = map (\(s,eu,si) -> testEnvUpStatementType s eu si) es-> itemToTft (DdlStatements es) = map (uncurry testEnvUp) es-> itemToTft (DdlStatementsEnv es) = map (uncurry testEnv) es--> itemToTft (Group s is) = [testGroup s $ concatMap itemToTft is]
− Database/HsSqlPpp/Utils.lhs
@@ -1,80 +0,0 @@-Copyright 2009 Jake Wheat--This file contains some generic utility stuff--> {-# OPTIONS_HADDOCK hide #-}--> module Database.HsSqlPpp.Utils where--> import Data.Maybe-> import Data.List-> import Data.Either-> import Control.Arrow-> import Control.Monad.Error-> import Control.Applicative--> errorWhen :: (Error a) => Bool -> a -> Either a ()-> errorWhen cond = when cond . Left--> returnWhen :: (Monad m) => Bool -> a -> m a -> m a-> returnWhen c t t1 = if c then return t else t1--> liftME :: a -> Maybe b -> Either a b-> liftME d m = case m of-> Nothing -> Left d-> Just b -> Right b--> both :: (a->b) -> (a,a) -> (b,b)-> both fn = fn *** fn--> (<:>) :: (Applicative f) =>-> f a -> f [a] -> f [a]-> (<:>) a b = (:) <$> a <*> b--> eitherToMaybe :: Either a b -> Maybe b-> eitherToMaybe (Left _) = Nothing-> eitherToMaybe (Right b) = Just b--> fromRight :: b -> Either a b -> b-> fromRight b (Left _) = b-> fromRight _ (Right r) = r--> fromLeft :: a -> Either a b -> a-> fromLeft _ (Left l) = l-> fromLeft a (Right _) = a--> mapEither :: (a->c) -> (b->d) -> Either a b -> Either c d-> mapEither l _ (Left a) = Left $ l a-> mapEither _ r (Right b) = Right $ r b--> mapRight :: (b -> c) -> Either a b -> Either a c-> mapRight = mapEither id--> mapLeft :: (a -> c) -> Either a b -> Either c b-> mapLeft l = mapEither l id--> isRight :: Either a b -> Bool-> isRight (Right _) = True-> isRight (Left _) = False--> leftToEmpty :: (r -> [a]) -> Either l r -> [a]-> leftToEmpty = either (const [])--> replace :: (Eq a) => [a] -> [a] -> [a] -> [a]-> replace _ _ [] = []-> replace old new xs@(y:ys) =-> case stripPrefix old xs of-> Nothing -> y : replace old new ys-> Just ys' -> new ++ replace old new ys'---> split :: Char -> String -> [String]-> split _ "" = []-> split c s = let (l, s') = break (== c) s-> in l : case s' of-> [] -> []-> (_:s'') -> split c s''--> liftThrows :: (MonadError t m) => Either t a -> m a-> liftThrows (Left err) = throwError err-> liftThrows (Right val) = return val
− Database/HsSqlPpp/Wrapper/WrapperTemplate.lhs
@@ -1,45 +0,0 @@--> module Database.HsSqlPpp.Wrapper.WrapperTemplate where--> import Language.Haskell.TH-> import Language.Haskell.TH.Quote-> import Language.Haskell.TH.Lib-> --import Control.Exception--> --import qualified Database.HDBC.PostgreSQL as Pg-> --import Database.HDBC-> import Control.Monad.Error--> import Database.HsSqlPpp.Commands.CommandComponents-> import Database.HsSqlPpp.Ast.SqlTypes as HsSql-> import Database.HsSqlPpp.Ast.TypeChecker-> import Database.HsSqlPpp.Ast.Annotation-> import Database.HsSqlPpp.Parsing.Parser----> select :: QuasiQuoter-> select = QuasiQuoter (litE . stringL) (litP . stringL)--> conv :: String -> String-> conv s = show $ parseSql "" s---> getSelectResultType :: String -> String -> IO [(String,HsSql.Type)]-> getSelectResultType dbName sqlText = wrapET $ do-> cat <- readCatalog dbName-> ast <- parseSql1 "" sqlText >>= typeCheckC cat >>= lsnd-> a <- case getTopLevelInfos ast of-> [Just (SelectInfo (SetOfType (CompositeType atts)))] ->-> return atts-> _ -> throwError $ AEMisc "expected one info"-> return a-- > select :: String -> IO (Q Exp)- > select s = return $ stringE s-- > select :: String -> Q Exp- > select s = stringE s--- undefined
− HsSqlSystem.lhs
@@ -1,555 +0,0 @@-#! /usr/bin/env runghc--Copyright 2009 Jake Wheat--Command line access to a bunch of utility functions.--run-./HsSqlSystem.lhs -?-to get a list of commands and purpose and usage info--> {-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}--> import System.Console.CmdArgs-> import System.IO-> import System.Directory-> import Data.List-> import Control.Monad.Error-> import Data.Char-> --import Control.Applicative--> import Test.Framework (defaultMainWithArgs)--> import Database.HsSqlPpp.Tests.ParserTests-> import Database.HsSqlPpp.Tests.TypeCheckTests-> import Database.HsSqlPpp.Tests.ExtensionTests-> import Database.HsSqlPpp.Tests.ParameterizedStatementTests--> import Database.HsSqlPpp.Ast.Environment-> import Database.HsSqlPpp.Ast.Ast-> import Database.HsSqlPpp.Commands.CommandComponents as C--> data HsSqlSystem = Lex {files :: [String]}-> | Parse {files :: [String]}-> | ParseExpression {files :: [String]}-> | Pppp {files :: [String]}-> | Ppp {files :: [String]}-> | TypeCheck {database :: String-> ,files :: [String]}-> | TypeCheckExpression {database :: String-> ,files :: [String]}-> | AllAnnotations {database :: String-> ,files :: [String]}-> | AnnotateSource {database :: String-> ,file :: String}-> | PPCatalog {database :: String-> ,files :: [String]}-> | Clear {database :: String}-> | Load {database :: String-> ,files :: [String]}-> | ClearLoad {database :: String-> ,files :: [String]}-> | DBCatalog {database :: String}-> | LoadPsql {database :: String-> ,files :: [String]}-> | PgDump {database :: String}-> | TestBattery {database :: String-> ,files :: [String]}-> | Test {extra :: [String]}-> | GenWrap {database :: String-> ,file :: String}-> | BuildDocs-> deriving (Show, Data, Typeable)--> main :: IO ()-> main = do-> cmd <- cmdArgs "HsSqlSystem, Copyright Jake Wheat 2009"-> [lexA, parseA, ppppA, pppA,-> parseExpressionA, typeCheckExpressionA,-> typeCheckA,allAnnotationsA,-> annotateSourceA, ppCatalogA,-> clearA, loadA, clearLoadA, catalogA, loadPsqlA,-> pgDumpA, testBatteryA,-> testA,buildDocsA, genWrapA]--> case cmd of-> Lex fns -> lexFiles fns-> Parse fns -> showAst fns-> Pppp fns -> testPppp fns-> Ppp fns -> showAst fns-> ParseExpression fns -> parseExpression fns-> TypeCheck db fns -> typeCheck2 db fns-> TypeCheckExpression db fns -> typeCheckExpression db fns-> AllAnnotations db fns -> typeCheck2 db fns-> AnnotateSource db fn -> annotateSourceF db fn-> PPCatalog db fns -> ppCatalog db fns-> Clear db -> cleardb db-> Load db fns -> loadSql db fns-> ClearLoad db fns -> clearAndLoadSql db fns-> DBCatalog db -> readCat db-> LoadPsql db fns -> loadSqlPsql db fns-> PgDump db -> pgDump1 db-> TestBattery db fns -> runTestBattery db fns-> Test as -> runTests as-> BuildDocs -> buildDocs-> GenWrap db f -> genWrap db f--would like to have the database argument be a common arg, don't know-how to do this--> lexA, parseA, ppppA, pppA, annotateSourceA, clearA, loadA,-> clearLoadA, catalogA, loadPsqlA, pgDumpA, testBatteryA,-> typeCheckA, testA, parseExpressionA, typeCheckExpressionA,-> buildDocsA, allAnnotationsA, ppCatalogA, genWrapA :: Mode HsSqlSystem--===============================================================================--> lexA = mode Lex {files = def &= typ "FILES" & args}-> &= text "lex the files given and output the tokens on separate lines"--> lexFiles :: [FilePath] -> IO ()-> lexFiles fns = wrapET $-> forM_ fns (\f ->-> message ("lexing " ++ f) >>-> readInput f >>= lexSql f >>= printList)--================================================================================--> parseA = mode $ Parse {files = def &= typ "FILES" & args}-> &= text "Parse files and output the asts"--> showAst :: [String] -> IO ()-> showAst = wrapET . mapM_ (\f ->-> message ("-- ast of " ++ f) >>-> readInput f >>= parseSql1 f >>= stripAnn >>= ppSh >>= message)--================================================================================--> ppppA = mode $ Pppp {files = def &= typ "FILES" & args}-> &= text "Routine to parse sql from a file, pretty print it then parse it \-> \again and check the post pretty printing ast is the same as the \-> \initial ast"--> testPppp :: [String] -> IO ()-> testPppp = wrapET . mapM_ (\f -> do-> ast1 <- readInput f >>= parseSql1 f >>= stripAnn-> ast2 <- ppSql ast1 >>= parseSql1 "" >>= stripAnn-> if ast1 /= ast2-> then do-> message "asts are different\n-- original"-> ppSh ast1 >>= message-> message "-- ppp'd"-> ppSh ast2 >>= message-> else message "success")--================================================================================--> pppA = mode $ Ppp {files = def &= typ "FILES" & args}-> &= text "Parse then pretty print some sql so you can check the result \-> \hasn't mangled the sql."--> ppp :: String -> IO()-> ppp f = wrapET $ message ("--ppp " ++ f) >>-> readInput f >>= parseSql1 f >>= ppSql >>= message--================================================================================--> parseExpressionA = mode $ ParseExpression {files = def &= typ "FILES" & args}-> &= text "Parse files each containing one expression \-> \and output the asts"--> parseExpression :: [String] -> IO ()-> parseExpression = wrapET . mapM_ (\f ->-> message ("-- ast of " ++ f) >>-> readInput f >>= parseExpression1 f >>= stripAnn-> >>= ppSh >>= message)--================================================================================--> annotateSourceA = mode $ AnnotateSource {database = def-> ,file = def &= typ "FILE"}-> &= text "reads a file, parses, type checks, then outputs info on \-> \each statement interspersed with the original source code"--> annotateSourceF :: String -> FilePath -> IO ()-> annotateSourceF db f =-> wrapET $ do-> message ("--annotated source of " ++ f)-> src <- readInput f-> cat <- readCatalog db-> parseSql1 f src >>= typeCheckC cat >>= lsnd >>=-> ppAnnOrig False src >>= message--================================================================================--> ppCatalogA = mode $ PPCatalog {database = def-> ,files = def &= typ "FILES" & args}-> &= text "reads each file, parses, type checks, then outputs the \-> \changes to the catalog that the sql makes"--> ppCatalog :: String -> [FilePath] -> IO ()-> ppCatalog db fns = wrapET $ do-> scat <- readCatalog db-> (ncat, _) <- mapM (\f -> readInput f >>=-> parseSql1 f) fns >>=-> lconcat >>= typeCheckC scat-> compareCatalogs scat emptyEnvironment ncat >>=-> ppCatDiff >>= message--================================================================================--> typeCheckA = mode $ TypeCheck {database = def-> ,files = def &= typ "FILES" & args}-> &= text "reads each file, parses, type checks, then outputs any type errors"---> typeCheck2 :: String -> [FilePath] -> IO ()-> typeCheck2 db fns = wrapET $-> readCatalog db >>= \cat ->-> mapM (\f -> readInput f >>= parseSql1 f) fns >>= lconcat >>=-> typeCheckC cat >>= lsnd >>= getTEs >>= ppTypeErrors >>= putStrLnList--================================================================================--> allAnnotationsA = mode $ AllAnnotations {database = def-> ,files = def &= typ "FILES" & args}-> &= text "reads each file, parses, type checks, then pretty prints the \-> \ast with all annotations except the source positions"--> allAnnotations :: String -> [FilePath] -> IO ()-> allAnnotations db fns = wrapET $-> readCatalog db >>= \cat ->-> mapM (\f -> readInput f >>= parseSql1 f) fns >>= lconcat >>=-> typeCheckC cat >>= lsnd >>= ppSh >>= message---================================================================================--> typeCheckExpressionA = mode $ TypeCheckExpression {database = def-> ,files = def &= typ "FILES" & args}-> &= text "reads each file, parses as expression, \-> \ type checks, then outputs the type or any type errors"---> typeCheckExpression :: String -> [FilePath] -> IO ()-> typeCheckExpression db fns = wrapET $ do-> aasts <- readCatalog db >>= \cat ->-> forM fns (\f -> readInput f >>= parseExpression1 f-> >>= typeCheckExpressionC cat)-> tes <- mapM getTEs aasts-> mapM_ (\x -> ppTypeErrors x >>= putStrLnList) $ filter (not . null) tes-> mapM_ (\a -> liftM (show . head) (getTopLevelTypes a) >>= message) aasts--================================================================================--= small hack utility to help with testing--TODO: use the correct username in this command-TODO: do something more correct--> clearA = mode $ Clear {database = def}-> &= text "hacky util to clear a database"--> cleardb :: String -> IO ()-> cleardb = wrapET . clearDB--================================================================================--= load sql file--> loadA = mode $ Load {database = def-> ,files = def &= typ "FILES" & args}-> &= text "This takes one or more files with sql source text, \-> \parses them then loads them into the database given."--> loadSql :: String -> [String] -> IO ()-> loadSql db fns = wrapET $-> liftIO (hSetBuffering stdout NoBuffering) >>-> mapM (\f -> readInput f >>= parseSql1 f) fns >>= lconcat >>=-> runExtensions >>= loadAst db ""--================================================================================--> loadPsqlA = mode $ LoadPsql {database = def-> ,files = def &= typ "FILES" & args}-> &= text "loads sql into a database using psql."--> loadSqlPsql :: String -> [String] -> IO ()-> loadSqlPsql db = wrapET .-> --srcs <- mapM readInput fns-> --mapM_ (\s -> loadSqlUsingPsql db s >>= message) (map snd srcs)-> mapM_ (\s -> loadSqlUsingPsqlFromFile db s >>= message)--================================================================================--> pgDumpA = mode $ PgDump {database = def}-> &= text "run pg dump, used for testing."--> pgDump1 :: String -> IO ()-> pgDump1 db = wrapET $ pgDump db >>= message---================================================================================--might try to work out a way of running multiple commands in one invoc-of this exe, then this command will disappear--> clearLoadA = mode $ ClearLoad {database = def-> ,files = def &= typ "FILES" & args}-> &= text "cleardb then loadsql"--> clearAndLoadSql :: String -> [String] -> IO ()-> clearAndLoadSql db fns = cleardb db >> loadSql db fns--================================================================================--This reads an catalog from a database and writes it out using show.--> catalogA = mode $ DBCatalog {database = def}-> &= text "read the catalog for the given db and dumps it in source \-> \format, used to create the catalog value for template1"--> readCat :: String -> IO ()-> readCat dbName = wrapET $ do-> cat <- readCatalog dbName-> message preamble-> ppSh cat >>= prefixLines >>= message-> where-> preamble = "\n\-> \Copyright 2009 Jake Wheat\n\-> \\n\-> \This file contains\n\-> \\n\-> \> {-# OPTIONS_HADDOCK hide #-}\n\-> \\n\-> \> module Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment\n\-> \> (defaultTemplate1Environment\n\-> \> ) where\n\-> \\n\-> \> import Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal\n\-> \> import Database.HsSqlPpp.AstInternals.TypeType\n\-> \\n\-> \> defaultTemplate1Environment :: Environment\n\-> \> defaultTemplate1Environment =\n\-> \> (\\l -> case l of\n\-> \> Left x -> error $ show x\n\-> \> Right e -> e) $\n\-> \> updateEnvironment defaultEnvironment\n"-> prefixLines :: (Monad m, Error e) => String -> ErrorT e m String-> prefixLines = return . unlines . map ("> " ++) . lines---================================================================================--run test battery: run a bunch of tests including consistency on the-database and sql files given--The idea is to typecheck the sql, load it into pg and dump it via psql-and via database loader, can then compare asts, catalogs, etc. in a-lot of different ways--currently:-parse and type check sql, save the catalog-load the sql into the db using psql, compare the catalog read from pg-with the catalog from typechecking-dump the sql and typecheck the dump, compare the catalog from this-check with the catalog from the original typecheck--todo: compare asts from initial parse with parsed dump - this is going-to be a lot of work to get passing since the statements are-re-ordered, and sometimes changed/ split up by pg--also: load the sql using the extension system and database loader,-then compare pg catalog with initial catalog, and dump and compare ast-with original ast--want to run a similar set of tests starting with the dump sql:-get ast,cat from dump sql, load using psql and using databaseloader-and check cats and subsequent dump asts.--getting the dump ast comparing with the original ast:--step one: convert tests in parser test to also roundtrip through-database, see parsertests for details--step two: write an ast conversion routine: assume that the pgdump ast-is like the ast fed into pg but with a few statements split into-components (e.g. create table with serial is split into create-sequence and create table), and then the statements are reordered, so-write a routine to mirror this - will then have-(anyast -> rearrange and reorder) == (anyast -> pg->pgdump)--> testBatteryA = mode $ TestBattery {database = def-> ,files = def &= typ "FILES" & args}-> &= text "runs a load of consistency tests on the sql passed"--> runTestBattery :: String -> [FilePath] -> IO ()-> runTestBattery dbName fns = wrapET $ do-> clearDB dbName-> startingCat <- readCatalog dbName-> (originalCat :: Environment,-> originalAast :: StatementList) <--> mapM (\f -> readInput f >>= parseSql1 f) fns >>= lconcat >>=-> runExtensions >>= typeCheckC startingCat--> headerMessage "type errors from initial parse:\n"-> getTEs originalAast >>= ppTypeErrors >>= putStrLnList--> mapM_ (\s -> loadSqlUsingPsqlFromFile dbName s >>= message) fns-> properCat <- readCatalog dbName-> headerMessage "catalog differences from initial parse and vanilla load:\n"-> compareCatalogs startingCat originalCat properCat >>=-> ppCatDiff >>= message--> (dumpCat,dumpAast) <--> pgDump dbName >>= parseSql1 "dump" >>= typeCheckC startingCat--> headerMessage "type errors from dump:\n"-> getTEs dumpAast >>= ppTypeErrors >>= putStrLnList--> headerMessage "catalog differences from initial parse and rechecked pg dump:\n"-> compareCatalogs startingCat originalCat dumpCat >>=-> ppCatDiff >>= message--> message "complete!"-> where-> headerMessage = message . ("-----------------------------\n" ++)--================================================================================--> testA = mode $ Test {extra = def &= typ "ANY" & args & unknownFlags}-> &= text "run automated tests, uses test.framework can pass arguments \-> \to this e.g. HsSqlSystem test -t parserTests"--> runTests :: [String] -> IO ()-> runTests as =-> flip defaultMainWithArgs as $-> parserTests ++-> typeCheckTests ++-> --parameterizedStatementTests ++-> [extensionTests]--================================================================================--options: nothing -> create/overwrite folders and files- clean -> delete generated files--create target folder if doesn't exist--> buildDocsA = mode $ BuildDocs-> &= text "build the documention in the docs/ folder"--> buildDocs :: IO ()-> buildDocs = wrapET $ do-> liftIO $ createDirectoryIfMissing False "docs/build"-> inputFiles <- sources-> let sts = zip (map ("docs/" ++) inputFiles) $-> flip map inputFiles-> (\f -> "docs/build/" ++ f ++ ".html")-> forM_ sts $ \(s,t) ->-> readInput s >>= pandoc >>= C.writeFile t-> where-> sources = liftM (filter (isSuffixOf ".txt"))-> (liftIO (getDirectoryContents "docs"))--================================================================================--> genWrapA = mode $ GenWrap {database = def-> ,file = def &= typ "FILE"}-> &= text "experimental code to generate typesafe haskell wrapper \-> \for db access"-> genWrap :: String -> String -> IO ()-> genWrap db f =-> wrapET doit-> where-> doit :: (MonadIO m) => ErrorT AllErrors m ()-> doit = wrapperGen1 db f >>= message--================================================================================--TODOS--command to display all annotation inline in sql source-better catalog diff, e.g. if two tables differ in one column just show-that difference-see if can improve ppshow to use slightly less newlines-command to show which bits of preexisting catalog are used-command to list which views/functions/etc. aren't used anywhere-replace a bunch of commands with composible set:-parse(expression), ppp, typecheck(expression), allannots-->-parse (expression option)-type check-annotation filter + options-output: ast, sql, annotations + options-----think of a better name for this command than hssqlsystem--want better options system:-first set of options get passed around in reader? monad:- database name, username, password for pg- useextensions- annotation control? - when showing values, which annotations to also output?-these have defaults, can change defaults in ~/.config/hssqlsystem or something,-and can be overridden using --dbname=...,etc. command line args (make-these work like psql? then have environment variables also)-second set of options is for input and output:-read from file(s), stdin, or from string literal command line arg, e.g.-HsSqlSystem expressionType --src="3 + 5"-output to file(s) or stdout--review command names and arguments:-find a better naming convention: some commands produce haskell values as text,-some produce non haskell compatible text e.g. lexfile-some run tests and produce a success/fail result, maybe a list of issues--run multiple commands in one invocation?--check errors passed to user are understandable--command line commands to add:--showAast-ppCatalog - read from db and print in human readable rather- than as haskell value-showexpressionast-showexpressionaast-typecheckexpression-pppexpression-showCatalogUpdates - run over some sql files, outputs the catalog changes- made by this sql-ppCatalogUpdates--graphviz stuff: dependency graph: pass a view name or function and it-draws a graph of all the views, tables and functions which are used by-that view or function--run an extension by name over some sql source to view differences: add-integration with external diff viewers, so can see before and after,-maybe option to either view pp'd sql, annotated pp'd sql, ast, aast,-etc. - can also use this for pppsql and pppexpression to view how the-pretty printer mangles things, and for testing, etc.--logging/verbosity:--want a way to log to stderr/stdout/ files with different verbosity-settings--command line arguments:-options:---database=xxx-?---extensions---username---password-?other connection info-annotation control?--command name-other command arguments:-- on its own is read from stdin---input='xxx' add literal input rather than from file/stdin-
LICENSE view
@@ -1,4 +1,4 @@-Copyright Jake Wheat 2009+Copyright Jake Wheat 2010-2014 All rights reserved.
README view
@@ -1,93 +1,16 @@-Summary: A parser, pretty printer, and type checker for PostgreSQL SQL-and PL/pgSQL. BSD licensed.--** Some of the documentation here and in the other files is out of- date, will be updated before the first alpha release. Please email- me (address below) if you have any questions in the meantime **--The current aims of the project is to provide a parser and type-checker for a substantial portion of PostgreSQL SQL and PL/pgSQL, and-then hopefully to build on this to make tools and libraries to help-developing PL/pgSQL code.--Status: it successfully parses and accurately pretty prints the three-moderate sized SQL files from another project of mine, but there are-lots of missing bits. Coverage of SQL is sort of reasonable - it's-possible that your SQL files will parse ok, but it's also possible-that they won't parse at all. Please report any sql which doesn't-parse.--It also has the beginnings of a type checker, which currently can type-check a fair bit of the three files mentioned above. You can run the-type checker on your SQL in various ways from the command line. Please-report any sql which doesn't type check correctly. Coming soon: a-command to produce a report on how well this code can parse and type-check your sql.--It comes with a small test suite.--To install, use-cabal update-then-cabal install hssqlppp--I think it should work on all GHC 6.10.x and possibly also GHC 6.8.x,-YMMV. GHC 6.12.x untested so far.--There are more doc files in the docs/ folder, and you can view the-haddock docs on hackage (see below for link). Better documentation is-coming soon.--The main dependencies of this project are: Parsec 3, HUnit, HDBC,-UUAGC. You currently need PostgreSQL installed.--================================================================================--Homepage--There isn't really a homepage or website yet, but you can view the-Launchpad page where the code is hosted, and the HackageDB page.--Launchpad:-http://launchpad.net/hssqlppp/--HackageDB page:-http://hackage.haskell.org/package/hssqlppp-You can also browse the limited Haddock documentation online here.--You can get the latest development code from Launchpad using Bazaar:-bzr branch lp:~jakewheat/hssqlppp/trunk--To get a snapshot release, see the downloads on the Launchpad page, or-use cabal install.---================================================================================--Contact--Let me know if you're using/ interesting in using the library, if you-have any problems or suggestions, etc.. All contributions, comments-and criticism welcome:--jakewheatmail@gmail.com--You can also report problems on the bug tracker on Launchpad.--================================================================================--= Some provisional future plans:+A parser, pretty printer, and type checker for SQL written in+Haskell. Mainly targets the PostgreSQL dialect of SQL and PL/pgSQL+syntax. -* use this system to develop a Lint-type checker for PL/pgSQL;+Pre alpha: works well and is stable for a subset of SQL, but there are+lots of unfinished areas and the api is likely to change a lot from+release to release at this time. -* provide support to help developing SQL from an IDE (targeting Emacs- mainly)+Website, with some docs and examples:+http://jakewheat.github.com/hssqlppp/latest -* support type checking simple SQL statements that you'd embed in- Haskell code, including with ? placeholders, to support generating- type safe wrappers - could integrate with MetaHDBC?;+Hackage: http://hackage.haskell.org/package/hssqlppp -* possibly a lightweight code generation/ simple macro support to help- with developing more robust PL/pgSQL code.+Repository: https://github.com/JakeWheat/hssqlppp -* documentation generation+Contact: jakewheatmail@gmail.com
− docs/Introduction.txt
@@ -1,154 +0,0 @@-# Introduction--This is a short guide to what hssqlsystem can do.--## Expression types--<%Command HsSqlSystem typecheckexpression '"2+2"'%>--<%Command HsSqlSystem typecheckexpression '"2+'3'"'%>--<%Command HsSqlSystem typecheckexpression '"2||'3'"'%>--<%Command HsSqlSystem typecheckexpression '"2+a"'%>--<%Command HsSqlSystem typecheckexpression '"noexist(2)"'%>--<%Command HsSqlSystem typecheckexpression '"'dsf'||'sadfsdf'"'%>--<%Command File SelectExpression.sql-(select attname as attribute_name,- typname as type_name,- relname as relvar_name- from pg_attribute inner join pg_class on (attrelid = pg_class.oid)- inner join pg_type on (atttypid = pg_type.oid)- inner join (select relname as relvar_name from pg_class where relnamespace =- (select oid from pg_namespace where nspname = 'public')- and relkind = 'r') base_relvars on (relname = base_relvars.relvar_name)- where attnum >= 1)-%>-- ;--<%Command HsSqlSystem typecheckexpression SelectExpression.sql%>--this shouldn't be hint: this needs different command as wrapper-to say it's wrapped in wrapET--<%Command File Select1.sql-select attname as attribute_name,- typname as type_name,- relname as relvar_name- from pg_attribute inner join pg_class on (attrelid = pg_class.oid)- inner join pg_type on (atttypid = pg_type.oid)- inner join (select relname as relvar_name from pg_class where relnamespace =- (select oid from pg_namespace where nspname = 'public')- and relkind = 'r') base_relvars on (relname = base_relvars.relvar_name)- where attnum >= 1;-%>--<%Command HsSqlSystem annotatesource -f=Select1.sql%>---: annotate source-aast-ppp--dig some big examples out of chaos--then with errors--## catalog info--<%Command File suppliers_and_parts_ddl.sql-create table s (- s_no int primary key,- sname text not null,- status int not null,- city text not null-);--create table p (- p_po int primary key,- pname text not null,- color text not null,- weight int not null,- city text not null-);--create table sp (- s_no int not null references s,- p_no int not null references p,- qty int not null,- primary key (s_no,p_no)-);%>--<%Command HsSqlSystem ppcatalog -d=template1 suppliers_and_parts_ddl.sql%>--show catalog--compare catalogs--# extensions--demonstrate create_var extension--+ haskell source?--# stuff to write which will look good here:--function match resolution annotation--better pretty printer for type errors--better pretty printer for annotations--better pretty printer for catalog updates--typechecking ? strings---reference for commands in hssqlppp with examples for each---add sql files for suppliers and parts database?--------more referency section with each command, a description, plus example-usage of each, and examples of all the options, and how to use a-config file----# ??literatize this file some more:--embed these notes into HsSqlSystem.lhs then provide two documentation-processes, one to htmlize without the source as a command line users-guide, and to htmlize the entire file as a programmers guide: extend-this to commands.lhs as the start of a tutorial/ guide for someone-using this as a library.---> then the system will allow conversion of HsSqlSystem.lhs to html- for:-end user guide: how to use the program-library user guide: includes source as example code for haskell programmers-haddock generated documentation-and also to produce an executable.---> need some way to mark which bits are excluded from the end user guide- need to be able to pandoc-up the file with syntax highlighting also- need to have some system to preprocess the file to run embedded- commands and feed the output into the file before it is- pandoc'd/syntax highlighted.---~~~~~~~~{.sql}-(select attname as attribute_name,- typname as type_name,- relname as relvar_name- from pg_attribute inner join pg_class on (attrelid = pg_class.oid)- inner join pg_type on (atttypid = pg_type.oid)- inner join base_relvars on (relname = base_relvars.relvar_name)- where attnum >= 1)-~~~~~~~~
− docs/TODO
@@ -1,670 +0,0 @@-= new immediate todos:--get typing working for wrapper generator demo -> release-then in some order:-- docs and examples - some basics-- roundtrip + report- start with users sql: either source files, a database or mixture- say if parse ok, -> source files or pg_dumps- list type errors from typechecking asts- pretty print the catalog from sql source or dumps from typechecking- check this catalog against pg catalog- also, rename environment type at least-- nullability plus support in wrapper generator-then maybe:- full api review, renames, error handling work, plus sqltypes review---= milestones-not in any particular order--== type check for implicit join: need brain to work on--== use better database config-command line args and config file for db, username and password, and- add prompt style so works like psql-== separate out documentation program to separate package--> how to do plugins for extra commands?--== documentation work-reorganise doc files (changelog, development, questions, README, TODO,- usage, introduction, etc.)-do test/example doc stuff for parsing and typechecking-parse transform pretty print example: basics of approach in chaos - do- some notes on how this can be improved-hssqlsystem commands reference-== tidy files, comment work-particularly ag files, redo comments, review all code for crufty bits-check todos at top of files: move to bottom-== nullability-== example code gen for typesafe access-== api review-tidyups, renames - rename everything pending, review public api- function names (particularly environment->catalog, and- localidentifierbindings to localenvironment)- get rid of inconsistent suffixes in hssqlsystem and command components-== error handling work- remove all calls to error- try to catch all places where errors are being ignored (mainly in- the type checking: add these errors to the aast)-== roundtrip tests -> report-== get chaos stuff working again-get chaos sql loading via hssqlppp again so can run roundtrip tests on-== module system, show used catalog-== better pretty printers for annotation types-== extensions code tidy?-== annotation generics style-== non sql syntax extensions work-== catalog ish: triggers, sequences, constraints, index, defaults-== haddock work-== do makefile type thing for development and deployment of db projects--maybe these:-builddocs work-hssqlsystem commands- better cat diff- show used catalog-finish intro docs-haskell intro docs-other docs-haddock in command components-testbattery-extensions - tidy code-annotation generics: tidy code-pretty printer for annotation-ppshow less newlines-better syntax for extensions-modules extension + public/private-syntax extension with non sql syntax using preprocessor?-multiline strings with string type e.g. sql-some sort of report mode to parse, typecheck and roundtrip some sql,- and report back what works and what doesn't-work on parse errors--long term todos-milestones for next release-todo for chaos (extensions, etc.)-divide todo categories- investigation, end user docs, internal docs, hygiene/maintenance,- testing, new functionality, bug fixes-docs: motivation/genesis, history?, high level criteria for 0.1-think about dependencies: make hdbc/pg dependency a flag?, split out- exes and tests somehow?----= documentation todo--write command processor thingy for builddocs-add extra commands to hssqlsystem for intro-finish intro-add haskell intro which uses the commandcomponents instead-other documentation files:- reference for hssqlsystem- hssqlsystem reference is generated from hssqlsystem.lhs:- inside this file is the reference information for each- command, plus example usage, so these appear next to the actual- source. then when building docs, filter this file first to leave- only the reference docs, then commandize and pandoc it- installation guide--do haddock for commandcomponents so it has examples and stuff---= New functionality--get checkbig mostly working: not trying to get no type errors or- differences, but to get all the different aspects of the tests- written and running so can see from the output what remains to be- fixed- main issues:- databaseloader isn't working on the chaos sql files anymore, I- think this is an issue with the pretty printer producing invalid- sql- finish extensions: for the tests to mostly work, need to flesh out- the current extension implementations which are mainly stubs- add missing items to catalog: triggers, sequences, constraints,- indexes, defaults--= Amending existing functionality--add dbms database name, username and password support-review holes:- round off parsing support for sql - make a list of what- needs to be added- should try to get as much typechecking working on what parses as- possible- work on organising the type checking tests, and make the tests much- more comprehensive--= Housecleaning--rename Environment type to Catalog-change type annotation from Type to either typecheckfailed Type so can- use monad style to propagate typecheckfaileds-work on error handling: try to add a lot better error reporting:- a few errors are being ignored rather than added to the aast, also- try to change all the calls to error into eithers to be added to- the aast-review commands in hssqlppp: mainly review names and arguments for- consistency (i.e. make sure every command accepts first a- databasename and then a list of sql files where this makes sense),- also redo annotate source so it can be run multiple times on the- same source, and run to update the annotation comments when the- source is changed. Maybe think about better error reporting?-tidy up code, refactor and add lots of comments, particularly in the- ag files--= Documentation--work on haddock documentation-find way to do nice html example documentation: short- intro/tour/tutorial to give people a flavour of what the- hssqlsystem exe can do-want to be able to show what the code can do easily and debug- annotations - so do a pretty printer which works the following way:- output source code on left side of a table (with syntax- highlighting, hyperlinks, etc? - use html?) and on the right output- the interesting annotations pretty printed, draw lines from the- pretty printed annotations to the sourcepositions in the source on- the left. Looks like might be able to do this using gtk:- http://www.bravegnu.org/gtktext/x498.html - maybe convert to png to- allow viewing in a web browser---= other issues to maybe fix:-check associativity of combine selects and join trefs without parens -- write tests using pg_dump output-ids in joins issue-redo order by parsing/ast to add direction to each element-write some notes on hacking: source overview rewrite, file overview- rewrites, and rough howto on adding new constructs: altering- parser, altering ast and altering type checking process-typecheck old and new pseudo records in trigger functions-explore creating template syntax for simple expansions of function- calls to make writing some extensions easier-makefile stuff?-plpgsql stuff: blocks, assignments in declarations, strict into,- labels,loops,continue-look into running test suite from cabal-todo for checkbig:-get initial catalog tests passing:- still some extra table triggers: think it may that foreign keys that- pg supports directly and primary keys don't add a table trigger- name/text result set resolution issue- uniquify constraint names support- trim constraint names support- distance function return type issue- plpgsql language functions---support multiple files in annotate source and check source-match pgdump output for adding explicit parens e.g. in select unions- and table refs, add tests for associativity in the absence of- parens-tidy up code and docs as usual - lots of work needed on type checking- code-redo catalog stuff (see below)-find some way to produce documentation: want motivation, examples,- etc. in nice html-get chaos pgdump output parsing and partially type checking, todo:- two parsing issues: not not, and count(distinct *)- type checking issues exposed:- old,new in trigger functions--old todoage:--================================================================================--== 2nd next release-fix catalog type, lots of work to make more robust:- rename environment to catalog- better pretty printer for catalog, and for bindings- add annotations to catalog, so can see where bits came from- do uniqueness testing e.g. disallow two tables with same name, two- attributes with same name, etc.-fix tests using new catalog approach: don't want to have tests which- use sql to alter catalog then use sql to test the catalog changes- have been made - use separate tests (more unit-y tests)--=== types and internal errors handling--move type check failed to left of either, make node types an either-when there is a type error, add that as separate annotation, and add-type as left typecheckfailed. This way can use the haskell type system-to check we are chaining type check failed properly.-look at all the places where type lists are wrapped in- unnamedcomposite and get rid of most of them - just use the type- list directly.-Look at all the contexts where pg types can be used, and split into- separate haskell types, and use sums to put them back together- to use the haskell type system better e.g. different set of types- can be used for an attribute in a table, for a function parameter,- function return type, variable declaration, etc. - want to use the- haskell type system to enforce this and get rid of a load of- runtime checks (mainly the unwrap setof, etc. in typetype).--make sure errors aren't ignored, lots of places where this currently- happens, e.g. updating environment - these errors need to end up in- the ast. Get all the env functions to return eithers, and stick- errors from these in the ast. Convert error calls to either return- type and stick these errors in the ast.--=== parse/typecheck errors to user--pretty printers for type check failed, work on error messages from parsing-investigate alternative parser libs which can e.g. continue parsing- after an error to provide more parse errors at once.-write a show for parsec errors which formats the lex tokens and- expected lists properly (was broken when moved to the separate- lexer)--================================================================================--== other soon todos--not sure which ones should be done before 0.1 release. rough guide is- 0.1 release should be something that regular sql programmers can- try out/use without being overwhelmed with half finished/ missing- bits, and actually see something useful.--=== schemas--think of a way to handle schemas, what about changes to schema search- path mid code.--=== catalog and bindings annotation--want to add the catalog and current catalog to the annotations, so- e.g. we can pretty print what exact updates are made to the catalog- from a ddl statement-Add the current bindings as annotation everywhere, this can be used by- the ambiguous identifier checks, etc., and to understand errors-also: add annotations to the catalog so we can see where an entity in- the catalog has come from, what update and what source line-add similar to bindings, so each binding annotation contains a little- explanation for where each binding has come from (e.g. identifier a- with type b comes from this tref at source position x,y)--=== casting annotation--for each casting operation, add a log which explains what the relevant- algorithm has done to either find the appropriate cast or what it's- considered before failing. (e.g. can provide a list of steps taken- with the candidate lists in the findcallmatch routine, might be- useful for errors when it can't find a match, and if it is calling- an unexpected function instead of the one you want).-add the prototype of the function actually matched at each funcall- site--=== definition annotations-add sourcepos/reference to definition where each item is referenced- (table, function, view, identifier binding, etc.)--=== documentation produce--=== null checking--null treatment-Basic motivation is to keep nulls carefully walled off, controlled,- and be able to catch them when they sneak back into expressions,- etc.. For each value, etc. we determine statically if it might be- null. This can be done for return types of functions, fields in a- select expression, etc.. (will do mappings e.g. if a functions- inputs are all non null, then the output is non null, etc.). Once- this is working ok, the second stage is to implement the anti null- warnings/ errors.-Allow nulls in tables, outer joins, in coalesce, to be produced by- selects (maybe add or remove from this allowed list, maybe make it- configurable on a per project basis).-Never allow nulls to be an argument to a function call, (including- ops, keyword ops, etc.). So every time you have a field being used- in an expression and it cannot be statically verified to be non- null, you have to insert a coalesce or fix it in some other way.-So nulls can still be used to represent optional values, n/a,- etc.. and output to clients doing selects, but there is no need to- grapple with:-* 3vl (or whatever it is that sql uses instead),-* what the result of a function call is if the some or all the- arguments are null,-* what the result of a sum aggregate is if some of the values are null,-* etc.,-because none of these things are allowed.--=== do sql support todo--fill in the main gaps, some notes below-want to cover '90% of regularly used sql', no attempt for v0.1 to be- comprehensive or nearly comprehensive--=== shadowed identifier test--use the bindings annotation to add warnings--=== modules extension--stage 1: set the current module with a function call-do creating the module and adding objects to the current module using- extension instead of the sql functions used at the moment-find a way to annotate the source with modules stuff, want to use it- for documentation-stage 2: add import/export stuff and check this--=== other extensions for chaos-mark generated code with annotation: make annotation types open with type- class or something? - can get rid of typeerrora, statementinfoa- wrappers this way-check for all ddl, etc. run in functions/executes and turn into- extensions so the type checker can see these things-out of order definitions: want to write defs in any order and- have the extension reorder them into something which can be loaded- into postgres-finish create_var extension: add constraints-constraint system: make a bunch of stuff automatic, like using 'pg- accelerators'-add notify triggers automatically, including for views-convert the sql tests (maybe some of the haskell tests) into static- checks on the ast-find a better way to work with the tables with null fields:- initial values - the copy statements are completely unreadable and- uneditable- what else?-crufty bits to try and simplify: turn sequence progression, action- valid tables, ai-see if can make the multiple update hack more automatic---=== development/deployment support:-build file for development, just lists sql files in order, and lists- which extensions are used-deployment: use system to load all sql via extensions into pg, then-to a regular pg dump which can then be deployed.---=== crufty bits to tidy-ag files constantly need fixing up for documentation and code clarity-syb stuff is a bit messy in astannotations (maybe use uniplate here to- reduce dependencies?)-tidy the annotating functions in astinternals, implement then in terms- of eachother-review local bindings use and decide how much logic to implement- inside the local bindings module rather than eg. tablerefs.ag-want to stop having to write explicit backtrees everywhere. The key to- fixing this is some way to read the existing annotation and supply- an altered annotation within uuagc code-think about how doing multiple passes could help (e.g. star- expansion).-think about where can use quickcheck-review when function bodies are typechecked - see if can do better-annotatesource function is a mess, also, make it overwrite it's own- annotations instead of adding them so you can run it over a file- multiple times.--=== testing-work on making the tests more comprehensive, want a test for each- branch/option where feasible--=== write some automated tests for various roundtrips-add script to test chaos sql in various ways: parse roundtrip, load- into database via psql and via hssqlppp comparison, and check- catalog consistency--=== do way to produce aast from live database--use psql dump, and then can do type checks, lint checks, produce- documentation--=== api-review/work on api and do haddock--=== prepare code for use by non haskell programmers + user docs-provide installation instructions-do usage documentation file, want to run code embedded in doc source- and have results outputted to html output.--=== prepare code for use by haskell client programmers:-user docs as above for using the parser, the extension system, the- annotator and annotations, examples for generating sql and writing- extensions, etc.--=== ? place holder statements--=== precedence and operator parsing-add missing operators to parser-see if @ as prefix and infix just works in parsec-some a_expr and b_expr support properly by looking at pg grammar file-------------some new random notes--literal sql mode, with workspace idea: can write code/sql inline-in the source, and run it against a database and view the results-inline like in some text books where code is executed then the results-printed inline into the result - so this is a partial replacement for- ghci, emacs haskell-mode ghci, psql, maybe bash, maybe ide, and- also a runtime diagnosis tool which can be embedded into production- exes. Pretty ambitious, need to focus on useful and easy features.--variant:-hssqlppp workspace: text view can type in commands and get results- back, create multiple workspaces and they're persistent, maybe- a wrapper round ghci but not conventional repl style, more like- entering elisp and evaluating it in emacs? want to use- as replacement for the ghci thing in emacs, and as a shell for working with- the ast stuff and actual databases--use template haskell to simplify generics in extensions: cases and- replacements are a bit verbose and difficult to write and read?---= parse and/or type check todo list:-(rough/incomplete)-"identifier"-6.5e-5-type 'string' style type cast-[:] slice-missing keyword ops-default template1 operators should all parse-agg(all expr) agg(distinct expr), agg(*)-window frame clauses, named windows-parse inside string literals when cast, for common types-multidimensional arrays-default values-serial-make sure can type check everything that parses-constraint names-provide list of keys in info for create/alter table: include unique- not null and serials-type check fks, and other constraints-alter table: add/remove column- constraint- default value- column type- rename column- rename table-what other alters/creates-views, functions, operators, types, domains, triggers, rules-selects:-implicit joins-group by, having + group by with unaggregated and aggregated fields-distinct, on-order by - do properly-limit, offset-with queries-type modifiers-data type names with spaces in them-timestamps-schemas-alternative text for true and false-enums-geometric types weird syntax-composites: selector variants, rowctors, component get/update-do all keyword and template1 operators-any/some/all subqueries and arrays-check over rowwise comparisons-indexes: create/alter/drop--another todo list:-catalog:-constraints, pg_constraint-triggers-rules-indexes-add drops for all creates-review which alters to add-default columns values + insert checking-support pks,fks better-support serial properly-type modifiers-sequences-enums-listen, notify, pg_listener-blocks in plpgsql, assignments in declarations, not null checking-strict in into-lables, loops, exit, continue-raise % counts-create schema--once all this is done, work on documenting precisely what is supported- and what isn't.--================================================================================--example for generating sql code from haskell using the ast-get database loader and typesafe access generators good enough to use- in chaos-example usage of each of these-look at the error message formatting, particularly try to fix the- parser errors so they make more sense-add annotation field to most ast nodes, store type and source- positioning in this field, fix parser to add lots of accurate- positioning information when parsing.-make sure the lint process works on text dumps of databases.-try checking the sample databases: http://pgfoundry.org/projects/dbsamples/---================================================================================--some syntax todo, not organised:---------------add support for following sql syntax (+ type checking)-alter table, common variations-create index-create rule-create trigger-+ drops for all creates-+ maybe alters?-ctes-loop, exit, labels-easy ones: transactions, savepoints, listen-prepare, execute + using-some more:-create or replace-alter table-transactions: begin, checkpoint, commit, end, rollback-cursors: declare, open, fetch, move, close, where current of-copy - parse properly-create database-create index-create rule-create trigger + plpgsql support-grant,revoke-listen, notify, unlisten-prepare, execute-savepoint, release savepoint, rollback to savepoint-set, reset-set constraints-set role-set transaction-correlated subquery attrs--plpgsql--blocks which aren't at the top level of a function-% types-strict on intos-not null for var defs-exception-execute using-get diagnostics-return query execute-raise missing bits-out params-elsif-loop-exit-labels-reverse, by in for-for in execute--expressions:-process string escapes, support dollar quoting and other quoting more- robustly in the pretty printer-full user operator support (?)-fix expression parser properly to handle things like between - see- grammar in pg source for info on how to do this-[:] array slices-aggregate: all and distinct-multi dimensional arrays: selectors and subscripting-missing keyword operators-datetime extract-time zone-subquery operators: any, some, all-in general, parsing operators is wrong, the lexer needs to be able to- lex sequences of symbols into single/multiple operators correctly,- what happens at the moment is a kludge, also, general operator- parsing will change how operators are represented in the ast--================================================================================--some other random ideas:--more tests:- add parse and type check roundtrips automated tests for chaos sql- add parse check which parses a single statement, then loads it into- pg, pg_dumps it, then parses the output to see if it is the same:- since pg sticks plenty of parens in, this should test the- associativity and precedence. pg also rewrites some of the sql so- will have to match that--parser, converter and pretty printer for explain output, want to view- how a query is executed in human readable pseudocode. Add lint type- checks, etc. to this, which can suggest ways to rewrite the query- to get better performance. Another idea is to make the dependencies- on the values in the tables more explicit, so you can see how much- the data can change before another plan is chosen, or you can see a- bad assumption about the kind of data the query will be run on.--incorporate pg regression test sql into parsing and type checking- tests - can run the roundtrip tests on them, check the- documentation generator, etc.--redo cabal file to add compile time options: exes, pg support, tests- or split into separate packages?--work on error reporting, add tests for malformed sql, already some- tests and plan for more for sql which fails type checks.--want to report multiple parse errors, perhaps can bodge this because- of the property that ';' can only appear inside a string or- comment, or otherwise at the end of a statement, so add some code- to jump to the next end of statement looking ';' and continue to- parse to end of file in an attempt to catch at least some further- syntax errors--get property checker working again - one problem is that the pretty- printer will reject some asts (which the parser cannot- produce), and the parser will probably reject some invalid sql that- the pretty printer will happily produce from some asts.--plpgsql on 'roids:-write libraries in haskell, and then write syntax extensions for- plpgsql using the extension mechanism to access these libs from- extended plpgsql e.g. ui lib written in haskell, accessed by syntax- extensions in plpgsql then can write the database and ui all in the- same source code in the same language, with first class support for- properly typed relation valued expressions, avoiding multiple- languages and mapping/'impedance mismatch' between database types- and types in the language you write the ui in.
− docs/changelog
@@ -1,60 +0,0 @@-cleaning--typechecking support for a few more contexts for expressions (e.g. on-expressions in joins, check expressions, wheres in updates and-deletes, etc.)-type checking support for a few more statement types-work on implicit casts-improvements to checksource command-prototype idea for extension system-hack to improve typechecking of function bodies - they are now type-checked after the whole rest of the file-lots of work on catalog typechecking--main internal changes:-lots of refactoring-heavy rearrangement of ag code, it's not a complete mess anymore-split local binding code from catalog code--environment--New environment data type with abstracted implementation, can now-process ddl in a script and type check against it. Some work on-variable scoping, and annotations. New commands: annotateSource (adds-some annotations for statements into the original source code as-comments), and checksource, which outputs type errors in emacs-friendly format.--annotated tree--The API and type checking code has had a major overhaul, now uses-annotations inline in the ast, has rudimentary haddock documentation,-and the API is starting to take shape. No significant progress on-actual parsing or typechecking since last release.--secondtypechecking--typechecks a fair amount of select statements, and does some type-checking of insert, update, delete and create statements. It can also-take a sql file and parse, type check, and spit it back out with type-checking information interspersed with the statements (but with the-formatting mangled and the comments stripped).---earlytypechecking--hasn't fixed the error messages, but can now type check some select-statements, it includes a command to read a sql file in, type check it-against a database, then pretty print the ast interspersed with the-inferred types of each statement in comments.---lexing--parses with a separate lexer, unfortunately the error messages have-gone wrong.---prealpha1--parses without a separate lexer and gives ok error messages
− docs/development
@@ -1,150 +0,0 @@-Some brief notes on developing with this code.--UUAGC is used in the type checking, there are some links at the top of-AstInternal.ag for more information.--The code uses a few GHC extensions, I don't know if they are-conservative extensions or not, see the cabal file and grep to find-out the current list.--Two of the files are generated:--DefaultTemplate1Environment.hs -> generated using- ./HsSqlSystem.lhs readenv template1 > something && cp something ...- You shouldn't need to regenerate this file unless you change the- Environment data type.--AstInternal.hs -> this is generated from AstInternal.ag and- Typechecking.ag using uuagc, see AstInternal.ag for the exact- arguments to use.--If you are editing either of these generated files directly you're-probably doing something wrong.--See the file 'usage' which documents a bunch of utility functions you-can run from the command line, you can look and HsSqlSystem.lhs source-for some example usage.--There are rudimentary test for a lot of the functionality, see-ParserTests.lhs and AstCheckTests.lhs (for type checking). These-contain some small examples of how the code can be used. The-HsSqlSystem.lhs file contains a few more examples.--Source file overview:--HsSqlSystem.lhs--Main executable to provide command line access to library functions,-mainly utilities to help with developing the source. Run-'./HsSqlSystem.lhs help' to list the commands. You can run the-automated tests using './HsSqlSystem.lhs test'.--All the other source code is under Database/HsSqlSystem/--Database/HsSqlPpp/Utils.lhs contains some small utility functions.--The main folders under Database/HsSqlPpp are:--Ast: public modules which forward parts of the internal ast and-typechecking code--AstInternals: private modules for ast, annotations, typechecking, etc.- also contains all the .ag files.--Commands: ErrorT wrappers for many library functions, used heavily in-HsSqlSystem.lhs--Dbms: Some rudimentary and half baked code to access databases.--Extensions: expermental code for a syntax extension system for plpgsql--HsText: code to help producing documentation: will process a text-file, extract commands, run them, and interpolate the output into the-text.--Parsing: the parsing code--PrettyPrinter: pretty printing code--Tests: hunit tests---Main code files:--The main parsing code is in Database/HsSqlPpp/Parsing/Lexer.lhs and-Database/HsSqlPpp/Parsing/Parser.lhs--The main pretty printing code is in-Database/HsSqlPpp/PrettyPrinter/PrettyPrinter.lhs and there is also-some code to insert types, etc. into the original source in-Database/HsSqlPpp/PrettyPrinter/AnnotateSource.lhs--The main ast and typechecking code is in the following files:--attribute grammar files:-Database/HsSqlPpp/AstInternals/AstInternal.ag contains the ast nodes-Database/HsSqlPpp/AstInternals/Typechecking/ contains the ATTR and SEM code-for type checking-These are supplemented by a bunch of helper modules:--Database/HsSqlPpp/AstInternals/TypeConversion.lhs - contains the code-which handles the implicit type cast resolution (these are postgresql-algorithms used to lookup function calls, work out the types of result-sets and check assignments).--Database/HsSqlPpp/AstInternals/TypeCheckingH.lhs - contains some code-which has been moved out of TypeChecking.ag for ease of development--Database/HsSqlPpp/AstInternals/AstAnnotation.lhs - contains the data-types and a few helper functions for the annotation data types.--Database/HsSqlPpp/AstInternals/TypeType.lhs - contains the data types-and a few helper functions for postgresql types, and also type errors.--Database/HsSqlPpp/AstInternals/AstUtils.lhs - contains some error handling utils--Database/HsSqlPpp/AstInternals/AnnotationUtils.lhs - contains some-additional annotation functions which depend on the ast nodes--the code to track environment changes during type checking-(e.g. catalog changes, variables/bindings) is in the following two files:-Database/HsSqlPpp/AstInternals/EnvironmentInternal.lhs - the main code-to create, update and use environments.-Database/HsSqlPpp/AstInternals/EnvironmentReader.lhs - code to read a-catalog from a database and produce an environment value.-Database/HsSqlPpp/AstInternals/DefaultTemplate1Environment.lhs - this-is a copy of the default template1 database environment--The code under Database/HsSqlPpp/AstInternals/ is hidden behind the-public modules in Database/HsSqlPpp/Ast/:-Database/HsSqlPpp/Ast/Annotator.lhs-Database/HsSqlPpp/Ast/Ast.lhs-Database/HsSqlPpp/Ast/Environment.lhs-Database/HsSqlPpp/Ast/Annotation.lhs-These pretty much just forward exports, and add a bit of haddock-organisation.--The hunit tests are in:-Database/HsSqlPpp/Tests/AstCheckTests.lhs-Database/HsSqlPpp/Tests/ParserTests.lhs-and also this file which isn't really used yet:-Database/HsSqlPpp/Tests/DatabaseLoaderTests.lhs--There are a few utilities to access databases in-Database/HsSqlPpp/Dbms/, this code is very sketchy.--These files all have (hopefully) useful comments, although many of-these haven't been kept up to date.--The error handling in the type checking code is in flux so quite a lot-of the code there is a bit of a mess unfortunately (I'm still not sure-what the best way to do this is.).--Also, some of the annotation functions use SYB which I'm a bit crap-with so that code is also a bit of a mess.--The test coverage isn't really great, but it's not bad (this will be-fixed at some point).--The bits which I hope aren't too bad are the ast node data types, the-parser code, and the catalog code.
− docs/recordtests.sql
@@ -1,370 +0,0 @@-/*--record tests: try to find out exactly how records work-run a bunch of functions and check the results--run this file by loading psql then issuing \i recordtests.sql--the output from doing this has been manually pasted into this file in-comments--start with something to help understand the psql output--*/-create or replace function doingfn(fn text) returns void as $$-begin- raise notice '\n===================================================\nFUNCTION: %\n-------------------------------------------',fn;-end;-$$ language plpgsql;----select doingfn('t1');--create or replace function t1() returns void as $$-declare- r record;- t pg_attrdef;-begin- select into r * from pg_attrdef;- t := r;- raise notice 'r: %',r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t1();--/*-result from this select is:-*************************-psql:recordtests.sql:20: NOTICE: r: (258241,3,"{FUNCEXPR :funcid 480 :funcresulttype 23 :funcretset false :funcformat 2 :args ({FUNCEXPR :funcid 1574 :funcresulttype 20 :funcretset false :funcformat 0 :args ({CONST :consttype 2205 :consttypmod -1 :constlen 4 :constbyval true :constisnull false :location -1 :constvalue 4 [ -65 -16 3 0 ]}) :location -1}) :location -1}","nextval('modules_module_order_seq'::regclass)")-psql:recordtests.sql:20: NOTICE: t: (258241,3,"{FUNCEXPR :funcid 480 :funcresulttype 23 :funcretset false :funcformat 2 :args ({FUNCEXPR :funcid 1574 :funcresulttype 20 :funcretset false :funcformat 0 :args ({CONST :consttype 2205 :consttypmod -1 :constlen 4 :constbyval true :constisnull false :location -1 :constvalue 4 [ -65 -16 3 0 ]}) :location -1}) :location -1}","nextval('modules_module_order_seq'::regclass)")- t1 ------ -(1 row)-*************************--the output is a list of values, looks like each has a type but we-don't get any field names, will investigate the field name aspects-below--The output from t and r are exactly the same - looks like the record-is pointing to exactly the same type of value that the composite variable is.--*/---- test two: build a record out of bits and then try to assign to a composite-select doingfn('t2');--create or replace function t2() returns void as $$-declare- r record;- t pg_attrdef;-begin- r.adrelid := 1;- --r.adnum := 2;- --r.adbin = 'adbinval';- --r.adsrc = 'adsrcval';- --raise notice 'r: %',t;- --t := r;- --raise notice 't: %',t;-end;-$$ language plpgsql;--select t2();-/*-psql:recordtests.sql:37: ERROR: record "r" is not assigned yet-DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.-CONTEXT: PL/pgSQL function "t1" line 5 at assignment--didn't know whether this would work or not, but this is only because I-didn't read the postgresql manual properly, it's noted in-38.3.4. Record Types--*/---- test three - assign to record from row ctor-select doingfn('t3');--create or replace function t3() returns void as $$-declare- r record;- t pg_attrdef;-begin- r := row(1,2,'adbinval','adsrcval');- raise notice 'r: %',r;- t := r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t3();-/*-output is:-psql:recordtests.sql:105: NOTICE: r: (,,,)-psql:recordtests.sql:105: NOTICE: t: (1,2,adbinval,adsrcval)--so:-the assignment worked, but we can't see the fields with the row-constructor value in the record for some reason. This suggests the row-isn't the same type as the composite or even the same kind of type,-but it is compatible. Next check: see what happens when the row ctor-value types are in the wrong order.-*/--select doingfn('t4');--create or replace function t4() returns void as $$-declare- r record;- t pg_attrdef;-begin- r := row('adbinval',1,2,'adsrcval');- raise notice 'r: %',t;- t := r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t4();--/*-psql:recordtests.sql:143: NOTICE: r: (,,,)-psql:recordtests.sql:143: ERROR: invalid input syntax for type oid: "adbinval"-CONTEXT: PL/pgSQL function "t4" line 7 at assignment--so this fails. So the the order of values counts. I think this would-mean our row ctor which assign succeeds above produces an anonymous-composite type with the structure:--(a:number,b:number,c:unknownstringlit,d:unknownstringlit)--where a,b,c,d are anonymous name placeholders, so we can't use them to-access the individual parts.--then we use the check assignment cast value one by one over the values to work out if the assign from the record to the composite type works.--next: check the number of fields behaviour-*/---select doingfn('t5');--create or replace function t5() returns void as $$-declare- r record;- t pg_attrdef;- b bool;-begin- r := row(1,2,'adbinval','adsrcval', 3,null,true,'is this ignored?');- raise notice 'r: %',t;- t := r;- raise notice 't: %',t;- --todo: investigate equalities in same way as assignments- b := row(1,2,'adbinval','adsrcval') = row(1,2,'adbinval','a1dsrcval');- raise notice 'b: %',b;-end;-$$ language plpgsql;--select t5();--/*-psql:recordtests.sql:173: NOTICE: r: (,,,)-psql:recordtests.sql:173: NOTICE: t: (1,2,adbinval,adsrcval)--slightly disappointing - it works instead of giving an error, with the-extra fields ignored.--test composite variations on this - see if extra fields are ignored there too--Want to check if the field names are significant for named composite-types with non anonymous field names.-- check composite to composite assignment with- same names and types- different names same types- same names and types but different order- check if extra fields get ignored or cause error as with row values--*/--select doingfn('t6');-drop type if exists fake_pg_attrdef;-create type fake_pg_attrdef as (- adrelid oid,- adnum int2,- adbin text,- adsrc text-);----just test a bunch of stuff which should definitely work as sanity check-create or replace function t6() returns void as $$-declare- t pg_attrdef;- u fake_pg_attrdef;- r record;-begin- u := (1,2,'adbinval','adsrcval');- t := u;- raise notice 'u: %',u;- raise notice 't: %',t;- r := u;- t := r;- raise notice 'u: %',r;- raise notice 'r: %',r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t6();--/*-works fine:-psql:recordtests.sql:220: NOTICE: u: (1,2,adbinval,adsrcval)-psql:recordtests.sql:220: NOTICE: t: (1,2,adbinval,adsrcval)-psql:recordtests.sql:220: NOTICE: u: (1,2,adbinval,adsrcval)-psql:recordtests.sql:220: NOTICE: r: (1,2,adbinval,adsrcval)-psql:recordtests.sql:220: NOTICE: t: (1,2,adbinval,adsrcval)--check if field names are significant:-*/--select doingfn('t7');-drop type if exists fake_renamed_pg_attrdef;-create type fake_renamed_pg_attrdef as (- a oid,- b int2,- c text,- d text-);--create or replace function t7() returns void as $$-declare- t pg_attrdef;- u fake_renamed_pg_attrdef;- r record;-begin- u := (1,2,'adbinval','adsrcval');- t := u;- raise notice 'u: %',u;- raise notice 't: %',t;- r := u;- t := r;- raise notice 'u: %',r;- raise notice 'r: %',r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t7();--/*-works fine also:-psql:recordtests.sql:261: NOTICE: u: (1,2,adbinval,adsrcval)-psql:recordtests.sql:261: NOTICE: t: (1,2,adbinval,adsrcval)-psql:recordtests.sql:261: NOTICE: u: (1,2,adbinval,adsrcval)-psql:recordtests.sql:261: NOTICE: r: (1,2,adbinval,adsrcval)-psql:recordtests.sql:261: NOTICE: t: (1,2,adbinval,adsrcval)--check field order is important:-*/--select doingfn('t8');-drop type if exists fake_renamed2_pg_attrdef;-create type fake_renamed2_pg_attrdef as (- adnum int2,- adbin text,- adsrc text,- adrelid oid-);--create or replace function t8() returns void as $$-declare- t pg_attrdef;- u fake_renamed2_pg_attrdef;- r record;-begin- u := (2,'adbinval','adsrcval',1);- --t := u;- raise notice 'u: %',u;- raise notice 't: %',t;- r := u;- t := r;- raise notice 'u: %',r;- raise notice 'r: %',r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t8();--/*-fails:-psql:recordtests.sql:300: ERROR: invalid input syntax for integer: "adbinval"-also fails with same error earlier if you uncomment the commented out line-confirmation: pg is just looking at the types in order and ignoring-the names. This seems consistent with the rest of sql (e.g. unions)...--check extra fields-*/--select doingfn('t9');-drop type if exists fake_renamed3_pg_attrdef;-create type fake_renamed3_pg_attrdef as (- adrelid oid,- adnum int2,- adbin text,- adsrc text,- hello text-);--create or replace function t9() returns void as $$-declare- t pg_attrdef;- u fake_renamed3_pg_attrdef;- r record;-begin- u := (1,2,'adbinval','adsrcval','test');- r := u;- t := r;- raise notice 'u: %',r;- raise notice 'r: %',r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t9();-/*-yes, it works just like the row ctor. ignores the extra field-psql:recordtests.sql:340: NOTICE: u: (1,2,adbinval,adsrcval,test)-psql:recordtests.sql:340: NOTICE: r: (1,2,adbinval,adsrcval,test)-psql:recordtests.sql:340: NOTICE: t: (1,2,adbinval,adsrcval)--check with missing fields:-*/--select doingfn('t10');-create or replace function t10() returns void as $$-declare- t pg_attrdef;- u fake_renamed3_pg_attrdef;- r record;-begin- u := (1,2,'adbinval');- r := u;- t := r;- raise notice 'u: %',r;- raise notice 'r: %',r;- raise notice 't: %',t;-end;-$$ language plpgsql;--select t10();-/*-yep, works-psql:recordtests.sql:363: NOTICE: u: (1,2,adbinval,,)-psql:recordtests.sql:363: NOTICE: r: (1,2,adbinval,,)-psql:recordtests.sql:363: NOTICE: t: (1,2,adbinval,)--*/
− docs/status
@@ -1,87 +0,0 @@-Rough notes on status, probably a bit out of date. You can also see the test files:--http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Tests/ParserTests.lhs--and--http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Tests/AstCheckTests.lhs--to see a load of examples of what type checks.--= Syntax supported/ not supported:--== Parsing--Partially supports:-select statements (selectlists (*, qualified, aliased/correlation names, expressions)- distinct, basic window functions,- from (with explicit joins - natural, inner, cross, left, right,- full outer, on and using), aliases, from functions- where, group by, having, order by, limit, offset- except, intersect, union--expressions: subselects, in, row ctors, strings + dollar strings,- integers, case, exists, boolean literals, null, arrays- and subscripting (slightly limited), function calls,- identifiers, cast(x as y), between (quite limited),- substring(x from a for b)--also partially supports:-insert (with multiple values and select support), update, delete (all-three with returning)-create and drop table, type, view, domain-create function for sql and plpgsql functions-all constraint types-sort of skips copy statements instead of erroring--plpgsql statements:- select into- null- continue- perform- execute- assignment- if- return, return next, return query- raise- for (select and integer variants)- while- case statement--Many things are missing at the moment, in particular- selects: cte, implicit joins- joins in updates (delete from, update using)- alter statements- create and drop apart from table, view, domain, type, function- transaction commands- triggers and trigger functions- loop statement, labels- error trapping- cursors-This is a non-exhaustive list.--Expression support is patchy, should work pretty well for a lot of-simple stuff though. There is a strong possibility that for some-complex selects and expressions, the implicit precedence (that is,-bits without enclosing parenthesis) may parse in the wrong-direction. Please let me know if you encounter such an error.--== Type checking--Type checking supports a good subset of expressions and select-statements that the parser parses, and has basic support for insert,-update, delete and the various create statements that the parser-supports. Development work is currently focused in this area.--= Other current downsides:--The design of the AST node types is pretty basic.--Not much work has been done on correctly rejecting invalid SQL-(although it does pretty well despite this) and not much thought has-been put into error messages and error reporting yet, this is slowly-improving, and at some point will become a major focus - I hope this-code will provide substantial benefits when developing in PL/pgSQL in-the future.--Only supports PostgreSQL SQL and PL/pgSQL.
− docs/usage
@@ -1,145 +0,0 @@-Here are some notes on what you can currently do with the code:--** This file is a bit out of date, you can run 'HsSqlSystem -?' to- get started **--= HsSqlSystem--Command line access to a number of functions is provided by-HsSqlSystem.lhs. You can list the commands using 'HsSqlSystem help',-and you can get the descriptions of what these commands do using-'HsSqlSystem help all'. (Assuming you have cabal installed the-software and have the cabal binary folder in your path.)--The commands which access postgresql probably won't work right on your-system, they are in a very early alpha state.--The most interesting commands are:-* parsefile-* roundtripfile, loadsql-* annotateSource-* checksource---== parsefile--Pass in one or more filenames for files containing sql source, and the-program will attempt to parse, then pretty print and reparse to see if-the two asts are the same. This can be used to check the program can-successfully parse your sql, and if pretty printing then parsing the-result mangles it - lack of such mangling might give you slightly more-confidence that it has parsed ok.--== roundtripfile, loadsql--Similar to parse file, pass in a source filename and a target-filename, and the code with parse then pretty print the text. You can-then load the pretty printed code into a database and run your test-suite to see if the code made it through the parsing and pretty-printing process ok, or you can just eyeball the resultant-sql.--The related command is loadsql, which will attempt to parse one or-more files then pretty print them line by line, loading each line-straight into a database to help with testing. This may be a bit more-fragile than using roundtripfile.--Loading the roundtripped sql into a database then running tests on it-will hopefully can give a bit more confidence that the sql has been-parsed accurately.--== annotateSource--This command takes a filename, parses and type checks the file, and-then outputs a copy of the source with the main annotations attached-to the statements interspersed into the source in comments. This can-be used e.g. to view the attribute names and types of a view. After-some more work has been done on this command, it is intended that this-is expanded to provide lots of useful comments which are maintained in-your actual source and checked in to source control, etc..--== checksource--This command takes a set of files and type checks each one in turn-(later files can depend on definitions appearing in files earlier in-the file list). It outputs all the type errors found in Emacs friendly-format. This mostly just shows you all the bits that haven't been-implemented in the type checker yet. This is the early precursor to-the lint checking process.--Pretty printers and other work for the Annotation types are planned,-to make the annotateSource comments and error messages more readable.--== reasonably up to date output of './HsSqlSystem.lhs help all'--commands available-help-use 'help' to see a list of commands-use 'help all' to see a list of commands with descriptions-use 'help [command]' to see the description for that command--cleardb-hacky util to clear a database--loadsql-This takes one or more files with sql source text, parses them then-loads them into the database given.--clearandloadsql-cleardb then loadsql--lexfile-lex the file given and output the tokens on separate lines--parsefile-Routine to parse sql from a file, check that it appears to parse ok,-that pretty printing it and parsing that text gives the same ast, and-then displays the pretty printed version so you can see how well it's-done--roundtripfile-Used to test the parsing and pretty printing round trip. Takes two-arguments, a source filename and a target filename. If the target file-exists, it quits. Parses the source file then pretty prints it to the-target filename.--readenv-read the catalogs for the given db and dump a Environment value source-text to stdout--annotateSource-reads a file, parses, type checks, then outputs info on each statement-interspersed with the original source code--checksource-reads each file, parses, type checks, then outputs any type errors--================================================================================--= library usage--See the haddock docs to get a basic idea of using the libraries. The-source for HsSqlSystem.lhs might also be worth a look for some-examples. You should be able to view the haddock docs online on the-hackagedb page here:-http://hackage.haskell.org/package/hssqlppp--Quick notes:--to parse some sql use the parse functions in-Database.HsSqlPpp.Parsing.Parser: 'parseSql' to parse from a string,-'parseSqlFile' to parse from a file. This will give you an ast with-source position annotations. If you want to get rid of these-annotations, use 'Database.HsSqlPpp.Ast.Annotation.stripAnnotations'.-To typecheck and add other information to the ast, use-'Database.HsSqlPpp.Ast.TypeChecker.typeCheck'. You can read the-environment value from a database to check against that database, or-parse the ddl source along with your dml and concatenate them both to-pass to the typeCheck function.--================================================================================--= run the automated tests--To run the test suite run ./HsSqlSystem.lhs test. This will run the tests-for parsing and pretty printing, and for type checking.
hssqlppp.cabal view
@@ -1,242 +1,196 @@ Name: hssqlppp-Version: 0.1.0-Synopsis: Sql parser and type checker-Description:- Sql parser, pretty printer and type checker, targets PostgreSQL SQL- and PL/pgSQL, uses Parsec and UUAGC.- .- Overview:- .- see the module 'Ast' for the ast types;- .- 'Parser' for converting text to asts;- .- 'PrettyPrinter' for converting asts to text;- .- 'AnnotateSource' for pretty printing annotations inline with original source;- .- 'TypeChecker' for type checking and annotating asts and working- with annotated trees;- .- 'SqlTypes' for the data types which represent SQL types, the data- type for type errors, and some support functions;- .- 'Annotation' for the annotation data types and utilities;- .- 'Environment' to read a catalog from a database to type check against,- or to generate catalog information;- .- 'DatabaseLoader' for the beginnings of a routine to load SQL into- a database (e.g. to generate an ast then load it into a database- without loading it via psql). The loader just about does the job- but error handling is a bit crap at the moment.- .- 'CommandComponents' for the component functions used in the HsSqlSystem- exe.- .- 'ChaosExtensions' for the experimental plpgsql syntax extensions.- .- Comes with command line access to some- functions via a exe called HsSqlSystem, run this file with no- arguments to get some help. Has a HUnit test suite which you can- run using the HsSqlSystem executable. for the time being you can- look at the source of this command to see what it can do:- .- <http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head:/HsSqlSystem.lhs>- .- See the project page- <https://launchpad.net/hssqlppp> for more information and- documentation links.- .- The test files for parsing and for type checking contain examples- of what parses/ typechecks and what the asts and annotations look- like:- .- <http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head:/Database/HsSqlPpp/Tests/ParserTests.lhs>- .- <http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head:/Database/HsSqlPpp/Tests/TypeCheckTests.lhs>-+Version: 0.6.2+Synopsis: SQL parser and type checker License: BSD3 License-file: LICENSE-Author: Jake Wheat+Author: Jake Wheat, SQream Maintainer: jakewheatmail@gmail.com Build-Type: Simple-Cabal-Version: >=1.2.3-copyright: Copyright 2009 Jake Wheat-stability: pre-alpha-homepage: https://launchpad.net/hssqlppp-bug-reports: mailto:jakewheatmail@gmail.com-category: Database+Cabal-Version: >=1.10+copyright: Copyright 2009-2015 Jake Wheat, Copyright 2011-2015 SQream+homepage: http://jakewheat.github.com/hssqlppp/+bug-reports: https://github.com/JakeWheat/hssqlppp/issues+category: Database,Language+Description:+ SQL parser and type checker, targets PostgreSQL SQL and PL/pgSQL.+ .+ Pre alpha: works well and is stable for a subset of SQL, but there+ are lots of unfinished areas and the api is likely to change a lot+ from release to release at this time.+ .+ Documentation, examples on the homepage:+ <http://jakewheat.github.com/hssqlppp/>.+ .+ Changes here: <https://github.com/JakeWheat/hssqlppp/blob/master/CHANGES> extra-source-files: README LICENSE- docs/changelog- docs/development- docs/Introduction.txt- docs/recordtests.sql- docs/status- docs/TODO- docs/usage- sqltestfiles/system.sql- sqltestfiles/server.sql- sqltestfiles/client.sql- --find Database/ -type f -a ! -iname '*.o' -a ! -iname '*.hi'- Database/HsSqlPpp/Utils.lhs- Database/HsSqlPpp/Commands/CommandComponents.lhs- Database/HsSqlPpp/Dbms/DBAccess.lhs- Database/HsSqlPpp/Dbms/DatabaseLoader.lhs- Database/HsSqlPpp/Dbms/WrapLib.lhs- Database/HsSqlPpp/Dbms/WrapperGen.lhs- Database/HsSqlPpp/Extensions/ChaosExtensions.lhs- Database/HsSqlPpp/AstInternals/AnnotationUtils.lhs- Database/HsSqlPpp/AstInternals/AstAnnotation.lhs- Database/HsSqlPpp/AstInternals/AstInternal.hs- Database/HsSqlPpp/AstInternals/Environment/DefaultTemplate1Environment.lhs- Database/HsSqlPpp/AstInternals/Environment/EnvironmentReader.lhs- Database/HsSqlPpp/AstInternals/Environment/EnvironmentInternal.lhs- Database/HsSqlPpp/AstInternals/Environment/LocalIdentifierBindings.lhs- Database/HsSqlPpp/AstInternals/AstInternal.ag- Database/HsSqlPpp/AstInternals/TypeType.lhs- Database/HsSqlPpp/AstInternals/TypeChecking/Dml.ag- Database/HsSqlPpp/AstInternals/TypeChecking/SelectStatement.ag- Database/HsSqlPpp/AstInternals/TypeChecking/TypeConversion.lhs- Database/HsSqlPpp/AstInternals/TypeChecking/TableRefs.ag- Database/HsSqlPpp/AstInternals/TypeChecking/Plpgsql.ag- Database/HsSqlPpp/AstInternals/TypeChecking/TypeChecking.ag- Database/HsSqlPpp/AstInternals/TypeChecking/Misc.ag- Database/HsSqlPpp/AstInternals/TypeChecking/ErrorUtils.lhs- Database/HsSqlPpp/AstInternals/TypeChecking/CreateTable.ag- Database/HsSqlPpp/AstInternals/TypeChecking/CreateFunction.ag- Database/HsSqlPpp/AstInternals/TypeChecking/Statements.ag- Database/HsSqlPpp/AstInternals/TypeChecking/SelectLists.ag- Database/HsSqlPpp/AstInternals/TypeChecking/Expressions.ag- Database/HsSqlPpp/AstInternals/TypeChecking/Drops.ag- Database/HsSqlPpp/AstInternals/TypeChecking/MiscCreates.ag- Database/HsSqlPpp/Wrapper/WrapperTemplate.lhs- Database/HsSqlPpp/Tests/ExtensionTests.lhs- Database/HsSqlPpp/Tests/ParserTests.lhs- Database/HsSqlPpp/Tests/DatabaseLoaderTests.lhs- Database/HsSqlPpp/Tests/RoundtripTests.lhs- Database/HsSqlPpp/Tests/TypeCheckTests.lhs- Database/HsSqlPpp/Tests/ParameterizedStatementTests.lhs- Database/HsSqlPpp/Here.lhs- Database/HsSqlPpp/PrettyPrinter/AnnotateSource.lhs- Database/HsSqlPpp/PrettyPrinter/PrettyPrinter.lhs- Database/HsSqlPpp/HsText/Commands.lhs- Database/HsSqlPpp/HsText/HsText.lhs- Database/HsSqlPpp/Parsing/Lexer.lhs- Database/HsSqlPpp/Parsing/Parser.lhs- Database/HsSqlPpp/Parsing/ParseErrors.lhs- Database/HsSqlPpp/Ast/Ast.lhs- Database/HsSqlPpp/Ast/Environment.lhs- Database/HsSqlPpp/Ast/Annotation.lhs- Database/HsSqlPpp/Ast/SqlTypes.lhs- Database/HsSqlPpp/Ast/TypeChecker.lhs +source-repository head+ type: git+ location: https://github.com/JakeWheat/hssqlppp.git+ Library Build-Depends: base >= 4 && < 5,- mtl,- parsec >= 3,- pretty,- containers,- regex-posix,- HDBC,- HDBC-postgresql,- directory,- syb,- uniplate,- pretty-show,- Pipe,- process,- --pandoc == 1.2.1,- filepath,- template-haskell,- haskell-src-exts+ containers >= 0.3.0.0 && < 0.7,+ mtl >= 2.0.1.0 && < 2.3,+ parsec >= 3.1.2 && < 3.2,+ pretty >= 1.0 && < 1.2,+ syb >= 0.1.0.2 && < 0.8,+ text >= 0.11.1.13 && < 1.3,+ uniplate >= 1.6 && < 1.7,+ transformers >= 0.3 && < 0.6,+ pretty-show >= 1.6 && < 1.10 - Exposed-modules: Database.HsSqlPpp.Ast.Ast- Database.HsSqlPpp.Ast.TypeChecker- Database.HsSqlPpp.Ast.Environment- Database.HsSqlPpp.Ast.Annotation- Database.HsSqlPpp.Ast.SqlTypes- Database.HsSqlPpp.Parsing.Parser- Database.HsSqlPpp.PrettyPrinter.PrettyPrinter- Database.HsSqlPpp.PrettyPrinter.AnnotateSource- Database.HsSqlPpp.Dbms.DatabaseLoader- Database.HsSqlPpp.Commands.CommandComponents- Database.HsSqlPpp.Extensions.ChaosExtensions+ hs-source-dirs: src+ Exposed-modules: Database.HsSqlPpp.Annotation+ Database.HsSqlPpp.Catalog+ Database.HsSqlPpp.Dialect+ Database.HsSqlPpp.Lex+ Database.HsSqlPpp.Parse+ Database.HsSqlPpp.Pretty+ Database.HsSqlPpp.Syntax+ Database.HsSqlPpp.Types+ Database.HsSqlPpp.TypeCheck+ Database.HsSqlPpp.Utility - Other-Modules: Database.HsSqlPpp.Utils- --Database.HsSqlPpp.Here- Database.HsSqlPpp.Dbms.DBAccess- Database.HsSqlPpp.Dbms.WrapperGen- Database.HsSqlPpp.Dbms.WrapLib- Database.HsSqlPpp.AstInternals.AnnotationUtils- Database.HsSqlPpp.AstInternals.AstAnnotation- Database.HsSqlPpp.AstInternals.AstInternal- Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment- Database.HsSqlPpp.AstInternals.Environment.EnvironmentReader- Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal- Database.HsSqlPpp.AstInternals.Environment.LocalIdentifierBindings- Database.HsSqlPpp.AstInternals.TypeType- Database.HsSqlPpp.AstInternals.TypeChecking.TypeConversion- Database.HsSqlPpp.AstInternals.TypeChecking.ErrorUtils- Database.HsSqlPpp.Tests.ExtensionTests- Database.HsSqlPpp.Tests.TypeCheckTests- Database.HsSqlPpp.Tests.ParserTests- Database.HsSqlPpp.Tests.DatabaseLoaderTests- Database.HsSqlPpp.Tests.ParameterizedStatementTests- Database.HsSqlPpp.HsText.Commands- Database.HsSqlPpp.HsText.HsText- Database.HsSqlPpp.Parsing.Lexer- Database.HsSqlPpp.Parsing.ParseErrors+ -- find src -iname '*hs' | sed -e "s@src/@@" | sed -e "s@/@.@g" |sed -e "s/.lhs//" |sed -e "s/.hs//"+ Other-Modules: Database.HsSqlPpp.Internals.TypeChecking.OldTediousTypeUtils+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion2+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.OldTypeConversion+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.SqlTypeConversion+ Database.HsSqlPpp.Internals.TypeChecking.Environment+ Database.HsSqlPpp.Internals.LexInternal+ Database.HsSqlPpp.Internals.Dialect+ Database.HsSqlPpp.Internals.ParseInternal+ Database.HsSqlPpp.Internals.PrettyInternal+ Database.HsSqlPpp.Internals.Catalog.CatalogUtils+ Database.HsSqlPpp.Internals.Catalog.CatalogTypes+ Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+ Database.HsSqlPpp.Internals.Catalog.CatalogInternal+ Database.HsSqlPpp.Internals.Catalog.CatalogNew+ Database.HsSqlPpp.Internals.AstInternal+ Database.HsSqlPpp.Internals.TypesInternal+ Database.HsSqlPpp.Internals.ParseErrors+ Database.HsSqlPpp.Internals.Utils+ Database.HsSqlPpp.Dialects.SqlServer+ Database.HsSqlPpp.Dialects.GeneratedPostgres+ Database.HsSqlPpp.Dialects.Postgres+ Database.HsSqlPpp.Dialects.Oracle+ Database.HsSqlPpp.Dialects.OdbcCatalog+ Database.HsSqlPpp.Dialects.BaseCatalog+ Database.HsSqlPpp.Dialects.Ansi - extensions: DeriveDataTypeable,RankNTypes,ScopedTypeVariables+ default-language: Haskell2010+ ghc-options: -Wall -Executable HsSqlSystem- Main-is: HsSqlSystem.lhs+Test-Suite Tests+ type: exitcode-stdio-1.0+ main-is: Tests.lhs+ hs-source-dirs: src,tests+ Build-Depends: base >= 4 && < 5,+ containers >= 0.3.0.0 && < 0.7,+ haskell-src-exts >= 1.13 && < 1.22,+ mtl >= 2.1 && < 2.3,+ parsec >= 3.1 && < 3.2,+ pretty >= 1.0 && < 1.2,+ syb >= 0.1.0.2 && < 0.8,+ template-haskell,+ tasty >= 0.10 && < 1.3,+ tasty-hunit >= 0.9 && < 0.11,+ text >= 0.11.1.13 && < 1.3,+ uniplate >= 1.6 && < 1.7,+ transformers >= 0.3 && < 0.6,+ pretty-show >= 1.6 && < 1.10 - Build-Depends: base,- haskell98,- regex-posix,- HDBC,- HDBC-postgresql,- directory,- test-framework,- test-framework-hunit,- HUnit,- cmdargs+ -- rough start:+ -- find src-extra/tests -iname '*hs' | sed -e "s@src-extra/tests/@@" | sed -e "s@/@.@g" |sed -e "s/.lhs//" |sed -e "s/.hs//"+ Other-Modules: Database.HsSqlPpp.Tests.TypeChecking.OdbcTypechecking+ Database.HsSqlPpp.Tests.TypeChecking.Aggregates+ Database.HsSqlPpp.Tests.TypeChecking.DDL+ Database.HsSqlPpp.Tests.TypeChecking.Rewrites+ Database.HsSqlPpp.Tests.TypeChecking.TrefIdentifiers+ Database.HsSqlPpp.Tests.TypeChecking.ScalarExprs+ Database.HsSqlPpp.Tests.TypeChecking.PrecisionAndNullable+ Database.HsSqlPpp.Tests.TypeChecking.ImplicitCasts+ Database.HsSqlPpp.Tests.TypeChecking.TypeConversion+ Database.HsSqlPpp.Tests.TypeChecking.Joins+ Database.HsSqlPpp.Tests.TypeChecking.InsertQueryExprs+ Database.HsSqlPpp.Tests.TypeChecking.TSQL+ Database.HsSqlPpp.Tests.TypeChecking.Tpch+ Database.HsSqlPpp.Tests.TypeChecking.CaseExpressions+ Database.HsSqlPpp.Tests.TypeChecking.QueryExprs+ Database.HsSqlPpp.Tests.TypeChecking.TypeCheckTests+ Database.HsSqlPpp.Tests.TypeChecking.SimpleQueryExprs+ Database.HsSqlPpp.Tests.TypeChecking.Utils+ Database.HsSqlPpp.Tests.TypeChecking.TrefSchemas+ Database.HsSqlPpp.Tests.TypeChecking.Issues+ Database.HsSqlPpp.Tests.TypeChecking.Updates+ Database.HsSqlPpp.Tests.Tests+ Database.HsSqlPpp.Tests.TestUtils+ Database.HsSqlPpp.Tests.Parsing.Dml+ Database.HsSqlPpp.Tests.Parsing.SqlServer+ Database.HsSqlPpp.Tests.Parsing.Misc+ Database.HsSqlPpp.Tests.Parsing.ScalarExprs+ Database.HsSqlPpp.Tests.Parsing.Plpgsql+ Database.HsSqlPpp.Tests.Parsing.LexerTests+ Database.HsSqlPpp.Tests.Parsing.CreateTable+ Database.HsSqlPpp.Tests.Parsing.SelectLists+ Database.HsSqlPpp.Tests.Parsing.OdbcParsing+ Database.HsSqlPpp.Tests.Parsing.FunctionsDdl+ Database.HsSqlPpp.Tests.Parsing.Joins+ Database.HsSqlPpp.Tests.Parsing.ParserTests+ Database.HsSqlPpp.Tests.Parsing.Oracle+ Database.HsSqlPpp.Tests.Parsing.Schemas+ Database.HsSqlPpp.Tests.Parsing.MiscQueryExprs+ Database.HsSqlPpp.Tests.Parsing.TableRefs+ Database.HsSqlPpp.Tests.Parsing.MiscDdl+ Database.HsSqlPpp.Tests.Parsing.Utils+ Database.HsSqlPpp.Tests.Parsing.CombineQueryExprs+ Database.HsSqlPpp.Tests.TestTypes+ Database.HsSqlPpp.Tests.TpchData+ Database.HsSqlPpp.Utils.Here+ Database.HsSqlPpp.Utils.GroomUtils+ Database.HsSqlPpp.Tests.TypeChecking.Catalog - Other-Modules: Database.HsSqlPpp.Utils- --Database.HsSqlPpp.Here- Database.HsSqlPpp.Commands.CommandComponents- Database.HsSqlPpp.Dbms.DBAccess- Database.HsSqlPpp.Dbms.DatabaseLoader- Database.HsSqlPpp.Extensions.ChaosExtensions- Database.HsSqlPpp.AstInternals.AnnotationUtils- Database.HsSqlPpp.AstInternals.AstAnnotation- Database.HsSqlPpp.AstInternals.AstInternal- Database.HsSqlPpp.AstInternals.Environment.DefaultTemplate1Environment- Database.HsSqlPpp.AstInternals.Environment.EnvironmentReader- Database.HsSqlPpp.AstInternals.Environment.EnvironmentInternal- Database.HsSqlPpp.AstInternals.Environment.LocalIdentifierBindings- Database.HsSqlPpp.AstInternals.TypeType- Database.HsSqlPpp.AstInternals.TypeChecking.TypeConversion- Database.HsSqlPpp.AstInternals.TypeChecking.ErrorUtils- Database.HsSqlPpp.Tests.ExtensionTests- Database.HsSqlPpp.Tests.TypeCheckTests- Database.HsSqlPpp.Tests.ParserTests- Database.HsSqlPpp.Tests.DatabaseLoaderTests- Database.HsSqlPpp.PrettyPrinter.AnnotateSource- Database.HsSqlPpp.PrettyPrinter.PrettyPrinter- Database.HsSqlPpp.HsText.Commands- Database.HsSqlPpp.HsText.HsText- Database.HsSqlPpp.Parsing.Lexer- Database.HsSqlPpp.Parsing.Parser- Database.HsSqlPpp.Parsing.ParseErrors- Database.HsSqlPpp.Ast.TypeChecker- Database.HsSqlPpp.Ast.Ast- Database.HsSqlPpp.Ast.Environment- Database.HsSqlPpp.Ast.Annotation- Database.HsSqlPpp.Ast.SqlTypes+ Database.HsSqlPpp.Annotation+ Database.HsSqlPpp.Catalog+ Database.HsSqlPpp.Dialect+ Database.HsSqlPpp.Dialects.Ansi+ Database.HsSqlPpp.Dialects.BaseCatalog+ Database.HsSqlPpp.Dialects.GeneratedPostgres+ Database.HsSqlPpp.Dialects.OdbcCatalog+ Database.HsSqlPpp.Dialects.Oracle+ Database.HsSqlPpp.Dialects.Postgres+ Database.HsSqlPpp.Dialects.SqlServer+ Database.HsSqlPpp.Internals.AstInternal+ Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+ Database.HsSqlPpp.Internals.Catalog.CatalogInternal+ Database.HsSqlPpp.Internals.Catalog.CatalogTypes+ Database.HsSqlPpp.Internals.Catalog.CatalogUtils+ Database.HsSqlPpp.Internals.Catalog.CatalogNew+ Database.HsSqlPpp.Internals.Dialect+ Database.HsSqlPpp.Internals.LexInternal+ Database.HsSqlPpp.Internals.ParseErrors+ Database.HsSqlPpp.Internals.ParseInternal+ Database.HsSqlPpp.Internals.PrettyInternal+ Database.HsSqlPpp.Internals.TypeChecking.Environment+ Database.HsSqlPpp.Internals.TypeChecking.OldTediousTypeUtils+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.OldTypeConversion+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.SqlTypeConversion+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion+ Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion2+ Database.HsSqlPpp.Internals.TypesInternal+ Database.HsSqlPpp.Internals.Utils+ Database.HsSqlPpp.Lex+ Database.HsSqlPpp.Parse+ Database.HsSqlPpp.Pretty+ Database.HsSqlPpp.Syntax+ Database.HsSqlPpp.Tests.TypeChecking.AnsiScalarExprs+ Database.HsSqlPpp.TypeCheck+ Database.HsSqlPpp.Types+ Database.HsSqlPpp.Utility - extensions: DeriveDataTypeable,RankNTypes,ScopedTypeVariables+ default-language: Haskell2010+ ghc-options: -Wall
− sqltestfiles/client.sql
@@ -1,1721 +0,0 @@-/*--Copyright 2009 Jake Wheat--= Overview--windows manager widget-extra stuff - colours, sprites, wizard display info- (additional info for each wizard)-board widget-info widget-spell book widget-new game widget-planned widgets--actions-key config-action valid view-turn phase-cursor/go-new game--see chaos.lhs for then main ui docs-*/-select new_module('client', 'chaos');--/*-================================================================================--= windows manager-Store window positions, size, maximised/minimised,- open/close so this is restored when- you restart the program or if it crashes-*/-select new_module('window_management', 'client');-/*-windows relvar-*/-create domain window_state as text- check (value in ('maximised', 'minimised',- 'hidden', 'normal'));-/*--Window with name name: top left corner of window is at position px, py-and the size of the window is sx, sy. It is in state 'state'.--*/-create table windows (- window_name text,- px integer, --position- py integer,- sx integer, --size- sy integer,- state window_state-); --assert there is a row for every widget type.-select add_key('windows', 'window_name');-select set_relvar_type('windows', 'data');--/*--function to reset the windows to default, can be used if the windows-get too messed up or e.g. the window manager row is deleted--*/-create function action_reset_windows() returns void as $$-begin- delete from windows;- insert into windows (window_name, px, py, sx, sy, state) values- --('window_manager', 0,28, 92,320, 'normal'),- ('info', 0,371, 579,213, 'normal'),- ('spell_book', 587,28, 268,556, 'normal'),- ('new_game', 514, 27, 500, 500, 'hidden'),- ('board', 99,28, 480,320, 'normal'),- ('action_history', 843,28, 429,556, 'normal');-end;-$$ language plpgsql volatile;--create function action_hide_window(vname text) returns void as $$-begin- if vname = 'window_manager' then- raise exception 'cannot hide window manager';- end if;- update windows set state='hidden' where window_name = vname;-end;-$$ language plpgsql volatile;-select set_module_for_preceding_objects('window_management');--/*--When another window is closed that window is hidden. when the window-manager is closed, the app exits--TODO: add window zoom and scroll positions to relvar-*/--create function action_refresh_widgets() returns void as $$-begin---doesn't do owt at the moment, all in the haskell code,--- just has this stub here to avoid special casing it in the---haskell code-end;-$$ language plpgsql volatile;--/*-================================================================================--= extras-== colours-*/-create table colours (- name text,- red int,- green int,- blue int-);-select add_key('colours', 'name');-select set_relvar_type('colours', 'readonly');--copy colours (name,red,green,blue) from stdin;-grid 32767 32767 32767-background 0 0 32767-black 0 0 0-blue 0 0 65535-green 0 65535 0-red 65535 0 0-pink 65535 49407 49407-purple 65535 0 65535-cyan 0 65535 65535-yellow 65535 65535 0-orange 65535 41215 0-grey 32767 32767 32767-white 65535 65535 65535-\.---/*--================================================================================--== sprites--just the list of the names of the sprites and their animation speed.-todo: add the png data here--pngs for every sprite listed in this table must exist on the disk to-be loaded or the game will refuse to run--*/-select new_module('sprites', 'client');--create table sprites (- sprite text, -- name of sprite, also part of the name of the png frames- animation_speed int---todo: add sprite data here-);-select add_key('sprites', 'sprite');-select set_relvar_type('sprites', 'readonly');-select set_module_for_preceding_objects('sprites');--copy sprites (sprite,animation_speed) from stdin;-bat 8-dead_bat 250-bear 23-dead_bear 250-centaur 23-dead_centaur 250-crocodile 34-dead_crocodile 250-dark_citadel 50-dire_wolf 12-dead_dire_wolf 250-eagle 14-dead_eagle 250-elf 26-dead_elf 250-faun 20-dead_faun 250-ghost 15-giant 23-dead_giant 250-giant_rat 13-dead_giant_rat 250-goblin 12-dead_goblin 250-golden_dragon 27-dead_golden_dragon 250-gooey_blob 40-gorilla 18-dead_gorilla 250-green_dragon 32-dead_green_dragon 250-gryphon 10-dead_gryphon 250-harpy 13-dead_harpy 250-horse 21-dead_horse 250-hydra 36-dead_hydra 250-king_cobra 30-dead_king_cobra 250-lion 38-dead_lion 250-magic_castle 50-magic_fire 12-magic_tree 250-manticore 13-dead_manticore 250-ogre 23-dead_ogre 250-orc 21-dead_orc 250-pegasus 16-dead_pegasus 250-red_dragon 34-dead_red_dragon 250-shadow_tree 30-skeleton 17-spectre 15-unicorn 16-dead_unicorn 250-vampire 40-wall 30-wizard0 250-wizard1 250-wizard2 250-wizard3 250-wizard4 250-wizard5 250-wizard6 250-wizard7 250-wizard_magic_armour 250-wizard_magic_bow 50-wizard_magic_knife 50-wizard_magic_shield 250-wizard_magic_sword 50-wizard_magic_wings 50-wizard0_shadow 20-wizard1_shadow 20-wizard2_shadow 20-wizard3_shadow 20-wizard4_shadow 20-wizard5_shadow 20-wizard6_shadow 20-wizard7_shadow 20-wizard_magic_armour_shadow 20-wizard_magic_bow_shadow 20-wizard_magic_knife_shadow 20-wizard_magic_shield_shadow 20-wizard_magic_sword_shadow 20-wizard_magic_wings_shadow 20-wraith 10-zombie 25-magic_bolt 250-lightning 250-law 250-large_law 250-chaos 250-large_chaos 250-vengeance 250-subversion 250-turmoil 250-disbelieve 250-justice 250-dark_power 250-decree 250-raise_dead 250-cursor 250-highlight_cast_target_spell 250-highlight_select_piece_at_position 250-highlight_walk 250-highlight_fly 250-highlight_attack 250-highlight_ranged_attack 250-effect_attack 250-\.--/*-================================================================================--== wizard display info--This table associates a wizards name (= the allegiance) from the-server with a colour for the wizard and his army and a wizard sprite-for display purposes.--The sprite in this table is what the wizard uses if he doesn't have-any upgrades.--Wizard named 'name' started with sprite default_sprite, his army is-coloured 'colour'.--*/-select new_module('wizard_display_info', 'client');--create table wizard_display_info (- wizard_name text,- default_sprite text, -- and matches /wizard.*/- colour text-);-select add_key('wizard_display_info', 'wizard_name');-select add_key('wizard_display_info', 'default_sprite');-select add_key('wizard_display_info', 'colour');-select add_foreign_key('wizard_display_info', 'wizard_name', 'wizards');-select add_foreign_key('wizard_display_info', 'default_sprite',- 'sprites', 'sprite');-select set_relvar_type('wizard_display_info','data');--create table init_wizard_display_info_argument (- wizard_name text,- sprite text, -- starts with wizard- colour text --todo: make list of colours-);-select add_key('init_wizard_display_info_argument', 'wizard_name');-select add_key('init_wizard_display_info_argument', 'sprite');-select add_key('init_wizard_display_info_argument', 'colour');-select add_foreign_key('init_wizard_display_info_argument',- 'wizard_name', 'wizards');-select add_foreign_key('init_wizard_display_info_argument',- 'sprite', 'sprites');-select set_relvar_type('init_wizard_display_info_argument', 'stack');--create function init_wizard_display_info() returns void as $$-begin- insert into wizard_display_info (wizard_name, default_sprite, colour)- select wizard_name,sprite,colour- from init_wizard_display_info_argument;-end;-$$ language plpgsql volatile;---select set_module_for_preceding_objects('wizard_display_info');--/*-================================================================================--== action history with colours--create a view to supply grey as colour for corpses (corpses don't have-an allegiance)--*/-create view allegiance_colours as- select wizard_name as allegiance, colour from wizard_display_info union- select 'dead' as allegiance, 'grey' as colour;--create view action_history_colour_mr as-select a.*, colour- from action_history_mr a- natural inner join allegiance_colours;--/*-================================================================================--= board widget--*/-select new_module('board_widget', 'client');-/*-== cursor position + ops--The cursor is at position x,y--The server code has no concept of the cursor.-In the end, this has just made the code more complicated for no reason.-*/-create table cursor_position (- x int,- y int-);-select add_constraint('cursor_position_coordinates_valid',-$$ not exists (select 1 from cursor_position- cross join board_size- where x >= width or y >= height)$$,-array['cursor_position', 'board_size']);-select constrain_to_zero_or_one_tuple('cursor_position');-select set_relvar_type('cursor_position', 'data');--/*-=== actions-cursor movement-*/--create function safe_move_cursor(px int, py int) returns void as $$-begin- update cursor_position- set x = min(max(x + px, 0), (select width from board_size) - 1),- y = min(max(y + py, 0), (select height from board_size) - 1);-end;-$$ language plpgsql volatile;--create function action_move_cursor(direction text) returns void as $$-begin- case direction- when 'up' then- perform safe_move_cursor(0, -1);- when 'down' then- perform safe_move_cursor(0, 1);- when 'left' then- perform safe_move_cursor(-1, 0);- when 'right' then- perform safe_move_cursor(1, 0);- when 'up-left' then- perform safe_move_cursor(-1, -1);- when 'up-right' then- perform safe_move_cursor(1, -1);- when 'down-left' then- perform safe_move_cursor(-1, 1);- when 'down-right' then- perform safe_move_cursor(1, 1);- else- raise exception- 'asked to move cursor in direction % which isn''t valid',- direction;- end case;-end;-$$ language plpgsql volatile;--/*-=== internals-When next phase is called, moved the cursor to that wizard-*/-create function action_move_cursor_to_current_wizard() returns void as $$-declare- p pos;-begin- --don't move cursor during autonomous phase- if get_turn_phase() != 'autonomous' then- select into p x,y from pieces- inner join current_wizard_table- on (current_wizard = allegiance)- where ptype = 'wizard';- update cursor_position set (x,y) = (p.x,p.y);- end if;-end;-$$ language plpgsql volatile;--create function init_cursor_position() returns void as $$-begin- insert into cursor_position (x,y) values (0,0);-end;-$$ language plpgsql volatile;--/*--the plan is to have a board_sprites view for the board widget. This-contains all the sprites on the board (basically everything drawn on-the board: piece sprites, cursor, highlights, etc.) all the board-needs is x,y,sprite and order. The order is used to make sure-overlapping sprites e.g. a piece, the cursor and a highlight, are-drawn in the right order--*/---/*-== piece sprites-Want to produce a list of x,y,sprite rows-for the pieces on top, the cursor,-and the highlights for the currently available actions--wizard sprites: look in the action history to find the most recent upgrade-*/-create view wizard_sprites as- select wizard_name,sprite,colour from- (select row_number() over(partition by wizard_name order by o desc) as rn,- wizard_name,- case when shadow_form then sprite || '_shadow'- else sprite- end as sprite, w.colour from- (select -1 as o, wizard_name, default_sprite as sprite- from wizard_display_info- union- select id as o, allegiance as wizard_name,- 'wizard_' || spell_name- from action_history_mr- natural inner join spells- where spell_name != 'shadow_form'- and spell_category = 'wizard'- and history_name = 'spell_succeeded'- ) as a- natural inner join wizard_display_info as w- natural inner join wizards) as w where rn = 1;--/*--piece ptype-allegiance-tag is at x,y, allegiance colour is 'colour',-sprite is 'sprite', sprite priority is sp.--*/-create view piece_sprite as- select x,y,ptype,- case when ptype='wizard' then w.sprite- when allegiance='dead' then 'dead_' || ptype- else ptype- end as sprite,- ac.colour,tag,allegiance- from pieces p- left outer join wizard_sprites w- on (allegiance = wizard_name and ptype='wizard')- inner join allegiance_colours ac- using (allegiance);--/*-== highlights-*/--create view board_highlights as--- include the squares for the selected spell--- when still in the choose phase, so the user can---see what squares are valid for their chosen spell-select x,y,'highlight_cast_target_spell' as sprite- from current_wizard_spell_squares- where get_turn_phase() = 'choose'-union-select x,y,'highlight_' || action as sprite- from valid_target_actions;--/*-== animation--we save a starting tick against each piece. Not really sure what the-best way to do this, some options are:--these are updated in the action_key_pressed and client_ai_continue fns--*/-create table piece_starting_ticks (- ptype text,- allegiance text,- tag int,- start_tick int-);-select add_key('piece_starting_ticks',- array['ptype', 'allegiance', 'tag']);-select add_foreign_key('piece_starting_ticks',- array['ptype', 'allegiance', 'tag'], 'pieces');-select set_relvar_type('piece_starting_ticks', 'data');---create function update_missing_startticks()- returns void as $$-begin- insert into piece_starting_ticks (ptype,allegiance,tag,start_tick)- select ptype,allegiance,tag, random()*2500 from pieces- where (ptype,allegiance,tag) not in- (select ptype,allegiance,tag- from piece_starting_ticks);-end;-$$ language plpgsql volatile;--/*--== board sprites--put the piece sprites, the highlight and the cursor-together to give the full list of sprites--split this up so the cursor movement isn't really laggy, just a hack --needs some more thought.--*/-create view board_sprites1_view as- select x,y,ptype,allegiance,tag,sprite,colour,sp,- start_tick, animation_speed, selected from- (select x,y,ptype,allegiance,tag,- sprite,colour,sp,start_tick,- case when not move_phase is null then true- else false- end as selected- from piece_sprite- natural inner join pieces_on_top- natural inner join piece_starting_ticks- natural inner join sprites- natural left outer join selected_piece- union- select x,y, '', '', -1, sprite, 'white', 5,0,false- from board_highlights) as a- natural inner join sprites- order by sp;--create table board_sprites1_cache as- select * from board_sprites1_view;-select set_relvar_type('board_sprites1_cache', 'data');--create function update_board_sprites_cache() returns void as $$-begin- if get_running_effects() then- return;- end if;- --raise notice 'update bpc';- delete from board_sprites1_cache;- insert into board_sprites1_cache- select * from board_sprites1_view;-end;-$$ language plpgsql volatile;--create view board_sprites as- select * from board_sprites1_cache-union-select x,y, '', '', -1,'cursor', 'white', 6,0, animation_speed, false- from cursor_position- inner join sprites on sprite='cursor';-----/*-== effects--two sorts of effects: beam and square--*/-create table board_square_effects (- id serial,- subtype text,- x1 int,- y1 int,- queuePos int-);-select add_key('board_square_effects', 'id');-select set_relvar_type('board_square_effects', 'data');--create table board_beam_effects (- id serial,- subtype text,- x1 int,- y1 int,- x2 int,- y2 int,- queuePos int-);-select add_key('board_beam_effects', 'id');-select set_relvar_type('board_beam_effects', 'data');--create table board_sound_effects (- id serial,- subtype text,- sound_name text,- queuePos int-);-select add_key('board_sound_effects', 'id');-select set_relvar_type('board_sound_effects', 'data');--create function get_running_effects() returns boolean as $$-begin- return exists (select 1 from board_beam_effects)- or exists (select 1 from board_square_effects)- or exists (select 1 from board_sound_effects);-end;-$$ language plpgsql stable;---create table history_sounds (- history_name text,- sound_name text-);-select add_key('history_sounds', array['history_name', 'sound_name']);-select set_relvar_type('history_sounds', 'readonly');--copy history_sounds (history_name,sound_name) from stdin;-walked walk-fly fly-attack attack-ranged_attack shoot-game_drawn draw-game_won win-spell_failed fail-spell_succeeded success-shrugged_off shrugged_off-wizard_up wizard_up-new_game new_game-chinned kill-attempt_target_spell cast-\.--create table history_no_visuals (- history_name text-);-select add_key('history_no_visuals', 'history_name');-select set_relvar_type('history_no_visuals', 'readonly');--copy history_no_visuals (history_name) from stdin;-wizard_up-new_turn-new_game-game_won-game_drawn-choose_spell-set_imaginary-set_real-\.--select create_var('last_history_effect_id', 'int');-select set_relvar_type('last_history_effect_id_table', 'data');--create function check_for_effects() returns void as $$-begin- insert into board_square_effects (subtype, x1, y1, queuePos)- select history_name,case when tx is null then x else tx end,- case when ty is null then y else ty end,id- from action_history_mr- where id > get_last_history_effect_id()- and x is not null and y is not null- and history_name not in (select history_name from history_no_visuals);- insert into board_beam_effects (subtype,x1,y1,x2,y2,queuePos)- select history_name,x,y,tx,ty,id- from action_history_mr- where id > get_last_history_effect_id()- and x is not null and y is not null- and tx is not null and ty is not null- and history_name not in (select history_name from history_no_visuals);- insert into board_sound_effects (subtype, sound_name,queuePos)- select history_name,sound_name,id- from action_history_mr- natural inner join history_sounds- left outer join wizards on allegiance = wizard_name- where id > get_last_history_effect_id()---exclude turn sound for computer controlled wizards choose phase- and not(history_name='wizard_up'- and turn_phase='choose'- and coalesce(computer_controlled,false))-;- update last_history_effect_id_table set- last_history_effect_id = (select max(id) from action_history_mr);-end;-$$ language plpgsql volatile;--/*--call this function before reading the current effects table and it-will leave those tables the same if the current effects are still-playing, or it will clear the old effects and fill them with the next-set of effects.--call it after reading the current effects table to clear the current-row of sounds, that way the sounds will only be returned to the ui-once and thus will only be played once.--*/--create table current_effects (- ticks int,- queuePos int-);-select set_relvar_type('current_effects', 'data');-select constrain_to_zero_or_one_tuple('current_effects');--create view current_board_sound_effects as- select * from board_sound_effects- natural inner join current_effects;--create view current_board_beam_effects as- select * from board_beam_effects- natural inner join current_effects;--create view current_board_square_effects as- select * from board_square_effects- natural inner join current_effects;--create function action_reset_current_effects() returns void as $$-begin- delete from board_sound_effects;- delete from board_beam_effects;- delete from board_square_effects;- delete from current_effects;-end;-$$ language plpgsql volatile;--create function action_update_effects_ticks(pticks int) returns void as $$-declare- wasEffects boolean := false;- nextQp int;-begin- if exists(select 1 from current_effects) then- wasEffects := true;- end if;- --always delete sound effects after the first time they are returned- if exists(select 1 from current_board_sound_effects) then- delete from board_sound_effects- where queuePos = (select queuePos from current_effects);- end if;- --see if we need a new row of effects- if not exists(select 1 from current_effects)- or pticks > (select ticks + 6 from current_effects) then- delete from board_sound_effects- where queuePos = (select queuePos from current_effects);- delete from board_beam_effects- where queuePos = (select queuePos from current_effects);- delete from board_square_effects- where queuePos = (select queuePos from current_effects);- delete from current_effects;- nextQp := (select min(queuePos) from- (select queuePos from board_sound_effects- union all- select queuePos from board_beam_effects- union all- select queuePos from board_square_effects) as a);- if nextQp is not null and nextQp <> 0 then- insert into current_effects (ticks, queuePos)- values (pticks, nextQp);- end if;- end if;- if not exists(select 1 from current_effects)- and wasEffects then- perform update_board_sprites_cache();- end if;-end;-$$ language plpgsql volatile;--create function action_client_ai_continue() returns void as $$-begin- if get_running_effects() then- return;- end if;-- perform action_ai_continue();- perform update_missing_startticks();- if (select computer_controlled from wizards- inner join current_wizard_table on wizard_name=current_wizard)- and get_turn_phase() = 'choose' then- perform action_client_ai_continue();- else- perform check_for_effects();- perform update_board_sprites_cache();- end if;- if not (select computer_controlled from wizards- inner join current_wizard_table- on wizard_name=current_wizard) then- perform action_move_cursor_to_current_wizard();- end if;-end;-$$ language plpgsql volatile;--create function action_client_ai_continue_if() returns void as $$-begin- if exists(select 1 from valid_activate_actions- where action='ai_continue') then- perform action_client_ai_continue();- end if;-end;-$$ language plpgsql volatile;--/*--================================================================================--= info widget--create a few views to help with the stuff shown-in the info widget--*/--create view piece_details as- select * from pieces_mr- full outer join- (select 'wizard'::text as wtype,* from live_wizards) as a- on (allegiance = wizard_name and ptype = wtype)- natural inner join pieces_with_priorities- natural inner join piece_sprite;--create view cursor_piece_details as- select * from piece_details- natural inner join cursor_position;--create view selected_piece_details as- select * from piece_details- natural inner join selected_piece- natural full outer join remaining_walk_table;--select set_module_for_preceding_objects('board_widget');--/*-================================================================================--= spell book widget--order the spells:-wizard, attack, object, misc, monster-law spells, then neutral, then chaos,-highest to lowest base chance,-alpha by spell name--this is a proper mess--== sprites-*/-create table spell_sprites (- spell_name text,- sprite text-);-select add_key('spell_sprites', 'spell_name');-select add_foreign_key('spell_sprites', 'sprite', 'sprites');-select add_foreign_key('spell_sprites', 'spell_name', 'spells_mr');-select set_relvar_type('spell_sprites', 'readonly');--copy spell_sprites(spell_name, sprite) from stdin;-magic_wood magic_tree-shadow_wood shadow_tree-magic_fire magic_fire-gooey_blob gooey_blob-wall wall-magic_castle magic_castle-dark_citadel dark_citadel-magic_bolt magic_bolt-lightning lightning-vengeance vengeance-justice justice-dark_power dark_power-decree decree-magic_armour wizard_magic_armour-magic_shield wizard_magic_shield-magic_knife wizard_magic_knife-magic_sword wizard_magic_sword-magic_bow wizard_magic_bow-magic_wings wizard_magic_wings-law law-large_law large_law-chaos chaos-large_chaos large_chaos-raise_dead raise_dead-subversion subversion-turmoil turmoil-disbelieve disbelieve-eagle eagle-elf elf-faun faun-ghost ghost-giant giant-giant_rat giant_rat-goblin goblin-golden_dragon golden_dragon-gorilla gorilla-green_dragon green_dragon-gryphon gryphon-harpy harpy-horse horse-hydra hydra-king_cobra king_cobra-lion lion-manticore manticore-ogre ogre-orc orc-pegasus pegasus-red_dragon red_dragon-skeleton skeleton-spectre spectre-unicorn unicorn-vampire vampire-wraith wraith-zombie zombie-shadow_form chaos-\.---select new_module('spell_book_widget', 'client');--/*-== show all setting-*/-select create_var('spell_book_show_all', 'boolean');-select set_relvar_type('spell_book_show_all_table', 'data');--create function action_spell_book_show_all_update(v boolean)- returns void as $$-begin- update spell_book_show_all_table set spell_book_show_all=v;-end;-$$ language plpgsql volatile;---/*-=== internals-==== ordering-order the spells by spell category-*/-create view section_order as- select 1 as section_order, 'wizard' as spell_category- union- select 2 as section_order, 'attacking' as spell_category- union- select 3 as section_order, 'object' as spell_category- union- select 4 as section_order, 'miscellaneous' as spell_category- union- select 5 as section_order, 'monster' as spell_category;--create view spells_with_order as- select *, case- when alignment > 0 then 0- when alignment = 0 then 1- when alignment < 0 then 2- end as alignment_order- from spells natural inner join section_order;-/*-==== spell counts-*/-create view current_wizard_spell_counts as- select spell_name, 0 as count from- (select spell_name from spells except- select spell_name from spell_books- inner join current_wizard_table- on (wizard_name = current_wizard)) as a- union- select spell_name, count(spell_name)- from spell_books- inner join current_wizard_table- on (wizard_name = current_wizard)- group by spell_name;----create a string to represent the number of copies of each spell-create function count_icons(int) returns text as $$- select repeat('#', $1) as result;-$$ language sql immutable;----create a string to represent the alignment of each spell-create function align_icons(int) returns text as $$- select case- when $1 < 0 then repeat('*', -$1)- when $1 > 0 then repeat('+', $1)- else '-'- end as result-$$ language sql immutable;-/*-==== colours-colour each spell according to the probability of casting success-*/--create function chance_colour(chance int) returns text as $$-begin- return case- when chance = 0 then 'grey'- when chance between 1 and 20 then 'red'- when chance between 21 and 40 then 'purple'- when chance between 41 and 60 then 'green'- when chance between 61 and 80 then 'cyan'- when chance between 81 and 99 then 'yellow'- when chance = 100 then 'white'- else 'blue'- end;-end;-$$ language plpgsql immutable;--create view spell_colours as- select spell_name, chance_colour(chance) as colour- from spell_cast_chance;--create function spell_colour(vspell text, vcount int) returns text as $$-declare- colour text;-begin- --if spell is current wizard's selected spell then highlight it- --if spell count is 0 or we aren't in choose phase then colour is grey- --else colour spell according to casting chance- if (exists (select 1 from wizard_spell_choices- inner join current_wizard_table- on wizard_name = current_wizard- where spell_name = vspell)) then- colour := 'inverse-' || chance_colour(spell_cast_chance(vspell));- elseif (vcount = 0 or get_turn_phase() != 'choose') then- colour := 'grey';- else- colour := chance_colour(spell_cast_chance(vspell));- end if;- return coalesce(colour, 'blue');-end;-$$ language plpgsql stable;---- format function for alignment-create function format_alignment(alignment int) returns text as $$-begin- if (alignment < 0) then- return 'chaos-' || cast(@ alignment as text);- elseif (alignment > 0) then- return 'law-' || cast(alignment as text);- else- return 'neutral';- end if;-end;-$$ language plpgsql immutable;-/*-== spell choice controls-*/-create table spell_keys (- spell_name text,- key text-);-select add_key('spell_keys', 'spell_name');-select add_key('spell_keys', 'key');-select add_foreign_key('spell_keys', 'spell_name', 'spells_mr');-select set_relvar_type('spell_keys', 'readonly');--copy spell_keys (spell_name, key) from stdin;-magic_knife 1-magic_shield 2-magic_armour 3-magic_bow 4-magic_sword 5-shadow_form 6-magic_wings 7-decree A-justice B-lightning C-magic_bolt D-vengeance E-dark_power F-magic_wood G-magic_castle H-wall I-gooey_blob J-magic_fire K-dark_citadel L-shadow_wood M-law O-large_law P-disbelieve Q-subversion R-turmoil S-chaos T-large_chaos U-raise_dead V-horse a-king_cobra b-eagle c-elf d-unicorn e-gryphon f-lion g-pegasus h-giant i-golden_dragon j-giant_rat k-gorilla l-goblin m-orc o-zombie p-faun q-ogre r-skeleton s-harpy t-spectre u-ghost v-hydra w-manticore x-wraith z-vampire W-green_dragon X-red_dragon Z-\.--/*-== stuff-*/-create view spell_book_table as- select spell_category, spell_name, count,- spell_cast_chance(spell_name) as chance,- alignment, format_alignment(alignment) as alignment_string,- key, sprite, section_order, alignment_order, base_chance,- count_icons(count::int), align_icons(alignment::int),- spell_colour(spell_name, count::int) as colour- from spells_with_order- natural inner join current_wizard_spell_counts- natural inner join spell_keys- natural inner join spell_sprites- cross join spell_book_show_all_table- where not (spell_book_show_all = false and count = 0);--create view spell_details as- select * from spells_mr- full outer join spell_sprites using (spell_name)- full outer join (- select /*spell_category,*/ spell_name, count, chance,- /*alignment,*/ alignment_string,- key, /*sprite,*/ section_order, alignment_order, /*base_chance,*/- count_icons, align_icons,- colour- from spell_book_table- ) as balls using (spell_name);--create view current_wizard_selected_spell_details as- select spell_name, spell_category, sprite, base_chance, description,- num, range, count, chance, alignment_string- from spell_details- natural inner join wizard_spell_choices- inner join current_wizard_table on (wizard_name = current_wizard);-select set_module_for_preceding_objects('spell_book_widget');--/*-================================================================================--= new game widget--Starting new game involves the following choices:-number of wizards (2-8)-computer wizards same ai same stats as player-for each wizard:- name text - autogenerated, can be changed- computer_controlled bool- sprite and colour displayed but cannot currently be changed--to add- AI level for each computer controlled wizard- change playing area size, square or hexagon tiles-*/-select new_module('new_game_widget', 'client');--/*-== data-*/--create domain new_wizard_state as text- check (value in ('human', 'computer', 'none'));--create table new_game_widget_state (- line int,- wizard_name text,- sprite text,- colour text,- state new_wizard_state-);-select add_key('new_game_widget_state', 'line');-select add_key('new_game_widget_state', 'wizard_name');-select add_key('new_game_widget_state', 'sprite');-select add_key('new_game_widget_state', 'colour');-select add_foreign_key('new_game_widget_state', 'sprite', 'sprites');-select add_constraint('new_game_widget_state_line_valid',-' not exists(select 1 from new_game_widget_state- where line >= 8)',-array['new_game_widget_state']);-select set_relvar_type('new_game_widget_state', 'data');--/*-== helpers-*/--create function extract_wizard_state(state text) returns boolean as $$-declare- ret boolean;-begin- if state = 'human' then- ret = false;- elseif state = 'computer' then- ret = true;- else- raise exception- 'argument must be human or computer, called with %', state;- end if;- return ret;-end-$$ language plpgsql immutable;--create function action_reset_new_game_widget_state() returns void as $$-begin- delete from new_game_widget_state;- insert into new_game_widget_state- (line, wizard_name, sprite, colour, state) values- (0, 'Buddha', 'wizard0', 'blue', 'human'),- (1, 'Kong Fuzi', 'wizard1', 'purple', 'computer'),- (2, 'Laozi', 'wizard2', 'cyan', 'computer'),- (3, 'Moshe', 'wizard3', 'yellow', 'computer'),- (4, 'Muhammad', 'wizard4', 'green', 'computer'),- (5, 'Shiva', 'wizard5', 'red', 'computer'),- (6, 'Yeshua', 'wizard6', 'white', 'computer'),- (7, 'Zarathushthra', 'wizard7', 'orange', 'computer');-end-$$ language plpgsql volatile;--/*-== actions-*/--create function action_client_new_game_using_new_game_widget_state()- returns void as $$-begin- delete from action_client_new_game_argument;- insert into action_client_new_game_argument- (place, wizard_name, sprite, colour, computer_controlled)- select line, wizard_name, sprite, colour,- case when state = 'computer' then true- else false end- from new_game_widget_state- where state != 'none';- perform action_client_new_game();-end-$$ language plpgsql volatile;--select set_module_for_preceding_objects('new_game_widget');--/*--================================================================================--= info widget (split?)--turn phase spell, cursor info & highlight key, cursor & selected piece info--================================================================================--= planned widget notes:--== help widget-=== controls-=== tutorials/ examples-=== rules reference-== spell info, monster info - reference widget-== wizard army widget-== versioning access widget-== action history widget-== game manager widget-== power/ debugger widget--================================================================================--= actions-*/-select new_module('client_actions', 'client');--/*-== action valid views--we add this view to cover the actions which are defined-in the client to supplement the action valid views-for the server actions define in the server.-*/-create view client_valid_target_actions as- select * from valid_target_actions- where not exists (select 1 from game_completed_table);--create view client_valid_activate_actions as-select * from (- select * from valid_activate_actions-union select 'move_cursor_up'-union select 'move_cursor_down'-union select 'move_cursor_left'-union select 'move_cursor_right'-union select 'move_cursor_up_left'-union select 'move_cursor_down_left'-union select 'move_cursor_up_right'-union select 'move_cursor_down_right'-union select 'print_widget_info'-union select 'refresh_windows'-union select 'spell_book_show_all_update_on'-union select 'spell_book_show_all_update_off'-union select 'client_next_phase'-union select 'go') as a- where not exists (select 1 from game_completed_table);--/*-== key controls-create a table to map gtk key descriptions to the-names of the action functions which are called.--*/--select new_module('key_controls', 'client');--create table key_control_settings (- key_code text,- action_name text-);-select add_key('key_control_settings', array['key_code','action_name']);-select set_relvar_type('key_control_settings', 'readonly');--copy key_control_settings(key_code, action_name) from stdin;-Up move_cursor_up-KP_Up move_cursor_up-Left move_cursor_left-KP_Left move_cursor_left-Right move_cursor_right-KP_Right move_cursor_right-Down move_cursor_down-KP_Down move_cursor_down-KP_Home move_cursor_up_left-KP_Page_Up move_cursor_up_right-KP_Page_Down move_cursor_down_right-KP_End move_cursor_down_left-End cancel-F11 print_widget_info-F12 refresh_widgets-0 choose_no_spell-Insert spell_book_show_all_update_on-Delete spell_book_show_all_update_off-space client_next_phase-KP_Begin go-Return go-KP_5 go-y set_imaginary-Y set_imaginary-n set_real-N set_real-\.--/*-== key press actions-*/-create function create_client_action_wrapper(client_action_name text,- action_call text)- returns void as $$-begin- execute $f$-create function action_$f$ || client_action_name || $f$() returns void as $a$-begin- perform action_$f$ || action_call || $f$;-end;-$a$ language plpgsql volatile;$f$;-end;-$$ language plpgsql volatile;--/*-cursor movement action redirections, used to make sense but don't-anymore - todo: split the move_cursor function into separate ones.-*/--select create_client_action_wrapper('move_cursor_down',- $$move_cursor('down')$$);-select create_client_action_wrapper('move_cursor_up',- $$move_cursor('up')$$);-select create_client_action_wrapper('move_cursor_left',- $$move_cursor('left')$$);-select create_client_action_wrapper('move_cursor_right',- $$move_cursor('right')$$);-select create_client_action_wrapper('move_cursor_up_left',- $$move_cursor('up-left')$$);-select create_client_action_wrapper('move_cursor_up_right',- $$move_cursor('up-right')$$);-select create_client_action_wrapper('move_cursor_down_right',- $$move_cursor('down-right')$$);-select create_client_action_wrapper('move_cursor_down_left',- $$move_cursor('down-left')$$);-select create_client_action_wrapper('spell_book_show_all_update_on',- $$spell_book_show_all_update(true)$$);-select create_client_action_wrapper('spell_book_show_all_update_off',- $$spell_book_show_all_update(false)$$);--create function action_key_pressed(pkeycode text) returns void as $$-declare- a text;- cursor_move boolean := false;-begin-/*-basic plan-have a table with key code, and action name-then a strategy of taking an action and- a. deciding where to get the arguments- b. deciding if it is allowed--profiling progress: started out about 1 sec to run when using for-loop, got rid of that, got it down to about 0.1 sec but this is for an-unmatched keypress, need to be faster.--*/- if get_running_effects() then- return;- end if;-- if exists(select 1 from valid_activate_actions- where action='ai_continue')- and pkeycode = 'space' then- perform action_client_ai_continue();- else- select into a action_name from key_control_settings k- inner join client_valid_activate_actions v- on k.action_name = v.action- where key_code = pkeycode;- if not a is null then- if substr(a,0,11) = 'move_cursor' then- cursor_move := true;- end if;- execute 'select action_' || a || '();';- else- select into a action_name from key_control_settings k- inner join client_valid_target_actions v- on k.action_name = v.action- natural inner join cursor_position- where key_code = pkeycode;- if substr(a,0,11) = 'move_cursor' then- cursor_move := true;- end if;- if not a is null then- execute 'select action_' || a ||- '(' || (select x from cursor_position) ||- ', ' || (select y from cursor_position) || ');';- else- null;- end if;- end if;- end if;- perform update_missing_startticks();- perform check_for_effects();- if not cursor_move then- perform update_board_sprites_cache();- end if;-end;-$$ language plpgsql volatile;--/*-=== spell choice-*/--- insert into key_control_settings(key_code, action_name)- select key, 'choose_' || spell_name || '_spell'- from spell_keys;---/*--================================================================================--== turn phases-*/--create function action_client_next_phase() returns void as $$-begin- perform action_next_phase();- if not (select computer_controlled from wizards- inner join current_wizard_table- on wizard_name=current_wizard) then- perform action_move_cursor_to_current_wizard();- end if;-end;-$$ language plpgsql volatile;--/*-================================================================================--== cursor/go actions-*/--create function action_go() returns void as $$-declare- r record;- s text;-begin- select into r x,y,action from client_valid_target_actions- natural inner join cursor_position;- if r is not null then- s := 'select action_' || r.action || '(' || r.x || ',' || r.y || ')';- execute s;- else- select into r action- from client_valid_activate_actions- where action in ('cast_activate_spell');- if r is not null then- s := 'select action_' || r.action || '()';- execute s;- end if;- end if;- return ;-end;-$$ language plpgsql volatile;--/*-================================================================================--== prompt--use the action valid views to provide the user with information on-what their options are.--*/-create view action_instructions as-select 'cast_target_spell'::text as action,- 'Cast spell: Select a square to cast ' ||- get_current_wizard_spell() || ' on' as help-union-select 'select_piece_at_position',- 'Select: choose a piece to move by selecting its square'-union-select 'walk',- 'Walk: select a square to move piece to'-union-select 'fly',- 'Fly: select a square to move piece to'-union-select 'attack',- 'Attack: select a square to attack that piece'-union-select 'ranged_attack',- 'Ranged attack: select a square to attack that piece'-union-select 'next_phase',- 'Next phase: press space to finish this wizard''s turn'-union-select 'set_imaginary',- 'Press y to cast an imaginary monster'-union-select 'set_real',- 'Press n to cast a real monster'-union-select 'cast_activate_spell',- 'Cast: Press enter to cast ' || get_current_wizard_spell()-union-select 'cancel',- 'Cancel: press End to cancel move/attack/ranged attack'-union-select 'choose_disbelieve_spell',- 'Press a key from the spell book to choose that spell to cast'-;--create view prompt as-select action, help- from action_instructions- natural inner join- (select action from client_valid_target_actions- union- select action from client_valid_activate_actions) as a;--/*--TODO: improve these messages, maybe add in relevant sprites inline,-draw lines onto the playing board, be more specific e.g. the help for-enter could say exactly what options are available, next phase is-context specific (e.g. next phase to decline to move pieces which-haven't moved, or to not use additional shots of the currently casting-spell, or if no parts have been cast, to say cancel spell cast, cancel-also more specific.--TODO: in addition to this help, want to make available a "why can't I-do this" facility, which explains why a particular action can't be run-at this time (for target actions, why a particular action can't be run-at this time on this square).--New idea:-state what activate action is available-or// state what target actions are available for some square-and state what target action will run on the current square--also: for squares with no valid action, try to provide a message-guessing what the user might want to run on that square and explain-why they can't: need to work through some examples to see how obvious-these messages will be to create--*/--/*--================================================================================--== new game action-*/--select new_module('client_new_game', 'client');--create table action_client_new_game_argument (- place int,- wizard_name text,- sprite text,- colour text,- computer_controlled boolean-);-select add_key('action_client_new_game_argument', 'place');-select add_key('action_client_new_game_argument', 'wizard_name');-select add_key('action_client_new_game_argument', 'sprite');-select add_key('action_client_new_game_argument', 'colour');-select add_foreign_key('action_client_new_game_argument',- 'sprite', 'sprites');-select add_constraint('action_client_new_game_place_valid',-'(select count(*) from action_client_new_game_argument- where place >=- (select count(*) from action_client_new_game_argument)) = 0',- array['action_client_new_game_argument']);-select set_relvar_type('action_client_new_game_argument', 'stack');----this calls server new game-create function action_client_new_game() returns void as $$-begin- --assert: argument has between 2 and 8 active wizards- delete from action_new_game_argument;- delete from init_wizard_display_info_argument;- -- clear data tables- delete from cursor_position;- delete from wizard_display_info;-- delete from last_history_effect_id_table;- insert into last_history_effect_id_table values (-1);- delete from board_square_effects;- delete from board_beam_effects;- delete from board_sound_effects;- delete from current_effects;-- -- don't reset windows, see below- --call server new_game- --populate argument first- delete from action_new_game_argument;- insert into action_new_game_argument- (wizard_name, computer_controlled, place)- select wizard_name, computer_controlled, place- from action_client_new_game_argument;- perform action_new_game();-- --wizard display_info- delete from init_wizard_display_info_argument;- insert into init_wizard_display_info_argument- (wizard_name, sprite, colour)- select wizard_name, sprite, colour- from action_client_new_game_argument;- perform init_wizard_display_info();-- --populate window data,- -- preserve settings from previous game if there are some- if not exists(select 1 from windows) then- perform action_reset_windows();- end if;-- if not exists(select 1 from spell_book_show_all_table) then- insert into spell_book_show_all_table values (false);- end if;-- perform update_board_sprites_cache();- perform check_for_effects();- perform init_cursor_position();-end-$$ language plpgsql volatile;--select set_module_for_preceding_objects('client_new_game');--select protect_readonly_relvars();-select set_all_attributes_to_not_null();-select set_notifies_on_all_data_tables();
− sqltestfiles/server.sql
@@ -1,4645 +0,0 @@-/*--Copyright 2009 Jake Wheat--= Overview--metadata - the readonly,data,stack tags for relvars-read only data - piece prototypes and spells revlars-game data - mainly wizards, spellbooks and pieces relvars-turn sequence - relvars for turn sequence progression-actions - action valid, actions for turn sequence, casting, moving, etc.-history - relar to record actions-new game - functions to reset data relvars and set up new games-test board support - functions to set up a few board layouts for testing-ai - ai for computer controlled wizards--================================================================================--= metadata-== base relvar tags--This stuff is mainly used to produce some half-baked documentation/-diagrams of the database.--*/-select new_module('chaos', 'root');-select new_module('server', 'chaos');-select new_module('metadata', 'server');--create table base_relvar_metadata (- relvar_name text,- type text check (type in('readonly', 'data', 'stack'))-);-select add_key('base_relvar_metadata', 'relvar_name');-select add_foreign_key('base_relvar_metadata', 'relvar_name', 'base_relvars');--create function set_relvar_type(vname text, vtype text) returns void as $$-begin- insert into base_relvar_metadata (relvar_name, type)- values (vname, vtype);-end;-$$ language plpgsql volatile;--select set_relvar_type('base_relvar_metadata', 'readonly');--/*-This view is only used in the check_code_some_tags function.-*/--create view chaos_base_relvars as- select object_name,object_type from public_database_objects- where object_type = 'base_relvar'- except- select object_name,object_type from module_objects- where module_name = 'catalog' and object_type='base_relvar';-/*-part of the tests, will check all the relvars which aren't defined in-system.sql are tagged.-*/--create function check_code_some_tags() returns boolean as $$-declare- r record;- success boolean;-begin- success := true;- for r in select object_name from chaos_base_relvars- except select relvar_name from base_relvar_metadata loop- success := false;- raise notice- 'table % is not tagged with one of readonly, data, stack',- r.object_name;- end loop;- return success;-end;-$$ language plpgsql volatile;--/*--After we've loaded the sql, we can protect all the readonly relvars-from being updated again using transition constraints (see below for-how they are implemented). This might catch some programming errors.-- */--create function protect_readonly_relvars() returns void as $$-declare- r record;-begin- for r in select relvar_name, type- from base_relvar_metadata- where type='readonly' loop- perform create_update_transition_tuple_constraint(- r.relvar_name, r.relvar_name || '_u_readonly', 'false');- perform create_delete_transition_tuple_constraint(- r.relvar_name, r.relvar_name || '_d_readonly', 'false');- perform create_insert_transition_tuple_constraint(- r.relvar_name, r.relvar_name || '_i_readonly', 'false');- -- get module- perform set_module_for_preceding_objects(- (select module_name from module_objects- where object_type = 'base_relvar'- and object_name = r.relvar_name));- end loop;-end;-$$ language plpgsql volatile;--/*--todo: find way to enforce stack tables empty outside transaction, or-some sort of partial tests on this--*/--/*-== callback notes--add a notify on each table when it is changed. Haven't worked out how-to listen from haskell yet so is unused at the moment.--*/--create function set_notifies_on_all_data_tables() returns void as $$-declare- r record;-begin- for r in select relvar_name from base_relvar_metadata where type='data'- except- select relvar_name from triggers where trigger_name like '%_changed' loop- perform notify_on_changed(r.relvar_name);- end loop;-end;-$$ language plpgsql volatile;--select set_module_for_preceding_objects('metadata');--/*-================================================================================--= read only data--This section defines all the constant data which doesn't change either-during a game or from one game to the next. These are the piece-prototypes, and the spells.--== piece prototypes--=== ddl--Each type of piece starts with the same stats. Once a piece is on the-board, some of these stats can be changed.--So - use a kind of prototype system. The template for each creature-is held in a read only table, and when a new creature is created on-the board, its stats are copied from this table, and then they can-change if needed.--*/-select new_module('piece_prototypes', 'server');----creature ranged weapons can be either projectiles or fireballs-create domain ranged_weapon_type as text- check (value in ('projectile', 'fire'));--create table piece_prototypes_mr (- ptype text not null,- flying boolean null,- speed int null,- agility int null,- undead boolean null,- ridable boolean null,- ranged_weapon_type ranged_weapon_type null,- range int null,- ranged_attack_strength int null,- attack_strength int null,- physical_defense int null,- magic_defense int null-);-select add_key('piece_prototypes_mr', 'ptype');-select set_relvar_type('piece_prototypes_mr', 'readonly');--create view piece_prototypes as- select ptype from piece_prototypes_mr;--create view creature_prototypes as- select ptype, flying, speed, agility- from piece_prototypes_mr- where flying is not null- and speed is not null- and agility is not null;--create view monster_prototypes as- select ptype, flying, speed, agility, undead, ridable- from piece_prototypes_mr- where undead is not null and ridable is not null;--create view object_piece_types as- select ptype from piece_prototypes_mr where speed is null;--create view ridable_prototypes as- select ptype from piece_prototypes_mr- where ridable;--create view enterable_piece_types as- select 'magic_tree'::text as ptype- union- select 'magic_castle'- union- select 'dark_citadel';-/*-=== data--TODO: find a way to represent data like this in the source in a much-more readable format.--*/---copy piece_prototypes_mr(ptype,flying,speed,agility,undead,ridable,-ranged_weapon_type,ranged_attack_strength,range,attack_strength,-physical_defense,magic_defense) from stdin;-bat t 5 4 f f \N \N \N 1 1 9-bear f 2 2 f f \N \N \N 6 7 6-centaur f 4 5 f t projectile 2 4 1 3 5-crocodile f 1 2 f f \N \N \N 5 6 2-dark_citadel \N \N \N \N \N \N \N \N \N \N \N-dire_wolf f 3 2 f f \N \N \N 3 2 7-eagle t 6 2 f f \N \N \N 3 3 8-elf f 1 7 f f projectile 2 6 1 2 5-faun f 1 8 f f \N \N \N 3 2 7-ghost t 2 6 t f \N \N \N 1 3 9-giant f 2 5 f f \N \N \N 9 7 6-giant_rat f 3 2 f f \N \N \N 1 1 8-goblin f 1 4 f f \N \N \N 2 4 4-golden_dragon t 3 5 f f fire 5 4 9 9 5-gooey_blob \N \N \N \N \N \N \N \N \N 1 \N-gorilla f 1 2 f f \N \N \N 6 5 4-green_dragon t 3 4 f f fire 4 6 5 8 4-gryphon t 5 6 f t \N \N \N 3 5 5-harpy t 5 5 f f \N \N \N 4 2 8-horse f 4 1 f t \N \N \N 1 3 8-hydra f 1 6 f f \N \N \N 7 8 4-king_cobra f 1 1 f f \N \N \N 4 1 6-lion f 4 3 f f \N \N \N 6 4 8-magic_castle \N \N \N \N \N \N \N \N \N \N \N-magic_fire \N \N \N \N \N \N \N \N \N \N \N-magic_tree \N \N \N \N \N \N \N \N \N 5 \N-manticore t 5 8 f t projectile 1 3 3 6 6-ogre f 1 6 f f \N \N \N 4 7 3-orc f 1 4 f f \N \N \N 2 1 4-pegasus t 5 7 f t \N \N \N 2 4 6-red_dragon t 3 5 f f fire 3 5 7 9 4-shadow_tree \N \N \N \N \N \N \N \N 2 4 \N-skeleton f 1 4 t f \N \N \N 3 2 3-spectre f 1 4 t f \N \N \N 4 2 6-unicorn f 4 7 f t \N \N \N 5 4 9-vampire t 4 5 t f \N \N \N 6 8 6-wall \N \N \N \N \N \N \N \N \N \N \N-wizard f 1 3 \N \N \N \N \N 3 3 5-wraith f 2 5 t f \N \N \N 5 5 4-zombie f 1 3 t f \N \N \N 1 1 2-\.--select set_module_for_preceding_objects('piece_prototypes');-/*--== spells--Spells come in a number of flavours, the user interface breaks them-down into the same groups that the original chaos instructions did:--wizard spells: upgrade your wizard in some way, most add weaponry--attacking spells: are cast directly on enemy wizards and their- monsters to kill them or destroy all of a wizards creations.--object spells: create object pieces--miscellaneous spells: various spells not in the other categories--monster spells: summon monsters for a wizard's army--The code breaks the spells down differently: target spells need a-square to be chosen to cast them on activate spells are all the other-spells.--Target spells are further be broken down into summon spells which-create new pieces on the board, and all the other target spells.--casting chance notes:--Each time you cast a spell it can affect the world alignment, which in-turn affects the spell casting chances.--=== ddl-*/-select new_module('spells', 'server');--create domain spell_category as text- check (value in ('object', 'attacking',- 'wizard', 'miscellaneous', 'monster'));----what kind of squares can spells be cast on?--create domain spell_square_category as text- check (value in (- 'empty',- 'empty_or_corpse_only',- 'attackable', --attackable - not in castle, incidental corpses allowed- 'creature_on_top', --creature on top - no blob,- --castle, wood, incidental corpses allowed- 'monster_on_top',- 'corpse_only',- 'empty_and_not_adjacent_to_tree'-));--create table spells_mr (- spell_name text not null,- base_chance int not null,- alignment int not null,- spell_category spell_category not null,- description text not null,- activate boolean null,- target boolean null,- range int null,- num int null,- ptype text null,- valid_square_category spell_square_category null-);--select add_key('spells_mr', 'spell_name');-select set_relvar_type('spells_mr', 'readonly');--create view spells as- select spell_name, base_chance, alignment,- spell_category, description- from spells_mr;--create view monster_spells as- select s.* from spells_mr s- inner join monster_prototypes m- on s.ptype=m.ptype;--create view spell_valid_square_types as- select spell_name, base_chance, alignment, spell_category,- description, valid_square_category- from spells_mr- where valid_square_category is not null;--create view spell_ranges as- select spell_name, base_chance, alignment, spell_category,- description, range- from spells_mr- where range is not null;--create view summon_spells as- select spell_name, base_chance, alignment, spell_category,- description, ptype- from spells_mr- where ptype is not null;--create view activate_spells as- select spell_name- from spells_mr- where activate is not null- and activate;--create view target_spells as- select spell_name- from spells_mr- where target is not null- and target;--create view spells_with_num_shots as- select spell_name, base_chance, alignment, spell_category,- description, num- from spells_mr- where num is not null;--/*-=== data--*/-copy spells_mr (spell_name, base_chance, alignment, spell_category, description,- activate, target, range, num, ptype, valid_square_category) from stdin;-dark_citadel 50 -1 object Gives wizard building to hide in. \N \N 8 1 dark_citadel empty-dark_power 50 -2 attacking When cast on a wizard it kills all that wizards creations if successful. Allows 3 attacks on enemy creatures \N t 20 3 \N creature_on_top-decree 90 1 attacking When cast on a wizard it kills all that wizards creations if successful. Allows 1 attack on an enemy creature. \N t 20 1 \N creature_on_top-disbelieve 100 0 miscellaneous Allows illusion creatures to be destroyed. This spell has 100% casting chance, and is always available. \N t 20 1 \N monster_on_top-eagle 70 1 monster monster \N \N 1 1 eagle empty_or_corpse_only-elf 70 2 monster monster \N \N 1 1 elf empty_or_corpse_only-chaos 80 -2 miscellaneous Makes the world more chaos. t \N \N \N \N \N-faun 80 -1 monster monster \N \N 1 1 faun empty_or_corpse_only-ghost 50 -1 monster monster \N \N 1 1 ghost empty_or_corpse_only-giant 40 1 monster monster \N \N 1 1 giant empty_or_corpse_only-giant_rat 100 0 monster monster \N \N 1 1 giant_rat empty_or_corpse_only-goblin 100 -1 monster monster \N \N 1 1 goblin empty_or_corpse_only-golden_dragon 10 2 monster monster \N \N 1 1 golden_dragon empty_or_corpse_only-law 80 2 miscellaneous Makes the world more law. t \N \N \N \N \N-gooey_blob 100 -1 object Attacks enemy units it covers and randomly spreads across the map. Any unit covered up by a gooey blob will be able to carry on once it is uncovered (except wizards who are killed by gooey blobs). \N \N 6 1 gooey_blob empty_or_corpse_only-gorilla 70 0 monster monster \N \N 1 1 gorilla empty_or_corpse_only-green_dragon 10 -1 monster monster \N \N 1 1 green_dragon empty_or_corpse_only-gryphon 60 1 monster monster \N \N 1 1 gryphon empty_or_corpse_only-harpy 60 -1 monster monster \N \N 1 1 harpy empty_or_corpse_only-horse 90 1 monster monster \N \N 1 1 horse empty_or_corpse_only-hydra 50 -1 monster monster \N \N 1 1 hydra empty_or_corpse_only-justice 50 2 attacking When cast on a wizard it kills all that wizards creations if successful. Allows 3 attacks. \N t 20 3 \N creature_on_top-king_cobra 90 1 monster monster \N \N 1 1 king_cobra empty_or_corpse_only-large_chaos 60 -4 miscellaneous Makes the world more chaos. t \N \N \N \N \N-large_law 60 4 miscellaneous Makes the world more law. t \N \N \N \N \N-lightning 100 0 attacking Attacks creature it is cast at (more powerful than magic bolt) \N t 4 1 \N attackable-lion 60 1 monster monster \N \N 1 1 lion empty_or_corpse_only-magic_armour 50 1 wizard Gives wizard increased protection from attack. t \N \N \N \N \N-magic_bolt 100 0 attacking Attacks creature it is cast at. \N t 6 1 \N attackable-magic_bow 50 1 wizard Gives wizard ranged weapon including undead creatures. t \N \N \N \N \N-magic_castle 50 1 object Gives wizard building to hide in. \N \N 8 1 magic_castle empty-magic_fire 80 -1 object Attacks and kills enemy units it covers and randomly spreads across the map. \N \N 6 1 magic_fire empty-magic_knife 70 1 wizard Gives wizard increase attack power including undead creatures. t \N \N \N \N \N-magic_shield 70 1 wizard Gives wizard increased protection from attack. t \N \N \N \N \N-magic_sword 40 1 wizard Gives wizard increase attack power including undead creatures. t \N \N \N \N \N-magic_wings 60 0 wizard Gives wizard ability to fly. t \N \N \N \N \N-magic_wood 80 1 object Summons up to eight magic trees near your wizard. If you put your wizard in a magic tree and leave him there, he gets a new spell after a few turns. \N \N 8 8 magic_tree empty_and_not_adjacent_to_tree-manticore 50 -1 monster monster \N \N 1 1 manticore empty_or_corpse_only-ogre 70 -1 monster monster \N \N 1 1 ogre empty_or_corpse_only-orc 100 -1 monster monster \N \N 1 1 orc empty_or_corpse_only-pegasus 60 2 monster monster \N \N 1 1 pegasus empty_or_corpse_only-raise_dead 60 -1 miscellaneous Allows reanimation of dead bodies left on screen. Any creatures raised from the dead become undead creatures, able to attack other undeads. \N t 4 1 \N corpse_only-red_dragon 10 -2 monster monster \N \N 1 1 red_dragon empty_or_corpse_only-shadow_form 80 0 wizard Gives wizard increased protection and allows movement of 3 spaces per turn. Disappears if wizard attacks anything. t \N \N \N \N \N-shadow_wood 50 -1 object Allows you to place up to eight shadow trees near your wizard. No two trees can be adjacent, and line of sight is needed in placing. Shadow trees can attack anything in contact with them (except undead). \N \N 8 8 shadow_tree empty_and_not_adjacent_to_tree-skeleton 70 -1 monster monster \N \N 1 1 skeleton empty_or_corpse_only-spectre 60 -1 monster monster \N \N 1 1 spectre empty_or_corpse_only-subversion 100 0 miscellaneous Realigns enemy creature to your side. \N t 7 1 \N monster_on_top-turmoil 100 -2 miscellaneous Randomly moves all objects onscreen to a different location. Only available from a magic tree. t \N \N \N \N \N-unicorn 70 2 monster monster \N \N 1 1 unicorn empty_or_corpse_only-vampire 20 -2 monster monster \N \N 1 1 vampire empty_or_corpse_only-vengeance 90 -1 attacking When cast on a wizard it kills all that wizards creations if successful. Allows 1 attack on an enemy creature. \N t 20 1 \N creature_on_top-wall 80 0 object Allows four wall blocks to be built near the wizard, which blocks creatures paths, but can be flown over. \N \N 8 4 wall empty-wraith 50 -1 monster monster \N \N 1 1 wraith empty_or_corpse_only-zombie 90 -1 monster monster \N \N 1 1 zombie empty_or_corpse_only-\.--select set_module_for_preceding_objects('spells');--/*-================================================================================--= game data--Players should not be able to see each others spells before the cast-phase. This is difficult when they are all on the same computer, but-should be easy when they are not.--Imaginary attribute should only be visible to owning player, same-notes as previous.--== global data-*/-select new_module('global_data', 'server');-/*-=== board size-The playing area is 'width' by 'height' squares.-*/-create table board_size (- width int,- height int-);-select add_key('board_size', array['width', 'height']);-select constrain_to_zero_or_one_tuple('board_size');-select set_relvar_type('board_size', 'data');-----update operator out param: board_size-create function init_board_size() returns void as $$-begin- -- default board size- insert into board_size (width, height) values (15, 10);-end;-$$ language plpgsql volatile;--/*-=== law/ chaos rating--The world has a law/ chaos rating which can be chaos-N, neutral or-law-N. It starts neutral. When the world is chaos, then chaos spells-become easier to cast, and law spells harder, and vice versa. It-becomes more chaos when chaos spells are cast, and more law when law-spells are cast.--*/--create domain alignment as text check (value in ('law', 'neutral', 'chaos'));----if world alignment = 0, world is neutral, if -ve world is chaos by that amount---if +ve world is law by that amount-select create_var('world_alignment', 'int');-select set_relvar_type('world_alignment_table', 'data');--create function init_world_alignment() returns void as $$-begin- insert into world_alignment_table values (0);-end;-$$ language plpgsql volatile;-select set_module_for_preceding_objects('global_data');--/*-== wizards--*/-select new_module('wizards', 'server');--create table wizards (- wizard_name text,- shadow_form boolean default false,- magic_sword boolean default false,- magic_knife boolean default false,- magic_shield boolean default false,- magic_wings boolean default false,- magic_armour boolean default false,- magic_bow boolean default false,- computer_controlled boolean,- original_place int, -- 0 <= n < num wizards- expired boolean default false-);-select add_key('wizards', 'wizard_name');-select set_relvar_type('wizards', 'data');--create view live_wizards as- select *,- row_number() over(order by original_place) - 1 as place- from wizards where not expired;--/*-== spell books-Wizard 'wizard_name' is able to cast spell 'spell_name'.-*/--create table spell_books (- id serial,- wizard_name text,- spell_name text-);-select add_key('spell_books', 'id');-select add_foreign_key('spell_books', 'wizard_name', 'wizards');-select add_constraint('no_spells_for_stiffs',- $$ not exists(select 1 from spell_books- natural inner join wizards where expired = true)$$,- array['spell_books', 'wizards']);-select add_foreign_key('spell_books', 'spell_name', 'spells');-select set_relvar_type('spell_books', 'data');--select set_module_for_preceding_objects('wizards');--/*-== pieces-=== piece natural keys-Keys consist of three parts:-type-allegiance-number--- if piece is a wizard -> type is "wizard", allegiance is wizard name,- number is 0 for all wizards?--- else if dead -> dead aren't owned, allegiance is "dead". (use- dead-[monster type]-[n] where n is integer, incremented for each- corpse type. e.g. you can have dead-giant-0, dead-giant-1 and- dead-eagle-0. Corpses which existed in current game but no longer do- leave a gap in the numbering.)--- else -> [owning wizard's name]-[type]-[m] where wizard[n] is the- owning wizard, m is integer incremented per wizard[n]-type, e.g. you- can have wizard1-goblin-0, wizard2-goblin-0, wizard1-ogre-0,- etc. (Assuming wizard names are wizard1, etc.). Pieces which existed- in current game but no longer do leave a gap in the numbering.--To do this will need to roll own sequence type because there will be-many many sequences? Like to create one table to hold all the-sequences: pieces_sequences (prefix text, current_number integer),-where prefix text is the prefix given above. This might be better as-(allegiance text, type text, current_number integer). Locking: intend-to use a server schema database wide lock every update. fastest-solution may be to use row level locking, probably write a function-like sequences to lock row, increment, get number, unlock and return-number.--For simplicity, just use same serial for all pieces for now.--=== relvars--*/-select new_module('pieces', 'server');----pieces are either a member of a particular wizard's army or--- they are dead, in which case they are not a member of--- any wizard's army-create view allegiances as- select wizard_name as allegiance from wizards- where expired = false- union select 'dead' as allegiance;--/*--TODO: maybe make pieces_mr a table called pieces with just the piece-key and position, and then use a view for an analog to pieces with-the stats. Create this view from the prototype stats, the pieces-table, and have table(s) containing things that can affect the stats-and the view selects from the the piece_prototypes and these tables.--I think all the ways stats can change from the prototypes are listed-here:-monster raised from the dead-wizard with upgrade--err... that's it.--*/--create table pieces (- ptype text,- allegiance text,- tag int,---Piece is on the board at grid position 'x', 'y'.- x int,- y int);--select add_key('pieces', array['ptype', 'allegiance', 'tag']);-select add_foreign_key('pieces', 'ptype', 'piece_prototypes');---piece must be on the board, not outside it-select add_constraint('piece_coordinates_valid',- ' not exists(select 1 from pieces- cross join board_size- where x >= width or y >= height)',- array['pieces', 'board_size']);-select add_foreign_key('pieces', 'allegiance', 'allegiances');---temporary constraint while 'fks' to non base relvars are buggy-select add_constraint('dead_wizard_army_empty',- $$ not exists(select 1 from pieces- inner join wizards- on (allegiance = wizard_name)- where expired = true)$$,- array['wizards', 'pieces']);-select set_relvar_type('pieces', 'data');--create type piece_key as (- ptype text,- allegiance text,- tag int-);----create function piece_key_equals(piece_key, piece_key) returns boolean as $$--- select $1.ptype = $2.ptype and--- $1.allegiance = $2.allegiance and--- $1.tag = $2.tag;---$$ language sql stable;---- create operator = (--- leftarg = piece_key,--- rightarg = piece_key,--- procedure = piece_key_equals,--- commutator = =--- );--create type pos as (- x int,- y int-);---- create function pos_equals(pos, pos) returns boolean as $$--- select $1.x = $2.x and--- $1.y = $2.y;--- $$ language sql stable;---- create operator = (--- leftarg = pos,--- rightarg = pos,--- procedure = pos_equals,--- commutator = =--- );---/*--add two auxiliary tables to track imaginary monsters and raised-monsters who are now undead--*/-create table imaginary_pieces (- ptype text,- allegiance text,- tag int);--select set_relvar_type('imaginary_pieces', 'data');-select add_key('imaginary_pieces', array['ptype', 'allegiance', 'tag']);-select add_foreign_key('imaginary_pieces',- array['ptype', 'allegiance', 'tag'], 'pieces');-select add_foreign_key('imaginary_pieces', 'ptype',- 'monster_prototypes');--create table crimes_against_nature (- ptype text,- allegiance text,- tag int-);--select set_relvar_type('crimes_against_nature', 'data');-select add_key('crimes_against_nature', array['ptype', 'allegiance', 'tag']);-select add_foreign_key('crimes_against_nature',- array['ptype', 'allegiance', 'tag'], 'pieces');-select add_foreign_key('crimes_against_nature', 'ptype',- 'monster_prototypes');--create view wizard_upgrade_stats as-select pp.ptype,- allegiance,- tag,- x,- y,- false as imaginary,- magic_wings as flying,- case when magic_wings then 6- when shadow_form then 3- else speed- end as speed,- case when shadow_form then agility + 2- else agility- end as agility,- undead,- ridable,- case when magic_bow then 'projectile'- else null- end as ranged_weapon_type,- case when magic_bow then 6- else null- end as range,- case when magic_bow then 6- else null- end as ranged_attack_strength,- case when magic_sword then attack_strength + 4- when magic_knife then attack_strength + 2- else attack_strength- end as attack_strength,- case when magic_armour and shadow_form then physical_defense + 6- when magic_shield and shadow_form then physical_defense + 4- when magic_armour then physical_defense + 4- when magic_shield then physical_defense + 2- when shadow_form then physical_defense + 2- else physical_defense- end as physical_defense,- magic_defense- from pieces p- inner join wizards- on allegiance = wizard_name- inner join piece_prototypes_mr pp- on pp.ptype='wizard'- where p.ptype = 'wizard';---- create view imaginary_or_not_pieces as--- select ptype,allegiance,tag,x,y,coalesce(imaginary,false) as imaginary--- from pieces--- natural left outer join (select *,true as imaginary--- from imaginary_pieces) as a;--create view pieces_mr as-select ptype,- allegiance,- tag,- x,- y,- coalesce(imaginary,case when not ridable is null then false- else null end) as imaginary,- flying,- speed,- agility,- coalesce(raised, undead) as undead,- ridable,- ranged_weapon_type,- range,- ranged_attack_strength,- attack_strength,- physical_defense,- magic_defense- from pieces- natural inner join piece_prototypes_mr- natural left outer join (select *,true as imaginary- from imaginary_pieces) as a- natural left outer join (select *,true as raised- from crimes_against_nature) as b- where ptype <> 'wizard'-union-select * from wizard_upgrade_stats;--create view creature_pieces as- select ptype,allegiance,tag,x,y,- flying,speed,agility- from pieces_mr- where flying is not null- and speed is not null- and agility is not null;--create view monster_pieces as- select ptype,allegiance,tag,x,y,- flying,speed,agility,- undead,ridable,imaginary- from pieces_mr- where flying is not null- and speed is not null- and agility is not null- and undead is not null- and ridable is not null;--create view dead_monster_pieces as- select * from monster_pieces- where allegiance = 'dead';--create view attacking_pieces as- select ptype,allegiance,tag,x,y,- attack_strength- from pieces_mr- where attack_strength is not null- and allegiance <> 'dead';--create view ranged_weapon_pieces as- select ptype,allegiance,tag,x,y,- ranged_weapon_type,range,ranged_attack_strength- from pieces_mr- where ranged_weapon_type is not null- and range is not null- and ranged_attack_strength is not null;--create view attackable_pieces as- select ptype,allegiance,tag,x,y,physical_defense- from pieces_mr- where physical_defense is not null;--create view magic_attackable_pieces as- select ptype,allegiance,tag,x,y,magic_defense- from pieces_mr- where magic_defense is not null;---/*--Rules for multiple pieces on one square: only one piece of each-type may occupy a square in particular you can't have two dead bodies-on one square. These are the traditional chaos rules which may change-for other rulesets.--When multiple pieces occupy one square, one is considered to be 'on-top'. This piece-* is the one piece displayed in the UI currently-* the piece upon which any spell cast on that square hits-* the piece which is attacked when another piece attacks or range- attacks that square--1 item-any-2 items-creature, stiff : creature on top-wizard, mountable monster: mountable monster on top-wizard, box : box on top-stiff, gooey blob : blob on top-monster, gooey blob : blob on top-3 items-wizard, stiff, mountable monster : mountable on top-stiff, monster, blob : blob on top--*/--select set_module_for_preceding_objects('pieces');-/*--================================================================================--= turn sequence--see readme for overview of turn sequence--For the player, there are three phases, but for the computer there are-four phases, the extra one is the autonomous phase in between casting-and moving. In this phase magic fire and gooey blob spread, castles-may disappear, and wizards may receive a new spell from a magic tree.--There are lots of constraints in this section. For an app like this-where all the updates are through stored procs which carefully check-their preconditions, and there are never any multiple updates, this is-a bit excessive. The main takeaway is that you need deferred-constraints or multiple updates for most constraints that involve more-that one table.--== ddl-*/-select new_module('turn_sequence', 'server');--/*-use this to simulate multiple updates:-for a constraint which refers to multiple tables which get updated-during an action_next_phase call, this will be set to true,-false at all other times, so using this can defer constraint checking-till the end of the action_next_phase call after all the relevant-turn phase relvars have been updated. Don't forget to put-in_next_phase_hack_table in the relvar list for the constraint.--*/-select create_var('in_next_phase_hack', 'boolean');-insert into in_next_phase_hack_table values (false);-select set_relvar_type('in_next_phase_hack_table', 'stack');--select create_var('creating_new_game', 'boolean');-insert into creating_new_game_table values (true);-select set_relvar_type('creating_new_game_table', 'stack');----Turn number, starts at 0 goes up 1 each full turn, just used to provide---info on how long the game has been going.-select create_var('turn_number', 'int');-select set_relvar_type('turn_number_table', 'data');----if not creating new game cardinality = 1--select create_update_transition_tuple_constraint(- 'turn_number_table',- 'turn_number_change_valid',- '(NEW.turn_number = OLD.turn_number + 1)');--create function no_deletes_inserts_except_new_game(relvar_name text)- returns void as $$-begin- perform create_delete_transition_tuple_constraint(- relvar_name,- relvar_name || '_no_delete',- 'exists(select 1 from creating_new_game_table- where creating_new_game = true)');- perform create_insert_transition_tuple_constraint(- relvar_name,- relvar_name || '_no_insert',- 'exists(select 1 from creating_new_game_table- where creating_new_game = true)');--end;-$$ language plpgsql volatile;--select no_deletes_inserts_except_new_game('turn_number_table');--/*-turn phase-must follow choose-cast-auto-move-choose-etc.--wizard spell choices-added row must be for current wizard, and in current wizard's spell book- in choose phase-removed row must be for current wizard- in cast phase--spell parts to cast-pieces to move-squares left to walk--*/--create view next_wizard as-select wizard_name, new_wizard_name from- (select wizard_name as new_wizard_name, place- from live_wizards) as a inner join- (select wizard_name,- (place + 1) %- (select max(place) + 1 from live_wizards)- as old_place from live_wizards) as b- on (place = old_place);---create function next_wizard(text) returns text as $$- select new_wizard_name from next_wizard- where wizard_name = $1;-$$ language sql stable;--/*select next_wizard('Buddha');-select next_wizard('Kong Fuzi');-select next_wizard('Laozi');-select next_wizard('Moshe');-select next_wizard('Muhammad');-select next_wizard('Shiva');-select next_wizard('Yeshua');-select next_wizard('Zarathushthra');-*/----current wizard is the wizard who's turn it is to do stuff in current phase-select create_var('current_wizard', 'text');-select set_relvar_type('current_wizard_table', 'data');-select add_foreign_key('current_wizard_table', 'current_wizard',- 'wizards', 'wizard_name');-select create_update_transition_tuple_constraint(- 'current_wizard_table',- 'next_wizard_change_valid',- 'NEW.current_wizard = next_wizard(OLD.current_wizard)');-select create_delete_transition_tuple_constraint(- 'current_wizard_table',- 'current_wizard_table_no_delete',- 'exists(select 1 from creating_new_game_table- where creating_new_game = true)- or exists (select 1 from game_completed_table)');-select create_insert_transition_tuple_constraint(- 'current_wizard_table',- 'current_wizard_table_no_insert',- 'exists(select 1 from creating_new_game_table- where creating_new_game = true)');-----select no_deletes_inserts_except_new_game('current_wizard_table');-select add_constraint('current_wizard_must_be_alive',- $$(select not expired from current_wizard_table- inner join wizards on current_wizard = wizard_name)$$,- array['wizards', 'current_wizard_table']);--/*-wizard field in most tables and views is named wizard_name--instead of tediously writing out inner join blah on wizard_name =-current_wizard use the following view to instead write natural inner-join current_wizard . Not that much less tedious though.--*/--create view current_wizard as- select current_wizard as wizard_name from current_wizard_table;----turn phase enum: choose spell, cast spell, autonomous, move-create domain turn_phase_enum as text- check (value in ('choose', 'cast', 'autonomous', 'move'));--create function next_turn_phase(text) returns text as $$- select case- when $1='choose' then 'cast'- when $1='cast' then 'autonomous'- when $1='autonomous' then 'move'- when $1='move' then 'choose'- end as result-$$ language sql immutable;--select create_var('turn_phase', 'turn_phase_enum');-select set_relvar_type('turn_phase_table', 'data');-select create_update_transition_tuple_constraint(- 'turn_phase_table',- 'turn_phase_change_valid',- 'NEW.turn_phase = next_turn_phase(OLD.turn_phase)');-select no_deletes_inserts_except_new_game('turn_phase_table');--create type turn_pos as (- turn_number int,- turn_phase turn_phase_enum,- current_wizard text-);---- create function turn_pos_equals(turn_pos, turn_pos) returns boolean as $$--- select $1.turn_number = $2.turn_number and--- $1.turn_phase = $2.turn_phase and--- $1.current_wizard = $2.current_wizard;--- $$ language sql stable;---- create operator = (--- leftarg = turn_pos,--- rightarg = turn_pos,--- procedure = turn_pos_equals,--- commutator = =--- );--create function get_current_turn_pos() returns turn_pos as $$- select (turn_number, turn_phase, current_wizard)::turn_pos- from turn_number_table- cross join turn_phase_table- cross join current_wizard_table;-$$ language sql stable;---/*--Both spell casting and moving have a bunch of state local to each-wizards turn in the that phase. Wizard spell choices is a piece of-turn phase state which is constructed bit by bit in the choice phase-then read in the cast phase, so this lasts from the start of the-choice phase to the end of the cast phase.--*/-create table wizard_spell_choices_mr (- wizard_name text not null,- spell_name text not null,- imaginary boolean null-);-select add_key('wizard_spell_choices_mr', 'wizard_name');-select add_constraint('dead_wizard_no_spell',- $$ not exists(select 1 from wizard_spell_choices_mr- natural inner join wizards- where expired = true)$$,- array['wizards', 'pieces']);--create view wizard_spell_choices as- select wizard_name, spell_name- from wizard_spell_choices_mr;--create view wizard_spell_choices_imaginary as- select wizard_name, imaginary- from wizard_spell_choices_mr- where imaginary is not null;--/*--todo: add constraint to say imaginary must be set for monsters and-must not be set for non-monsters (will need a multiple update hack to-go with this)--*/----shortcut for current wizard's spell-create view current_wizard_spell as- select spell_name from wizard_spell_choices- natural inner join current_wizard;--create function get_current_wizard_spell() returns text as $$- select spell_name from current_wizard_spell;-$$ language sql stable;--/*this really needs multiple updates----select add_foreign_key('wizard_spell_choices', array['wizard_name',--- 'spell_name'], 'spell_books');--the problem is that in the action_next_phase for the end of a wizards-cast phase we want to delete the spell choice from this table, and-also delete the spell from the wizards spell book. The code deletes-the spell from the spell book first, but since the spell choice-references the spell book table, the reference stops the delete.--We can't use a conventional cascade delete since there may be multiple-rows in the spell book for the same spell/wizard combo - this isn't a-foreign key in sql sense.--One alternative is to save the wizard and spell names in a variable so-we can delete the spell choice first then the spell book entry, but-that is pretty inelegant.--We could do it properly with multiple updates, so simulate this by-writing out the fk by hand and adding the in next phase hack.--*/-select create_var('spell_choice_hack', 'boolean');-insert into spell_choice_hack_table values (false);-select set_relvar_type('spell_choice_hack_table', 'stack');--select add_constraint('wizard_spell_choices_wizard_name_spell_name_fkey',-$$((select spell_choice_hack from spell_choice_hack_table) or-not exists(select wizard_name, spell_name from wizard_spell_choices- except-select wizard_name, spell_name from spell_books))$$,-array['spell_choice_hack_table', 'wizard_spell_choices_mr', 'spell_books']);---/*-if choose phase: only current and previous wizards may have a row-if cast phase: only current and subsequent wizards may have a row-this constraint really needs multiple updates.-*/-select add_constraint('chosen_spell_phase_valid',-$$-((select in_next_phase_hack from in_next_phase_hack_table) or-(((select turn_phase='choose' from turn_phase_table) and- (select max(place) from wizard_spell_choices- natural inner join live_wizards) <=- (select place from live_wizards- inner join current_wizard_table- on wizard_name = current_wizard))-or-((select turn_phase='cast' from turn_phase_table) and- (select min(place) from wizard_spell_choices- natural inner join live_wizards) >=- (select place from live_wizards- inner join current_wizard_table- on wizard_name = current_wizard))-or not exists(select 1 from wizard_spell_choices)-))$$, array['turn_phase_table', 'current_wizard_table',- 'wizard_spell_choices_mr', 'wizards', 'in_next_phase_hack_table']);--select create_update_transition_tuple_constraint(- 'wizard_spell_choices_mr',- 'update_spell_choice_restricted',- $$(select turn_phase = 'choose' from turn_phase_table)- and (NEW.wizard_name = OLD.wizard_name)- and (select current_wizard = NEW.wizard_name from current_wizard_table)$$);-select create_insert_transition_tuple_constraint(- 'wizard_spell_choices_mr',- 'insert_spell_choice_restricted',- $$(select turn_phase = 'choose' from turn_phase_table)- and (select current_wizard = NEW.wizard_name from current_wizard_table)$$);-select create_delete_transition_tuple_constraint(- 'wizard_spell_choices_mr',- 'delete_spell_choice_restricted',- $$(select turn_phase in ('cast', 'choose') from turn_phase_table)$$);--select set_relvar_type('wizard_spell_choices_mr', 'data');--/*--if wizard is skipping casting a spell then no tuple appears in this-relvar for that wizard--spellparts to cast is local to spell casting phase for each wizard--current wizard has cast amount spell parts in this turn phase--when entering spell cast phase, this is set to 0 if wizard has no-spell or max number of casts otherwise--*/--select create_var('spell_parts_to_cast', 'int');-select set_relvar_type('spell_parts_to_cast_table', 'data');--select add_constraint('parts_to_cast_only', $$- ((select turn_phase = 'cast' from turn_phase_table)- or not exists(select 1 from spell_parts_to_cast_table))-$$, array['turn_phase_table', 'spell_parts_to_cast_table']);--/*-If casting multipart spell, only check success on first part.-Store whether current wizard's spell needs a success check here.-make sure to reset it each next phase during cast phase-*/--select create_var('cast_success_checked', 'boolean');-select set_relvar_type('cast_success_checked_table', 'data');-select add_constraint('cast_checked_cast_only', $$- ((select turn_phase = 'cast' from turn_phase_table)- or not exists(select 1 from cast_success_checked_table))-$$, array['cast_success_checked_table', 'turn_phase_table']);--/*--casting affecting alignment--how does a successful or unsuccessful spell affect world alignment?-do unsuccessful spells have any effect?-does the current world alignment affect the effect?-is there a limit to how much the alignment can change in a turn?-is each spell's effect independent of what other spells are cast that turn?--what about:- each spell can affect the world alignment- spell alignments don't add up, the result is taken by random- from one of the spells cast that turn- e.g.- 0, -1, -4, 2, -1: five spells cast with alignments given- chose one of these at random, each with 1/5 chance- then adjust alignment by this (align/2 with probability for halfs?)--current plan:-only successful spells affect alignment-keep track of all spells during cast phase-sum up total alignment, divide by 2, each full number affects alignment-the fractional part has probability to affect it-maximum change is 2--this means that law increases alignment by one and large law does it-by two in the absence of any other spells.--*/-select create_var('cast_alignment', 'integer');-select set_relvar_type('cast_alignment_table', 'stack');--select add_constraint('cast_alignment_empty',- $$((get_turn_phase() = 'cast') or- not exists(select 1 from cast_alignment_table))$$,- array['turn_phase_table', 'cast_alignment_table']);--create function adjust_world_alignment() returns void as $$-declare- abs_change float;-begin- select into abs_change- min(abs(get_cast_alignment()) / 2, 2);- update world_alignment_table- set world_alignment = world_alignment- + trunc(abs_change) * sign(get_cast_alignment());- --get fractional part- if (random() < abs_change - trunc(abs_change)) then- update world_alignment_table- set world_alignment = world_alignment +- sign(get_cast_alignment());- end if;- update cast_alignment_table set cast_alignment = 0;-end;-$$ language plpgsql volatile;----/*--pieces to move and selected piece are local to move phase for each-wizard--Piece in this table from current wizard's army hasn't yet moved-in this turn.--TODO: i think switching this from pieces to move to pieces_moved will-be a bit more straightforward--*/-create table pieces_to_move (- ptype text,- allegiance text,- tag int-);-select add_key('pieces_to_move', array['ptype', 'allegiance', 'tag']);---cascade delete here:-select add_foreign_key('pieces_to_move', array['ptype', 'allegiance', 'tag'],- 'pieces');-select add_foreign_key('pieces_to_move', 'allegiance',- 'current_wizard_table', 'current_wizard');-select set_relvar_type('pieces_to_move', 'data');-select add_constraint('pieces_to_move_empty',-$$((select turn_phase = 'move' from turn_phase_table) or-not exists (select 1 from pieces_to_move))$$,-array['pieces_to_move', 'turn_phase_table']);--create domain move_phase as text- check (value in ('motion', 'attack', 'ranged_attack'));--create table selected_piece (- ptype text,- allegiance text,- tag int,- move_phase move_phase,- engaged boolean-); -- 0 to 1 tuple when in move phase,--- piece key from current wizards army, empty otherwise-select add_key('selected_piece', array['ptype', 'allegiance', 'tag']);-select add_foreign_key('selected_piece', array['ptype', 'allegiance', 'tag'],- 'pieces');-select add_foreign_key('selected_piece', 'allegiance',- 'current_wizard_table', 'current_wizard');-select constrain_to_zero_or_one_tuple('selected_piece');-select set_relvar_type('selected_piece', 'data');---/*--squares left to walk is local to the current moving piece during-its walking phase, not used if piece is not a walker.--TODO: this doesn't take into account e.g. move of 3 squares, move-diagonal, second diagonal move all move used up, can't do three-diagonal moves.--*/-select create_var('remaining_walk', 'int');-select set_relvar_type('remaining_walk_table', 'data');-select create_var('remaining_walk_hack', 'boolean');-select set_relvar_type('remaining_walk_hack_table', 'stack');-insert into remaining_walk_hack_table values (false);--select add_constraint('remaining_walk_only_motion',-$$ ((not exists(select 1 from remaining_walk_table)) or- exists(select 1 from creating_new_game_table- where creating_new_game = true) or- (select remaining_walk_hack- from remaining_walk_hack_table) or- (exists(select 1 from selected_piece)- and (select move_phase = 'motion' from selected_piece)- and exists (select 1 from creature_pieces- natural inner join selected_piece)- and (select not flying from creature_pieces- natural inner join selected_piece))) $$,- array['selected_piece', 'pieces', 'remaining_walk_table',- 'remaining_walk_hack_table', 'creating_new_game_table']);----this function is used to initialise the turn phase data.-create function init_turn_stuff() returns void as $$-begin- --this should catch attempts to start a game- --which has already been started- if exists(select 1 from turn_number_table) then- raise exception 'new game started when turn number table not empty';- end if;- insert into turn_number_table values (0);- insert into turn_phase_table- values ('choose');- insert into current_wizard_table- select wizard_name from live_wizards- order by place limit 1;-end;-$$ language plpgsql volatile;--/*--table to cache if the game is over: someone has one or it's a draw.-(This also makes it possible to have a draw when there are wizards-remaining.)--*/--select create_var('game_completed', 'boolean');-select set_relvar_type('game_completed_table', 'data');-select add_constraint('game_completed_wizards',- $$(not exists(select 1 from game_completed_table)- or (select count(1) <= 1 from live_wizards))$$,- array['game_completed_table']);--create function game_completed() returns void as $$-begin- insert into game_completed_table- select true where not exists (select 1 from game_completed_table);-end;-$$ language plpgsql volatile;---- 1 tuple iff current moving piece walks, empty otherwise---/*-================================================================================--= Actions-*/-select new_module('actions', 'server');-/*-== Testing--for testing purposes sometimes want to make a given nondeterministic-action always fail or always succeed.--The categories are:-castle disappear-gooey blob spread-attack-ranged attack-resist: decree, lightning, subversion-cast spell--you have to set the override each time you want to override something--*/--create domain random_test text check (value in- ('disappear', 'spread', 'attack',- 'ranged_attack', 'resist', 'cast',- 'bonus','break_engaged'));--create table test_action_overrides (- override random_test,- setting bool-);-select set_relvar_type('test_action_overrides', 'data');--create function action_rig_action_success(poverride random_test,- psetting boolean) returns void as $$-begin- insert into test_action_overrides (override, setting)- values (poverride, psetting);-end;-$$ language plpgsql volatile;--select add_key('test_action_overrides', 'override');--/*-== random numbers-run all random tests through this, so that we can hook into them-during testing.-*/-create function check_random_success(t random_test, successPercentage int)- returns boolean as $$-declare- o boolean;-begin- o := (select setting from test_action_overrides- where override = t);- if o is null then --normal random- return (random() * 100) < successPercentage;- else --overriden- delete from test_action_overrides- where override = t;- return o;- end if;-end;-$$ language plpgsql volatile;--create function min(integer, integer) returns integer as $$- select min(n) from (select $1 as n union select $2 as n) as a;-$$ language sql immutable;--create function max(integer, integer) returns integer as $$- select max(n) from (select $1 as n union select $2 as n) as a;-$$ language sql immutable;--create function limit_chance(integer) returns integer as $$- select max(10, min($1, 100));-$$ language sql immutable;--/*-== action validity--*/-select new_module('squares_valid', 'actions');--/*-=== pieces on top--The topmost piece on each square is the one you interact with most of-the time, e.g. when selecting, attacking, etc.--The exception to this rule is when you select a wizard that is in a-magic tree or castle or mounted on a monster.--The pieces_on_top view also determines what sprite is shown in a-square in the ui--*/--create view pieces_with_priorities as- select ptype,allegiance,tag,x,y,- case- when allegiance='dead' then 3- when ptype='wizard' then 2- when ptype in (select ptype from monster_prototypes) then 1- else 0- end as sp- from pieces;----restrict this view taking only the top piece from each square to get---the final result--create view pieces_on_top as- select x,y,ptype,allegiance,tag,sp from- (select row_number() over(partition by (x,y) order by sp) as rn,- x, y, ptype, allegiance, tag, sp- from pieces_with_priorities) as pwp where rn = 1;----create a full view to help with updates---- question: why does pieces_view natural inner join pieces_on_top--- return too many rows?--create view pieces_on_top_view as- select p.* from pieces_mr p- inner join pieces_on_top- using (ptype,allegiance,tag);--/*-=== selectable squares and pieces--We can't use the pieces on top for the selection because of-the exceptions re castles, magic wood and mounted wizards,-so create a similar view so we can determine the piece that-gets selected by square, this part is just the pieces on top-combined with all the wizards even if they are not on top.--This is finished off using the pieces_to_move relvar.--*/-create view moving_pieces as- select ptype, allegiance, tag,x,y from pieces_mr- where speed is not null- or attack_strength is not null- or ranged_attack_strength is not null;--create view selectable_pieces_with_priorities as- select ptype,allegiance,tag,x,y,- case- when ptype='wizard' then 0- else 1- end as sp- from moving_pieces- where (x,y) not in(select x,y from pieces- where ptype = 'gooey_blob');--/*--=== internals-*/--create function distance(int, int, int, int) returns float(24) as $$- select (point($1, $2) <-> point($3, $4))::float(24) as result;-$$ language sql immutable;--create view board_ranges as---iterate x,y over each square on board--- iterate d over 0 to 20--- iterate tx,ty over each square on board--- include x,y,d, tx, ty iff d(x,y,tx,ty) < d---so: we include squares <= to the range, not just squares at that---range-- select * from generate_series(0, 14) as x- cross join generate_series(0, 9) as y- cross join generate_series(1, 20) as range- cross join generate_series(0, 14) as tx- cross join generate_series(0, 9) as ty- where- --slightly hacky, we never need the centre square to be included so- --exclude it here even though it's not quite mathematically correct- (x,y) != (tx,ty) and- distance(x,y,tx,ty) - 0.5 <= range; --round to closest int--select set_module_for_preceding_objects('squares_valid');----this view contains all the squares with no pieces in them-create view empty_squares as- select x,y from generate_series(0, 14) as x- cross join generate_series(0, 9) as y- except- select x,y from pieces;---- this view contains all the squares containing corpses and nothing else-create view corpse_only_squares as- select x,y from pieces_on_top- natural inner join dead_monster_pieces;----empty or corpse only doubles as the list of squares moveable to---either by walking or flying-create view empty_or_corpse_only_squares as---empty squares union- select * from empty_squares- union- select * from corpse_only_squares;---- this view contains all the squares which are exactly one square--- away from a tree (doesn't include the tree squares themselves)-create view adjacent_to_tree_squares as- select tx as x, ty as y- from board_ranges- natural inner join pieces- where ptype in ('magic_tree', 'shadow_tree')- and range = 1;----create view empty_and_not_adjacent_to_tree_squares as- select * from empty_squares- except- select * from adjacent_to_tree_squares;----this view contains squares which the 'top piece' is attackable-create view attackable_squares as- select x,y from attackable_pieces- natural inner join pieces_on_top;----this view contains squares which the 'top piece' is a creature-create view creature_on_top_squares as- select x,y from creature_pieces- natural inner join pieces_on_top;----this view contains squares which the 'top piece' is a monster-create view monster_on_top_squares as- select x,y from monster_pieces- natural inner join pieces_on_top;---- this view contains all the squares which are valid for the--- different spell target categories. Doesn't take into account range-create view spell_valid_squares as- select 'empty' as valid_square_category, *- from empty_squares- union- select 'empty_or_corpse_only' as valid_square_category, *- from empty_or_corpse_only_squares- union- select 'attackable' as valid_square_category, *- from attackable_squares- union- select 'creature_on_top' as valid_square_category, *- from creature_on_top_squares- union- select 'monster_on_top' as valid_square_category, *- from monster_on_top_squares- union- select 'corpse_only' as valid_square_category, *- from corpse_only_squares- union- select 'empty_and_not_adjacent_to_tree' as valid_square_category, *- from empty_and_not_adjacent_to_tree_squares;----this view contains all the squares which would be valid---for the current wizard's current spell, not taking into---account the wizard's position and the spell's range.-create view current_wizard_spell_type_squares as- select x,y from wizard_spell_choices- inner join current_wizard_table on (wizard_name = current_wizard)- natural inner join spell_valid_square_types- natural inner join spell_valid_squares;----rewrote joining to board_ranges as a where for speed purposes-create view current_wizard_spell_range_squares as- select tx as x, ty as y- from board_ranges- where (x,y,range) =- (select x, y, range- from pieces- inner join current_wizard_table- on (allegiance = current_wizard)- inner join wizard_spell_choices- on (wizard_name = current_wizard)- natural inner join spell_ranges- where ptype = 'wizard');----this view contains all the squares which are valid targets--- for the current wizard's current spell---taking into account the spell target category, the wizard's---position and the range, i.e. the final product---this is directly used in action valid during spell casting-create view current_wizard_spell_squares as- select * from current_wizard_spell_type_squares- intersect- select * from current_wizard_spell_range_squares- except- select x, y from pieces- inner join current_wizard_table- on (allegiance = current_wizard) where ptype='wizard';--/*-create a view containing all the squares the selected piece-could move to if they had unlimited speed-*/-create view selected_piece_move_squares as- select x,y from empty_or_corpse_only_squares- union- select x,y from pieces- natural inner join- (select ptype from enterable_piece_types- where (select ptype='wizard' from selected_piece)- union- select ptype from ridable_prototypes- where (select ptype='wizard' from selected_piece)) as a- where allegiance = (select allegiance from selected_piece);---- = all squares range one from piece, which--- dont contain anything but-create view selected_piece_walk_squares as- select x,y from- selected_piece_move_squares- intersect---adjust for 1 square away from selected piece:---get the ranges- select tx as x, ty as y from board_ranges- natural inner join selected_piece- natural inner join pieces---restrict to 1 range---exclude flying creatures- where range = 1-- and not (select flying or engaged- from creature_pieces- natural inner join selected_piece)--- only if the selected piece has squares left to walk- and get_remaining_walk() > 0;--create view squares_within_selected_piece_flight_range as- select tx as x, ty as y from board_ranges- natural inner join selected_piece- natural inner join creature_pieces- where flying and range <= speed;----this view is the analogue of selected_piece_walk_squares--- for flying creatures-create view selected_piece_fly_squares as-select x,y from selected_piece_move_squares-intersect-select x,y from squares_within_selected_piece_flight_range--- only if the selected piece hasn't moved- where (select move_phase from selected_piece) = 'motion';--create view selected_piecexy as- select * from selected_piece- natural inner join pieces;----create view selected_piece_shootable_squares as--- select x,y from pieces_on_top--- natural inner join attackable_pieces;--create function is_equipped(text) returns boolean as $$-- select magic_sword or magic_knife or magic_bow- from wizards where wizard_name = $1;--$$ language sql stable;--create view selected_piece_attackable_squares as- select x,y from pieces_on_top t- natural inner join pieces_mr p- cross join selected_piece s- where physical_defense is not null- and p.allegiance <> s.allegiance- and p.allegiance <> 'dead'- --wizards can't attack magic trees but monsters can- and not (p.ptype='magic_tree' and s.ptype='wizard')--/*--logic isn't quite right - a wizard can only attack undead with the-magic weapon so e.g. they shouldn't be able to attack h2h if they only-have a magic bow--*/- and (not coalesce(undead,false)- or coalesce((select coalesce(undead,false) from pieces_mr- natural inner join selected_piece), false)- or coalesce(s.ptype = 'wizard'- and is_equipped(s.allegiance), false));--create view selected_piece_walk_attack_squares as- select x,y from selected_piece_attackable_squares- intersect- select tx,ty from board_ranges r- natural inner join selected_piecexy- where range = 1- and move_phase in ('motion','attack');--create view selected_piece_fly_attack_squares as- select x,y from selected_piece_attackable_squares- natural inner join squares_within_selected_piece_flight_range- where (select move_phase from selected_piece) = 'motion';--create view selected_piece_in_range_squares as- select tx as x, ty as y from board_ranges b- natural inner join ranged_weapon_pieces s- natural inner join selected_piece- where b.range <= s.range;--create view selected_piece_ranged_attackable_squares as- select x,y from selected_piece_attackable_squares- natural inner join selected_piece_in_range_squares;--/*-this view lists all the squares which have pieces which can be-selected. It is empty when:- not in move phase- there is a currently selected piece- the current wizard has no pieces left to select-the pieces to move only has entries for- the current wizard who's moving, else it's empty- so only need to switch the contents dependant on- whether there is a selected piece or not-*/--create view selectable_pieces as- select * from- (select row_number() over (partition by (x,y) order by sp) as rn, *- from selectable_pieces_with_priorities- natural inner join pieces_to_move- where not exists(select 1 from selected_piece)- ) as s where rn = 1;----- select distinct on (x,y) * from selectable_pieces_with_priorities--- natural inner join pieces_to_move--- where not exists(select 1 from selected_piece)--- order by x,y,sp;--/*-=== valid actions--The end result: two relvars, one with x,y,-to list all the valid actions at any time.-*/-create view valid_target_actions as-select * from (---target spells-select x,y, 'cast_target_spell'::text as action- from current_wizard_spell_squares- where get_turn_phase() = 'cast'---selecting a piece-union-select x,y,action from (-select x,y, 'select_piece_at_position':: text as action- from selectable_pieces---walking-union-select x,y, 'walk'::text as action- from selected_piece_walk_squares---flying-union-select x,y, 'fly'::text as action- from selected_piece_fly_squares---attacking-union-select x,y, 'attack'::text as action- from selected_piece_walk_attack_squares---fly attacking-union-select x,y, 'attack'::text as action- from selected_piece_fly_attack_squares---shooting-union-select x,y, 'ranged_attack'::text as action- from selected_piece_ranged_attackable_squares-)as s1-where get_turn_phase()='move'-) as s-where not exists (select 1 from game_completed_table);--create function current_wizard_replicant() returns bool as $$- select computer_controlled from wizards- inner join current_wizard_table- on wizard_name=current_wizard;-$$ language sql stable;--/*-create a view with the choose spell predicates automatically-*/--create view valid_activate_actions as-select * from (---next_phase - always valid-select 'next_phase'::text as action---choose spell - need one for each spell, add programmatically---set imaginary-union-select 'set_imaginary'::text as action- from monster_spells- where get_current_wizard_spell() is not null- and spell_name = get_current_wizard_spell()---set real-union-select 'set_real'::text as action- from monster_spells- where get_current_wizard_spell() is not null- and spell_name = get_current_wizard_spell()---cast activate spell-union-select 'cast_activate_spell'::text as action- where exists (select 1- from current_wizard_spell- natural inner join activate_spells- where get_turn_phase() = 'cast')- or (select spell_name ='magic_wood'- from current_wizard_spell- where get_turn_phase() = 'cast')---skip spell---union---select 'skip_spell'::text as action--- where get_turn_phase() = 'cast'---unselect-union-select 'unselect_piece'::text as action- from selected_piece---next subphase-union-select 'cancel'::text as action- from selected_piece-union-/*--generate a separate choose action wrapper for each spell--without this, we can add a general choose spell action but then we-first check if the current player can choose a spell at this time, and-then check if they have the particular spell they are trying to-choose.--By creating these simple wrappers, we can check both at once, and also-the ui has one simple test to see if a spell choice action is valid-instead of two stages.--*/-select 'choose_' || spell_name || '_spell'::text as action- from spell_books where wizard_name = get_current_wizard()- and get_turn_phase()='choose'-union-select 'choose_no_spell'::text as action- from turn_phase_table where turn_phase ='choose'-union-select 'ai_continue'- from wizards- inner join current_wizard_table- on wizard_name = current_wizard- where computer_controlled-) as a-where not exists (select 1 from game_completed_table);--/*-==== internals-provide shortcut functions to check if an action can be run using-these views--*/-create function check_can_run_action(action_name text) returns void as $$-begin- if not exists (select 1 from valid_activate_actions- where action = action_name) then- raise exception 'cannot run % here', action_name;- end if;-end;-$$ language plpgsql stable;--create function check_can_run_action(action_name text, px int, py int)- returns void as $$-begin- if not exists (select 1 from valid_target_actions- where action = action_name and (x,y) = (px,py)) then- raise exception 'cannot run % on %,% here', action_name, px, py;- end if;-end;-$$ language plpgsql stable;--/*-== next phase--next phase strings the enter and exits all together in the right order-and provides a simple API for clients--there seems to be some nomenclaturic confusion as to whether a single-phase is all wizards choosing, or all casting, or all moving, or if-it's one wizard casting, i.e. whether there are 3 (choose, cast, move,-or 4 including autonomous) phases per turn or roughly 3 * number of-live wizards ( + 1 for autonomous) phases per turn.--Next_phase implies each wizard is a new phase, but sometimes e.g. the-whole of the cast phase for all wizards is refered to as the phase or-a phase...?--*/----select create_var('dont_nest_ai_next_phase', 'bool');---select set_relvar_type('dont_nest_ai_next_phase_table', 'stack');--create function action_next_phase() returns void as $$-declare- c int;- next_phase_again boolean := false;-begin-/*-=== check for game completion-*/- if (exists (select 1 from game_completed_table)) then- return;- end if;- --check for win or draw- c := (select count(1) from wizards- where not expired);- if c = 1 then --someone has won- perform game_completed();- update current_wizard_table set current_wizard =- (select wizard_name from wizards where not expired);- perform add_history_game_won();- return;- elseif c = 0 then --game is drawn- perform game_completed();- perform add_history_game_drawn();- delete from current_wizard_table;- return;- end if;--/*-=== current wizard clean up phase--If the user selects next phase when they have a spell to cast, then we-want to call the usual skip spell action so as not to duplicate the-work. But skip spell will call next_phase itself automatically and we-don't want to do two next phases, so if there is a spell to be-skipped, run that and don't run the rest of the next_phase function-since it will be called via skip spell.--*/- -- if the current spell isn't completed, then skip it- if exists(select 1 from wizard_spell_choices- inner join current_wizard_table- on (current_wizard = wizard_name)- where get_turn_phase() = 'cast') then- perform skip_spell();- return;- end if;-- --multiple update hack to get round constraints- update in_next_phase_hack_table- set in_next_phase_hack = true;-- --complete current phase:- if (select turn_phase = 'move' from turn_phase_table) then- delete from pieces_to_move;- end if;--/*-=== all wizards clean up phase--clean up if this is the last wizard for this phase, then move to next-phase, if this is autonomous, then do it and move to move phase this-works because all the end phase stuff happens before the autonomous-phase is run in this function, and all the setup runs after it is run.--*/-- if is_last_wizard() then- --clear the cast alignment which is used to adjust the world- --alignment when a spell is cast- if get_turn_phase() = 'cast' then- delete from cast_alignment_table;- end if;-- --if this is the end of the move phase then we're on the next turn- if (select turn_phase = 'move' from turn_phase_table) then- update turn_number_table- set turn_number = turn_number + 1;- perform add_history_new_turn();- end if;-- --move to the next turn phase- update turn_phase_table- set turn_phase = next_turn_phase(turn_phase);-- if (select turn_phase = 'autonomous' from turn_phase_table) then- perform do_autonomous_phase();- update turn_phase_table- set turn_phase = next_turn_phase(turn_phase);- end if;- end if;--/*-=== init new current phase-*/- -- move to the next wizard, this is the meat of this function- update current_wizard_table- set current_wizard = next_wizard(current_wizard);-- --setup the cast alignment table if this is the start of the cast- --phases- if get_turn_phase() = 'cast' and is_first_wizard() then- insert into cast_alignment_table values(0);- end if;-- --initialise the spell for this phase- if (select turn_phase = 'cast' from turn_phase_table) then- if exists(select 1 from current_wizard_spell) then- insert into spell_parts_to_cast_table- select coalesce(num, 0) from spells_with_num_shots- natural inner join current_wizard_spell;- insert into cast_success_checked_table values (false);- else- --skip to the next phase automatically- next_phase_again := true;- end if;- elseif (select turn_phase = 'move' from turn_phase_table) then- insert into pieces_to_move- select ptype, allegiance, tag- from moving_pieces- inner join current_wizard_table- on allegiance = current_wizard;- end if;-- --finished our updates for this next phase- update in_next_phase_hack_table- set in_next_phase_hack = false;-- perform add_history_wizard_up();-/*-=== continue-*/- --if there is nothing to do in the new current phase - continue to- --next phase automatically- if next_phase_again then- perform action_next_phase();- end if;-end;-$$ language plpgsql volatile;--/*-=== internals-*/-create function is_last_wizard() returns boolean as $$-begin- return ((select place from live_wizards- natural inner join current_wizard)- = (select max(place) from live_wizards));-end;-$$ language plpgsql stable;--create function is_first_wizard() returns boolean as $$-begin- return ((select place from live_wizards- natural inner join current_wizard)- = (select min(place) from live_wizards));-end;-$$ language plpgsql stable;--/*-== spell choice--*/-create function action_choose_spell(vspell_name text)- returns void as $$-begin- --create the argumentless action name so we can check the action- --valid table- perform check_can_run_action('choose_' || vspell_name || '_spell');-- --do nothing if this is the same as the currently selected spell- if (select spell_name from wizard_spell_choices- where wizard_name = get_current_wizard()) = vspell_name then- null;- else- --if wizard already has a chosen spell then remove it- delete from wizard_spell_choices_mr- where wizard_name = get_current_wizard();- insert into wizard_spell_choices_mr (wizard_name, spell_name)- values- (get_current_wizard(), vspell_name);- --- -- set imaginary to false if this is a monster spell- if exists(select 1 from monster_spells- where spell_name = vspell_name) then- update wizard_spell_choices_mr- set imaginary = false- where wizard_name = get_current_wizard();- else- update wizard_spell_choices_mr- set imaginary = null- where wizard_name = get_current_wizard();- end if;- end if;- perform add_history_choose_spell();-end;-$$ language plpgsql volatile;--create function action_choose_no_spell() returns void as $$-begin- perform check_can_run_action('choose_no_spell');- delete from wizard_spell_choices_mr where wizard_name = get_current_wizard();-end;-$$ language plpgsql volatile;--create function action_set_imaginary() returns void as $$-begin- perform check_can_run_action('set_imaginary');- update wizard_spell_choices_mr- set imaginary = true- where wizard_name = get_current_wizard();-end;-$$ language plpgsql volatile;--create function action_set_real() returns void as $$-begin- perform check_can_run_action('set_real');- update wizard_spell_choices_mr- set imaginary = false- where wizard_name = get_current_wizard();-end;-$$ language plpgsql volatile;-/*-=== internals-generate the individual spell choice actions--*/-create function generate_spell_choice_actions() returns void as $$-declare- sn text;- s text;-begin- for sn in select spell_name from spells loop- s := $a$-create function action_choose_$a$ || sn || $a$_spell() returns void as $b$-begin- perform check_can_run_action('choose_$a$ || sn || $a$_spell');- perform action_choose_spell('$a$ || sn || $a$');-end;-$b$ language plpgsql volatile;-$a$;- execute s;- end loop;-end;-$$ language plpgsql volatile;--select generate_spell_choice_actions();-drop function generate_spell_choice_actions();--/*-== cast spells-*/-create function skip_spell() returns void as $$-begin- perform add_history_spell_skipped();- perform spend_current_wizard_spell();-end;-$$ language plpgsql volatile;--create function action_cast_target_spell(px int, py int) returns void as $$-declare- vspell_name text;-begin- perform check_can_run_action('cast_target_spell', px, py);- perform add_history_attempt_target_spell(px,py);-- if not check_spell_success() then- return;- end if;-- if exists(select 1 from current_wizard_spell- natural inner join monster_spells) then- perform cast_monster_spell(px, py);- else-- select into vspell_name spell_name from current_wizard_spell;- if vspell_name = 'disbelieve' then- if not cast_disbelieve(px, py) then- return;- end if;- elseif vspell_name = 'subversion' then- if not cast_subversion(px, py) then- return;- end if;- elseif vspell_name = 'raise_dead' then- perform cast_raise_dead(px, py);- elseif vspell_name in ('decree', 'justice', 'vengeance', 'dark_power') then- perform cast_decree_spell(px, py);- elseif vspell_name in ('lightning', 'magic_bolt') then- perform cast_ballistic_spell(px, py);- elseif vspell_name in ('shadow_wood',- 'magic_fire', 'gooey_blob', 'wall',- 'magic_castle', 'dark_citadel') then- perform cast_object_spell(px, py);- else- raise exception 'unrecognised target spell %', vspell_name;- end if;- end if;- --todo: only update alignment once per spell- perform update_alignment_from_cast();-- update spell_parts_to_cast_table- set spell_parts_to_cast = spell_parts_to_cast - 1;- if get_spell_parts_to_cast() = 0 then- perform spend_current_wizard_spell();- end if;-end;-$$ language plpgsql volatile;--create function action_cast_activate_spell() returns void as $$-begin- perform check_can_run_action('cast_activate_spell');--- perform check_can_cast_spell_now();- perform add_history_attempt_activate_spell();- if not check_spell_success() then- return;- end if;- --call the appropiate function to handle the spell- if (select spell_category = 'wizard' from spells- natural inner join current_wizard_spell) then- perform action_cast_wizard_spell(get_current_wizard(),- get_current_wizard_spell());- elseif exists(select 1 from spells- natural inner join current_wizard_spell- where spell_name in('law', 'chaos', 'large_law',- 'large_chaos')) then- perform cast_lawchaos();- elseif (select spell_name='turmoil' from current_wizard_spell) then- perform cast_turmoil();- elseif (select spell_name='magic_wood' from current_wizard_spell) then- perform cast_magic_wood();- else- raise exception 'unrecognised activate spell: %',- (select spell_name from current_wizard_spell);- end if;- perform update_alignment_from_cast();- perform spend_current_wizard_spell();-end;-$$ language plpgsql volatile;---/*-=== internals--*/-create function spend_current_wizard_spell() returns void as $$-begin- --remove current wizard's spell from spell book- --make sure we only remove one shot of the spell- --don't remove disbelieve- update spell_choice_hack_table- set spell_choice_hack = true;-- delete from spell_parts_to_cast_table;- delete from cast_success_checked_table;-- delete from spell_books where id =- (select id from spell_books- natural inner join wizard_spell_choices- where wizard_name = get_current_wizard()- and spell_name != 'disbelieve'- limit 1);- -- and wipe it from the wizard_spell_choices_table- delete from wizard_spell_choices_mr- where wizard_name = get_current_wizard();-- update spell_choice_hack_table- set spell_choice_hack = false;-- --auto move to next wizard- perform action_next_phase();-end;-$$ language plpgsql volatile;--create view spell_cast_chance as- select spell_name, base_chance as chance from- --all spells if world is neutral, neutral spells unirregardless- -- of world alignment- (select spell_name, sign(alignment) as salign, base_chance,- 'neutral' as alignment from spells- union- --world alignment same as spell alignment- -- proportionately more easy- select spell_name, sign(alignment) as salign,- limit_chance(base_chance + (@ get_world_alignment()) * 10),- 'same' as alignment from spells- union- --world alignment opposite, spell slightly harder- select spell_name, sign(alignment) as salign,- limit_chance(base_chance - 10),- 'opposite' as alignment from spells) as a- where (salign = 0 and alignment = 'neutral') --neutral spells always- --same alignment- or (sign(get_world_alignment()) = 0 and alignment = 'neutral')- or (sign(get_world_alignment()) = 1 and --world law- ((salign = 1 and alignment = 'same') --law spells benefit- or salign = -1 and alignment = 'opposite'))- or (sign(get_world_alignment()) = -1 and -- world chaos- ((salign = -1 and alignment = 'same') --chaos spells benefit- or salign = 1 and alignment = 'opposite'));--create function spell_cast_chance(text) returns integer as $$- select chance from spell_cast_chance where spell_name = $1;-$$ language sql stable;--create function action_cast_wizard_spell(- pwizard_name text, spell_name text)- returns void as $$-begin- --todo: update stats- if spell_name = 'magic_armour' then- update wizards- set magic_armour = true- where wizard_name = pwizard_name;- elseif spell_name = 'magic_shield' then- update wizards- set magic_shield = true- where wizard_name = pwizard_name;- elseif spell_name = 'magic_knife' then- update wizards- set magic_knife = true- where wizard_name = pwizard_name;- elseif spell_name = 'magic_sword' then- update wizards- set magic_sword = true- where wizard_name = pwizard_name;- elseif spell_name = 'magic_bow' then- update wizards- set magic_bow = true- where wizard_name = pwizard_name;- elseif spell_name = 'magic_wings' then- update wizards set magic_wings = true- where wizard_name = pwizard_name;- elseif spell_name = 'shadow_form' then- update wizards- set shadow_form = true- where wizard_name = pwizard_name;- else- raise exception 'unrecognised wizard spell %', spell_name;- end if;- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;--create function cast_lawchaos() returns void as $$-begin- --don't need to do anything, the effect is- --restricted to the alignment effect which- --is handled in the same place for all spells- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;--create function cast_turmoil() returns void as $$-declare- r record;- s record;- tx int;- ty int;-begin- --algorithm: similar to the original chaos I think- -- run through each square in turn, starting at top- --left across top then along each row till you get to the- --bottom right- --move all the pieces in a square to a new random empty- --square at the time of the move (so if pieces on the- --same square as each other before turmoil is cast- --will still be on the same square as each other- --afterwoods. (since we do one square at a time we- -- won't get exact random distribution).-- -- the for loop does actually save the full query- -- at the start so updates in the for loop are not- -- seen by the for loop so there is no risk of a- -- piece teleporting twice- for r in select x,y from pieces_on_top order by x,y loop- select x,y into tx,ty from empty_squares order by random() limit 1;- update pieces set x = tx, y = ty- where (x,y) = (r.x,r.y);- --add histories-/* for s in select ptype, allegiance, tag- from pieces where x = tx and y = ty loop-- perform einsert(array['action_history',- 'action_history_piece_teleport'],- array['history_name', 'ptype', 'allegiance', 'tag'],- array['piece teleport', s.ptype, s.allegiance, s.tag::text]);- end loop;*/- end loop;- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;--create function cast_decree_spell(px int, py int) returns void as $$-declare- r piece_key;- m int;--begin- --if cast on wizard then success destroys all wizards objects- --else if cast on monster then success destroys monster- --get target magic defense- --todo: should this take into account the spell/attack?- m := (select magic_defense- from pieces_on_top- natural inner join magic_attackable_pieces- where (x,y)=(px,py));-- if not check_random_success('resist', m * 10) then- select into r ptype, allegiance, tag- from pieces_on_top- where (x,y)=(px,py);- if r.ptype = 'wizard' then- for r in select ptype, allegiance, tag from pieces- where allegiance = r.allegiance and ptype != 'wizard' loop- perform disintegrate(r);- end loop;- else- perform disintegrate(r);- end if;- perform add_history_spell_succeeded();- end if;-end;-$$ language plpgsql volatile;--create function cast_ballistic_spell(px int, py int) returns void as $$-declare- r piece_key;-begin- --todo: should factor in the attack strength?- if not check_random_success('resist',- (select physical_defense * 10- from pieces_on_top_view- where (x,y) = (px,py))) then- --need to added the chinned history before the- --piece is killed or we loose the allegiance- --need to add the spell successful before the- --chinned history or the order is wrong- perform add_history_spell_succeeded();- perform add_chinned_history(px,py);- select into r ptype,allegiance,tag- from pieces_on_top- where (x,y) = (px,py);- perform kill_piece(r);- else- --spell didn't do any damage- perform add_history_spell_succeeded();- perform add_history_shrugged_off(px, py);- end if;-end;-$$ language plpgsql volatile;--create function cast_raise_dead(px int, py int) returns void as $$-declare- r piece_key;-begin- --turn dead creature on square to live undead- select into r ptype,allegiance,tag- from pieces_on_top- where (x,y) = (px,py);- update pieces- set allegiance = get_current_wizard(),- tag = get_next_tag(r.ptype,get_current_wizard())- where (ptype,allegiance,tag)::piece_key = r- returning tag into r.tag;- insert into crimes_against_nature (ptype,allegiance,tag)- values (r.ptype,get_current_wizard(),r.tag);- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;--create function cast_subversion(px int, py int) returns boolean as $$-declare- r piece_key;-begin- if check_random_success('resist',- (select magic_defense * 10- from pieces_on_top_view- where (x,y) = (px, py))) then- perform add_history_shrugged_off(px, py);- perform action_cast_failed();- return false;- end if;- select into r ptype,allegiance,tag from pieces_on_top- where (x,y) = (px, py);- update pieces- set allegiance = get_current_wizard(),- tag = get_next_tag(r.ptype,get_current_wizard())- where (ptype,allegiance,tag)::piece_key = r;- perform add_chinned_history(px, py);- perform add_history_spell_succeeded();- return true;-end;-$$ language plpgsql volatile;--create function cast_disbelieve(px int, py int) returns boolean as $$-declare- r piece_key;-begin- if not (select imaginary from pieces_on_top_view where (x,y) = (px,py)) then- perform add_history_shrugged_off(px, py);- perform action_cast_failed();- return false;- end if;- select into r ptype, allegiance, tag- from pieces_on_top_view where (x,y) = (px,py);-- perform add_history_spell_succeeded();- perform add_chinned_history(px, py);- perform disintegrate(r);- return true;-end;-$$ language plpgsql volatile;--create function cast_object_spell(px int, py int) returns void as $$-begin- perform create_object(- (select ptype from current_wizard_spell- natural inner join summon_spells),- get_current_wizard(), px, py);- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;---create function cast_monster_spell(x int, y int) returns void as $$-begin- perform create_monster(- (select ptype from current_wizard_spell- natural inner join summon_spells),- get_current_wizard(), x, y, coalesce((- select imaginary- from wizard_spell_choices_imaginary- where wizard_name = get_current_wizard()),false));- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;--create function check_spell_success() returns boolean as $$-begin- -- if already checked then return true- if (select cast_success_checked- from cast_success_checked_table) then- return true;- end if;-- -- if imaginary monster then always succeed- if (select coalesce(imaginary, false)- from wizard_spell_choices_mr- natural inner join current_wizard) then- return true;- end if;-- if not check_random_success('cast',- (select chance- from spell_cast_chance- natural inner join current_wizard_spell)) then- perform action_cast_failed();- return false;- else- update cast_success_checked_table- set cast_success_checked = true;- return true;- end if;-end;-$$ language plpgsql volatile;--create function update_alignment_from_cast() returns void as $$-begin- update cast_alignment_table- set cast_alignment = cast_alignment +- (select alignment from spells- natural inner join current_wizard_spell);- perform adjust_world_alignment();-end;-$$ language plpgsql volatile;--create function action_cast_failed() returns void as $$-begin- perform add_history_spell_failed();- perform spend_current_wizard_spell();-end;-$$ language plpgsql volatile;---create table cast_magic_wood_squares (- x int,- y int,- unique (x,y)-);-select set_relvar_type('cast_magic_wood_squares', 'stack');--create view adjacent_to_new_tree_squares as- select tx as x, ty as y from- board_ranges natural inner join- cast_magic_wood_squares- where range = 1;----take into account range, line of sight,---atm only takes into account empty squares---and trees cannot be next to each other-create view cast_magic_wood_available_squares as-select * from empty_and_not_adjacent_to_tree_squares-except select * from adjacent_to_new_tree_squares;--create type ipos as (- index int,- x int,- y int-);-create function get_square_range(x int, y int, range int)- returns setof ipos as $$-declare- p ipos;-begin- p.index := 0;- if range < 1 then- return;- end if;- --top row- p.y = y - range;- for i in 0 .. (range * 2) loop- p.x = x - range + i;- return next p;- p.index := p.index + 1;- end loop;- --sides- for i in 1 .. (range * 2 + 1) - 2 loop- p.x = x - range;- p.y = y - range + i;- return next p;- p.index := p.index + 1;- p.x = x + range;- return next p;- p.index := p.index + 1;- end loop;- --bottom row- p.y = y + range;- for i in 0 .. (range * 2) loop- p.x = x - range + i;- return next p;- p.index := p.index + 1;- end loop;-end;-$$ language plpgsql immutable;--- /*- idea is to create a view with all the valid squares in it- and to start with a square series of squares 1 square away from- the wizard:- XXX- XWX- XXX- starting with the top left one, cast trees in the available squares- then move to 2 squares away:- XXXXX- X...X- X.W.X- X...X- XXXXX- and keep going until we are at the range of the spell (if- the view takes the range into account then we keep going- to max(width of board, height of board) if this isn't too slow- pos_in_square is used to track which square we are looking at e.g.- at range one:- 123- 4W5- 678- range two- 12345- 6...7- 8.W.9- 0...1- 23456- (the 012346 on the second to last and last rows- represent 10,11,12,13,14,15,16- */--create function cast_magic_wood() returns void as $$-declare- casted int;- range int;- pos_in_square int;- max_pos_in_square int;- wx int;- wy int;- r record;- s text;-begin- casted := 0;- range := 1;- pos_in_square := 0;- max_pos_in_square := 7;- wx := (select x from pieces- where ptype = 'wizard'- and allegiance = get_current_wizard());- wy := (select y from pieces- where ptype = 'wizard'- and allegiance = get_current_wizard());-- while (casted < 8 and range <= 15) loop- select into r * from get_square_range(wx, wy, range)- where index = pos_in_square;--- s := 'checking ' || ip.x || ',' || ip.y;- if exists(select 1 from cast_magic_wood_available_squares- where (x,y) = (r.x, r.y)) then- insert into cast_magic_wood_squares(x,y) values (r.x, r.y);- casted := casted + 1;- else- null;- end if;- if pos_in_square = max_pos_in_square then- range := range + 1;- pos_in_square = 0;- max_pos_in_square = (select max(index) from get_square_range(0,0,range));- else- pos_in_square := pos_in_square + 1;- end if;- end loop;- for r in select * from cast_magic_wood_squares loop- perform create_object(- 'magic_tree', get_current_wizard(), r.x, r.y);- end loop;- delete from cast_magic_wood_squares;- perform add_history_spell_succeeded();-end;-$$ language plpgsql volatile;---/*-== move-Individual Piece move notes-A piece may be 'selected' iff it can move or attack or has a ranged attack.--Once a piece is selected it must first move, then attack, then ranged-attack (skipping bits which don't apply).--The piece can forfeit any part of this (and can choose to move only-part of it's move if walking).--The parts must be in this strict order.--If a piece is unselected before it has moved or done anything then it-remains able to move this turn otherwise its move is over for this-turn.--=== selection and subphase-*/--create function select_piece(pk piece_key) returns void as $$-declare- nextp text;- p pos;-begin- nextp:= piece_next_subphase('start', false, 'none', pk);- if nextp = 'end' then- --nothing to do- delete from pieces_to_move- where (ptype, allegiance, tag)::piece_key = pk;- if not exists(select 1 from pieces_to_move) then- perform action_next_phase();- end if;- return;- end if;- insert into selected_piece (ptype, allegiance, tag, move_phase, engaged) values- (pk.ptype, pk.allegiance, pk.tag, nextp, false);-- if nextp = 'motion' and- exists(select 1 from selected_piece- natural inner join creature_pieces- where not flying) then- update remaining_walk_hack_table- set remaining_walk_hack = true;- insert into remaining_walk_table- select speed from creature_pieces- natural inner join selected_piece;- update remaining_walk_hack_table- set remaining_walk_hack = false;- perform check_engaged();- end if;-end;-$$ language plpgsql volatile;-----short cut for interface---this fails silently if the action is not valid---client may wrap this in select piece at cursor, but the---server doesn't require that the client iface uses a cursor-create function action_select_piece_at_position(vx int, vy int)- returns void as $$-declare- r piece_key;-begin- perform check_can_run_action('select_piece_at_position', vx,vy);- select into r ptype,allegiance, tag from selectable_pieces- where (x,y) = (vx,vy);- perform select_piece(r);-end;-$$ language plpgsql volatile;--create function action_unselect_piece() returns void as $$-begin- perform check_can_run_action('unselect_piece');- --remove piece from pieces to move- delete from pieces_to_move where (ptype, allegiance, tag) =- (select ptype, allegiance, tag from selected_piece);- --empty selected piece, squares left_to_walk- update remaining_walk_hack_table- set remaining_walk_hack = true;- delete from selected_piece;- delete from remaining_walk_table;- update remaining_walk_hack_table- set remaining_walk_hack = false;- --if there are no more pieces that can be selected then move to next- --phase automatically, todo: take into account monsters in blob- if not exists(select 1 from pieces_to_move) then- perform action_next_phase();- end if;-- --insert history-end;-$$ language plpgsql volatile;--create function action_cancel() returns void as $$-begin- perform check_can_run_action('cancel');- perform do_next_move_subphase(true,'none');-end;-$$ language plpgsql volatile;-/*-==== internals-*/-create function do_next_move_subphase(skip_attack boolean, phase_done text)- returns void as $$-declare- r record;- nextp text;-begin- if not exists (select 1 from selected_piece) then- return;- end if;- select into r * from selected_piece- natural inner join pieces;- nextp := piece_next_subphase((select move_phase from selected_piece),- skip_attack, phase_done, (r.ptype, r.allegiance, r.tag)::piece_key);- if r.move_phase = 'motion' then- update remaining_walk_hack_table- set remaining_walk_hack = true;- delete from remaining_walk_table;- update remaining_walk_hack_table- set remaining_walk_hack = false;- end if;-- if nextp = 'end' then- perform action_unselect_piece();- else- update selected_piece set move_phase = nextp;- end if;-end;-$$ language plpgsql volatile;---/*-=== movement-*/-create function action_walk(px int, py int) returns void as $$-declare- p pos;-begin- perform check_can_run_action('walk', px, py);- select into p x,y from pieces natural inner join selected_piece;- perform selected_piece_move_to(px, py);- perform add_history_walked(p.x,p.y);- if get_remaining_walk() = 0 then- perform do_next_move_subphase(false, 'motion');- end if;-end;-$$ language plpgsql volatile;--create function action_fly(px int, py int) returns void as $$-declare- p pos;-begin- perform check_can_run_action('fly', px, py);- select into p x,y from pieces natural inner join selected_piece;- perform selected_piece_move_to(px, py);- perform add_history_fly(p.x,p.y);- perform do_next_move_subphase(false, 'motion');-end;-$$ language plpgsql volatile;--/*-=== attacking-*/-create function action_attack(px int, py int) returns void as $$-declare- ap piece_key;- r piece_key;- att int;- def int;-begin- perform check_can_run_action('attack', px, py);-- --if the attacker is a wizard with shadow form, they lose the shadow- --form when they attack-- att := (select attack_strength- from attacking_pieces- natural inner join selected_piece);- def := (select physical_defense- from attackable_pieces- natural inner join pieces_on_top- where (x,y) = (px,py));-- --check for shadow form-- select into ap ptype, allegiance,tag- from selected_piece;-- if ap.ptype = 'wizard' and- exists(select 1 from wizards- where wizard_name = ap.allegiance- and shadow_form) then- update wizards- set shadow_form = false- where wizard_name = ap.allegiance;- end if;-- select into r ptype, allegiance,tag- from pieces_on_top- where (x,y) = (px,py);-- perform add_history_attack(r);--- if not check_random_success('attack', max((att - def) * 10 + 50, 10)) then- --failure- perform add_history_shrugged_off(r);- perform do_next_move_subphase(true, 'attack');- return;- end if;-- perform add_history_chinned(r);- perform kill_piece(r);-- --move to the square if walker and square empty- if exists(select 1 from creature_prototypes- natural inner join selected_piece)- and exists(select 1 from selected_piece_move_squares- where (x,y) = (px,py)) then- perform selected_piece_move_to(px, py);- end if;- perform do_next_move_subphase(true, 'attack');-end;-$$ language plpgsql volatile;--create function action_ranged_attack(px int, py int)- returns void as $$-declare- r piece_key;- att int;- def int;-begin- perform check_can_run_action('ranged_attack', px, py);-- att := (select ranged_attack_strength- from ranged_weapon_pieces- natural inner join selected_piece);- def := (select physical_defense- from attackable_pieces- natural inner join pieces_on_top- where (x,y) = (px, py));-- select into r ptype, allegiance,tag- from pieces_on_top- where (x,y) = (px, py);-- perform add_history_ranged_attack(r);-- if not check_random_success('ranged_attack', max((att - def) * 10 + 50, 10)) then- --failure- perform add_history_shrugged_off(r);- perform do_next_move_subphase(false, 'ranged_attack');- return;- end if;-- perform add_history_chinned(r);- perform kill_piece(r);- perform do_next_move_subphase(false, 'ranged_attack');-end;-$$ language plpgsql volatile;--/*-=== internals--subphase progression--skip attack is used to tell this routine to skip the attack sub-phase. this is if either the motion subphase was just cancelled, or if-the piece attacked when it was in the motion subphase--*/--create function piece_next_subphase(- current_subphase text, skip_attack boolean, just_done text, pk piece_key)- returns text as $$-declare- r record;-begin- select into r x,y from pieces- where (ptype,allegiance,tag)::piece_key=pk;- if current_subphase = 'start'- and just_done='none'- and exists(select 1 from creature_pieces- where (ptype,allegiance,tag)::piece_key = pk) then- return 'motion';- elseif current_subphase not in ('attack','ranged_attack')- and not skip_attack- and just_done not in ('attack', 'ranged_attack')- and exists(select 1 from attacking_pieces- where (ptype,allegiance,tag)::piece_key=pk)- and exists(select 1 from attackable_pieces ap- natural inner join pieces_on_top- --want to keep rows where the attack piece is range 1 from- --the piece in question, so the board range source x,y is the- --x,y of the piece in question, and the target x,y is the- --x,y positions of the enemy attackable pieces- inner join board_ranges b on (b.x,b.y,tx,ty)=(r.x,r.y,ap.x,ap.y)- where allegiance <> pk.allegiance- and range = 1) then- return 'attack';- elseif current_subphase not in ('ranged_attack')- and just_done not in ('ranged_attack')- and exists(select 1 from ranged_weapon_pieces- where (ptype,allegiance,tag)::piece_key = pk) then- return 'ranged_attack';- else- return 'end';- end if;-end;-$$ language plpgsql volatile;--create function add_chinned_history(px int, py int) returns void as $$-declare- r piece_key;-begin- select into r ptype, allegiance, tag- from pieces_on_top where (x,y) = (px,py);- perform add_history_chinned(r);-end;-$$ language plpgsql volatile;--create function add_history_shrugged_off(px int, py int) returns void as $$-declare- r piece_key;-begin- select into r ptype, allegiance, tag- from pieces_on_top where (x,y) = (px,py);- perform add_history_shrugged_off(r);-end;-$$ language plpgsql volatile;--create function selected_piece_move_to(px int, py int) returns void as $$-begin- -- this is used to move a piece when it walks/flies and as part of a- -- successful attack to keep the logic for moving a wizard piece- -- along with his mount in one place- if- --this is a ridable monster- exists(select 1 from selected_piece- natural inner join monster_pieces- where ridable) and- --there is also a wizard on this square- exists(select 1- from (select x,y from pieces- natural inner join selected_piece) as a- natural inner join pieces- where ptype='wizard') then- -- move the wizard also- update pieces- set x = px,- y = py- where (ptype,allegiance,tag) =- (select ptype, allegiance, tag- from (select x,y from pieces- natural inner join selected_piece) as a- natural inner join pieces- where ptype='wizard');- end if;-- update pieces- set x = px,- y = py- where (ptype,allegiance,tag) =- (select ptype,allegiance,tag from selected_piece);-- --todo: if diagonal, reduce by 1.5- if exists(select 1 from creature_pieces- natural inner join selected_piece- where not flying) and- (select move_phase from selected_piece)='motion' then- update remaining_walk_table- set remaining_walk = remaining_walk - 1;- perform check_engaged();- end if;--end;-$$ language plpgsql volatile;--create view selected_piece_adjacent_attacking_squares as- select x,y from pieces_on_top- natural inner join pieces_mr- where attack_strength is not null- and allegiance <> (select allegiance- from selected_piece)- and allegiance <> 'dead'- intersect- select tx,ty from board_ranges r- natural inner join selected_piecexy- where range = 1;---create function check_engaged() returns void as $$-declare- ag int;-begin- if exists(select 1 from selected_piece_adjacent_attacking_squares) then- select into ag agility from pieces_mr- natural inner join selected_piece;- if check_random_success('break_engaged', ag * 10) then- update selected_piece set engaged = false;- else- update selected_piece set engaged = true;- end if;- else- update selected_piece set engaged = false;- end if;-end;-$$ language plpgsql volatile;---/*-== autonomous-*/--create view wizards_in_trees as-select ptype,allegiance,tag from pieces- where ptype='wizard'- and (x,y) in (select x,y from pieces- where ptype='magic_tree');--create function do_autonomous_phase() returns void as $$-declare- r piece_key;- r1 piece_key;-begin- --castles- for r in select ptype,allegiance,tag from pieces- where ptype in ('magic_castle', 'dark_citadel') loop- if check_random_success('disappear', 20) then- perform disintegrate(r);- end if;- end loop;- --magic trees- for r in select ptype,allegiance,tag from wizards_in_trees loop- if check_random_success('bonus', 20) then- select into r1 ptype,allegiance,tag- from pieces- where ptype ='magic_tree'- and (x,y) = (select x,y from pieces- where (ptype,allegiance,tag)::piece_key = r);- perform disintegrate(r1);- insert into spell_books (wizard_name, spell_name)- values (r.allegiance,- (select spell_name from spells- where spell_name <> 'disbelieve'- order by random() limit 1));- end if;- end loop;- perform do_spreading();-end;-$$ language plpgsql volatile;--/*-can't find this function in the postgresql docs...?-*/--create function array_contains(ar anyarray, e anyelement) returns boolean as $$-declare- i int;-begin- if ar = '{}' then- return false;- end if;- for i in (array_lower(ar,1))..(array_upper(ar,1)) loop- if ar[i] = e then- return true;- end if;- end loop;- return false;-end;-$$ language plpgsql immutable;---/*-rules:-each piece has 10% chance of disappearing-each piece has 20% chance of spawning a new piece-each piece has 20% chance of spawning two new pieces--can't spread to object squares-can't spread to same allegiance squares-blob spreading over wizard kills wizard-blob spreading on monster leaves monster trapped until blob is killed/recedes-fire spreading onto anything kills & disintegrates it--need hack to prevent blobs trying to spread which are owned by wizards-killed previously during this spreading. I think we need to keep-track of these manually since the database won't let us read a-partially updated wizards or pieces table during the transaction--insert into spell_books (wizard_name,spell_name)- select wizard_name, 'magic_wood' from wizards- where not expired;---insert into spell_books (wizard_name,spell_name)- select wizard_name, 'gooey_blob' from wizards- union- select wizard_name, 'magic_fire' from wizards;--*/--create view spreadable_squares as- select x,y from generate_series(0, 14) as x- cross join generate_series(0, 9) as y- except- select x,y from pieces natural inner join object_piece_types;--select create_var('disable_spreading', 'boolean');-insert into disable_spreading_table values (false);-select set_relvar_type('disable_spreading_table', 'data');--create function do_spreading() returns void as $$-declare- r piece_key;- r1 piece_key;- p pos;- sp record;- i int;- c int;- tg int;- killed_wizards text[] = '{}';-begin- if get_disable_spreading() then- return;- end if;- for sp in select ptype,allegiance,tag,x,y from pieces- where ptype in ('gooey_blob', 'magic_fire') loop- --raise notice 'check % e %', sp.allegiance, killed_wizards;- if array_contains(killed_wizards, sp.allegiance) then- --raise notice 'skip piece %', sp.allegiance;- continue;- end if;- c := (random() * 100)::Int;- if c < 10 then- --recede- perform add_history_recede(r);- perform disintegrate((sp.ptype,sp.allegiance,sp.tag));- elseif c < 50 then- for i in 1..(case when c < 30 then 1 else 2 end) loop- select into p tx,ty from (- select tx, ty from board_ranges b- inner join spreadable_squares s- on (s.x,s.y) = (b.tx,b.ty)- where range = 1- and (b.x,b.y) = (sp.x,sp.y)- except- select x as tx,y as ty- from pieces- where allegiance=sp.allegiance) as a- order by random() limit 1;- if p.x is null then continue; end if;- if exists(select 1 from pieces- where (x,y) = (p.x,p.y)- and ptype = 'wizard') then- select into r1 ptype,allegiance,tag from pieces- where (x,y) = (p.x,p.y)- and ptype = 'wizard';- if r1.allegiance = sp.allegiance then- raise exception 'spread tried to get friendly piece';- end if;- killed_wizards := array_append(killed_wizards, r1.allegiance);- --raise notice 'killed_wizards %', killed_wizards;- perform add_chinned_history(p.x,p.y);- perform kill_piece(r1);- end if;- --magic fire removes all pieces- for r1 in select ptype,allegiance,tag from pieces- where (x,y) = (p.x,p.y) loop- if r1.allegiance = sp.allegiance then- raise exception 'spread tried to get friendly piece';- end if;- perform disintegrate(r1);- end loop;- --raise notice 'spreading %', sp.allegiance;- tg := create_object(sp.ptype, sp.allegiance, p.x,p.y);- perform add_history_spread((sp.ptype,sp.allegiance,tg));- end loop;- end if;- end loop;-end;-$$ language plpgsql volatile;--/*-== helpers for piece creation and destruction-*/--/*-help to speed up start game - this allows us to select 19 non unique-random spells quicker than using order by random() limit 1 in a loop-*/--create table spell_indexes_no_dis_turm (- row_number serial,- spell_name text-);-select set_relvar_type('spell_indexes_no_dis_turm', 'readonly');-select add_key('spell_indexes_no_dis_turm', 'row_number');---create type random_entry as (- line int,- num int-);--create function makeNRandoms(n int, maxi int) returns setof random_entry as $$-begin- return query- select generate_series(0, n - 1),- (random() * maxi + 0.5)::int as num;-end;-$$ language plpgsql volatile;---insert into spell_indexes_no_dis_turm (spell_name)- select spell_name from spells_mr- where spell_name not in ('disbelieve', 'turmoil');--create function create_object(vptype text, vallegiance text, x int, y int)- returns int as $$-begin- --assert ptype is an object ptype- if not exists(select 1 from object_piece_types where ptype = vptype) then- raise exception 'called create object on % which is not an object', vptype;- end if;- return create_piece_internal(vptype, vallegiance, x, y, false);-end-$$ language plpgsql volatile;---create function create_monster(vptype text, allegiance text, x int, y int,- imaginary boolean) returns void as $$-begin- if not exists(select 1 from monster_prototypes where ptype = vptype) then- raise exception 'called create monster on % which is not a monster', vptype;- end if;- perform create_piece_internal(vptype, allegiance, x, y, imaginary);-end-$$ language plpgsql volatile;--create function create_corpse(vptype text, px int, py int, imaginary boolean)- returns void as $$-declare- vtag int;- twiz text;-begin- if not exists(select count(*) from monster_prototypes- where ptype = vptype) then- raise exception 'called create corpse on % which is not a monster', vptype;- end if;- vtag := create_piece_internal(vptype,- 'Buddha',- px, py, imaginary);- perform kill_monster((vptype, 'Buddha', vtag));-end-$$ language plpgsql volatile;--------------------------------------------------------create function get_next_tag(pptype text, pallegiance text) returns int as $$-- select coalesce(max(tag) + 1, 0) from pieces- where (ptype,allegiance) = ($1,$2);--$$ language sql stable;--create function create_piece_internal(vptype text, vallegiance text,- vx int, vy int, vimaginary boolean)- returns int as $$-declare- vtag int;-begin-- insert into pieces (ptype, allegiance, tag, x, y)- select vptype, vallegiance, get_next_tag(vptype,vallegiance), vx, vy- returning tag into vtag;-- insert into imaginary_pieces (ptype,allegiance,tag)- select vptype,vallegiance,vtag where coalesce(vimaginary,false);- return vtag;-end-$$ language plpgsql volatile;--create function make_piece_undead(vptype text, vallegiance text, vtag int)- returns void as $$-begin- if not exists(select 1 from piece_prototypes_mr- where ptype=vptype and undead)- and not exists (select 1 from crimes_against_nature- where (ptype,allegiance,tag) =- (vptype,vallegiance,vtag)) then- insert into crimes_against_nature- (ptype,allegiance,tag) values- (vptype,vallegiance,vtag);- end if;-end;-$$ language plpgsql volatile;-------------------------------------------------/*-new plan for piece killing and stuff-disintegrate: removes piece, no corpse even for non undead monster-kill piece: calls appropriate routine:- kill monster: creates corpse if not undead else calls disintegrate- kill object: calls disintegrate- kill wizard: calls disintegrate on army and wizard, and other clean up-*/--create function disintegrate(pk piece_key)- returns void as $$-begin- delete from pieces where (ptype, allegiance, tag)::piece_key = pk;-end;-$$ language plpgsql volatile;--create function kill_monster(pk piece_key)- returns void as $$-begin- --todo some asserts: monster, non undead- -- undead cannot be dead - add constraint- -- non monster cannot be dead: shouldn't be possible, check this- -- after adding update rule to pieces_view- --todo: generate update rules automatically for entities- -- and use a single update here- -- do the sub ones first since the pieces update changes the key- update pieces set allegiance = 'dead',- tag = get_next_tag(pk.ptype,'dead')- where (ptype, allegiance, tag) = pk;-end-$$ language plpgsql volatile;--create function disintegrate_wizards_army(pwizard_name text) returns void as $$-declare- r piece_key;-begin- for r in select ptype, allegiance, tag from pieces- where allegiance = pwizard_name loop- perform disintegrate(r);- end loop;-end;-$$ language plpgsql volatile;--create function kill_wizard(pwizard_name text) returns void as $$-begin---if current wizard then next_wizard- if get_current_wizard() = pwizard_name then- perform action_next_phase();- --check if this is the last wizard, slightly hacky- if get_current_wizard() = pwizard_name then- perform game_completed();- perform add_history_game_drawn();- delete from current_wizard_table;- end if;- end if;- --this should all be handled with cascades...?- delete from wizard_spell_choices_mr where wizard_name = pwizard_name;---wipe spell book- delete from spell_books where wizard_name = pwizard_name;---kill army- perform disintegrate_wizards_army(pwizard_name);---set expired to true- update wizards set expired = true- where wizard_name = pwizard_name;-end;-$$ language plpgsql volatile;--create function kill_piece(pk piece_key)- returns void as $$-begin- if (select coalesce(undead,false) from pieces_mr- where (ptype, allegiance, tag)::piece_key = pk)- or exists(select 1 from object_piece_types- where ptype = pk.ptype) then- perform disintegrate(pk);- elseif exists(select 1 from monster_prototypes where ptype = pk.ptype) then- perform kill_monster(pk);- elseif pk.ptype = 'wizard' then- perform kill_wizard(pk.allegiance);- else- raise exception 'don''t know how to kill piece with ptype %', pk.ptype;- end if;--end;-$$ language plpgsql volatile;----- testing function-create function kill_top_piece_at(px int, py int) returns void as $$-declare- r piece_key;-begin- select into r ptype,allegiance,tag- from pieces_on_top where (x,y) = (px,py);- perform kill_piece(r);-end;-$$ language plpgsql volatile;--select set_module_for_preceding_objects('actions');--/*-================================================================================--= history-save a short description of each action completed during play--TODO: create a detailed history that allows a game to be replayed-then create a view to show the player visible log with some events-removed and some combined.-*/--select new_module('action_history', 'server');--create domain history_name_enum as text- check (value in (- 'spell_succeeded'- ,'spell_failed'- ,'chinned'- ,'shrugged_off'- ,'walked'- ,'fly'- ,'attack'- ,'ranged_attack'- ,'set_imaginary'- ,'set_real'- ,'game_won'- ,'game_drawn'- ,'spell_skipped'- ,'new_turn'- ,'wizard_up'- ,'choose_spell'- ,'spread'- ,'recede'- ,'disappear'- ,'new_game'- ,'attempt_target_spell'- ));---create table action_history_mr (- id serial not null,- history_name history_name_enum not null,- ptype text null,- allegiance text null,- tag int null,- spell_name text null,- turn_number int null,- turn_phase turn_phase_enum null,- num_wizards int null,- x int null,- y int null,- tx int null,- ty int null-);-select add_key('action_history_mr', 'id');-select set_relvar_type('action_history_mr', 'data');----Turns--create function get_current_wizard_pos() returns pos as $$- select x,y from pieces- where allegiance=get_current_wizard()- and ptype = 'wizard';-$$ language sql stable;--create function add_history_new_turn() returns void as $$-begin- insert into action_history_mr (history_name, turn_number)- values ('new_turn', get_turn_number());-end;-$$ language plpgsql volatile;--create function add_history_wizard_up() returns void as $$-declare- w pos;-begin- w := get_current_wizard_pos();- insert into action_history_mr (history_name, allegiance, turn_phase, x, y)- values ('wizard_up', get_current_wizard(), get_turn_phase(), w.x, w.y);-end;-$$ language plpgsql volatile;--create function add_history_new_game() returns void as $$-begin- insert into action_history_mr (history_name, num_wizards)- values ('new_game', (select count(1) from wizards));-end;-$$ language plpgsql volatile;--create function add_history_game_won() returns void as $$-declare- w pos;-begin- w := get_current_wizard_pos();- insert into action_history_mr (history_name, allegiance, x, y)- values ('game_won', (select allegiance- from pieces- where ptype='wizard'),- w.x, w.y);-end;-$$ language plpgsql volatile;--create function add_history_game_drawn() returns void as $$-begin- insert into action_history_mr (history_name)- values ('game_drawn');-end;-$$ language plpgsql volatile;----Choosing--create function add_history_choose_spell() returns void as $$-declare- w pos;-begin- w := get_current_wizard_pos();- insert into action_history_mr (history_name, allegiance, spell_name,x,y)- values ('choose_spell', get_current_wizard(), get_current_wizard_spell(),- w.x,w.y);-end;-$$ language plpgsql volatile;--create function add_history_set_imaginary() returns void as $$-begin- insert into action_history_mr (history_name, allegiance)- values ('set_imaginary', get_current_wizard());-end;-$$ language plpgsql volatile;--create function add_history_set_real() returns void as $$-begin- insert into action_history_mr (history_name, allegiance)- values ('set_real', get_current_wizard());-end;-$$ language plpgsql volatile;----Casting--create function add_history_attempt_target_spell(px int, py int) returns void as $$-declare- w pos;-begin- select into w x,y from pieces- where allegiance=get_current_wizard()- and ptype = 'wizard';- insert into action_history_mr (history_name, allegiance, spell_name, x, y, tx, ty)- values ('attempt_target_spell', get_current_wizard(),- get_current_wizard_spell(), w.x, w.y, px, py);-end;-$$ language plpgsql volatile;--create function add_history_attempt_activate_spell() returns void as $$-declare- w pos;-begin- select into w x,y from pieces- where allegiance=get_current_wizard()- and ptype = 'wizard';- insert into action_history_mr (history_name, allegiance, spell_name, x, y)- values ('attempt_target_spell', get_current_wizard(),- get_current_wizard_spell(), w.x, w.y);-end;-$$ language plpgsql volatile;---create function add_history_spell_succeeded() returns void as $$-begin- insert into action_history_mr (history_name, allegiance, spell_name)- values ('spell_succeeded', get_current_wizard(), get_current_wizard_spell());-end;-$$ language plpgsql volatile;--create function add_history_spell_failed() returns void as $$-begin- insert into action_history_mr (history_name, allegiance, spell_name)- values ('spell_failed', get_current_wizard(), get_current_wizard_spell());-end;-$$ language plpgsql volatile;--create function add_history_spell_skipped() returns void as $$-begin- insert into action_history_mr (history_name, allegiance, spell_name)- values ('spell_skipped', get_current_wizard(), get_current_wizard_spell());-end;-$$ language plpgsql volatile;----chinned and shrugged off--create function add_history_chinned(k piece_key) returns void as $$-declare- w pos;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- insert into action_history_mr (history_name, ptype, allegiance,tag, x, y)- values ('chinned', k.ptype, k.allegiance, k.tag, w.x, w.y);--end;-$$ language plpgsql volatile;--create function add_history_shrugged_off(k piece_key) returns void as $$-declare- w pos;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- insert into action_history_mr (history_name, ptype, allegiance,tag, x, y)- values ('shrugged_off', k.ptype, k.allegiance, k.tag,w.x, w.y);-end;-$$ language plpgsql volatile;----Autonomous--create function add_history_receive_spell(pwizard_name text, pspell_name text) returns void as $$-declare- w pos;-begin- select into w x,y from pieces- where allegiance=pwizard_name- and ptype = 'wizard';- insert into action_history_mr (history_name, allegiance, spell_name, x, y)- values ('choose_spell', pwizard_name, pspell_name, w.x, w.y);-end;-$$ language plpgsql volatile;--create function add_history_spread(k piece_key) returns void as $$-declare- w pos;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- insert into action_history_mr (history_name, ptype,allegiance,tag, x, y)- values ('spread', k.ptype,k.allegiance,k.tag, w.x, w.y);-end;-$$ language plpgsql volatile;--create function add_history_recede(k piece_key) returns void as $$-declare- w pos;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- insert into action_history_mr (history_name, ptype,allegiance,tag,x, y)- values ('recede', k.ptype,k.allegiance,k.tag, w.x, w.y);-end;-$$ language plpgsql volatile;--create function add_history_disappear(k piece_key) returns void as $$-declare- w pos;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- insert into action_history_mr (history_name, ptype,allegiance,tag, x, y)- values ('disappear', k.ptype,k.allegiance,k.tag, w.x, w.y);-end;-$$ language plpgsql volatile;-----Move-create function add_history_walked(sx int, sy int) returns void as $$-declare- w pos;- k piece_key;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- select into k ptype,allegiance,tag from selected_piece;- insert into action_history_mr (history_name, ptype, allegiance,tag,x, y, tx, ty)- values ('walked', k.ptype, k.allegiance, k.tag, w.x,w.y, sx, sy);-end;-$$ language plpgsql volatile;--create function add_history_fly(sx int, sy int) returns void as $$-declare- w pos;- k piece_key;-begin- select into w x,y from pieces where (ptype,allegiance,tag) = k;- select into k ptype,allegiance,tag from selected_piece;- insert into action_history_mr (history_name, ptype, allegiance,tag,x, y, tx, ty)- values ('fly', k.ptype, k.allegiance, k.tag, w.x,w.y, sx, sy);-end;-$$ language plpgsql volatile;--create function add_history_attack(t piece_key) returns void as $$-declare- sp record;- tp pos;-begin- select into sp ptype,allegiance,tag,x,y from selected_piece- natural inner join pieces;- select into tp x,y from pieces where (ptype,allegiance,tag) = t;- insert into action_history_mr (history_name, ptype, allegiance,tag,x,y,tx,ty)- values ('attack', sp.ptype, sp.allegiance, sp.tag, sp.x,sp.y, tp.x,tp.y);-end;-$$ language plpgsql volatile;--create function add_history_ranged_attack(t piece_key) returns void as $$-declare- sp record;- tp pos;-begin- select into sp ptype,allegiance,tag,x,y from selected_piece- natural inner join pieces;- select into tp x,y from pieces where (ptype,allegiance,tag) = t;- insert into action_history_mr (history_name, ptype, allegiance,tag,x,y,tx,ty)- values ('ranged_attack', sp.ptype, sp.allegiance, sp.tag, sp.x,sp.y, tp.x,tp.y);-end;-$$ language plpgsql volatile;---/*--create a view to hide the details which players shouldn't be able to-see - this is the view that the ui should use:-hide set real, imaginary-hide spell received in tree---*/--select set_module_for_preceding_objects('action_history');--/*-================================================================================--= new game-== wizard starting positions-Wizards start the game in positions set by how many wizards there are in a game:---When there are 'wizard_count' wizards in a game, wizard at place-'place' starts at grid position x, y.--These figures are only valid iff there are 2-8 wizards and the board is-15 x 10. Will have to figure out some other system for more wizards or-different boards.--*/----in a game with wizard_count wizards, wizard at place 'place' starts---the game on square x,y.--select new_module('new_game', 'server');--create table wizard_starting_positions (- wizard_count int,- place int,- x int,- y int-);-select add_key('wizard_starting_positions', array['wizard_count', 'place']);-select add_key('wizard_starting_positions', array['wizard_count', 'x', 'y']);-select add_constraint('wizard_starting_positions_place_valid',- 'not exists(select 1 from wizard_starting_positions- where place >= wizard_count)',- array['wizard_starting_positions']);-select set_relvar_type('wizard_starting_positions', 'readonly');--copy wizard_starting_positions (wizard_count, place, x, y) from stdin;-2 0 1 4-2 1 13 4-3 0 7 1-3 1 1 8-3 2 13 8-4 0 1 1-4 1 13 1-4 2 1 8-4 3 13 8-5 0 7 0-5 1 0 3-5 2 14 3-5 3 3 9-5 4 11 9-6 0 7 0-6 1 0 1-6 2 14 1-6 3 0 8-6 4 14 8-6 5 7 9-7 0 7 0-7 1 1 1-7 2 13 1-7 3 0 6-7 4 14 6-7 5 4 9-7 6 10 9-8 0 0 0-8 1 7 0-8 2 14 0-8 3 0 4-8 4 14 4-8 5 0 9-8 6 7 9-8 7 14 9-\.--/*-== new game action-*/--create table action_new_game_argument (- place int, -- place 0..cardinality- wizard_name text,- computer_controlled boolean-);-select add_key('action_new_game_argument', 'place');-select add_key('action_new_game_argument', 'wizard_name');-select add_constraint('action_new_game_argument_place_valid',- '(select count(*) from action_new_game_argument- where place >= (select count(*) from action_new_game_argument)) = 0',- array['action_new_game_argument']);--select set_relvar_type('action_new_game_argument', 'stack');--/*-new game action - fill in action_new_game_argument first-*/-create function action_new_game() returns void as $$-declare- r record;- t int;-begin-- update creating_new_game_table set creating_new_game = true;- --assert: all tables tagged data are in this delete list- --(only need base table of entities since these cascade)- -- tables are in order of dependencies so delete sequence works-- -- clear data tables- delete from action_history_mr;- perform setval('action_history_mr_id_seq', 1);-- --turn data- delete from game_completed_table;- delete from cast_alignment_table;- delete from remaining_walk_table;- delete from selected_piece;- delete from pieces_to_move;- delete from spell_parts_to_cast_table;- delete from wizard_spell_choices_mr;- delete from current_wizard_table;- delete from turn_phase_table;- delete from cast_success_checked_table;- delete from turn_number_table;- --piece data- delete from spell_books;- delete from imaginary_pieces;- delete from pieces;- delete from wizards;- delete from board_size;- delete from world_alignment_table;-- if not exists(select 1 from disable_spreading_table) then- insert into disable_spreading_table values(false);- else- update disable_spreading_table- set disable_spreading = false;- end if;-- --reset the overrides when starting new game- delete from test_action_overrides;-- --assert: call init_ for each data table, make sure order is good-- perform init_world_alignment();- perform init_board_size();-- --create wizards- -- wizard table- insert into wizards (wizard_name, computer_controlled, original_place)- select wizard_name, computer_controlled, place- from action_new_game_argument;- -- pieces- t := (select count(*) from action_new_game_argument);- insert into pieces (ptype, allegiance, tag, x, y)- select 'wizard', wizard_name, 0, x,y- from action_new_game_argument- natural inner join wizard_starting_positions- where wizard_count = t;- -- spell books- --init spell book- -- disbelieve plus 19 {random spells not disbelieve or turmoil}- insert into spell_books (wizard_name, spell_name)- select wizard_name, 'disbelieve'- from action_new_game_argument;-- insert into spell_books (wizard_name, spell_name)- select wizard_name,spell_name- from action_new_game_argument- inner join (select line, spell_name- from spell_indexes_no_dis_turm- inner join makeNRandoms(t * 19, 53)- on row_number = num) as a- on (line/19) = place;- --sanity check that bad boy- if exists(select 1 from (select wizard_name, count(spell_name)- from spell_books group by wizard_name- ) as a where count <> 20) then- raise exception 'miscount in initial spell books';- end if;- --turn stuff- perform init_turn_stuff();-- /*- data tables with no init because they are empty at start of game- piece sub entities- action_history and sub entities- wizard spell choices, pieces to move, current moving piece- */- --TODO: add new game action history- perform add_history_new_game();-- update creating_new_game_table set creating_new_game = false;--end-$$ language plpgsql volatile;--/*-================================================================================--= test board support-*/---TODO: make this function dump the current game to unique file for backup-create function action_setup_test_board(flavour text) returns void as $$-declare- i int;- rec record;- vwidth int;- vname text;- vx int;- vy int;- vallegiance text;-begin- --assert - new game just created- -- flavour is one of all_pieces, upgraded_wizards, overlapping- select into vwidth width from board_size;-- if flavour = 'all_pieces' then- --create one of each monster- i:= 0;- for rec in select ptype from monster_prototypes loop- perform create_monster(rec.ptype, 'Buddha',- i % vwidth, 1 + i / vwidth, false);- i := i + 1;- end loop;- --create one of each corpse- i := 0;- for rec in select ptype from monster_prototypes where undead = false loop- perform create_monster(rec.ptype, 'Buddha',- i % vwidth, 5 + i / vwidth, false);- perform kill_top_piece_at(i % vwidth, 5 + i / vwidth);- i := i + 1;- end loop;- --create one of each (pieces - creatures)- i := 0;- for rec in select ptype from object_piece_types loop- perform create_object(rec.ptype, 'Kong Fuzi', i, 8);- i := i + 1;- end loop;- elseif flavour = 'upgraded_wizards' then- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 0),- 'shadow_form');- --fix history- update action_history_mr- set spell_name = 'shadow_form',- allegiance='Buddha'- where spell_name is null;- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 1),- 'magic_sword');- update action_history_mr- set spell_name = 'magic_sword',- allegiance = 'Kong Fuzi'- where spell_name is null;- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 2),- 'magic_knife');- update action_history_mr- set spell_name = 'magic_knife',- allegiance = 'Laozi'- where spell_name is null;- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 3),- 'magic_shield');- update action_history_mr- set spell_name = 'magic_shield',- allegiance='Moshe'- where spell_name is null;- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 4),- 'magic_wings');- update action_history_mr- set spell_name = 'magic_wings',- allegiance='Muhammad'- where spell_name is null;- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 5),- 'magic_armour');- update action_history_mr- set spell_name = 'magic_armour',- allegiance='Shiva'- where spell_name is null;- perform action_cast_wizard_spell(- (select wizard_name from wizards where original_place = 6),- 'magic_bow');- update action_history_mr- set spell_name = 'magic_bow',- allegiance = 'Yeshua'- where spell_name is null;- elseif flavour = 'overlapping' then- --assert at least 5 wizards- --wizard, stiff- select into vx,vy x,y from pieces- inner join wizards- on allegiance = wizard_name- where ptype = 'wizard' and original_place = 0;- perform create_monster('goblin', 'Buddha', 1, 0, false);- perform kill_top_piece_at(1, 0);- --drop in an extra dead gobbo for testing raise dead- perform create_monster('goblin', 'Yeshua', vx, vy, false);- perform kill_top_piece_at(vx, vy);---wizard, mountable- select into vx,vy,vallegiance x,y,allegiance- from pieces inner join wizards- on allegiance = wizard_name- where ptype = 'wizard' and original_place = 1;- perform create_monster('horse', vallegiance, vx, vy, false);---wizard in magic tree, castle, citadel- select into vx,vy,vallegiance x,y,allegiance- from pieces inner join wizards- on allegiance = wizard_name- where ptype = 'wizard' and original_place = 2;- perform create_object('magic_tree', vallegiance, vx, vy);- select into vx,vy,vallegiance x,y,allegiance- from pieces inner join wizards- on allegiance = wizard_name- where ptype = 'wizard' and original_place = 3;- perform create_object('magic_castle', vallegiance, vx, vy);- select into vx,vy,vallegiance x,y,allegiance- from pieces inner join wizards- on allegiance = wizard_name- where ptype = 'wizard' and original_place = 4;- perform create_object('dark_citadel', vallegiance, vx, vy);---monster, stiff- perform create_monster('goblin', 'Buddha', 3, 3, false);- perform kill_top_piece_at(3, 3);- perform create_monster('giant', 'Buddha', 3, 3, false);---stiff, blob- perform create_monster('goblin', 'Buddha', 4, 3, false);- perform kill_top_piece_at(4, 3);- perform create_object('gooey_blob', 'Buddha', 4, 3);---monster, blob- perform create_monster('goblin', 'Laozi', 5, 3, false);- perform create_object('gooey_blob', 'Buddha', 5, 3);---stiff, monster, blob- perform create_monster('elf', 'Buddha', 6, 3, false);- perform kill_top_piece_at(6, 3);- perform create_monster('goblin', 'Laozi', 6, 3, false);- perform create_object('gooey_blob', 'Buddha', 6, 3);- else- raise exception- 'argument must be one of all_pieces, upgraded_wizards, overlapping, got %',- flavour;- end if;-end-$$ language plpgsql volatile;---select set_module_for_preceding_objects('new_game');-/*--================================================================================--= ai--For each stage we compile a list of possible actions using the valid_action views. These are then filtered to remove actions we don't want to run. At some places, the possible action list is reduced by keeping only the actions which are deemed vital (e.g. the wizard needs to run away, or a monster has a chance to attact a wizard). The remaining actions are possibly weighted and one is chosen at random.--Choose spells by weighting them according to casting chance, some spells are never cast, and some will be further weighted by the board layout.--When moving army, the general plan is to move the monsters closest to an enemy first.--choose spell-cast spell-move pieces--option 1: upgrade-weight by probability-don't cast one already have or a weaker one in same category-armour - shield-knife - sword-shadow - wings--decree et al: use: wizard with lots of bad guys, being threatened-magic wood: if range of spells is a bit shit-castle, wall, blob, fire, shadowwood - random-disbelieve: cast when threatened by a hard creature, small chance otherwise-subversion - hard creature nearby, when threatened-raise dead - when can-monsters: weight by chances, decide on imag weighted by chances--assess: defensive: wizard under threat-aggressive: choose a target to send everyone against--casting:-raise: hardest corpse in range-decree: if threatened target monster or wizard, else target hardest-wizard/monster on screen-castle -next to, away from danger-disbelieve - closest monster-subvert - closest monster (or if tougher one next to closest monster?)-monster - toward nearest threat-wall - just randomly put about-blob - want to grow safely, unless under threat then use aggresively-fire - use aggressively-shadow wood: use magic wood layout, bias in directions that have-moving enemy pieces--moving:-if defensive move pieces starting with close--The system for running the ai is to make an action available when the-current wizard is an ai to continue the ai's turn. This will do one-action, and move to the next phase if the ai has completed it's-action. This api allows the client to control how and at what speed-the ai's turns are run, we use this to run one ai action every half-second so you can see what the ai is doing by watching the board-change.--TODO:---don't attack friendlies---don't cast, attack corpses---don't choose spells that can't work-cast spells in sensible place-weight choice by chance-sometimes cast imag when unlikely-disbelieve logic and tracking-move phase:- keep wizards out of danger- always move into castles,wood- move towards wood if near- stay in castles, wood-send monsters towards closest enemy-always attack if can-choose targets: favour wizards and hardest that likely to kill--*/--/*--== main ai action--*/--create function action_ai_continue() returns void as $$-begin- perform check_can_run_action('ai_continue');- if get_turn_phase() = 'choose' then- perform ai_choose_spell();- perform action_next_phase();- elseif get_turn_phase() = 'cast' then- perform ai_cast_spell();- elseif get_turn_phase() = 'move' then- perform ai_move_pieces();- end if;-end;-$$ language plpgsql volatile;--/*--== spell choice--First, eliminate all the useless target spells - those that have no-target and those that can only be cast on a friendly or corpse.--*/--create view current_wizard_target_spells as- select spell_name,range from spell_books- inner join current_wizard_table- on current_wizard = wizard_name- natural inner join spell_ranges;--create view current_wizard_square as- select x,y from pieces- inner join current_wizard_table- on allegiance =current_wizard- where ptype= 'wizard';--/*--take all the target spells and create a list of spell names a squares-that they can be cast on using the range and valid square types of-each spell--*/--create view castable_target_spells as- select spell_name,svs.x,svs.y- from current_wizard_target_spells cwts- natural inner join spell_valid_squares svs- natural inner join spell_valid_square_types svst- inner join board_ranges br- on (br.x,br.y) = (select x,y from current_wizard_square)- and br.range = cwts.range- and (br.tx, br.ty) = (svs.x, svs.y);--/*--eliminate the rows which have only corpses or friendlies on top--*/--create view ai_useful_spells as- select spell_name from spell_books- inner join current_wizard_table- on wizard_name = current_wizard- natural inner join activate_spells- union- select spell_name from castable_target_spells- where (x,y) not in (select x,y from corpse_only_squares- union- select x,y from pieces_on_top- inner join current_wizard_table- on current_wizard = allegiance);--create function ai_choose_spell() returns void as $$-declare- vspell_name text;-begin- select into vspell_name spell_name- from ai_useful_spells- order by random() limit 1;- if vspell_name is null then- --skip choosing one- return;- else- perform action_choose_spell(vspell_name);- end if;-end;-$$ language plpgsql volatile;--/*--== spell casting--first filter out all the targets we don't want to cast on:--*/--create view ai_filtered_target_spells as- select * from valid_target_actions- where action='cast_target_spell'- and (x,y) not in- (select x,y from pieces_on_top- where allegiance in (get_current_wizard(), 'dead'));--/*-cast spells in a sensible place:-dark power: don't choose a wizard with no creations- pick enemy monsters that are close or wizards with lots of shit-lightning, magic bolt: enemy wizard then closest monster-raise dead: choose hardest corpse-subversion: choose hardest enemy-shadow wood: use magic tree layout-fire: next to wizard or monster if can, else towards closest enemy-blob: towards closest enemy in some space-castle: next to wizard away from danger-monster: towards closest enemy-*/--create function ai_cast_spell() returns void as $$-declare- p pos;-begin- if exists(select 1 from valid_activate_actions- where action = 'cast_activate_spell') then- perform action_cast_activate_spell();- elseif exists(select 1 from ai_filtered_target_spells) then- select into p x,y from ai_filtered_target_spells- order by random() limit 1;- perform action_cast_target_spell(p.x, p.y);- else- perform action_next_phase();- end if;-end;-$$ language plpgsql volatile;--/*--== move phase--*/--create function ai_move_pieces() returns void as $$-declare- p pos;-begin- --if no piece selected and none selectable, go to next phase- if not exists(select 1 from selected_piece)- and not exists(select 1 from valid_target_actions- where action = 'select_piece_at_position') then- perform action_next_phase();- return;- end if;- --if no piece selected try to select one- if not exists(select 1 from selected_piece)- and exists(select 1 from valid_target_actions- where action = 'select_piece_at_position') then- select into p x,y from valid_target_actions- where action = 'select_piece_at_position'- order by random() limit 1;- perform action_select_piece_at_position(p.x, p.y);- --check if it has been immediately unselected- if not exists(select 1 from selected_piece) then- return;- end if;- end if;- perform ai_move_selected_piece();-end;-$$ language plpgsql volatile;--create view ai_selected_piece_actions as-select a.x,a.y,action- from valid_target_actions a- left outer join pieces_on_top p- using (x,y)- where action in('walk', 'fly')- or ((action in('attack', 'ranged_attack')- and allegiance not in (get_current_wizard(), 'dead')));---/*-rules:-send monsters towards enemy-always attack if can-choose targets: wizards if can, then hardest creature-*/--create view prefered_targets as-select x,y,action,- case when ptype = 'wizard' then -500- else 20 - physical_defense- end as preference-from valid_target_actions-natural inner join pieces_mr-where action in('attack','ranged_attack');--create view closest_enemy_to_selected_piece as- select a.x,a.y- from selected_piece_attackable_squares a- cross join selected_piece s- inner join pieces s1- using(ptype,allegiance,tag)- order by distance(s1.x,s1.y,a.x,a.y) limit 1;--create view select_best_move as- select a.action,a.x,a.y from ai_selected_piece_actions a- cross join closest_enemy_to_selected_piece e- where action in('walk', 'fly')- order by distance(a.x,a.y,e.x,e.y) limit 1;--create function ai_move_selected_piece() returns void as $$-declare- r record;-begin- if exists(select 1 from ai_selected_piece_actions- where action = 'attack'- or (action = 'ranged_attack'- and (select move_phase='ranged_attack'- from selected_piece))) then- select into r x,y,action from prefered_targets- order by preference limit 1;- if r.action = 'attack' then- perform action_attack(r.x, r.y);- elseif r.action = 'ranged_attack' then- perform action_ranged_attack(r.x, r.y);- else- --raise exception 'bad ai attack action: %', r.action;- perform action_cancel();- end if;- else- if exists(select 1 from ai_selected_piece_actions- where action in ('walk','fly')) then- select into r * from select_best_move;- if r.action = 'walk' then- perform action_walk(r.x, r.y);- elseif r.action = 'fly' then- perform action_fly(r.x, r.y);- else- perform action_cancel();- end if;- else- perform action_cancel();- end if;- end if;-end;-$$ language plpgsql volatile;--/*----------------------------------------------------------------------------------*/-select set_all_attributes_to_not_null();-select set_notifies_on_all_data_tables();-
− sqltestfiles/system.sql
@@ -1,1310 +0,0 @@-/*--Copyright 2009 Jake Wheat--= Overview--catalog-constraints-modules-utils--= Introduction--This file contains extensions to support some extra relational theory-stuff that pg doesn't support and also add some other things like-modules.--Probably the only interesting bit is the constraint system.--*/-create language plpgsql;-/*-================================================================================--= Catalog--Some new catalog views to use, supposed to be a bit more straight-forward than the sql or pg catalogs.---== system implementation objects--Quite a lot of the code in this file generates extra functions,-triggers and uses extra tables. When you're browsing the catalog,-e.g. as a designer of a schema, or trying to work out the data-structures for a program, you don't usually want to see all this extra-stuff, so tag them.--Also, objects in this table should not be visible to user code, only-to the code in this file (just have to pretend for now).--Implementation objects include objects which are part of the catalog-and extensions themselves as well as objects which are generated when-user code uses the extensions.--Should probably put the catalog in a separate module to the internal-objects.--*/--create table system_implementation_objects (- object_name text,- object_type text check (object_type in(- 'scalar',- 'base_relvar',- 'operator',- 'view',- 'trigger',- 'database_constraint'))-);-insert into system_implementation_objects (object_name, object_type)- values ('system_implementation_objects', 'base_relvar');--create view base_relvars as- select relname as relvar_name from pg_class where relnamespace =- (select oid from pg_namespace where nspname = 'public')- and relkind = 'r';--create view base_relvar_attributes as- select attname as attribute_name,- typname as type_name,- relname as relvar_name- from pg_attribute inner join pg_class on (attrelid = pg_class.oid)- inner join pg_type on (atttypid = pg_type.oid)- inner join base_relvars on (relname = base_relvars.relvar_name)- where attnum >= 1;--/*-scalars here since we are using the base relvar attributes table-to try to only show scalar types which are used and not the vast-array that pg comes with. This is a bit of a hack job, probably-a bit inaccurate-*/-create view scalars as--- select typname as scalar_name from pg_type--- where typtype in ('b', 'd')--- and typnamespace =--- (select oid from pg_namespace where nspname='public')--- union- select distinct type_name as scalar_name- from base_relvar_attributes;--create view base_relvar_keys as- select conname as constraint_name, relvar_name- from pg_constraint- natural inner join- (select oid as conrelid, relname as relvar_name from pg_class) as b- where contype in('p', 'u') and connamespace =- (select oid from pg_namespace where nspname='public');--create view base_relvar_key_attributes as- select constraint_name, attribute_name from- (select conname as constraint_name, conrelid,- conkey[generate_series] as attnum- from pg_constraint- cross join generate_series(1,- (select max(array_upper(conkey, 1)) from pg_constraint))- where contype in('p', 'u') and connamespace =- (select oid from pg_namespace where nspname='public')- and generate_series between- array_lower(conkey, 1) and- array_upper(conkey, 1)) as a- natural inner join- (select oid as conrelid, relname as relvar_name from pg_class) as b- natural inner join- (select attrelid as conrelid, attname as attribute_name,- attnum from pg_attribute) as c--- order by constraint_name- ;--create view operators as- select proname as operator_name from pg_proc- where pronamespace = (select oid from pg_namespace- where nspname = 'public');--create view operator_source as- select proname as operator_name, prosrc as source from pg_proc- where pronamespace = (select oid from pg_namespace- where nspname = 'public');--create view triggers as- select relname as relvar_name, tgname as trigger_name,- proname as operator_name- from pg_trigger- inner join pg_class on (tgrelid = pg_class.oid)- inner join pg_proc on (tgfoid = pg_proc.oid)- inner join base_relvars on (relname = base_relvars.relvar_name)- where not tgisconstraint; -- eliminate pg internal triggers--create view views as- select viewname as view_name, definition- from pg_views- where schemaname = 'public';--create view view_attributes as- select attname as attribute_name,- typname as type_name,- relname as relvar_name- from pg_attribute inner join pg_class on (attrelid = pg_class.oid)- inner join pg_type on (atttypid = pg_type.oid)- inner join views on (relname = view_name)- where attnum >= 1;--/*-== constraints-*/-create table database_constraints (- constraint_name text,- expression text-);-/*-== all database objects-*/-create view all_database_objects as- select 'scalar' as object_type,- scalar_name as object_name from scalars- union select 'base_relvar' as object_type,- relvar_name as object_name from base_relvars- union select 'operator' as object_type,- operator_name as object_name from operators- union select 'view' as object_type,- view_name as object_name from views- union select 'trigger' as object_type,- trigger_name as object_name from triggers- union select 'database_constraint' as object_type,- constraint_name as object_name from database_constraints;-insert into system_implementation_objects- (object_name, object_type) values- ('all_database_objects', 'view');-create view public_database_objects as- select object_name,object_type from all_database_objects- except- select object_name,object_type from system_implementation_objects;--create view object_orders as- select 'scalar'::text as object_type, 0 as object_order- union select 'database_constraint', 1- union select 'base_relvar', 2- union select 'operator', 3- union select 'view', 4- union select 'trigger', 5-;-/*-================================================================================--= Constraints--Add some extra stuff to the existing pg constraints for the following:--* to support transition constraints directly--* to support constraints which refer to more than one table or row, or- to views--Both of these are implemented in the usual way using triggers, but-using some shorthands, and the plumbing is hidden to some extent.--There are shortcuts for creating keys and foreign keys which use-postgresql constraints where possible to speed things up.--You have to supply the list of base tables that the triggers will-attach to, so if a constraint involves a view you have to work out the-base tables by hand. This could easily be automated to some extent-with a parser.--The constraints are implemented with--* a table to hold the constraint names and expressions-* a regenerate constraint function which creates:- * a function which checks all the constraint expressions for a given- table (excluding ones which are implemented as pg constraints- directly)- * a trigger to call that function when the table changes--The regenerate function is called whenever a constraint is added to-the database.--You also get a check_constraint function for each constraint which can-be run at any time. (including keys and sql fks), but unless you want-to sanity check a constraint these are never actually used.--We load candidate key and sql style foreign keys into this constraint-system, but instead of using the constraint check functions to enforce-these, we just load them in as regular pg unique not null and foreign-keys. When a constraint is implemented this way, it's called an-accelerated constraint in the code below--== issues--Since pg has no multiple updates, it may be necessary to have a hack-to disable constraints temporarily. The reenable function will have to-make sure the current data is good. This isn't implemented here yet-but some constraints in the server code use a hack based on this idea.--I'm pretty sure the constraint system works fine as long as-* you never change the columns on a table after adding a constraint-* you only add constraints, never change or remove them-* all database transactions are run one at a time, serialised- (actually serialised, not just using sql isolation serializable).--If any of these assumptions are broken, you will probably break the-database, load bad data in or just get weird errors for stuff that-should work.--Plan for supporting database updates in the field is to export the-data in the database being upgraded, recreate the new database from-scratch, then load the export back in.--== public interface-*/----this is the public function which you call to add a constraint-create function add_constraint(vname text,- vexpression text,- vrelvars text[]- ) returns void as $$-begin- perform add_constraint_internal(vname,vexpression,vrelvars, false);-end;-$$ language plpgsql volatile;--/*-=== internal-create this function so that we can add accelerated constraints and-normal ones in the same place.--*/-create function add_constraint_internal(vname text, vexpression text,- vrelvars text[], is_con_pg boolean) returns void as $$-declare- r boolean;- i integer;- t text;- constraint_operator text;- s text;-begin- --check the constraint is valid, cannot add it if it doesn't currently- --evaluate to true- --raise notice '******* adding constraint: %****%', vname, vexpression;- if not is_con_pg then- execute 'select ' || vexpression into r;- if not r then- raise exception- 'attempt to add constraint % which evaluates to false: %',- vname, vexpression;- end if;- end if;- --make entry in catalog- insert into database_constraints (constraint_name, expression)- values (vname, vexpression);- constraint_operator := 'check_con_' || vname;- --create implementation and add to catalog- --we do this even if we actually implement it using- --an accelerator-- --this function checks that the constraint currently holds- execute 'create function ' || constraint_operator ||- '() returns boolean as $a$-begin- return ' || vexpression || ';-end;-$a$ language plpgsql stable;';- --hide the check function from the user catalog- insert into system_implementation_objects(object_name, object_type)- values (constraint_operator, 'operator');- --store the check function in the internal constraint implementation catalog- execute $a$insert into dbcon_ops- (constraint_name, operator_name) values ('$a$ || vname || $a$', '$a$- || constraint_operator || $a$');$a$;- --add entries into constraint_relvars: so we can get a list of- --constraint implementation functions for a given table- if not is_con_pg then- for i in array_lower(vrelvars, 1)..array_upper(vrelvars, 1) loop- -- todo: if relvar is a view, then need to trigger on- -- view definition change and on any relvars which the view- -- depends on change- -- for now just skip views?- insert into dbcon_relvars (constraint_name, relvar_name)- values (vname, vrelvars[i]);- end loop;- --now recreate the actual triggers which enforce the constraint- perform regenerate_constraint_triggers();- end if;-- --hack: if the constraint mentions any tables which are- -- system_implementation_objects then add the constraint as a- -- system_implementation_object- -- this is also to hide implementation details from the user catalog-- if exists(select 1 from system_implementation_objects- where object_type = 'base_relvar' and- object_name = any (vrelvars)) then- insert into system_implementation_objects (object_name, object_type)- values (vname, 'database_constraint');- end if;-end;-$$ language plpgsql volatile;---/*-== constraint shortcuts--=== keys--*/--create function add_key(vtable text, attr text[]) returns void as $$-declare- cn text;-begin- cn := vtable || '_' ||- array_to_string(attr, '_') || '_key';- cn := sort_out_constraint_name(cn, '_key');- perform add_constraint_internal(cn,-$a$(select count(*) from $a$ || vtable || $a$ ) =-(select count(distinct $a$ || array_to_string(attr, ', ') || $a$)-from $a$ || vtable || $a$)$a$,- array[vtable], true);- perform set_pg_unique(cn, vtable, attr);-end;-$$ language plpgsql volatile;---- shortcut for a key on one attribute-create function add_key(vtable text, attr text) returns void as $$-begin- perform add_key(vtable, array[attr]);-end;-$$ language plpgsql volatile;--/*-=== fk/ references--The system generalises foreign keys-to a generic 'the tuples in the select expression must be a subset of-the tuples in this other select expression'. This allows-foreign keys to views, and to non key columns.--*/--- this function is used in the add foreign key function-create function attrs_are_key(text, text[]) returns boolean as $$- select exists- (select constraint_name, count(attribute_name)- from base_relvar_keys- natural inner join base_relvar_key_attributes- where relvar_name = $1- group by constraint_name- intersect- select constraint_name, count(attribute_name)- from base_relvar_keys- natural inner join base_relvar_key_attributes- where relvar_name = $1- and attribute_name = any ($2)- group by constraint_name);-$$ language sql stable;-insert into system_implementation_objects- (object_name,object_type) values- ('attrs_are_key', 'operator');---- foreign key to view/expression shortcut-create function add_foreign_key(vtable text,- src_attr text[],- reftable text,- ref_attr text[])- returns void as $$-declare- i int;- vcn text;- bt text[];- accel boolean;-begin-/*--automatically generate a name for this constraint in the catalog at-some point, you'll have to provide a name for every constraint-manually (plus some other stuff, like error message variants and-documentation to display in end user programs for user friendliness)--*/- vcn := vtable || '_' || array_to_string(src_attr, '_') || '_fkey';- vcn := sort_out_constraint_name(vcn, '_fkey');- -- make sure we get a unique name in case there are multiple foreign keys- -- on one set of attributes- --TODO: rewrite this to use max instead of looping- -- if target is a base relvar and the target attributes are a key then- -- pg accelerate it- if exists(select 1 from database_constraints where- constraint_name = vcn) then- i := 1;--- I must be going mad cos I can't find the convert--- int to string in base 10 function in pg...- while exists(select 1 from database_constraints where- constraint_name = vcn || to_hex(i)) loop- i := i + 1;- end loop;- vcn := vcn || to_hex(i);- end if;- --now try to automatically determine the list of base relvars- --that this constraint depends on- -- I think this means that references involving views are a bit- --broken...- --TODO: get to the bottom of this, and fix it if necessary- if exists(select 1 from base_relvars- where relvar_name = reftable) then- bt := array[vtable, reftable];- else- bt := array[vtable];- raise notice 'fk on % ignoring view %', vtable, reftable;- end if;-- accel := attrs_are_key(reftable, ref_attr);- -- add constraint- perform add_constraint_internal(vcn, 'not exists-(select ' || array_to_string(src_attr, ', ') ||- ' from ' || vtable || '- except-select ' || array_to_string(ref_attr, ', ') ||- ' from ' || reftable || ')',-bt, accel);- if accel then- perform set_pg_fk(vcn, vtable, src_attr, reftable, ref_attr);- end if;--end;-$$ language plpgsql volatile;----- add foreign key shortcuts for special cases:---same attributes-create function add_foreign_key(vtable text, src_attr text[], reftable text)- returns void as $$-begin- perform add_foreign_key(vtable, src_attr, reftable, src_attr);-end;-$$ language plpgsql volatile;--- one attribute-create function add_foreign_key(vtable text,- src_attr text,- reftable text,- ref_attr text)- returns void as $$-begin- perform add_foreign_key(vtable, array[src_attr], reftable, array[ref_attr]);-end;-$$ language plpgsql volatile;---- same one attribute-create function add_foreign_key(vtable text, src_attr text, reftable text)- returns void as $$-begin- perform add_foreign_key(vtable, array[src_attr], reftable, array[src_attr]);-end;-$$ language plpgsql volatile;--/*-=== upto 1 tuple-table cardinality 0 or 1 constraint-don't know if there is a better way to do this--*/--create function constrain_to_zero_or_one_tuple(table_name text)- returns void as $$-begin- execute $a$select add_constraint('$a$ || table_name || $a$_01_tuple',- '(select count(*) from $a$ || table_name || $a$) <= 1',- array['$a$ || table_name || $a$']);$a$;-end;-$$ language plpgsql volatile;--/*--cascade: add cascade to a fk relationship from one base relvar to-another base relvar (implemented using pg on update cascade on delete-cascade)--== internals--each expression gets wrapped up as a function:-every check including those that are accelerated are- in this table so they can be sanity checked.- these operators are not used when checking table updates--so this table contains one function per user constraint-the function can be used to check the constraint holds-(without using any acceleration)-*/--create table dbcon_ops (- constraint_name text,- operator_name text-);-insert into system_implementation_objects(object_name, object_type)- values ('dbcon_ops', 'base_relvar');--/*-this is the catalog bit that tells us which tables are referenced-by which constraints. In particular, this is used when generating-the trigger for a table which enforces all the constraints.--*/-create table dbcon_relvars (- constraint_name text,- relvar_name text-);-insert into system_implementation_objects(object_name, object_type)- values ('dbcon_relvars', 'base_relvar');--create function sort_out_constraint_name(cn text,suffix text)- returns text as $$-begin- --truncate the name if too long- --make sure it's unique- --preserve the suffix- if length(cn) > 54 then- --wtf kind of syntax is this?!- return substring(cn from 0 for (54 - length(suffix))) || suffix;- else- return cn;- end if;-end;-$$ language plpgsql volatile;--/*-=== acceleration ish-==== views for postgresql stuff-track all the pg accelerated constraints-constraint_name, relvar_name, expression-*/-create view check_pg as- select conname as constraint_name, relname as relvar_name,--- currently displayed as 'CHECK((expression))' for some reason.- pg_get_constraintdef(pg_constraint.oid) as expression- from pg_constraint- inner join pg_class on (conrelid = pg_class.oid)- where contype = 'c' and connamespace =- (select oid from pg_namespace where nspname='public');-insert into system_implementation_objects(object_name, object_type)- values ('check_pg', 'view');--/*-This view shows all the pg accelerated key constraints :-constraint_name, relvar_name, attribute_name-*/-create view key_pg as -- not normalised- select constraint_name, relvar_name, attribute_name from- (select conname as constraint_name, conrelid,- conkey[generate_series] as attnum- from pg_constraint- cross join generate_series(1,- (select max(array_upper(conkey, 1)) from pg_constraint))- where contype in('p', 'u') and connamespace =- (select oid from pg_namespace where nspname='public')- and generate_series between- array_lower(conkey, 1) and- array_upper(conkey, 1)) as a- -- 'a' contains what we want, but with oids for- -- relvar and attribute names- -- natural join in these using renames- -- using natural joins and renames makes- -- the sql code much clearer- natural inner join- (select oid as conrelid, relname as relvar_name from pg_class) as b- natural inner join- (select attrelid as conrelid, attname as attribute_name,- attnum from pg_attribute) as c--- order by constraint_name- ;-insert into system_implementation_objects(object_name, object_type)- values ('key_pg', 'view');--/*-pg accelerated foreign keys--constraint_name, relvar_name, attribute_name,-target_relvar_name, target_attribute_name--*/--create view fk_pg as -- not normalised- select constraint_name, relvar_name, attribute_name,- target_relvar_name, target_attribute_name from- (select conname as constraint_name, conrelid, confrelid,- conkey[generate_series] as attnum,- confkey[generate_series] as fattnum- from pg_constraint- cross join generate_series(1,- (select max(array_upper(conkey, 1)) from pg_constraint))- where contype = 'f' and connamespace =- (select oid from pg_namespace where nspname='public')- and generate_series between- array_lower(conkey, 1) and- array_upper(conkey, 1)) as a- natural inner join- (select oid as conrelid,- relname as relvar_name from pg_class) as b- natural inner join- (select oid as confrelid,- relname as target_relvar_name from pg_class) as c- natural inner join- (select attrelid as conrelid, attname as attribute_name,- attnum from pg_attribute) as d- natural inner join- (select attrelid as confrelid, attname as target_attribute_name,- attnum as fattnum from pg_attribute) as e--- order by constraint_name- ;-insert into system_implementation_objects(object_name, object_type)- values ('fk_pg', 'view');-/*-==== functions to activate pg stuff-These add the pg constraint, and insert into the-accelerated constraint catalog relvar-*/-create function check_constraint_name(cn text) returns void as $$-begin- if length(cn) > 54 then- raise exception- 'pg constraint names must be 54 chars or less, you have % (%)',- length(cn), cn;- end if;-end;-$$ language plpgsql volatile;--create function set_pg_unique- (vconstraint_name text, vrelvar_name text, vattributes text[])- returns void as $$-begin- perform check_constraint_name(vconstraint_name);- execute 'alter table ' || vrelvar_name ||- ' add constraint ' || vconstraint_name || ' unique(' ||- array_to_string(vattributes, ', ') || ');';- insert into con_pg(constraint_name)- values(vconstraint_name);-end;-$$ language plpgsql volatile;--insert into system_implementation_objects(object_name, object_type)- values ('set_pg_unique', 'operator');--create function set_pg_check- (vconstraint_name text, vrelvar_name text, vexpression text)- returns void as $$-begin- perform check_constraint_name(vconstraint_name);- execute 'alter table ' || vrelvar_name || 'add constraint '- || vconstraint_name || ' check(' || vexpression || ');';- insert into con_pg(constraint_name)- values(vconstraint_name);-end;-$$ language plpgsql volatile;-insert into system_implementation_objects(object_name, object_type)- values ('set_pg_check', 'operator');--create function set_pg_fk- (vconstraint_name text, vrelvar_name text, vattributes text[],- vtarget_relvar_name text, vtarget_attributes text[]) returns void as $$-begin- perform check_constraint_name(vconstraint_name);- execute 'alter table ' || vrelvar_name || ' add constraint '- || vconstraint_name || ' foreign key(' ||- array_to_string(vattributes, ',') || ') references ' ||- vtarget_relvar_name || '(' ||- array_to_string(vtarget_attributes, ',') ||---just uses cascade for now, revisit this decision at some point.- ') on update cascade on delete cascade;';-- insert into con_pg(constraint_name)- values(vconstraint_name);-end;-$$ language plpgsql volatile;-insert into system_implementation_objects(object_name, object_type)- values ('set_pg_fk', 'operator');---/*--===== internal catalog for pg ish-*/--- save which constraints have pg accelerators-create table con_pg (- constraint_name text-);-insert into system_implementation_objects(object_name, object_type)- values ('con_pg', 'base_relvar');--/*-==== general constraint implementation--remember trigger functions used to enforce constraints-all trigger functions have same sig so just record name-*/-create table dbcon_trigger_ops (- operator_name text-);-insert into system_implementation_objects(object_name, object_type)- values ('dbcon_trigger_ops', 'base_relvar');--- remember triggers used for constraints- --triggers have to be dropped with name and table so record both-create table dbcon_triggers (- trigger_name text,- relvar_name text-);-insert into system_implementation_objects(object_name, object_type)- values ('dbcon_triggers', 'base_relvar');--/* trigger code-atm it redoes all of them whenever anything changes.-Constraints are not changed much so this should be ok, possibly it-slows down the reset process.--Take all the constraints-exclude ones implemented by pg accelerators-then for each table referenced by the remaining constraints-* generate a function which checks all the-(non pg accel'd) constraints for that table and raises if any aren't true-* generate a trigger to call the function whenever that-table changes--*/-create view non_accelerated_constraints as-select relvar_name,constraint_name,expression- from dbcon_relvars- natural inner join database_constraints- where constraint_name not in- (select constraint_name from con_pg);--insert into system_implementation_objects(object_name, object_type)- values ('non_accelerated_constraints', 'view');--create function regenerate_constraint_triggers() returns void as $$-declare- r record;- s record;- f text;- table_trigger_function text;- table_trigger text;-begin- --clean up old triggers and trigger functions- --store names in table so they can be dropped- for r in select * from dbcon_triggers loop- execute 'drop trigger ' || r.trigger_name || ' on '- || r.relvar_name || ';';- delete from system_implementation_objects- where object_name=r.trigger_name- and object_type='trigger';- end loop;- delete from dbcon_triggers;-- for r in select * from dbcon_trigger_ops loop- execute 'drop function ' || r.operator_name || '();';- delete from system_implementation_objects- where object_name=r.operator_name- and object_type='operator';- end loop;- delete from dbcon_trigger_ops;--/*-if constraints are handled by pg constraints, then we-just ignore them here - don't need any operators or triggers-for them.-*/- for r in select distinct(relvar_name) from non_accelerated_constraints loop- -- for this table create a trigger function which calls all the relevant- -- constraint check operators- table_trigger_function := r.relvar_name || '_constraint_trigger_operator';- table_trigger := r.relvar_name || '_constraint_trigger';- --it's a bit tricky following this- -- start the function definition- f := $f$create function $f$ || table_trigger_function ||-$f$() returns trigger as $a$-begin--- raise notice 'in constraint op for $f$ || r.relvar_name || $f$';-$f$;- -- loop through the constraints- for s in select distinct constraint_name, expression- from non_accelerated_constraints- where relvar_name = r.relvar_name loop- -- and add a line for each one which checks if- --it is true, otherwise raises- f := f ||-$f$ if not $f$ || s.expression || $f$ then- raise exception- 'value violates database constraint "$f$ || s.constraint_name || $f$"';- end if;-$f$;- end loop;- f := f ||-$f$--- raise notice 'complete constraint op for $f$ || r.relvar_name || $f$';- return OLD;-end;-$a$ language plpgsql;$f$;- --create the function- execute f;- insert into system_implementation_objects(object_name, object_type)- values (table_trigger_function, 'operator');-- --now create the trigger to call the function- execute-$f$create trigger $f$ || table_trigger ||-$f$ after insert or update or delete on $f$ || r.relvar_name ||-$f$ for each statement execute procedure $f$ || table_trigger_function ||-$f$();$f$;- insert into system_implementation_objects(object_name, object_type)- values (table_trigger, 'trigger');- insert into dbcon_triggers- (trigger_name, relvar_name)- values(table_trigger, r.relvar_name);- insert into dbcon_trigger_ops- (operator_name)- values(table_trigger_function);- end loop;-end;-$$ language plpgsql volatile;-insert into system_implementation_objects(object_name, object_type)- values ('regenerate_constraint_triggers', 'operator');--/*-todo: static check - if there are constraints that fisher price my first-constraints system doesn't know about then complain, add this as-a sql test i.e. check_blah returns bool-*/--- add constraints to the tables already mentioned---which we can't do in the right place since we have to---wait for the constraint system to be defined--select add_key('system_implementation_objects',- array['object_name', 'object_type']);----comment this one out since it triples the reset speed---select add_foreign_key('system_implementation_objects',--- array['object_name', 'object_type'],--- 'all_database_objects');---run it as a test so at least we keep checking it-create function check_code_slow_si_objects_constraints() returns boolean as $$-begin- if not exists- (select object_name, object_type from system_implementation_objects- except- select object_name, object_type from all_database_objects) then- return true;- else- return false;- end if;-end;-$$ language plpgsql volatile;---select add_key('database_constraints', 'constraint_name');--select add_key('dbcon_ops', 'constraint_name');-select add_key('dbcon_ops', 'operator_name');-select add_foreign_key('dbcon_ops', 'constraint_name',- 'database_constraints');---select add_foreign_key('dbcon_ops', 'operator_name', 'operators');--select add_key('dbcon_relvars', array['constraint_name', 'relvar_name']);-select add_foreign_key('dbcon_relvars', 'constraint_name',- 'database_constraints');-select add_foreign_key('dbcon_relvars', 'relvar_name', 'base_relvars');--select add_key('con_pg', 'constraint_name');-select add_foreign_key('con_pg', 'constraint_name', 'database_constraints');-select add_foreign_key('con_pg', 'constraint_name',- '(select constraint_name from check_pg union- select constraint_name from key_pg union- select constraint_name from fk_pg) as x');--select add_key('dbcon_trigger_ops', 'operator_name');-select add_foreign_key('dbcon_trigger_ops', 'operator_name', 'operators');--select add_key('dbcon_triggers', 'trigger_name');-select add_foreign_key('dbcon_triggers', array['trigger_name', 'relvar_name'],- 'triggers');--/*-=== ghetto test thing-want to write some tests for this constraint system just as a sanity-check for now:-arbitrary check e.g. cardinality < 5-arbitrary check multiple tables e.g. sum cardinality of two tables-check without acceleration?:-fk-fk to view-unique-x,y in board size range from another table--for each check:-check adding constraint to invalid tables throws-check adding constraint to valid tables OK-insert OK data into constrained tables-insert bad data into constrained tables--accelerated checks-fk to view-x,y in board size range-check acceleration for normal checks & fk without pg?--pg accelerated checks:-just check pg catalog to see if inserted-check-fk-unique--all todo: yes, that means there is no direct testing of any of the-constraint stuff...--=== transition constraints--quickly hacked together. at the moment only supports constraints involving-a single tuple at a time from a single table. Separate functions-to create a constraint for updates, inserts and deletes.-I'm still not sure transition constraints like this are useful.-*/--create function create_x_transition_tuple_constraint(- relvar_name text, constraint_name text, constraint_expression text,- statement_type text) returns void as $$-declare- st text;-begin- st := $f$-create function check_$f$ || constraint_name || $f$() returns trigger as $a$-begin- if not ($f$ || constraint_expression || $f$) then- raise exception '$f$ || statement_type || $f$ on $f$ || relvar_name ||- $f$ violates transition constraint $f$ || constraint_name || $f$';- end if;-$f$;- if statement_type = 'update' or statement_type = 'insert' then- st := st || ' return OLD;';- else- st := st || ' return null;';- end if;- st := st || $f$-end;-$a$ language plpgsql volatile;$f$;-- execute st;- insert into system_implementation_objects(object_name,object_type)- values ('check_' || constraint_name, 'operator');-- execute $f$- create trigger $f$ || constraint_name ||- $f$_transition_trigger after $f$ ||- statement_type || $f$ on $f$ || relvar_name || $f$- for each row execute procedure check_$f$- || constraint_name || $f$();$f$;-- insert into system_implementation_objects(object_name,object_type)- values (constraint_name || '_transition_trigger', 'trigger');--end;-$$ language plpgsql volatile;-insert into system_implementation_objects- (object_name, object_type) values- ('create_x_transition_tuple_constraint', 'operator');----create function create_update_transition_tuple_constraint(- relvar_name text, constraint_name text, constraint_expression text)- returns void as $$-begin- perform create_x_transition_tuple_constraint(relvar_name,- constraint_name, constraint_expression, 'update');-end;-$$ language plpgsql volatile;--create function create_insert_transition_tuple_constraint(- relvar_name text, constraint_name text, constraint_expression text)- returns void as $$-begin- perform create_x_transition_tuple_constraint(relvar_name,- constraint_name, constraint_expression, 'insert');-end;-$$ language plpgsql volatile;--create function create_delete_transition_tuple_constraint(- relvar_name text, constraint_name text, constraint_expression text)- returns void as $$-begin- perform create_x_transition_tuple_constraint(relvar_name,- constraint_name, constraint_expression, 'delete');-end;-$$ language plpgsql volatile;--/*---================================================================================--= modules--The module system is designed to break programs up into-parts. At some point would like to add namespacing-(e.g. import and export lists, for modules with-enforcement by the compiler).-At the moment it's mainly just used by the documentation-generators and e.g. could be used to assist when browsing-the database in gui and to organise documentation--documentation here needs a bit more work--module order is a hack to allow a program to get the modules-out in the order they are created, which should match up to-the order in which they appear in the source.-*/-create table modules (- module_name text,- module_parent_name text,- module_order serial-);-select add_key('modules', 'module_name');----can't add this constraint cos it causes another constraint violation--- haven't worked out why yet---select add_foreign_key('modules', 'module_name',--- 'modules', 'module_parent_name');--insert into modules (module_name, module_parent_name)- values ('root', 'root');--create table all_module_objects (- object_name text,- object_type text,- module_name text-);-insert into system_implementation_objects(object_name, object_type)- values ('all_module_objects', 'base_relvar');-select add_key('all_module_objects', array['object_name', 'object_type']);-select add_foreign_key('all_module_objects', 'module_name',- 'modules');--/*-todo: when we get recursive with in pg 8.4,-add view to give module paths from the root to a module-*/--create view implementation_module_objects as- select * from all_module_objects natural inner join- system_implementation_objects;--insert into system_implementation_objects(object_name, object_type)- values ('implementation_module_objects', 'view');--create view module_objects as- select object_name, object_type, module_name- from all_module_objects- except- select object_name, object_type, module_name- from implementation_module_objects;--/*-hack to only name the module once after all its contents-since everything in my catalog is in a module, can just find-all objects without a module which is the objects which have-just been added, and set their module. This saves having to add-each object to a module individually-*/--create function set_module_for_preceding_objects(vmodule_name text)- returns void as $$-begin- insert into all_module_objects(module_name, object_name, object_type)- select vmodule_name as module_name, object_name, object_type from- (select object_name, object_type from all_database_objects- except select object_name, object_type- from all_module_objects) as a;-end;-$$ language plpgsql volatile;--create function new_module(mname text, mparent text) returns void as $$-begin- insert into modules (module_name, module_parent_name)- values(mname, mparent);-end;-$$ language plpgsql volatile;--select new_module('system', 'root');-select new_module('catalog', 'system');--select set_module_for_preceding_objects('catalog');---create function check_code_module_membership() returns boolean as $$-declare- success boolean := true;- r record;-begin- --returns false if any objects with no package- --also list problems them using raise notice- for r in select object_name, object_type from all_database_objects- except select object_name, object_type- from all_module_objects loop- success := false;- raise notice '% % - no module', r.object_type, r.object_name;- end loop;- return success;-end;-$$ language plpgsql volatile;----- add in all internal objects already defined-select set_module_for_preceding_objects('catalog');--/*--================================================================================--= utils--needs some work--*/-select new_module('utils', 'system');--/*-== set all columns to not null--saves us putting not null all over almost every table definition--The _mr suffix was left over from an attempt to do some sort of poor-man's multirelation system. The _mr tables can contain nullable as-well as non-nullable columns, so we leave them alone when setting non-nulls and ignore them when checking for nullable attributes.--*/-create function set_all_attributes_to_not_null() returns void as $$-begin- update pg_attribute set attnotnull = true- where attrelid in- (select oid from pg_class where relnamespace =- (select oid from pg_namespace- where nspname = 'public')- and relkind = 'r'- --don't touch 'multirelations'- and not exists(select 1 from regexp_matches(relname, '_mr$')))- and attnum >= 1;-end;-$$ language plpgsql volatile;--/*-since we can't put triggers on the catalog, at least make sure the above-function has been run in the tests.-verify all attributes in tables are not null. This doesn't affect views-which may have null values.-*/-create function check_code_no_nullable_table_columns() returns boolean as $$-declare- r record;- success boolean;-begin- success := true;- --check every table is tagged with one of- --readonly, data, argument, widget_state- for r in select table_name, column_name- from information_schema.columns- inner join base_relvars- on (table_name = relvar_name)- where is_nullable='YES'- --ignore touch multirelations- and not exists(select 1 from regexp_matches(table_name, '_mr$')) loop- success := false;- raise notice '%.% - nullable column', r.table_name, r.column_name;- end loop;- return success;-end;-$$ language plpgsql volatile;--/*--== relvars with 0 or 1 values (i.e. 0-1 tuples, one attribute)-only provide a shortcut for select, the rest might as well be in normal sql-rather than wrapped in a function.-*/-create function create_var(vname text, vtype text) returns void as $$-begin--- create table name_table(name type primary key)- execute $f$create table $f$ || vname || $f$_table ($f$ ||- vname || $f$ $f$ || vtype || $f$);$f$;- execute $f$select add_key('$f$ || vname || $f$_table',- '$f$ || vname || $f$');$f$;--- adds 0 or 1 tuple constraint to this table- --execute $f$select notify_on_changed(- -- '$f$ || vname || $f$_table');$f$;- execute $f$select constrain_to_zero_or_one_tuple(- '$f$ || vname || $f$_table');$f$;--- creates (static) functions:--- insert_name inserts value into table--- (will error if table isn't empty)--- execute 'create function insert_' || vname ||- -- '(' || vtype || ') returns void as $a$\n ' ||--- 'insert into ' || vname || '_table values($1);\n' ||--- '$a$ language sql volatile;';--- update_name updates value in table--- (will error if table is empty)--- execute 'create function update_' || vname || '(' || vtype || ')--- returns void as $a$\n ' ||--- 'update ' || vname || '_table set ' || vname || ' = $1;\n' ||--- '$a$ language sql volatile;';--- delete_name deletes from table--- (doesn't error if table is already empty)--- execute 'create function delete_' || vname || '()--- returns void as $a$\n ' ||--- 'delete from ' || vname || '_table;\n' ||--- '$a$ language sql volatile;';--- get_name returns select * from table_name as a single value- execute 'create function get_' || vname || '() returns ' ||- vtype || E' as $a$\n ' ||- 'select * from ' || vname || E'_table;\n' ||- '$a$ language sql stable;';--- drop_var_name - drop all this ish, cleanup--- execute 'create function dropvar_' || vname || E'()--- returns void as $a$\n ' ||--- 'drop function dropvar_' || vname || E'();\n' ||--- 'drop function insert_' || vname || '(' || vtype ||');\n' ||--- 'drop function update_' || vname || '(' || vtype ||');\n' ||--- 'drop function delete_' || vname || '();\n' ||--- 'drop function get_' || vname || E'();\n' ||--- 'drop table ' || vname || E'_table;\n' ||--- '$a$ language sql volatile;';-end;-$$ language plpgsql volatile;-/*-== table changed notifier macro--notifier: this function is used setup a trigger to notify with table-name when a table changes. It should be applied to all the data-tables.--*/--create function notify_on_changed(table_name text) returns void as $$-begin- execute 'create function ' || table_name- || E'_changed() returns trigger as $a$\n'- || E'begin\n'- || 'notify ' || table_name || E';\n'- || E'return null;\n'- || E'end;\n'- || '$a$ language plpgsql volatile;';- --perform add_to_package('utils', 'notify_table_' ||--- table_name || '_changed', 'trigger_function');- insert into system_implementation_objects- (object_name, object_type) values- (table_name || '_changed', 'operator');-- execute 'create trigger ' || table_name || '_changed'- || ' after insert or update or delete on '- || table_name || ' execute procedure '- || table_name || '_changed();';- insert into system_implementation_objects- (object_name, object_type) values- (table_name || '_changed', 'trigger');--end;-$$ language plpgsql volatile;--select set_module_for_preceding_objects('utils');
+ src/Database/HsSqlPpp/Annotation.lhs view
@@ -0,0 +1,24 @@++This is the public module to the annotation data types and support+functions (not including those that depend on the ast data types).++> {- | Contains the annotation data types and a few auxiliary functions.+> -}+>+> module Database.HsSqlPpp.Annotation+> (+> -- * Annotation data types+> Annotation(..)+> --,TypeExtra(..)+> ,SourcePosition+> --,ParameterizedStatementType+> ,getAnnotation+> --,updateAnnotations+> ,updateAnnotation+> --,getAnnotations+> ,emptyAnnotation+> --,resetAnnotations+> ) where+>+> import Database.HsSqlPpp.Internals.AstInternal+> --import Database.HsSqlPpp.Internals.AnnotationUtils
+ src/Database/HsSqlPpp/Catalog.lhs view
@@ -0,0 +1,63 @@++Forward the public part of CatalogInternal.++> {- | This module contains the database catalog data types and helper+> functions.+>+> The catalog data type holds the catalog information needed to type+> check sql code, and a catalog value is produced after typechecking sql+> which represents the catalog that would be produced (e.g. for sql+> containing ddl)+>++> You can create a catalog using the 'CatalogUpdate' type, and there+> is example and util in the repo which reads a catalog from+> an existing database in postgres.+>+> -}+>+> module Database.HsSqlPpp.Catalog+> (+> -- * Data types+> Catalog+> -- ** Updates+> ,CatalogUpdate(..)+> --,ppCatUpdate+> -- ** bits and pieces+> ,CastContext(..)+> ,CompositeFlavour(..)+> ,CatName+> ,CatNameExtra(..)+> ,mkCatNameExtra+> ,mkCatNameExtraNN+> --,CompositeDef+> --,FunctionPrototype+> --,DomainDefinition+> --,FunFlav(..)+> -- -- * Catalog values+> --,emptyCatalog+> --,defaultCatalog+> --,ansiCatalog+> --,defaultTemplate1Catalog+> --,defaultTSQLCatalog+> --,odbcCatalog+> -- -- * Catalog comparison+> --,CatalogDiff(..)+> --,compareCatalogs+> --,ppCatDiff+> -- * Functions+> ,updateCatalog+> ,deconstructCatalog+> -- * testing support+> ,Environment+> ,brokeEnvironment+> ,envSelectListEnvironment+> ) where+>+> import Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Internals.Catalog.DefaultTemplate1Catalog+> --import Database.HsSqlPpp.Internals.Catalog.DefaultTSQLCatalog+> --import Database.HsSqlPpp.Internals.Catalog.OdbcCatalog+> --import Database.HsSqlPpp.Internals.Catalog.AnsiCatalog+> import Database.HsSqlPpp.Internals.TypeChecking.Environment
+ src/Database/HsSqlPpp/Dialect.lhs view
@@ -0,0 +1,21 @@+++++> module Database.HsSqlPpp.Dialect+> (Dialect(..)+> ,SyntaxFlavour(..)+> ,ansiDialect+> ,postgresDialect+> ,sqlServerDialect+> ,oracleDialect+> ,canonicalizeTypeName+> ,ansiTypeNameToDialect+> ) where++> import Database.HsSqlPpp.Internals.Dialect++> import Database.HsSqlPpp.Dialects.Ansi+> import Database.HsSqlPpp.Dialects.Postgres+> import Database.HsSqlPpp.Dialects.Oracle+> import Database.HsSqlPpp.Dialects.SqlServer
+ src/Database/HsSqlPpp/Dialects/Ansi.lhs view
@@ -0,0 +1,259 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Dialects.Ansi (ansiDialect) where+> import Database.HsSqlPpp.Internals.Dialect++> import Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> import Database.HsSqlPpp.Dialects.BaseCatalog+++> ansiDialect :: Dialect+> ansiDialect = Dialect+> {diName = "ansi"+> ,diSyntaxFlavour = Ansi+> ,diCanonicalTypeNames = [("char",["character"])+> ,("varchar",["char varying","character varying"])+> ,("clob",["character large object","char large object"])+> ,("nchar",["national character","national char"])+> ,("nvarchar",["national character varying"+> ,"national char varying"+> ,"nchar varying"])+> ,("nclob",["national character large object"+> ,"nchar large object"])+> -- todo: this list isn't complete+> ,("varbinary",["binary varying"])+> ,("blob",["binary large object"])+> ,("int",["integer"])+> ,("float",["double precision"])+> ]+> ,diTextTypes = ["char","varchar","clob","nchar","nvarchar","nclob"]+> ,diDatetimeTypes = ["date","time","timestamp","interval"]+> ,diNumberTypes = ["smallint","int","bigint","decimal","numeric","float","real"]+> ,namesForAnsiTypes = [("char","char")+> ,("varchar","varchar")+> ,("bigint","bigint")+> ,("boolean","boolean")+> ,("numeric","numeric")+> ,("int","int")+> ,("date","date")+> ,("time","time")+> ,("timestamp","timestamp")+> ] -- todo: finish this+> ,diDefaultCatalog = ansiCatalog+> }+++> ansiCatalog :: Catalog+> ansiCatalog =+> (\l -> case l of+> Left x -> error $ show x -- todo: what is the best way to handle this?+> Right e -> e) $+> flip updateCatalog emptyCatalog (+> -- todo: duplicated list of text types+> [CatCreateScalarType "char"+> ,CatCreateScalarType "varchar"+> ,CatCreateScalarType "clob"++> ,CatCreateScalarType "nchar"+> ,CatCreateScalarType "nvarchar"+> ,CatCreateScalarType "nclob"++> ,CatCreateScalarType "binary"+> ,CatCreateScalarType "varbinary"+> ,CatCreateScalarType "blob"++> ,CatCreateScalarType "numeric"+> ,CatCreateScalarType "decimal"++> ,CatCreateScalarType "smallint"+> ,CatCreateScalarType "int"+> ,CatCreateScalarType "bigint"++> ,CatCreateScalarType "float"+> ,CatCreateScalarType "real"++> ,CatCreateScalarType "boolean"++> ,CatCreateScalarType "date"+> ,CatCreateScalarType "time"+> ,CatCreateScalarType "timestamp"+> ,CatCreateScalarType "interval"+> ]++what to do about these?++position+char_length+extract+substring+convert+translate+trim+overlay+nromalize+between+in+like+collate++++> ++ [CatCreateFunction charLen [t] False "int"+> | t <- ["char","varchar","clob"+> ,"nchar","nvarchar","nclob"]+> , charLen <- ["char_length", "character_length", "octet_length"] ]+> ++ concat+> -- unary +- all numeric types plus interval+> [ [CatCreatePrefixOp "+" n n+> ,CatCreatePrefixOp "-" n n]+> | n <- ["numeric","decimal","smallint","int","bigint"+> ,"float","real","interval"] ]+> -- binary + - * / all numeric types+> ++ concat+> [ [ CatCreateBinaryOp "+" n n n+> ,CatCreateBinaryOp "-" n n n+> ,CatCreateBinaryOp "*" n n n+> ,CatCreateBinaryOp "/" n n n]+> | n <- ["numeric","decimal","smallint","int","bigint"+> ,"float","real"] ]+> -- || concatenation on strings, binaries and arrays+> -- not sure how arrays will work right now+> ++ [CatCreateBinaryOp "||" s s s+> | s <- ["char","varchar","clob"+> ,"nchar","nvarchar", "nclob"+> ,"binary","varbinary","blob" ] ]+> -- comparisons, should some of these be generic?+> -- maybe want the option of user defined types+> -- not having comparisons? not sure about types without+> -- equals makes any sense here+> ++ [CatCreateBinaryOp op t t "boolean"+> | op <- ["=","<>","<",">","<=",">="]+> , t <- ["char","varchar","clob"+> ,"nchar","nvarchar","nclob"+> ,"binary","varbinary","blob"+> ,"numeric","decimal"+> ,"smallint","int","bigint"+> ,"float","real"+> ,"boolean"+> ,"date","time","timestamp","interval"+> ] ]+>+> ++ [CatCreateFunction "abs" [t] False t+> | t <- ["numeric", "decimal", "smallint", "int", "bigint", "float","real"]]++> ++ [CatCreateFunction "mod" [t,t] False t+> | t <- ["numeric", "smallint", "int", "bigint"]]++> ++ [CatCreateFunction fn [t] False t+> | t <- ["float","real"]+> , fn <- ["ln","exp","pow","sqrt"] ]+> ++ [CatCreateFunction fn [t] False t+> | t <- ["float","real","numeric"]+> , fn <- ["floor","ceil","ceiling"] ]++> ++ [CatCreateFunction "width_bucket" [t,t,t,"numeric"] False "numeric"+> | t <- ["char","varchar","clob"+> ,"nchar","nvarchar","nclob"+> ,"binary","varbinary","blob"+> ,"numeric","decimal"+> ,"smallint","int","bigint"+> ,"float","real"+> ,"boolean"+> ,"date","time","timestamp","interval"+> ] ]++> ++ [CatCreateFunction fn [t] False t+> | t <- ["char","varchar","clob"+> ,"nchar","nvarchar","nclob"]+> , fn <- ["lower","upper"] ]++> ++ concat+> [ [ CatCreateBinaryOp "+" dt "interval" dt+> ,CatCreateBinaryOp "+" "interval" dt dt+> ,CatCreateBinaryOp "-" dt "interval" dt]+> | dt <- ["date","time","timestamp"]]+> ++ [CatCreateBinaryOp "+" "interval" "interval" "interval"+> ,CatCreateBinaryOp "-" "interval" "interval" "interval"]++quick and dirty to get tpch working++> +++> [ CatCreateAggregate "sum" [ "numeric" ] "numeric"+> , CatCreateAggregate "sum" [ "smallint" ] "smallint"+> --todo: figure out what the options for the types are here+> , CatCreateAggregate "sum" [ "int" ] "bigint"+> , CatCreateAggregate "sum" [ "bigint" ] "bigint"+> , CatCreateAggregate "avg" [ "numeric" ] "numeric"+> , CatCreateAggregate "max" [ "numeric" ] "numeric"+> , CatCreateAggregate "min" [ "numeric" ] "numeric"+> , CatCreateAggregate "count" [ "any" ] "bigint"]+++> ++ [+> --todo: these are taken from postgres catalog+> -- they need careful review to see if they are exactly+> -- what we want in the ansi dialect+> CatCreateCast "boolean" "int" ExplicitCastContext,+> CatCreateCast "boolean" "varchar" AssignmentCastContext,+> CatCreateCast "char" "int" ExplicitCastContext,+> CatCreateCast "char" "varchar" AssignmentCastContext,+> CatCreateCast "date" "timestamp" ImplicitCastContext,+> CatCreateCast "real" "float" ImplicitCastContext,+> CatCreateCast "real" "smallint" AssignmentCastContext,+> CatCreateCast "real" "int" AssignmentCastContext,+> CatCreateCast "real" "bigint" AssignmentCastContext,+> CatCreateCast "real" "numeric" AssignmentCastContext,+> CatCreateCast "float" "real" AssignmentCastContext,+> CatCreateCast "float" "smallint" AssignmentCastContext,+> CatCreateCast "float" "int" AssignmentCastContext,+> CatCreateCast "float" "bigint" AssignmentCastContext,+> CatCreateCast "float" "numeric" AssignmentCastContext,+> CatCreateCast "smallint" "real" ImplicitCastContext,+> CatCreateCast "smallint" "float" ImplicitCastContext,+> CatCreateCast "smallint" "int" ImplicitCastContext,+> CatCreateCast "smallint" "bigint" ImplicitCastContext,+> CatCreateCast "smallint" "numeric" ImplicitCastContext,+> CatCreateCast "int" "boolean" ExplicitCastContext,+> CatCreateCast "int" "char" ExplicitCastContext,+> CatCreateCast "int" "real" ImplicitCastContext,+> CatCreateCast "int" "float" ImplicitCastContext,+> CatCreateCast "int" "smallint" AssignmentCastContext,+> CatCreateCast "int" "bigint" ImplicitCastContext,+> CatCreateCast "int" "numeric" ImplicitCastContext,+> CatCreateCast "bigint" "real" ImplicitCastContext,+> CatCreateCast "bigint" "float" ImplicitCastContext,+> CatCreateCast "bigint" "smallint" AssignmentCastContext,+> CatCreateCast "bigint" "int" AssignmentCastContext,+> CatCreateCast "bigint" "numeric" ImplicitCastContext,+> CatCreateCast "interval" "interval" ImplicitCastContext,+> CatCreateCast "interval" "time" AssignmentCastContext,+> CatCreateCast "numeric" "real" ImplicitCastContext,+> CatCreateCast "numeric" "float" ImplicitCastContext,+> CatCreateCast "numeric" "smallint" AssignmentCastContext,+> CatCreateCast "numeric" "int" AssignmentCastContext,+> CatCreateCast "numeric" "bigint" AssignmentCastContext,+> CatCreateCast "numeric" "numeric" ImplicitCastContext,+> CatCreateCast "time" "interval" ImplicitCastContext,+> CatCreateCast "time" "time" ImplicitCastContext,+> CatCreateCast "timestamp" "date" AssignmentCastContext,+> CatCreateCast "timestamp" "time" AssignmentCastContext,+> CatCreateCast "timestamp" "timestamp" ImplicitCastContext,+> CatCreateCast "varchar" "char" AssignmentCastContext,+> CatCreateCast "varchar" "varchar" ImplicitCastContext,+> CatCreateTypeCategoryEntry "boolean" ("B", True),+> CatCreateTypeCategoryEntry "char" ("S", False),+> CatCreateTypeCategoryEntry "date" ("D", False),+> CatCreateTypeCategoryEntry "real" ("N", False),+> CatCreateTypeCategoryEntry "float" ("N", True),+> CatCreateTypeCategoryEntry "smallint" ("N", False),+> CatCreateTypeCategoryEntry "int" ("N", False),+> CatCreateTypeCategoryEntry "bigint" ("N", False),+> CatCreateTypeCategoryEntry "interval" ("T", True),+> CatCreateTypeCategoryEntry "numeric" ("N", False),+> CatCreateTypeCategoryEntry "time" ("D", False),+> CatCreateTypeCategoryEntry "timestamp" ("D", False),+> CatCreateTypeCategoryEntry "varchar" ("S", False)]+> ++ baseCatalog "boolean" "int" ["char","varchar","clob","nchar","nvarchar","nclob"]++> )
+ src/Database/HsSqlPpp/Dialects/BaseCatalog.lhs view
@@ -0,0 +1,114 @@++This file contains special definitions which are used by pretty much+every dialect.++This includes the catalog entries to support:+mixfix:+between and not between++keyword operators:+and, or, not, (not) like, is (not) null, overlaps+is (not) similar to+is (not) { true | false | unknown }+is (not) distinct from++in (list version)++almost-function like operators+position+substring+convert+translate+overlay+trim++coalesce and nullif also appear here++TODO: this isn't complete yet (we cannot even parse some of the above+currently)++todo: not sure how to handle:+array subscript and ctor+cast - very special case+extract - special case because one of the args is a typename not+ a scalar expr+quantified comparisons?+array and multiset ops+other subqueries++> {-# LANGUAGE DeriveDataTypeable,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Dialects.BaseCatalog+> (baseCatalog+> --,insertOperators+> ) where+> import Data.Text (Text)++> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes++> baseCatalog :: Text -> Text -> [Text] -> [CatalogUpdate]+> baseCatalog boolTypeName intTypeName textTypeNames =+> CatCreateSchema "public"+> : (binaryOps boolTypeName intTypeName textTypeNames+> ++ prefixOps boolTypeName+> ++ postfixOps boolTypeName+> ++ functions+> ++ specialOps boolTypeName intTypeName textTypeNames)+++> binaryOps :: Text -> Text -> [Text] -> [CatalogUpdate]+> binaryOps bool _int texts =+> [CatCreateBinaryOp "and" bool bool bool+> ,CatCreateBinaryOp "or" bool bool bool+> ] +++> concat [ [CatCreateBinaryOp "like" t t bool+> -- todo: rename this to "not like"+> -- and other operators the same+> ,CatCreateBinaryOp "notlike" t t bool+> -- todo: overlaps needs a tuple?+> --,CatCreateBinaryOp "overlaps" t t bool+> --is (not) similar to+> -- is (not) distinct from+> ]+> | t <- texts]+> ++ -- these should go in a separate namespace, not functions+> [CatCreateFunction "between" ["anyelement","anyelement","anyelement"] False bool+> ,CatCreateFunction "notbetween" ["anyelement","anyelement","anyelement"] False bool+> ]++todo: do some writeup on namespaces in the hssqlppp catalog code++> specialOps :: Text -> Text -> [Text] -> [CatalogUpdate]+> specialOps _bool int texts =+> -- these should go in a separate namespace along with between+> [CatCreateSpecialOp "substring" [t,int,int] False t+> -- in (list version) can be treated as a variadic special function+> -- extract ... takes a typename as one of the args+> -- position+> -- convert+> -- translate+> -- overlay+> -- trim++> | t <- texts]+++> prefixOps :: Text -> [CatalogUpdate]+> prefixOps bool =+> [CatCreatePrefixOp "not" bool bool]++> postfixOps :: Text -> [CatalogUpdate]+> postfixOps bool =+> [CatCreatePostfixOp "isnull" "anyelement" bool+> ,CatCreatePostfixOp "isnotnull" "anyelement" bool+> -- is (not) { true | false | unknown }+> ]++These appear here since basically every dialect has them the same. Not+sure if this is a good enough reason.++> functions :: [CatalogUpdate]+> functions =+> [CatCreateVariadicFunction "coalesce" ["anyelement"] False "anyelement"+> ,CatCreateFunction "nullif" ["anyelement","anyelement"] False "anyelement"+> ]
+ src/Database/HsSqlPpp/Dialects/GeneratedPostgres.lhs view
@@ -0,0 +1,6042 @@++++This file is auto generated, to regenerate run+make regenDefaultTemplate1Catalog. You will need postgresql+installed to do this.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Dialects.GeneratedPostgres+> (generatedPostgresCatalogEntries) where+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes++> -- | The catalog from a default template1 database in roughly the+> -- latest postgres. 'select version()' from the dbms this catalog+> -- was generated from: 'PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 5.2.1-23) 5.2.1 20151028, 64-bit'.+> generatedPostgresCatalogEntries :: [CatalogUpdate]+> generatedPostgresCatalogEntries =++ +> [ CatCreateScalarType "abstime"+> , CatCreateScalarType "aclitem"+> , CatCreateScalarType "bit"+> , CatCreateScalarType "bool"+> , CatCreateScalarType "box"+> , CatCreateScalarType "bpchar"+> , CatCreateScalarType "bytea"+> , CatCreateScalarType "char"+> , CatCreateScalarType "cid"+> , CatCreateScalarType "cidr"+> , CatCreateScalarType "circle"+> , CatCreateScalarType "date"+> , CatCreateScalarType "float4"+> , CatCreateScalarType "float8"+> , CatCreateScalarType "gtsvector"+> , CatCreateScalarType "inet"+> , CatCreateScalarType "int2"+> , CatCreateScalarType "int2vector"+> , CatCreateScalarType "int4"+> , CatCreateScalarType "int8"+> , CatCreateScalarType "interval"+> , CatCreateScalarType "json"+> , CatCreateScalarType "jsonb"+> , CatCreateScalarType "line"+> , CatCreateScalarType "lseg"+> , CatCreateScalarType "macaddr"+> , CatCreateScalarType "money"+> , CatCreateScalarType "name"+> , CatCreateScalarType "numeric"+> , CatCreateScalarType "oid"+> , CatCreateScalarType "oidvector"+> , CatCreateScalarType "path"+> , CatCreateScalarType "pg_lsn"+> , CatCreateScalarType "pg_node_tree"+> , CatCreateScalarType "point"+> , CatCreateScalarType "polygon"+> , CatCreateScalarType "refcursor"+> , CatCreateScalarType "regclass"+> , CatCreateScalarType "regconfig"+> , CatCreateScalarType "regdictionary"+> , CatCreateScalarType "regoper"+> , CatCreateScalarType "regoperator"+> , CatCreateScalarType "regproc"+> , CatCreateScalarType "regprocedure"+> , CatCreateScalarType "regtype"+> , CatCreateScalarType "reltime"+> , CatCreateScalarType "smgr"+> , CatCreateScalarType "text"+> , CatCreateScalarType "tid"+> , CatCreateScalarType "time"+> , CatCreateScalarType "timestamp"+> , CatCreateScalarType "timestamptz"+> , CatCreateScalarType "timetz"+> , CatCreateScalarType "tinterval"+> , CatCreateScalarType "tsquery"+> , CatCreateScalarType "tsvector"+> , CatCreateScalarType "txid_snapshot"+> , CatCreateScalarType "unknown"+> , CatCreateScalarType "uuid"+> , CatCreateScalarType "varbit"+> , CatCreateScalarType "varchar"+> , CatCreateScalarType "xid"+> , CatCreateScalarType "xml"+> , CatCreateDomainType "information_schema.yes_or_no" "varchar"+> , CatCreateCast+> "information_schema.yes_or_no" "varchar" ImplicitCastContext+> , CatCreateDomainType "information_schema.time_stamp" "timestamptz"+> , CatCreateCast+> "information_schema.time_stamp" "timestamptz" ImplicitCastContext+> , CatCreateDomainType "information_schema.sql_identifier" "varchar"+> , CatCreateCast+> "information_schema.sql_identifier" "varchar" ImplicitCastContext+> , CatCreateDomainType "information_schema.character_data" "varchar"+> , CatCreateCast+> "information_schema.character_data" "varchar" ImplicitCastContext+> , CatCreateDomainType "information_schema.cardinal_number" "int4"+> , CatCreateCast+> "information_schema.cardinal_number" "int4" ImplicitCastContext+> , CatCreateArrayType "_xml" "xml"+> , CatCreateTypeCategoryEntry "_xml" ( "A" , False )+> , CatCreateArrayType "_xid" "xid"+> , CatCreateTypeCategoryEntry "_xid" ( "A" , False )+> , CatCreateArrayType "_varchar" "varchar"+> , CatCreateTypeCategoryEntry "_varchar" ( "A" , False )+> , CatCreateArrayType "_varbit" "varbit"+> , CatCreateTypeCategoryEntry "_varbit" ( "A" , False )+> , CatCreateArrayType "_uuid" "uuid"+> , CatCreateTypeCategoryEntry "_uuid" ( "A" , False )+> , CatCreateArrayType "_txid_snapshot" "txid_snapshot"+> , CatCreateTypeCategoryEntry "_txid_snapshot" ( "A" , False )+> , CatCreateArrayType "_tsvector" "tsvector"+> , CatCreateTypeCategoryEntry "_tsvector" ( "A" , False )+> , CatCreateArrayType "_tstzrange" "tstzrange"+> , CatCreateTypeCategoryEntry "_tstzrange" ( "A" , False )+> , CatCreateArrayType "_tsrange" "tsrange"+> , CatCreateTypeCategoryEntry "_tsrange" ( "A" , False )+> , CatCreateArrayType "_tsquery" "tsquery"+> , CatCreateTypeCategoryEntry "_tsquery" ( "A" , False )+> , CatCreateArrayType "_tinterval" "tinterval"+> , CatCreateTypeCategoryEntry "_tinterval" ( "A" , False )+> , CatCreateArrayType "_timetz" "timetz"+> , CatCreateTypeCategoryEntry "_timetz" ( "A" , False )+> , CatCreateArrayType "_timestamptz" "timestamptz"+> , CatCreateTypeCategoryEntry "_timestamptz" ( "A" , False )+> , CatCreateArrayType "_timestamp" "timestamp"+> , CatCreateTypeCategoryEntry "_timestamp" ( "A" , False )+> , CatCreateArrayType "_time" "time"+> , CatCreateTypeCategoryEntry "_time" ( "A" , False )+> , CatCreateArrayType "_tid" "tid"+> , CatCreateTypeCategoryEntry "_tid" ( "A" , False )+> , CatCreateArrayType "_text" "text"+> , CatCreateTypeCategoryEntry "_text" ( "A" , False )+> , CatCreateArrayType "_reltime" "reltime"+> , CatCreateTypeCategoryEntry "_reltime" ( "A" , False )+> , CatCreateArrayType "_regtype" "regtype"+> , CatCreateTypeCategoryEntry "_regtype" ( "A" , False )+> , CatCreateArrayType "_regprocedure" "regprocedure"+> , CatCreateTypeCategoryEntry "_regprocedure" ( "A" , False )+> , CatCreateArrayType "_regproc" "regproc"+> , CatCreateTypeCategoryEntry "_regproc" ( "A" , False )+> , CatCreateArrayType "_regoperator" "regoperator"+> , CatCreateTypeCategoryEntry "_regoperator" ( "A" , False )+> , CatCreateArrayType "_regoper" "regoper"+> , CatCreateTypeCategoryEntry "_regoper" ( "A" , False )+> , CatCreateArrayType "_regdictionary" "regdictionary"+> , CatCreateTypeCategoryEntry "_regdictionary" ( "A" , False )+> , CatCreateArrayType "_regconfig" "regconfig"+> , CatCreateTypeCategoryEntry "_regconfig" ( "A" , False )+> , CatCreateArrayType "_regclass" "regclass"+> , CatCreateTypeCategoryEntry "_regclass" ( "A" , False )+> , CatCreateArrayType "_refcursor" "refcursor"+> , CatCreateTypeCategoryEntry "_refcursor" ( "A" , False )+> , CatCreateArrayType "_record" "record"+> , CatCreateTypeCategoryEntry "_record" ( "A" , False )+> , CatCreateArrayType "_polygon" "polygon"+> , CatCreateTypeCategoryEntry "_polygon" ( "A" , False )+> , CatCreateArrayType "_point" "point"+> , CatCreateTypeCategoryEntry "_point" ( "A" , False )+> , CatCreateArrayType "_pg_lsn" "pg_lsn"+> , CatCreateTypeCategoryEntry "_pg_lsn" ( "A" , False )+> , CatCreateArrayType "_path" "path"+> , CatCreateTypeCategoryEntry "_path" ( "A" , False )+> , CatCreateArrayType "_oidvector" "oidvector"+> , CatCreateTypeCategoryEntry "_oidvector" ( "A" , False )+> , CatCreateArrayType "_oid" "oid"+> , CatCreateTypeCategoryEntry "_oid" ( "A" , False )+> , CatCreateArrayType "_numrange" "numrange"+> , CatCreateTypeCategoryEntry "_numrange" ( "A" , False )+> , CatCreateArrayType "_numeric" "numeric"+> , CatCreateTypeCategoryEntry "_numeric" ( "A" , False )+> , CatCreateArrayType "_name" "name"+> , CatCreateTypeCategoryEntry "_name" ( "A" , False )+> , CatCreateArrayType "_money" "money"+> , CatCreateTypeCategoryEntry "_money" ( "A" , False )+> , CatCreateArrayType "_macaddr" "macaddr"+> , CatCreateTypeCategoryEntry "_macaddr" ( "A" , False )+> , CatCreateArrayType "_lseg" "lseg"+> , CatCreateTypeCategoryEntry "_lseg" ( "A" , False )+> , CatCreateArrayType "_line" "line"+> , CatCreateTypeCategoryEntry "_line" ( "A" , False )+> , CatCreateArrayType "_jsonb" "jsonb"+> , CatCreateTypeCategoryEntry "_jsonb" ( "A" , False )+> , CatCreateArrayType "_json" "json"+> , CatCreateTypeCategoryEntry "_json" ( "A" , False )+> , CatCreateArrayType "_interval" "interval"+> , CatCreateTypeCategoryEntry "_interval" ( "A" , False )+> , CatCreateArrayType "_int8range" "int8range"+> , CatCreateTypeCategoryEntry "_int8range" ( "A" , False )+> , CatCreateArrayType "_int8" "int8"+> , CatCreateTypeCategoryEntry "_int8" ( "A" , False )+> , CatCreateArrayType "_int4range" "int4range"+> , CatCreateTypeCategoryEntry "_int4range" ( "A" , False )+> , CatCreateArrayType "_int4" "int4"+> , CatCreateTypeCategoryEntry "_int4" ( "A" , False )+> , CatCreateArrayType "_int2vector" "int2vector"+> , CatCreateTypeCategoryEntry "_int2vector" ( "A" , False )+> , CatCreateArrayType "_int2" "int2"+> , CatCreateTypeCategoryEntry "_int2" ( "A" , False )+> , CatCreateArrayType "_inet" "inet"+> , CatCreateTypeCategoryEntry "_inet" ( "A" , False )+> , CatCreateArrayType "_gtsvector" "gtsvector"+> , CatCreateTypeCategoryEntry "_gtsvector" ( "A" , False )+> , CatCreateArrayType "_float8" "float8"+> , CatCreateTypeCategoryEntry "_float8" ( "A" , False )+> , CatCreateArrayType "_float4" "float4"+> , CatCreateTypeCategoryEntry "_float4" ( "A" , False )+> , CatCreateArrayType "_daterange" "daterange"+> , CatCreateTypeCategoryEntry "_daterange" ( "A" , False )+> , CatCreateArrayType "_date" "date"+> , CatCreateTypeCategoryEntry "_date" ( "A" , False )+> , CatCreateArrayType "_cstring" "cstring"+> , CatCreateTypeCategoryEntry "_cstring" ( "A" , False )+> , CatCreateArrayType "_circle" "circle"+> , CatCreateTypeCategoryEntry "_circle" ( "A" , False )+> , CatCreateArrayType "_cidr" "cidr"+> , CatCreateTypeCategoryEntry "_cidr" ( "A" , False )+> , CatCreateArrayType "_cid" "cid"+> , CatCreateTypeCategoryEntry "_cid" ( "A" , False )+> , CatCreateArrayType "_char" "char"+> , CatCreateTypeCategoryEntry "_char" ( "A" , False )+> , CatCreateArrayType "_bytea" "bytea"+> , CatCreateTypeCategoryEntry "_bytea" ( "A" , False )+> , CatCreateArrayType "_bpchar" "bpchar"+> , CatCreateTypeCategoryEntry "_bpchar" ( "A" , False )+> , CatCreateArrayType "_box" "box"+> , CatCreateTypeCategoryEntry "_box" ( "A" , False )+> , CatCreateArrayType "_bool" "bool"+> , CatCreateTypeCategoryEntry "_bool" ( "A" , False )+> , CatCreateArrayType "_bit" "bit"+> , CatCreateTypeCategoryEntry "_bit" ( "A" , False )+> , CatCreateArrayType "_aclitem" "aclitem"+> , CatCreateTypeCategoryEntry "_aclitem" ( "A" , False )+> , CatCreateArrayType "_abstime" "abstime"+> , CatCreateTypeCategoryEntry "_abstime" ( "A" , False )+> , CatCreatePrefixOp "!!" "int8" "numeric"+> , CatCreatePrefixOp "!!" "tsquery" "tsquery"+> , CatCreatePrefixOp "#" "path" "int4"+> , CatCreatePrefixOp "#" "polygon" "int4"+> , CatCreatePrefixOp "+" "int8" "int8"+> , CatCreatePrefixOp "+" "int2" "int2"+> , CatCreatePrefixOp "+" "int4" "int4"+> , CatCreatePrefixOp "+" "float4" "float4"+> , CatCreatePrefixOp "+" "float8" "float8"+> , CatCreatePrefixOp "+" "numeric" "numeric"+> , CatCreatePrefixOp "-" "int8" "int8"+> , CatCreatePrefixOp "-" "int2" "int2"+> , CatCreatePrefixOp "-" "int4" "int4"+> , CatCreatePrefixOp "-" "float4" "float4"+> , CatCreatePrefixOp "-" "float8" "float8"+> , CatCreatePrefixOp "-" "interval" "interval"+> , CatCreatePrefixOp "-" "numeric" "numeric"+> , CatCreatePrefixOp "?-" "lseg" "bool"+> , CatCreatePrefixOp "?-" "line" "bool"+> , CatCreatePrefixOp "?|" "lseg" "bool"+> , CatCreatePrefixOp "?|" "line" "bool"+> , CatCreatePrefixOp "@" "int8" "int8"+> , CatCreatePrefixOp "@" "int2" "int2"+> , CatCreatePrefixOp "@" "int4" "int4"+> , CatCreatePrefixOp "@" "float4" "float4"+> , CatCreatePrefixOp "@" "float8" "float8"+> , CatCreatePrefixOp "@" "numeric" "numeric"+> , CatCreatePrefixOp "@-@" "lseg" "float8"+> , CatCreatePrefixOp "@-@" "path" "float8"+> , CatCreatePrefixOp "@@" "lseg" "point"+> , CatCreatePrefixOp "@@" "path" "point"+> , CatCreatePrefixOp "@@" "box" "point"+> , CatCreatePrefixOp "@@" "polygon" "point"+> , CatCreatePrefixOp "@@" "circle" "point"+> , CatCreatePrefixOp "|" "tinterval" "abstime"+> , CatCreatePrefixOp "|/" "float8" "float8"+> , CatCreatePrefixOp "||/" "float8" "float8"+> , CatCreatePrefixOp "~" "int8" "int8"+> , CatCreatePrefixOp "~" "int2" "int2"+> , CatCreatePrefixOp "~" "int4" "int4"+> , CatCreatePrefixOp "~" "macaddr" "macaddr"+> , CatCreatePrefixOp "~" "inet" "inet"+> , CatCreatePrefixOp "~" "bit" "bit"+> , CatCreatePostfixOp "!" "int8" "numeric"+> , CatCreateBinaryOp "!~" "name" "text" "bool"+> , CatCreateBinaryOp "!~" "text" "text" "bool"+> , CatCreateBinaryOp "!~" "bpchar" "text" "bool"+> , CatCreateBinaryOp "!~*" "name" "text" "bool"+> , CatCreateBinaryOp "!~*" "text" "text" "bool"+> , CatCreateBinaryOp "!~*" "bpchar" "text" "bool"+> , CatCreateBinaryOp "!~~" "bytea" "bytea" "bool"+> , CatCreateBinaryOp "!~~" "name" "text" "bool"+> , CatCreateBinaryOp "!~~" "text" "text" "bool"+> , CatCreateBinaryOp "!~~" "bpchar" "text" "bool"+> , CatCreateBinaryOp "!~~*" "name" "text" "bool"+> , CatCreateBinaryOp "!~~*" "text" "text" "bool"+> , CatCreateBinaryOp "!~~*" "bpchar" "text" "bool"+> , CatCreateBinaryOp "#" "int8" "int8" "int8"+> , CatCreateBinaryOp "#" "int2" "int2" "int2"+> , CatCreateBinaryOp "#" "int4" "int4" "int4"+> , CatCreateBinaryOp "#" "lseg" "lseg" "point"+> , CatCreateBinaryOp "#" "box" "box" "box"+> , CatCreateBinaryOp "#" "line" "line" "point"+> , CatCreateBinaryOp "#" "bit" "bit" "bit"+> , CatCreateBinaryOp "##" "point" "lseg" "point"+> , CatCreateBinaryOp "##" "point" "box" "point"+> , CatCreateBinaryOp "##" "point" "line" "point"+> , CatCreateBinaryOp "##" "lseg" "lseg" "point"+> , CatCreateBinaryOp "##" "lseg" "box" "point"+> , CatCreateBinaryOp "##" "lseg" "line" "point"+> , CatCreateBinaryOp "##" "line" "lseg" "point"+> , CatCreateBinaryOp "##" "line" "box" "point"+> , CatCreateBinaryOp "#<" "tinterval" "reltime" "bool"+> , CatCreateBinaryOp "#<=" "tinterval" "reltime" "bool"+> , CatCreateBinaryOp "#<>" "tinterval" "reltime" "bool"+> , CatCreateBinaryOp "#=" "tinterval" "reltime" "bool"+> , CatCreateBinaryOp "#>" "json" "_text" "json"+> , CatCreateBinaryOp "#>" "tinterval" "reltime" "bool"+> , CatCreateBinaryOp "#>" "jsonb" "_text" "jsonb"+> , CatCreateBinaryOp "#>=" "tinterval" "reltime" "bool"+> , CatCreateBinaryOp "#>>" "json" "_text" "text"+> , CatCreateBinaryOp "#>>" "jsonb" "_text" "text"+> , CatCreateBinaryOp "%" "int8" "int8" "int8"+> , CatCreateBinaryOp "%" "int2" "int2" "int2"+> , CatCreateBinaryOp "%" "int4" "int4" "int4"+> , CatCreateBinaryOp "%" "numeric" "numeric" "numeric"+> , CatCreateBinaryOp "&" "int8" "int8" "int8"+> , CatCreateBinaryOp "&" "int2" "int2" "int2"+> , CatCreateBinaryOp "&" "int4" "int4" "int4"+> , CatCreateBinaryOp "&" "macaddr" "macaddr" "macaddr"+> , CatCreateBinaryOp "&" "inet" "inet" "inet"+> , CatCreateBinaryOp "&" "bit" "bit" "bit"+> , CatCreateBinaryOp "&&" "box" "box" "bool"+> , CatCreateBinaryOp "&&" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "&&" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "&&" "circle" "circle" "bool"+> , CatCreateBinaryOp "&&" "inet" "inet" "bool"+> , CatCreateBinaryOp "&&" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "&&" "tsquery" "tsquery" "tsquery"+> , CatCreateBinaryOp "&&" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "&<" "box" "box" "bool"+> , CatCreateBinaryOp "&<" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "&<" "circle" "circle" "bool"+> , CatCreateBinaryOp "&<" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "&<|" "box" "box" "bool"+> , CatCreateBinaryOp "&<|" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "&<|" "circle" "circle" "bool"+> , CatCreateBinaryOp "&>" "box" "box" "bool"+> , CatCreateBinaryOp "&>" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "&>" "circle" "circle" "bool"+> , CatCreateBinaryOp "&>" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "*" "int8" "int8" "int8"+> , CatCreateBinaryOp "*" "int8" "int2" "int8"+> , CatCreateBinaryOp "*" "int8" "int4" "int8"+> , CatCreateBinaryOp "*" "int2" "int8" "int8"+> , CatCreateBinaryOp "*" "int2" "int2" "int2"+> , CatCreateBinaryOp "*" "int2" "int4" "int4"+> , CatCreateBinaryOp "*" "int2" "money" "money"+> , CatCreateBinaryOp "*" "int4" "int8" "int8"+> , CatCreateBinaryOp "*" "int4" "int2" "int4"+> , CatCreateBinaryOp "*" "int4" "int4" "int4"+> , CatCreateBinaryOp "*" "int4" "money" "money"+> , CatCreateBinaryOp "*" "point" "point" "point"+> , CatCreateBinaryOp "*" "path" "point" "path"+> , CatCreateBinaryOp "*" "box" "point" "box"+> , CatCreateBinaryOp "*" "float4" "float4" "float4"+> , CatCreateBinaryOp "*" "float4" "float8" "float8"+> , CatCreateBinaryOp "*" "float4" "money" "money"+> , CatCreateBinaryOp "*" "float8" "float4" "float8"+> , CatCreateBinaryOp "*" "float8" "float8" "float8"+> , CatCreateBinaryOp "*" "float8" "money" "money"+> , CatCreateBinaryOp "*" "float8" "interval" "interval"+> , CatCreateBinaryOp "*" "circle" "point" "circle"+> , CatCreateBinaryOp "*" "money" "int2" "money"+> , CatCreateBinaryOp "*" "money" "int4" "money"+> , CatCreateBinaryOp "*" "money" "float4" "money"+> , CatCreateBinaryOp "*" "money" "float8" "money"+> , CatCreateBinaryOp "*" "interval" "float8" "interval"+> , CatCreateBinaryOp "*" "numeric" "numeric" "numeric"+> , CatCreateBinaryOp "*" "anyrange" "anyrange" "anyrange"+> , CatCreateBinaryOp "*<" "record" "record" "bool"+> , CatCreateBinaryOp "*<=" "record" "record" "bool"+> , CatCreateBinaryOp "*<>" "record" "record" "bool"+> , CatCreateBinaryOp "*=" "record" "record" "bool"+> , CatCreateBinaryOp "*>" "record" "record" "bool"+> , CatCreateBinaryOp "*>=" "record" "record" "bool"+> , CatCreateBinaryOp "+" "int8" "int8" "int8"+> , CatCreateBinaryOp "+" "int8" "int2" "int8"+> , CatCreateBinaryOp "+" "int8" "int4" "int8"+> , CatCreateBinaryOp "+" "int8" "inet" "inet"+> , CatCreateBinaryOp "+" "int2" "int8" "int8"+> , CatCreateBinaryOp "+" "int2" "int2" "int2"+> , CatCreateBinaryOp "+" "int2" "int4" "int4"+> , CatCreateBinaryOp "+" "int4" "int8" "int8"+> , CatCreateBinaryOp "+" "int4" "int2" "int4"+> , CatCreateBinaryOp "+" "int4" "int4" "int4"+> , CatCreateBinaryOp "+" "int4" "date" "date"+> , CatCreateBinaryOp "+" "point" "point" "point"+> , CatCreateBinaryOp "+" "path" "point" "path"+> , CatCreateBinaryOp "+" "path" "path" "path"+> , CatCreateBinaryOp "+" "box" "point" "box"+> , CatCreateBinaryOp "+" "float4" "float4" "float4"+> , CatCreateBinaryOp "+" "float4" "float8" "float8"+> , CatCreateBinaryOp "+" "float8" "float4" "float8"+> , CatCreateBinaryOp "+" "float8" "float8" "float8"+> , CatCreateBinaryOp "+" "abstime" "reltime" "abstime"+> , CatCreateBinaryOp "+" "circle" "point" "circle"+> , CatCreateBinaryOp "+" "money" "money" "money"+> , CatCreateBinaryOp "+" "inet" "int8" "inet"+> , CatCreateBinaryOp "+" "_aclitem" "aclitem" "_aclitem"+> , CatCreateBinaryOp "+" "date" "int4" "date"+> , CatCreateBinaryOp "+" "date" "time" "timestamp"+> , CatCreateBinaryOp "+" "date" "interval" "timestamp"+> , CatCreateBinaryOp "+" "date" "timetz" "timestamptz"+> , CatCreateBinaryOp "+" "time" "date" "timestamp"+> , CatCreateBinaryOp "+" "time" "interval" "time"+> , CatCreateBinaryOp "+" "timestamp" "interval" "timestamp"+> , CatCreateBinaryOp "+" "timestamptz" "interval" "timestamptz"+> , CatCreateBinaryOp "+" "interval" "date" "timestamp"+> , CatCreateBinaryOp "+" "interval" "time" "time"+> , CatCreateBinaryOp "+" "interval" "timestamp" "timestamp"+> , CatCreateBinaryOp "+" "interval" "timestamptz" "timestamptz"+> , CatCreateBinaryOp "+" "interval" "interval" "interval"+> , CatCreateBinaryOp "+" "interval" "timetz" "timetz"+> , CatCreateBinaryOp "+" "timetz" "date" "timestamptz"+> , CatCreateBinaryOp "+" "timetz" "interval" "timetz"+> , CatCreateBinaryOp "+" "numeric" "numeric" "numeric"+> , CatCreateBinaryOp "+" "anyrange" "anyrange" "anyrange"+> , CatCreateBinaryOp "-" "int8" "int8" "int8"+> , CatCreateBinaryOp "-" "int8" "int2" "int8"+> , CatCreateBinaryOp "-" "int8" "int4" "int8"+> , CatCreateBinaryOp "-" "int2" "int8" "int8"+> , CatCreateBinaryOp "-" "int2" "int2" "int2"+> , CatCreateBinaryOp "-" "int2" "int4" "int4"+> , CatCreateBinaryOp "-" "int4" "int8" "int8"+> , CatCreateBinaryOp "-" "int4" "int2" "int4"+> , CatCreateBinaryOp "-" "int4" "int4" "int4"+> , CatCreateBinaryOp "-" "point" "point" "point"+> , CatCreateBinaryOp "-" "path" "point" "path"+> , CatCreateBinaryOp "-" "box" "point" "box"+> , CatCreateBinaryOp "-" "float4" "float4" "float4"+> , CatCreateBinaryOp "-" "float4" "float8" "float8"+> , CatCreateBinaryOp "-" "float8" "float4" "float8"+> , CatCreateBinaryOp "-" "float8" "float8" "float8"+> , CatCreateBinaryOp "-" "abstime" "reltime" "abstime"+> , CatCreateBinaryOp "-" "circle" "point" "circle"+> , CatCreateBinaryOp "-" "money" "money" "money"+> , CatCreateBinaryOp "-" "inet" "int8" "inet"+> , CatCreateBinaryOp "-" "inet" "inet" "int8"+> , CatCreateBinaryOp "-" "_aclitem" "aclitem" "_aclitem"+> , CatCreateBinaryOp "-" "date" "int4" "date"+> , CatCreateBinaryOp "-" "date" "date" "int4"+> , CatCreateBinaryOp "-" "date" "interval" "timestamp"+> , CatCreateBinaryOp "-" "time" "time" "interval"+> , CatCreateBinaryOp "-" "time" "interval" "time"+> , CatCreateBinaryOp "-" "timestamp" "timestamp" "interval"+> , CatCreateBinaryOp "-" "timestamp" "interval" "timestamp"+> , CatCreateBinaryOp "-" "timestamptz" "timestamptz" "interval"+> , CatCreateBinaryOp "-" "timestamptz" "interval" "timestamptz"+> , CatCreateBinaryOp "-" "interval" "interval" "interval"+> , CatCreateBinaryOp "-" "timetz" "interval" "timetz"+> , CatCreateBinaryOp "-" "numeric" "numeric" "numeric"+> , CatCreateBinaryOp "-" "pg_lsn" "pg_lsn" "numeric"+> , CatCreateBinaryOp "-" "anyrange" "anyrange" "anyrange"+> , CatCreateBinaryOp "->" "json" "int4" "json"+> , CatCreateBinaryOp "->" "json" "text" "json"+> , CatCreateBinaryOp "->" "jsonb" "int4" "jsonb"+> , CatCreateBinaryOp "->" "jsonb" "text" "jsonb"+> , CatCreateBinaryOp "->>" "json" "int4" "text"+> , CatCreateBinaryOp "->>" "json" "text" "text"+> , CatCreateBinaryOp "->>" "jsonb" "int4" "text"+> , CatCreateBinaryOp "->>" "jsonb" "text" "text"+> , CatCreateBinaryOp "-|-" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "/" "int8" "int8" "int8"+> , CatCreateBinaryOp "/" "int8" "int2" "int8"+> , CatCreateBinaryOp "/" "int8" "int4" "int8"+> , CatCreateBinaryOp "/" "int2" "int8" "int8"+> , CatCreateBinaryOp "/" "int2" "int2" "int2"+> , CatCreateBinaryOp "/" "int2" "int4" "int4"+> , CatCreateBinaryOp "/" "int4" "int8" "int8"+> , CatCreateBinaryOp "/" "int4" "int2" "int4"+> , CatCreateBinaryOp "/" "int4" "int4" "int4"+> , CatCreateBinaryOp "/" "point" "point" "point"+> , CatCreateBinaryOp "/" "path" "point" "path"+> , CatCreateBinaryOp "/" "box" "point" "box"+> , CatCreateBinaryOp "/" "float4" "float4" "float4"+> , CatCreateBinaryOp "/" "float4" "float8" "float8"+> , CatCreateBinaryOp "/" "float8" "float4" "float8"+> , CatCreateBinaryOp "/" "float8" "float8" "float8"+> , CatCreateBinaryOp "/" "circle" "point" "circle"+> , CatCreateBinaryOp "/" "money" "int2" "money"+> , CatCreateBinaryOp "/" "money" "int4" "money"+> , CatCreateBinaryOp "/" "money" "float4" "money"+> , CatCreateBinaryOp "/" "money" "float8" "money"+> , CatCreateBinaryOp "/" "money" "money" "float8"+> , CatCreateBinaryOp "/" "interval" "float8" "interval"+> , CatCreateBinaryOp "/" "numeric" "numeric" "numeric"+> , CatCreateBinaryOp "<" "bool" "bool" "bool"+> , CatCreateBinaryOp "<" "bytea" "bytea" "bool"+> , CatCreateBinaryOp "<" "char" "char" "bool"+> , CatCreateBinaryOp "<" "name" "name" "bool"+> , CatCreateBinaryOp "<" "int8" "int8" "bool"+> , CatCreateBinaryOp "<" "int8" "int2" "bool"+> , CatCreateBinaryOp "<" "int8" "int4" "bool"+> , CatCreateBinaryOp "<" "int2" "int8" "bool"+> , CatCreateBinaryOp "<" "int2" "int2" "bool"+> , CatCreateBinaryOp "<" "int2" "int4" "bool"+> , CatCreateBinaryOp "<" "int4" "int8" "bool"+> , CatCreateBinaryOp "<" "int4" "int2" "bool"+> , CatCreateBinaryOp "<" "int4" "int4" "bool"+> , CatCreateBinaryOp "<" "text" "text" "bool"+> , CatCreateBinaryOp "<" "oid" "oid" "bool"+> , CatCreateBinaryOp "<" "tid" "tid" "bool"+> , CatCreateBinaryOp "<" "oidvector" "oidvector" "bool"+> , CatCreateBinaryOp "<" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "<" "path" "path" "bool"+> , CatCreateBinaryOp "<" "box" "box" "bool"+> , CatCreateBinaryOp "<" "float4" "float4" "bool"+> , CatCreateBinaryOp "<" "float4" "float8" "bool"+> , CatCreateBinaryOp "<" "float8" "float4" "bool"+> , CatCreateBinaryOp "<" "float8" "float8" "bool"+> , CatCreateBinaryOp "<" "abstime" "abstime" "bool"+> , CatCreateBinaryOp "<" "reltime" "reltime" "bool"+> , CatCreateBinaryOp "<" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "<" "circle" "circle" "bool"+> , CatCreateBinaryOp "<" "money" "money" "bool"+> , CatCreateBinaryOp "<" "macaddr" "macaddr" "bool"+> , CatCreateBinaryOp "<" "inet" "inet" "bool"+> , CatCreateBinaryOp "<" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "<" "date" "date" "bool"+> , CatCreateBinaryOp "<" "date" "timestamp" "bool"+> , CatCreateBinaryOp "<" "date" "timestamptz" "bool"+> , CatCreateBinaryOp "<" "time" "time" "bool"+> , CatCreateBinaryOp "<" "timestamp" "date" "bool"+> , CatCreateBinaryOp "<" "timestamp" "timestamp" "bool"+> , CatCreateBinaryOp "<" "timestamp" "timestamptz" "bool"+> , CatCreateBinaryOp "<" "timestamptz" "date" "bool"+> , CatCreateBinaryOp "<" "timestamptz" "timestamp" "bool"+> , CatCreateBinaryOp "<" "timestamptz" "timestamptz" "bool"+> , CatCreateBinaryOp "<" "interval" "interval" "bool"+> , CatCreateBinaryOp "<" "timetz" "timetz" "bool"+> , CatCreateBinaryOp "<" "bit" "bit" "bool"+> , CatCreateBinaryOp "<" "varbit" "varbit" "bool"+> , CatCreateBinaryOp "<" "numeric" "numeric" "bool"+> , CatCreateBinaryOp "<" "record" "record" "bool"+> , CatCreateBinaryOp "<" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "<" "uuid" "uuid" "bool"+> , CatCreateBinaryOp "<" "pg_lsn" "pg_lsn" "bool"+> , CatCreateBinaryOp "<" "anyenum" "anyenum" "bool"+> , CatCreateBinaryOp "<" "tsvector" "tsvector" "bool"+> , CatCreateBinaryOp "<" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp "<" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp "<" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "<#>" "abstime" "abstime" "tinterval"+> , CatCreateBinaryOp "<->" "point" "point" "float8"+> , CatCreateBinaryOp "<->" "point" "lseg" "float8"+> , CatCreateBinaryOp "<->" "point" "path" "float8"+> , CatCreateBinaryOp "<->" "point" "box" "float8"+> , CatCreateBinaryOp "<->" "point" "line" "float8"+> , CatCreateBinaryOp "<->" "point" "circle" "float8"+> , CatCreateBinaryOp "<->" "lseg" "lseg" "float8"+> , CatCreateBinaryOp "<->" "lseg" "box" "float8"+> , CatCreateBinaryOp "<->" "lseg" "line" "float8"+> , CatCreateBinaryOp "<->" "path" "path" "float8"+> , CatCreateBinaryOp "<->" "box" "box" "float8"+> , CatCreateBinaryOp "<->" "polygon" "polygon" "float8"+> , CatCreateBinaryOp "<->" "line" "box" "float8"+> , CatCreateBinaryOp "<->" "line" "line" "float8"+> , CatCreateBinaryOp "<->" "circle" "polygon" "float8"+> , CatCreateBinaryOp "<->" "circle" "circle" "float8"+> , CatCreateBinaryOp "<<" "int8" "int4" "int8"+> , CatCreateBinaryOp "<<" "int2" "int4" "int2"+> , CatCreateBinaryOp "<<" "int4" "int4" "int4"+> , CatCreateBinaryOp "<<" "point" "point" "bool"+> , CatCreateBinaryOp "<<" "box" "box" "bool"+> , CatCreateBinaryOp "<<" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "<<" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "<<" "circle" "circle" "bool"+> , CatCreateBinaryOp "<<" "inet" "inet" "bool"+> , CatCreateBinaryOp "<<" "bit" "int4" "bit"+> , CatCreateBinaryOp "<<" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "<<=" "inet" "inet" "bool"+> , CatCreateBinaryOp "<<|" "box" "box" "bool"+> , CatCreateBinaryOp "<<|" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "<<|" "circle" "circle" "bool"+> , CatCreateBinaryOp "<=" "bool" "bool" "bool"+> , CatCreateBinaryOp "<=" "bytea" "bytea" "bool"+> , CatCreateBinaryOp "<=" "char" "char" "bool"+> , CatCreateBinaryOp "<=" "name" "name" "bool"+> , CatCreateBinaryOp "<=" "int8" "int8" "bool"+> , CatCreateBinaryOp "<=" "int8" "int2" "bool"+> , CatCreateBinaryOp "<=" "int8" "int4" "bool"+> , CatCreateBinaryOp "<=" "int2" "int8" "bool"+> , CatCreateBinaryOp "<=" "int2" "int2" "bool"+> , CatCreateBinaryOp "<=" "int2" "int4" "bool"+> , CatCreateBinaryOp "<=" "int4" "int8" "bool"+> , CatCreateBinaryOp "<=" "int4" "int2" "bool"+> , CatCreateBinaryOp "<=" "int4" "int4" "bool"+> , CatCreateBinaryOp "<=" "text" "text" "bool"+> , CatCreateBinaryOp "<=" "oid" "oid" "bool"+> , CatCreateBinaryOp "<=" "tid" "tid" "bool"+> , CatCreateBinaryOp "<=" "oidvector" "oidvector" "bool"+> , CatCreateBinaryOp "<=" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "<=" "path" "path" "bool"+> , CatCreateBinaryOp "<=" "box" "box" "bool"+> , CatCreateBinaryOp "<=" "float4" "float4" "bool"+> , CatCreateBinaryOp "<=" "float4" "float8" "bool"+> , CatCreateBinaryOp "<=" "float8" "float4" "bool"+> , CatCreateBinaryOp "<=" "float8" "float8" "bool"+> , CatCreateBinaryOp "<=" "abstime" "abstime" "bool"+> , CatCreateBinaryOp "<=" "reltime" "reltime" "bool"+> , CatCreateBinaryOp "<=" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "<=" "circle" "circle" "bool"+> , CatCreateBinaryOp "<=" "money" "money" "bool"+> , CatCreateBinaryOp "<=" "macaddr" "macaddr" "bool"+> , CatCreateBinaryOp "<=" "inet" "inet" "bool"+> , CatCreateBinaryOp "<=" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "<=" "date" "date" "bool"+> , CatCreateBinaryOp "<=" "date" "timestamp" "bool"+> , CatCreateBinaryOp "<=" "date" "timestamptz" "bool"+> , CatCreateBinaryOp "<=" "time" "time" "bool"+> , CatCreateBinaryOp "<=" "timestamp" "date" "bool"+> , CatCreateBinaryOp "<=" "timestamp" "timestamp" "bool"+> , CatCreateBinaryOp "<=" "timestamp" "timestamptz" "bool"+> , CatCreateBinaryOp "<=" "timestamptz" "date" "bool"+> , CatCreateBinaryOp "<=" "timestamptz" "timestamp" "bool"+> , CatCreateBinaryOp "<=" "timestamptz" "timestamptz" "bool"+> , CatCreateBinaryOp "<=" "interval" "interval" "bool"+> , CatCreateBinaryOp "<=" "timetz" "timetz" "bool"+> , CatCreateBinaryOp "<=" "bit" "bit" "bool"+> , CatCreateBinaryOp "<=" "varbit" "varbit" "bool"+> , CatCreateBinaryOp "<=" "numeric" "numeric" "bool"+> , CatCreateBinaryOp "<=" "record" "record" "bool"+> , CatCreateBinaryOp "<=" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "<=" "uuid" "uuid" "bool"+> , CatCreateBinaryOp "<=" "pg_lsn" "pg_lsn" "bool"+> , CatCreateBinaryOp "<=" "anyenum" "anyenum" "bool"+> , CatCreateBinaryOp "<=" "tsvector" "tsvector" "bool"+> , CatCreateBinaryOp "<=" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp "<=" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp "<=" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "<>" "bool" "bool" "bool"+> , CatCreateBinaryOp "<>" "bytea" "bytea" "bool"+> , CatCreateBinaryOp "<>" "char" "char" "bool"+> , CatCreateBinaryOp "<>" "name" "name" "bool"+> , CatCreateBinaryOp "<>" "int8" "int8" "bool"+> , CatCreateBinaryOp "<>" "int8" "int2" "bool"+> , CatCreateBinaryOp "<>" "int8" "int4" "bool"+> , CatCreateBinaryOp "<>" "int2" "int8" "bool"+> , CatCreateBinaryOp "<>" "int2" "int2" "bool"+> , CatCreateBinaryOp "<>" "int2" "int4" "bool"+> , CatCreateBinaryOp "<>" "int4" "int8" "bool"+> , CatCreateBinaryOp "<>" "int4" "int2" "bool"+> , CatCreateBinaryOp "<>" "int4" "int4" "bool"+> , CatCreateBinaryOp "<>" "text" "text" "bool"+> , CatCreateBinaryOp "<>" "oid" "oid" "bool"+> , CatCreateBinaryOp "<>" "tid" "tid" "bool"+> , CatCreateBinaryOp "<>" "oidvector" "oidvector" "bool"+> , CatCreateBinaryOp "<>" "point" "point" "bool"+> , CatCreateBinaryOp "<>" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "<>" "float4" "float4" "bool"+> , CatCreateBinaryOp "<>" "float4" "float8" "bool"+> , CatCreateBinaryOp "<>" "float8" "float4" "bool"+> , CatCreateBinaryOp "<>" "float8" "float8" "bool"+> , CatCreateBinaryOp "<>" "abstime" "abstime" "bool"+> , CatCreateBinaryOp "<>" "reltime" "reltime" "bool"+> , CatCreateBinaryOp "<>" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "<>" "circle" "circle" "bool"+> , CatCreateBinaryOp "<>" "money" "money" "bool"+> , CatCreateBinaryOp "<>" "macaddr" "macaddr" "bool"+> , CatCreateBinaryOp "<>" "inet" "inet" "bool"+> , CatCreateBinaryOp "<>" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "<>" "date" "date" "bool"+> , CatCreateBinaryOp "<>" "date" "timestamp" "bool"+> , CatCreateBinaryOp "<>" "date" "timestamptz" "bool"+> , CatCreateBinaryOp "<>" "time" "time" "bool"+> , CatCreateBinaryOp "<>" "timestamp" "date" "bool"+> , CatCreateBinaryOp "<>" "timestamp" "timestamp" "bool"+> , CatCreateBinaryOp "<>" "timestamp" "timestamptz" "bool"+> , CatCreateBinaryOp "<>" "timestamptz" "date" "bool"+> , CatCreateBinaryOp "<>" "timestamptz" "timestamp" "bool"+> , CatCreateBinaryOp "<>" "timestamptz" "timestamptz" "bool"+> , CatCreateBinaryOp "<>" "interval" "interval" "bool"+> , CatCreateBinaryOp "<>" "timetz" "timetz" "bool"+> , CatCreateBinaryOp "<>" "bit" "bit" "bool"+> , CatCreateBinaryOp "<>" "varbit" "varbit" "bool"+> , CatCreateBinaryOp "<>" "numeric" "numeric" "bool"+> , CatCreateBinaryOp "<>" "record" "record" "bool"+> , CatCreateBinaryOp "<>" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "<>" "uuid" "uuid" "bool"+> , CatCreateBinaryOp "<>" "pg_lsn" "pg_lsn" "bool"+> , CatCreateBinaryOp "<>" "anyenum" "anyenum" "bool"+> , CatCreateBinaryOp "<>" "tsvector" "tsvector" "bool"+> , CatCreateBinaryOp "<>" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp "<>" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp "<>" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "<?>" "abstime" "tinterval" "bool"+> , CatCreateBinaryOp "<@" "point" "lseg" "bool"+> , CatCreateBinaryOp "<@" "point" "path" "bool"+> , CatCreateBinaryOp "<@" "point" "box" "bool"+> , CatCreateBinaryOp "<@" "point" "polygon" "bool"+> , CatCreateBinaryOp "<@" "point" "line" "bool"+> , CatCreateBinaryOp "<@" "point" "circle" "bool"+> , CatCreateBinaryOp "<@" "lseg" "box" "bool"+> , CatCreateBinaryOp "<@" "lseg" "line" "bool"+> , CatCreateBinaryOp "<@" "box" "box" "bool"+> , CatCreateBinaryOp "<@" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "<@" "circle" "circle" "bool"+> , CatCreateBinaryOp "<@" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "<@" "anyelement" "anyrange" "bool"+> , CatCreateBinaryOp "<@" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp "<@" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp "<@" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "<^" "point" "point" "bool"+> , CatCreateBinaryOp "<^" "box" "box" "bool"+> , CatCreateBinaryOp "=" "bool" "bool" "bool"+> , CatCreateBinaryOp "=" "bytea" "bytea" "bool"+> , CatCreateBinaryOp "=" "char" "char" "bool"+> , CatCreateBinaryOp "=" "name" "name" "bool"+> , CatCreateBinaryOp "=" "int8" "int8" "bool"+> , CatCreateBinaryOp "=" "int8" "int2" "bool"+> , CatCreateBinaryOp "=" "int8" "int4" "bool"+> , CatCreateBinaryOp "=" "int2" "int8" "bool"+> , CatCreateBinaryOp "=" "int2" "int2" "bool"+> , CatCreateBinaryOp "=" "int2" "int4" "bool"+> , CatCreateBinaryOp "=" "int2vector" "int2vector" "bool"+> , CatCreateBinaryOp "=" "int4" "int8" "bool"+> , CatCreateBinaryOp "=" "int4" "int2" "bool"+> , CatCreateBinaryOp "=" "int4" "int4" "bool"+> , CatCreateBinaryOp "=" "text" "text" "bool"+> , CatCreateBinaryOp "=" "oid" "oid" "bool"+> , CatCreateBinaryOp "=" "tid" "tid" "bool"+> , CatCreateBinaryOp "=" "xid" "int4" "bool"+> , CatCreateBinaryOp "=" "xid" "xid" "bool"+> , CatCreateBinaryOp "=" "cid" "cid" "bool"+> , CatCreateBinaryOp "=" "oidvector" "oidvector" "bool"+> , CatCreateBinaryOp "=" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "=" "path" "path" "bool"+> , CatCreateBinaryOp "=" "box" "box" "bool"+> , CatCreateBinaryOp "=" "line" "line" "bool"+> , CatCreateBinaryOp "=" "float4" "float4" "bool"+> , CatCreateBinaryOp "=" "float4" "float8" "bool"+> , CatCreateBinaryOp "=" "float8" "float4" "bool"+> , CatCreateBinaryOp "=" "float8" "float8" "bool"+> , CatCreateBinaryOp "=" "abstime" "abstime" "bool"+> , CatCreateBinaryOp "=" "reltime" "reltime" "bool"+> , CatCreateBinaryOp "=" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "=" "circle" "circle" "bool"+> , CatCreateBinaryOp "=" "money" "money" "bool"+> , CatCreateBinaryOp "=" "macaddr" "macaddr" "bool"+> , CatCreateBinaryOp "=" "inet" "inet" "bool"+> , CatCreateBinaryOp "=" "aclitem" "aclitem" "bool"+> , CatCreateBinaryOp "=" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "=" "date" "date" "bool"+> , CatCreateBinaryOp "=" "date" "timestamp" "bool"+> , CatCreateBinaryOp "=" "date" "timestamptz" "bool"+> , CatCreateBinaryOp "=" "time" "time" "bool"+> , CatCreateBinaryOp "=" "timestamp" "date" "bool"+> , CatCreateBinaryOp "=" "timestamp" "timestamp" "bool"+> , CatCreateBinaryOp "=" "timestamp" "timestamptz" "bool"+> , CatCreateBinaryOp "=" "timestamptz" "date" "bool"+> , CatCreateBinaryOp "=" "timestamptz" "timestamp" "bool"+> , CatCreateBinaryOp "=" "timestamptz" "timestamptz" "bool"+> , CatCreateBinaryOp "=" "interval" "interval" "bool"+> , CatCreateBinaryOp "=" "timetz" "timetz" "bool"+> , CatCreateBinaryOp "=" "bit" "bit" "bool"+> , CatCreateBinaryOp "=" "varbit" "varbit" "bool"+> , CatCreateBinaryOp "=" "numeric" "numeric" "bool"+> , CatCreateBinaryOp "=" "record" "record" "bool"+> , CatCreateBinaryOp "=" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "=" "uuid" "uuid" "bool"+> , CatCreateBinaryOp "=" "pg_lsn" "pg_lsn" "bool"+> , CatCreateBinaryOp "=" "anyenum" "anyenum" "bool"+> , CatCreateBinaryOp "=" "tsvector" "tsvector" "bool"+> , CatCreateBinaryOp "=" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp "=" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp "=" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp ">" "bool" "bool" "bool"+> , CatCreateBinaryOp ">" "bytea" "bytea" "bool"+> , CatCreateBinaryOp ">" "char" "char" "bool"+> , CatCreateBinaryOp ">" "name" "name" "bool"+> , CatCreateBinaryOp ">" "int8" "int8" "bool"+> , CatCreateBinaryOp ">" "int8" "int2" "bool"+> , CatCreateBinaryOp ">" "int8" "int4" "bool"+> , CatCreateBinaryOp ">" "int2" "int8" "bool"+> , CatCreateBinaryOp ">" "int2" "int2" "bool"+> , CatCreateBinaryOp ">" "int2" "int4" "bool"+> , CatCreateBinaryOp ">" "int4" "int8" "bool"+> , CatCreateBinaryOp ">" "int4" "int2" "bool"+> , CatCreateBinaryOp ">" "int4" "int4" "bool"+> , CatCreateBinaryOp ">" "text" "text" "bool"+> , CatCreateBinaryOp ">" "oid" "oid" "bool"+> , CatCreateBinaryOp ">" "tid" "tid" "bool"+> , CatCreateBinaryOp ">" "oidvector" "oidvector" "bool"+> , CatCreateBinaryOp ">" "lseg" "lseg" "bool"+> , CatCreateBinaryOp ">" "path" "path" "bool"+> , CatCreateBinaryOp ">" "box" "box" "bool"+> , CatCreateBinaryOp ">" "float4" "float4" "bool"+> , CatCreateBinaryOp ">" "float4" "float8" "bool"+> , CatCreateBinaryOp ">" "float8" "float4" "bool"+> , CatCreateBinaryOp ">" "float8" "float8" "bool"+> , CatCreateBinaryOp ">" "abstime" "abstime" "bool"+> , CatCreateBinaryOp ">" "reltime" "reltime" "bool"+> , CatCreateBinaryOp ">" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp ">" "circle" "circle" "bool"+> , CatCreateBinaryOp ">" "money" "money" "bool"+> , CatCreateBinaryOp ">" "macaddr" "macaddr" "bool"+> , CatCreateBinaryOp ">" "inet" "inet" "bool"+> , CatCreateBinaryOp ">" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp ">" "date" "date" "bool"+> , CatCreateBinaryOp ">" "date" "timestamp" "bool"+> , CatCreateBinaryOp ">" "date" "timestamptz" "bool"+> , CatCreateBinaryOp ">" "time" "time" "bool"+> , CatCreateBinaryOp ">" "timestamp" "date" "bool"+> , CatCreateBinaryOp ">" "timestamp" "timestamp" "bool"+> , CatCreateBinaryOp ">" "timestamp" "timestamptz" "bool"+> , CatCreateBinaryOp ">" "timestamptz" "date" "bool"+> , CatCreateBinaryOp ">" "timestamptz" "timestamp" "bool"+> , CatCreateBinaryOp ">" "timestamptz" "timestamptz" "bool"+> , CatCreateBinaryOp ">" "interval" "interval" "bool"+> , CatCreateBinaryOp ">" "timetz" "timetz" "bool"+> , CatCreateBinaryOp ">" "bit" "bit" "bool"+> , CatCreateBinaryOp ">" "varbit" "varbit" "bool"+> , CatCreateBinaryOp ">" "numeric" "numeric" "bool"+> , CatCreateBinaryOp ">" "record" "record" "bool"+> , CatCreateBinaryOp ">" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp ">" "uuid" "uuid" "bool"+> , CatCreateBinaryOp ">" "pg_lsn" "pg_lsn" "bool"+> , CatCreateBinaryOp ">" "anyenum" "anyenum" "bool"+> , CatCreateBinaryOp ">" "tsvector" "tsvector" "bool"+> , CatCreateBinaryOp ">" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp ">" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp ">" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp ">=" "bool" "bool" "bool"+> , CatCreateBinaryOp ">=" "bytea" "bytea" "bool"+> , CatCreateBinaryOp ">=" "char" "char" "bool"+> , CatCreateBinaryOp ">=" "name" "name" "bool"+> , CatCreateBinaryOp ">=" "int8" "int8" "bool"+> , CatCreateBinaryOp ">=" "int8" "int2" "bool"+> , CatCreateBinaryOp ">=" "int8" "int4" "bool"+> , CatCreateBinaryOp ">=" "int2" "int8" "bool"+> , CatCreateBinaryOp ">=" "int2" "int2" "bool"+> , CatCreateBinaryOp ">=" "int2" "int4" "bool"+> , CatCreateBinaryOp ">=" "int4" "int8" "bool"+> , CatCreateBinaryOp ">=" "int4" "int2" "bool"+> , CatCreateBinaryOp ">=" "int4" "int4" "bool"+> , CatCreateBinaryOp ">=" "text" "text" "bool"+> , CatCreateBinaryOp ">=" "oid" "oid" "bool"+> , CatCreateBinaryOp ">=" "tid" "tid" "bool"+> , CatCreateBinaryOp ">=" "oidvector" "oidvector" "bool"+> , CatCreateBinaryOp ">=" "lseg" "lseg" "bool"+> , CatCreateBinaryOp ">=" "path" "path" "bool"+> , CatCreateBinaryOp ">=" "box" "box" "bool"+> , CatCreateBinaryOp ">=" "float4" "float4" "bool"+> , CatCreateBinaryOp ">=" "float4" "float8" "bool"+> , CatCreateBinaryOp ">=" "float8" "float4" "bool"+> , CatCreateBinaryOp ">=" "float8" "float8" "bool"+> , CatCreateBinaryOp ">=" "abstime" "abstime" "bool"+> , CatCreateBinaryOp ">=" "reltime" "reltime" "bool"+> , CatCreateBinaryOp ">=" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp ">=" "circle" "circle" "bool"+> , CatCreateBinaryOp ">=" "money" "money" "bool"+> , CatCreateBinaryOp ">=" "macaddr" "macaddr" "bool"+> , CatCreateBinaryOp ">=" "inet" "inet" "bool"+> , CatCreateBinaryOp ">=" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp ">=" "date" "date" "bool"+> , CatCreateBinaryOp ">=" "date" "timestamp" "bool"+> , CatCreateBinaryOp ">=" "date" "timestamptz" "bool"+> , CatCreateBinaryOp ">=" "time" "time" "bool"+> , CatCreateBinaryOp ">=" "timestamp" "date" "bool"+> , CatCreateBinaryOp ">=" "timestamp" "timestamp" "bool"+> , CatCreateBinaryOp ">=" "timestamp" "timestamptz" "bool"+> , CatCreateBinaryOp ">=" "timestamptz" "date" "bool"+> , CatCreateBinaryOp ">=" "timestamptz" "timestamp" "bool"+> , CatCreateBinaryOp ">=" "timestamptz" "timestamptz" "bool"+> , CatCreateBinaryOp ">=" "interval" "interval" "bool"+> , CatCreateBinaryOp ">=" "timetz" "timetz" "bool"+> , CatCreateBinaryOp ">=" "bit" "bit" "bool"+> , CatCreateBinaryOp ">=" "varbit" "varbit" "bool"+> , CatCreateBinaryOp ">=" "numeric" "numeric" "bool"+> , CatCreateBinaryOp ">=" "record" "record" "bool"+> , CatCreateBinaryOp ">=" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp ">=" "uuid" "uuid" "bool"+> , CatCreateBinaryOp ">=" "pg_lsn" "pg_lsn" "bool"+> , CatCreateBinaryOp ">=" "anyenum" "anyenum" "bool"+> , CatCreateBinaryOp ">=" "tsvector" "tsvector" "bool"+> , CatCreateBinaryOp ">=" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp ">=" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp ">=" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp ">>" "int8" "int4" "int8"+> , CatCreateBinaryOp ">>" "int2" "int4" "int2"+> , CatCreateBinaryOp ">>" "int4" "int4" "int4"+> , CatCreateBinaryOp ">>" "point" "point" "bool"+> , CatCreateBinaryOp ">>" "box" "box" "bool"+> , CatCreateBinaryOp ">>" "polygon" "polygon" "bool"+> , CatCreateBinaryOp ">>" "circle" "circle" "bool"+> , CatCreateBinaryOp ">>" "inet" "inet" "bool"+> , CatCreateBinaryOp ">>" "bit" "int4" "bit"+> , CatCreateBinaryOp ">>" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp ">>=" "inet" "inet" "bool"+> , CatCreateBinaryOp ">^" "point" "point" "bool"+> , CatCreateBinaryOp ">^" "box" "box" "bool"+> , CatCreateBinaryOp "?" "jsonb" "text" "bool"+> , CatCreateBinaryOp "?#" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "?#" "lseg" "box" "bool"+> , CatCreateBinaryOp "?#" "lseg" "line" "bool"+> , CatCreateBinaryOp "?#" "path" "path" "bool"+> , CatCreateBinaryOp "?#" "box" "box" "bool"+> , CatCreateBinaryOp "?#" "line" "box" "bool"+> , CatCreateBinaryOp "?#" "line" "line" "bool"+> , CatCreateBinaryOp "?&" "jsonb" "_text" "bool"+> , CatCreateBinaryOp "?-" "point" "point" "bool"+> , CatCreateBinaryOp "?-|" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "?-|" "line" "line" "bool"+> , CatCreateBinaryOp "?|" "point" "point" "bool"+> , CatCreateBinaryOp "?|" "jsonb" "_text" "bool"+> , CatCreateBinaryOp "?||" "lseg" "lseg" "bool"+> , CatCreateBinaryOp "?||" "line" "line" "bool"+> , CatCreateBinaryOp "@>" "path" "point" "bool"+> , CatCreateBinaryOp "@>" "box" "point" "bool"+> , CatCreateBinaryOp "@>" "box" "box" "bool"+> , CatCreateBinaryOp "@>" "polygon" "point" "bool"+> , CatCreateBinaryOp "@>" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "@>" "circle" "point" "bool"+> , CatCreateBinaryOp "@>" "circle" "circle" "bool"+> , CatCreateBinaryOp "@>" "_aclitem" "aclitem" "bool"+> , CatCreateBinaryOp "@>" "anyarray" "anyarray" "bool"+> , CatCreateBinaryOp "@>" "tsquery" "tsquery" "bool"+> , CatCreateBinaryOp "@>" "jsonb" "jsonb" "bool"+> , CatCreateBinaryOp "@>" "anyrange" "anyelement" "bool"+> , CatCreateBinaryOp "@>" "anyrange" "anyrange" "bool"+> , CatCreateBinaryOp "@@" "text" "text" "bool"+> , CatCreateBinaryOp "@@" "text" "tsquery" "bool"+> , CatCreateBinaryOp "@@" "tsvector" "tsquery" "bool"+> , CatCreateBinaryOp "@@" "tsquery" "tsvector" "bool"+> , CatCreateBinaryOp "@@@" "tsvector" "tsquery" "bool"+> , CatCreateBinaryOp "@@@" "tsquery" "tsvector" "bool"+> , CatCreateBinaryOp "^" "float8" "float8" "float8"+> , CatCreateBinaryOp "^" "numeric" "numeric" "numeric"+> , CatCreateBinaryOp "|" "int8" "int8" "int8"+> , CatCreateBinaryOp "|" "int2" "int2" "int2"+> , CatCreateBinaryOp "|" "int4" "int4" "int4"+> , CatCreateBinaryOp "|" "macaddr" "macaddr" "macaddr"+> , CatCreateBinaryOp "|" "inet" "inet" "inet"+> , CatCreateBinaryOp "|" "bit" "bit" "bit"+> , CatCreateBinaryOp "|&>" "box" "box" "bool"+> , CatCreateBinaryOp "|&>" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "|&>" "circle" "circle" "bool"+> , CatCreateBinaryOp "|>>" "box" "box" "bool"+> , CatCreateBinaryOp "|>>" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "|>>" "circle" "circle" "bool"+> , CatCreateBinaryOp "||" "bytea" "bytea" "bytea"+> , CatCreateBinaryOp "||" "text" "text" "text"+> , CatCreateBinaryOp "||" "text" "anynonarray" "text"+> , CatCreateBinaryOp "||" "varbit" "varbit" "varbit"+> , CatCreateBinaryOp "||" "anyarray" "anyarray" "anyarray"+> , CatCreateBinaryOp "||" "anyarray" "anyelement" "anyarray"+> , CatCreateBinaryOp "||" "anyelement" "anyarray" "anyarray"+> , CatCreateBinaryOp "||" "anynonarray" "text" "text"+> , CatCreateBinaryOp "||" "tsvector" "tsvector" "tsvector"+> , CatCreateBinaryOp "||" "tsquery" "tsquery" "tsquery"+> , CatCreateBinaryOp "~" "name" "text" "bool"+> , CatCreateBinaryOp "~" "text" "text" "bool"+> , CatCreateBinaryOp "~" "path" "point" "bool"+> , CatCreateBinaryOp "~" "box" "box" "bool"+> , CatCreateBinaryOp "~" "polygon" "point" "bool"+> , CatCreateBinaryOp "~" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "~" "circle" "point" "bool"+> , CatCreateBinaryOp "~" "circle" "circle" "bool"+> , CatCreateBinaryOp "~" "_aclitem" "aclitem" "bool"+> , CatCreateBinaryOp "~" "bpchar" "text" "bool"+> , CatCreateBinaryOp "~*" "name" "text" "bool"+> , CatCreateBinaryOp "~*" "text" "text" "bool"+> , CatCreateBinaryOp "~*" "bpchar" "text" "bool"+> , CatCreateBinaryOp "~<=~" "text" "text" "bool"+> , CatCreateBinaryOp "~<=~" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "~<~" "text" "text" "bool"+> , CatCreateBinaryOp "~<~" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "~=" "point" "point" "bool"+> , CatCreateBinaryOp "~=" "box" "box" "bool"+> , CatCreateBinaryOp "~=" "polygon" "polygon" "bool"+> , CatCreateBinaryOp "~=" "tinterval" "tinterval" "bool"+> , CatCreateBinaryOp "~=" "circle" "circle" "bool"+> , CatCreateBinaryOp "~>=~" "text" "text" "bool"+> , CatCreateBinaryOp "~>=~" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "~>~" "text" "text" "bool"+> , CatCreateBinaryOp "~>~" "bpchar" "bpchar" "bool"+> , CatCreateBinaryOp "~~" "bytea" "bytea" "bool"+> , CatCreateBinaryOp "~~" "name" "text" "bool"+> , CatCreateBinaryOp "~~" "text" "text" "bool"+> , CatCreateBinaryOp "~~" "bpchar" "text" "bool"+> , CatCreateBinaryOp "~~*" "name" "text" "bool"+> , CatCreateBinaryOp "~~*" "text" "text" "bool"+> , CatCreateBinaryOp "~~*" "bpchar" "text" "bool"+> , CatCreateFunction "abbrev" [ "inet" ] False "text"+> , CatCreateFunction "abbrev" [ "cidr" ] False "text"+> , CatCreateFunction "abs" [ "float4" ] False "float4"+> , CatCreateFunction "abs" [ "float8" ] False "float8"+> , CatCreateFunction "abs" [ "int8" ] False "int8"+> , CatCreateFunction "abs" [ "int4" ] False "int4"+> , CatCreateFunction "abs" [ "int2" ] False "int2"+> , CatCreateFunction "abs" [ "numeric" ] False "numeric"+> , CatCreateFunction "abstime" [ "timestamptz" ] False "abstime"+> , CatCreateFunction "abstime" [ "timestamp" ] False "abstime"+> , CatCreateFunction+> "abstimeeq" [ "abstime" , "abstime" ] False "bool"+> , CatCreateFunction+> "abstimege" [ "abstime" , "abstime" ] False "bool"+> , CatCreateFunction+> "abstimegt" [ "abstime" , "abstime" ] False "bool"+> , CatCreateFunction "abstimein" [ "cstring" ] False "abstime"+> , CatCreateFunction+> "abstimele" [ "abstime" , "abstime" ] False "bool"+> , CatCreateFunction+> "abstimelt" [ "abstime" , "abstime" ] False "bool"+> , CatCreateFunction+> "abstimene" [ "abstime" , "abstime" ] False "bool"+> , CatCreateFunction "abstimeout" [ "abstime" ] False "cstring"+> , CatCreateFunction "abstimerecv" [ "internal" ] False "abstime"+> , CatCreateFunction "abstimesend" [ "abstime" ] False "bytea"+> , CatCreateFunction+> "aclcontains" [ "aclitem" , "_aclitem" ] False "bool"+> , CatCreateFunction+> "acldefault" [ "char" , "oid" ] False "_aclitem"+> , CatCreateFunction "aclexplode" [ "_aclitem" ] True "record"+> , CatCreateFunction+> "aclinsert" [ "aclitem" , "_aclitem" ] False "_aclitem"+> , CatCreateFunction+> "aclitemeq" [ "aclitem" , "aclitem" ] False "bool"+> , CatCreateFunction "aclitemin" [ "cstring" ] False "aclitem"+> , CatCreateFunction "aclitemout" [ "aclitem" ] False "cstring"+> , CatCreateFunction+> "aclremove" [ "aclitem" , "_aclitem" ] False "_aclitem"+> , CatCreateFunction "acos" [ "float8" ] False "float8"+> , CatCreateFunction "age" [ "xid" ] False "int4"+> , CatCreateFunction+> "age" [ "timestamptz" , "timestamptz" ] False "interval"+> , CatCreateFunction "age" [ "timestamptz" ] False "interval"+> , CatCreateFunction+> "age" [ "timestamp" , "timestamp" ] False "interval"+> , CatCreateFunction "age" [ "timestamp" ] False "interval"+> , CatCreateFunction "any_in" [ "cstring" ] False "any"+> , CatCreateFunction "any_out" [ "any" ] False "cstring"+> , CatCreateFunction "anyarray_in" [ "cstring" ] False "anyarray"+> , CatCreateFunction "anyarray_out" [ "anyarray" ] False "cstring"+> , CatCreateFunction "anyarray_recv" [ "internal" ] False "anyarray"+> , CatCreateFunction "anyarray_send" [ "anyarray" ] False "bytea"+> , CatCreateFunction+> "anyelement_in" [ "cstring" ] False "anyelement"+> , CatCreateFunction+> "anyelement_out" [ "anyelement" ] False "cstring"+> , CatCreateFunction "anyenum_in" [ "cstring" ] False "anyenum"+> , CatCreateFunction "anyenum_out" [ "anyenum" ] False "cstring"+> , CatCreateFunction+> "anynonarray_in" [ "cstring" ] False "anynonarray"+> , CatCreateFunction+> "anynonarray_out" [ "anynonarray" ] False "cstring"+> , CatCreateFunction+> "anyrange_in" [ "int4" , "cstring" , "oid" ] False "anyrange"+> , CatCreateFunction "anyrange_out" [ "anyrange" ] False "cstring"+> , CatCreateFunction+> "anytextcat" [ "text" , "anynonarray" ] False "text"+> , CatCreateFunction "area" [ "box" ] False "float8"+> , CatCreateFunction "area" [ "path" ] False "float8"+> , CatCreateFunction "area" [ "circle" ] False "float8"+> , CatCreateFunction+> "areajoinsel"+> [ "internal" , "internal" , "oid" , "internal" , "int2" ]+> False+> "float8"+> , CatCreateFunction+> "areasel"+> [ "internal" , "int4" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "array_agg_finalfn" [ "anyelement" , "internal" ] False "anyarray"+> , CatCreateFunction+> "array_agg_transfn" [ "internal" , "anyelement" ] False "internal"+> , CatCreateFunction+> "array_append" [ "anyelement" , "anyarray" ] False "anyarray"+> , CatCreateFunction+> "array_cat" [ "anyarray" , "anyarray" ] False "anyarray"+> , CatCreateFunction "array_dims" [ "anyarray" ] False "text"+> , CatCreateFunction+> "array_eq" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction+> "array_fill" [ "_int4" , "anyelement" ] False "anyarray"+> , CatCreateFunction+> "array_fill" [ "_int4" , "anyelement" , "_int4" ] False "anyarray"+> , CatCreateFunction+> "array_ge" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction+> "array_gt" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction+> "array_in" [ "int4" , "cstring" , "oid" ] False "anyarray"+> , CatCreateFunction+> "array_larger" [ "anyarray" , "anyarray" ] False "anyarray"+> , CatCreateFunction+> "array_le" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction+> "array_length" [ "int4" , "anyarray" ] False "int4"+> , CatCreateFunction+> "array_lower" [ "anyarray" , "int4" ] False "int4"+> , CatCreateFunction+> "array_lt" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction "array_ndims" [ "anyarray" ] False "int4"+> , CatCreateFunction+> "array_ne" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction "array_out" [ "anyarray" ] False "cstring"+> , CatCreateFunction+> "array_prepend" [ "anyelement" , "anyarray" ] False "anyarray"+> , CatCreateFunction+> "array_recv" [ "int4" , "internal" , "oid" ] False "anyarray"+> , CatCreateFunction+> "array_remove" [ "anyarray" , "anyelement" ] False "anyarray"+> , CatCreateFunction+> "array_replace"+> [ "anyelement" , "anyelement" , "anyarray" ]+> False+> "anyarray"+> , CatCreateFunction "array_send" [ "anyarray" ] False "bytea"+> , CatCreateFunction+> "array_smaller" [ "anyarray" , "anyarray" ] False "anyarray"+> , CatCreateFunction "array_to_json" [ "anyarray" ] False "json"+> , CatCreateFunction+> "array_to_json" [ "bool" , "anyarray" ] False "json"+> , CatCreateFunction+> "array_to_string" [ "text" , "anyarray" , "text" ] False "text"+> , CatCreateFunction+> "array_to_string" [ "text" , "anyarray" ] False "text"+> , CatCreateFunction "array_typanalyze" [ "internal" ] False "bool"+> , CatCreateFunction+> "array_upper" [ "anyarray" , "int4" ] False "int4"+> , CatCreateFunction+> "arraycontained" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction+> "arraycontains" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction+> "arraycontjoinsel"+> [ "internal" , "internal" , "oid" , "internal" , "int2" ]+> False+> "float8"+> , CatCreateFunction+> "arraycontsel"+> [ "int4" , "internal" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "arrayoverlap" [ "anyarray" , "anyarray" ] False "bool"+> , CatCreateFunction "ascii" [ "text" ] False "int4"+> , CatCreateFunction+> "ascii_to_mic"+> [ "int4" , "int4" , "int4" , "cstring" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "ascii_to_utf8"+> [ "int4" , "cstring" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction "asin" [ "float8" ] False "float8"+> , CatCreateFunction "atan" [ "float8" ] False "float8"+> , CatCreateFunction "atan2" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction+> "big5_to_euc_tw"+> [ "int4" , "int4" , "int4" , "internal" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "big5_to_mic"+> [ "int4" , "cstring" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "big5_to_utf8"+> [ "int4" , "int4" , "cstring" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction "bit" [ "int4" , "int4" ] False "bit"+> , CatCreateFunction "bit" [ "int4" , "bit" , "bool" ] False "bit"+> , CatCreateFunction "bit" [ "int8" , "int4" ] False "bit"+> , CatCreateFunction+> "bit_in" [ "int4" , "cstring" , "oid" ] False "bit"+> , CatCreateFunction "bit_length" [ "bytea" ] False "int4"+> , CatCreateFunction "bit_length" [ "text" ] False "int4"+> , CatCreateFunction "bit_length" [ "bit" ] False "int4"+> , CatCreateFunction "bit_out" [ "bit" ] False "cstring"+> , CatCreateFunction+> "bit_recv" [ "internal" , "oid" , "int4" ] False "bit"+> , CatCreateFunction "bit_send" [ "bit" ] False "bytea"+> , CatCreateFunction "bitand" [ "bit" , "bit" ] False "bit"+> , CatCreateFunction "bitcat" [ "varbit" , "varbit" ] False "varbit"+> , CatCreateFunction "bitcmp" [ "bit" , "bit" ] False "int4"+> , CatCreateFunction "biteq" [ "bit" , "bit" ] False "bool"+> , CatCreateFunction "bitge" [ "bit" , "bit" ] False "bool"+> , CatCreateFunction "bitgt" [ "bit" , "bit" ] False "bool"+> , CatCreateFunction "bitle" [ "bit" , "bit" ] False "bool"+> , CatCreateFunction "bitlt" [ "bit" , "bit" ] False "bool"+> , CatCreateFunction "bitne" [ "bit" , "bit" ] False "bool"+> , CatCreateFunction "bitnot" [ "bit" ] False "bit"+> , CatCreateFunction "bitor" [ "bit" , "bit" ] False "bit"+> , CatCreateFunction "bitshiftleft" [ "int4" , "bit" ] False "bit"+> , CatCreateFunction "bitshiftright" [ "bit" , "int4" ] False "bit"+> , CatCreateFunction "bittypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "bittypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "bitxor" [ "bit" , "bit" ] False "bit"+> , CatCreateFunction "bool" [ "int4" ] False "bool"+> , CatCreateFunction+> "bool_accum" [ "bool" , "internal" ] False "internal"+> , CatCreateFunction+> "bool_accum_inv" [ "bool" , "internal" ] False "internal"+> , CatCreateFunction "bool_alltrue" [ "internal" ] False "bool"+> , CatCreateFunction "bool_anytrue" [ "internal" ] False "bool"+> , CatCreateFunction+> "booland_statefunc" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "booleq" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "boolge" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "boolgt" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "boolin" [ "cstring" ] False "bool"+> , CatCreateFunction "boolle" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "boollt" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "boolne" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction+> "boolor_statefunc" [ "bool" , "bool" ] False "bool"+> , CatCreateFunction "boolout" [ "bool" ] False "cstring"+> , CatCreateFunction "boolrecv" [ "internal" ] False "bool"+> , CatCreateFunction "boolsend" [ "bool" ] False "bytea"+> , CatCreateFunction "box" [ "point" , "point" ] False "box"+> , CatCreateFunction "box" [ "polygon" ] False "box"+> , CatCreateFunction "box" [ "circle" ] False "box"+> , CatCreateFunction "box_above" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_above_eq" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_add" [ "point" , "box" ] False "box"+> , CatCreateFunction "box_below" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_below_eq" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_center" [ "box" ] False "point"+> , CatCreateFunction "box_contain" [ "box" , "box" ] False "bool"+> , CatCreateFunction+> "box_contain_pt" [ "point" , "box" ] False "bool"+> , CatCreateFunction "box_contained" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_distance" [ "box" , "box" ] False "float8"+> , CatCreateFunction "box_div" [ "point" , "box" ] False "box"+> , CatCreateFunction "box_eq" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_ge" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_gt" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_in" [ "cstring" ] False "box"+> , CatCreateFunction "box_intersect" [ "box" , "box" ] False "box"+> , CatCreateFunction "box_le" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_left" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_lt" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_mul" [ "point" , "box" ] False "box"+> , CatCreateFunction "box_out" [ "box" ] False "cstring"+> , CatCreateFunction "box_overabove" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_overbelow" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_overlap" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_overleft" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_overright" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_recv" [ "internal" ] False "box"+> , CatCreateFunction "box_right" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_same" [ "box" , "box" ] False "bool"+> , CatCreateFunction "box_send" [ "box" ] False "bytea"+> , CatCreateFunction "box_sub" [ "point" , "box" ] False "box"+> , CatCreateFunction "bpchar" [ "name" ] False "bpchar"+> , CatCreateFunction+> "bpchar" [ "bpchar" , "bool" , "int4" ] False "bpchar"+> , CatCreateFunction "bpchar" [ "char" ] False "bpchar"+> , CatCreateFunction+> "bpchar_larger" [ "bpchar" , "bpchar" ] False "bpchar"+> , CatCreateFunction+> "bpchar_pattern_ge" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpchar_pattern_gt" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpchar_pattern_le" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpchar_pattern_lt" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpchar_smaller" [ "bpchar" , "bpchar" ] False "bpchar"+> , CatCreateFunction+> "bpcharcmp" [ "bpchar" , "bpchar" ] False "int4"+> , CatCreateFunction "bpchareq" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction "bpcharge" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction "bpchargt" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpchariclike" [ "bpchar" , "text" ] False "bool"+> , CatCreateFunction+> "bpcharicnlike" [ "bpchar" , "text" ] False "bool"+> , CatCreateFunction+> "bpcharicregexeq" [ "text" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpcharicregexne" [ "bpchar" , "text" ] False "bool"+> , CatCreateFunction+> "bpcharin" [ "cstring" , "oid" , "int4" ] False "bpchar"+> , CatCreateFunction "bpcharle" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction "bpcharlike" [ "text" , "bpchar" ] False "bool"+> , CatCreateFunction "bpcharlt" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction "bpcharne" [ "bpchar" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpcharnlike" [ "text" , "bpchar" ] False "bool"+> , CatCreateFunction "bpcharout" [ "bpchar" ] False "cstring"+> , CatCreateFunction+> "bpcharrecv" [ "int4" , "oid" , "internal" ] False "bpchar"+> , CatCreateFunction+> "bpcharregexeq" [ "text" , "bpchar" ] False "bool"+> , CatCreateFunction+> "bpcharregexne" [ "text" , "bpchar" ] False "bool"+> , CatCreateFunction "bpcharsend" [ "bpchar" ] False "bytea"+> , CatCreateFunction "bpchartypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "bpchartypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "broadcast" [ "inet" ] False "inet"+> , CatCreateFunction+> "btabstimecmp" [ "abstime" , "abstime" ] False "int4"+> , CatCreateFunction+> "btarraycmp" [ "anyarray" , "anyarray" ] False "int4"+> , CatCreateFunction+> "btbeginscan"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "btboolcmp" [ "bool" , "bool" ] False "int4"+> , CatCreateFunction+> "btbpchar_pattern_cmp" [ "bpchar" , "bpchar" ] False "int4"+> , CatCreateFunction+> "btbuild" [ "internal" , "internal" , "internal" ] False "internal"+> , CatCreateFunction "btbuildempty" [ "internal" ] False "void"+> , CatCreateFunction+> "btbulkdelete"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "btcanreturn" [ "internal" ] False "bool"+> , CatCreateFunction "btcharcmp" [ "char" , "char" ] False "int4"+> , CatCreateFunction+> "btcostestimate"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "void"+> , CatCreateFunction "btendscan" [ "internal" ] False "void"+> , CatCreateFunction+> "btfloat48cmp" [ "float8" , "float4" ] False "int4"+> , CatCreateFunction+> "btfloat4cmp" [ "float4" , "float4" ] False "int4"+> , CatCreateFunction+> "btfloat4sortsupport" [ "internal" ] False "void"+> , CatCreateFunction+> "btfloat84cmp" [ "float4" , "float8" ] False "int4"+> , CatCreateFunction+> "btfloat8cmp" [ "float8" , "float8" ] False "int4"+> , CatCreateFunction+> "btfloat8sortsupport" [ "internal" ] False "void"+> , CatCreateFunction+> "btgetbitmap" [ "internal" , "internal" ] False "int8"+> , CatCreateFunction+> "btgettuple" [ "internal" , "internal" ] False "bool"+> , CatCreateFunction+> "btinsert"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction "btint24cmp" [ "int4" , "int2" ] False "int4"+> , CatCreateFunction "btint28cmp" [ "int2" , "int8" ] False "int4"+> , CatCreateFunction "btint2cmp" [ "int2" , "int2" ] False "int4"+> , CatCreateFunction "btint2sortsupport" [ "internal" ] False "void"+> , CatCreateFunction "btint42cmp" [ "int2" , "int4" ] False "int4"+> , CatCreateFunction "btint48cmp" [ "int4" , "int8" ] False "int4"+> , CatCreateFunction "btint4cmp" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "btint4sortsupport" [ "internal" ] False "void"+> , CatCreateFunction "btint82cmp" [ "int8" , "int2" ] False "int4"+> , CatCreateFunction "btint84cmp" [ "int8" , "int4" ] False "int4"+> , CatCreateFunction "btint8cmp" [ "int8" , "int8" ] False "int4"+> , CatCreateFunction "btint8sortsupport" [ "internal" ] False "void"+> , CatCreateFunction "btmarkpos" [ "internal" ] False "void"+> , CatCreateFunction "btnamecmp" [ "name" , "name" ] False "int4"+> , CatCreateFunction "btnamesortsupport" [ "internal" ] False "void"+> , CatCreateFunction "btoidcmp" [ "oid" , "oid" ] False "int4"+> , CatCreateFunction "btoidsortsupport" [ "internal" ] False "void"+> , CatCreateFunction+> "btoidvectorcmp" [ "oidvector" , "oidvector" ] False "int4"+> , CatCreateFunction "btoptions" [ "bool" , "_text" ] False "bytea"+> , CatCreateFunction+> "btrecordcmp" [ "record" , "record" ] False "int4"+> , CatCreateFunction+> "btrecordimagecmp" [ "record" , "record" ] False "int4"+> , CatCreateFunction+> "btreltimecmp" [ "reltime" , "reltime" ] False "int4"+> , CatCreateFunction+> "btrescan"+> [ "internal" , "internal" , "internal" , "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction "btrestrpos" [ "internal" ] False "void"+> , CatCreateFunction "btrim" [ "text" , "text" ] False "text"+> , CatCreateFunction "btrim" [ "text" ] False "text"+> , CatCreateFunction "btrim" [ "bytea" , "bytea" ] False "bytea"+> , CatCreateFunction+> "bttext_pattern_cmp" [ "text" , "text" ] False "int4"+> , CatCreateFunction "bttextcmp" [ "text" , "text" ] False "int4"+> , CatCreateFunction "bttidcmp" [ "tid" , "tid" ] False "int4"+> , CatCreateFunction+> "bttintervalcmp" [ "tinterval" , "tinterval" ] False "int4"+> , CatCreateFunction+> "btvacuumcleanup" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "bytea_string_agg_finalfn" [ "internal" ] False "bytea"+> , CatCreateFunction+> "bytea_string_agg_transfn"+> [ "internal" , "bytea" , "bytea" ]+> False+> "internal"+> , CatCreateFunction "byteacat" [ "bytea" , "bytea" ] False "bytea"+> , CatCreateFunction "byteacmp" [ "bytea" , "bytea" ] False "int4"+> , CatCreateFunction "byteaeq" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "byteage" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "byteagt" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "byteain" [ "cstring" ] False "bytea"+> , CatCreateFunction "byteale" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "bytealike" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "bytealt" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "byteane" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "byteanlike" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "byteaout" [ "bytea" ] False "cstring"+> , CatCreateFunction "bytearecv" [ "internal" ] False "bytea"+> , CatCreateFunction "byteasend" [ "bytea" ] False "bytea"+> , CatCreateFunction "cardinality" [ "anyarray" ] False "int4"+> , CatCreateFunction "cash_cmp" [ "money" , "money" ] False "int4"+> , CatCreateFunction+> "cash_div_cash" [ "money" , "money" ] False "float8"+> , CatCreateFunction+> "cash_div_flt4" [ "float4" , "money" ] False "money"+> , CatCreateFunction+> "cash_div_flt8" [ "money" , "float8" ] False "money"+> , CatCreateFunction+> "cash_div_int2" [ "money" , "int2" ] False "money"+> , CatCreateFunction+> "cash_div_int4" [ "int4" , "money" ] False "money"+> , CatCreateFunction "cash_eq" [ "money" , "money" ] False "bool"+> , CatCreateFunction "cash_ge" [ "money" , "money" ] False "bool"+> , CatCreateFunction "cash_gt" [ "money" , "money" ] False "bool"+> , CatCreateFunction "cash_in" [ "cstring" ] False "money"+> , CatCreateFunction "cash_le" [ "money" , "money" ] False "bool"+> , CatCreateFunction "cash_lt" [ "money" , "money" ] False "bool"+> , CatCreateFunction "cash_mi" [ "money" , "money" ] False "money"+> , CatCreateFunction+> "cash_mul_flt4" [ "float4" , "money" ] False "money"+> , CatCreateFunction+> "cash_mul_flt8" [ "money" , "float8" ] False "money"+> , CatCreateFunction+> "cash_mul_int2" [ "money" , "int2" ] False "money"+> , CatCreateFunction+> "cash_mul_int4" [ "int4" , "money" ] False "money"+> , CatCreateFunction "cash_ne" [ "money" , "money" ] False "bool"+> , CatCreateFunction "cash_out" [ "money" ] False "cstring"+> , CatCreateFunction "cash_pl" [ "money" , "money" ] False "money"+> , CatCreateFunction "cash_recv" [ "internal" ] False "money"+> , CatCreateFunction "cash_send" [ "money" ] False "bytea"+> , CatCreateFunction "cash_words" [ "money" ] False "text"+> , CatCreateFunction+> "cashlarger" [ "money" , "money" ] False "money"+> , CatCreateFunction+> "cashsmaller" [ "money" , "money" ] False "money"+> , CatCreateFunction "cbrt" [ "float8" ] False "float8"+> , CatCreateFunction "ceil" [ "numeric" ] False "numeric"+> , CatCreateFunction "ceil" [ "float8" ] False "float8"+> , CatCreateFunction "ceiling" [ "numeric" ] False "numeric"+> , CatCreateFunction "ceiling" [ "float8" ] False "float8"+> , CatCreateFunction "center" [ "box" ] False "point"+> , CatCreateFunction "center" [ "circle" ] False "point"+> , CatCreateFunction "char" [ "int4" ] False "char"+> , CatCreateFunction "char" [ "text" ] False "char"+> , CatCreateFunction "char_length" [ "bpchar" ] False "int4"+> , CatCreateFunction "char_length" [ "text" ] False "int4"+> , CatCreateFunction "character_length" [ "bpchar" ] False "int4"+> , CatCreateFunction "character_length" [ "text" ] False "int4"+> , CatCreateFunction "chareq" [ "char" , "char" ] False "bool"+> , CatCreateFunction "charge" [ "char" , "char" ] False "bool"+> , CatCreateFunction "chargt" [ "char" , "char" ] False "bool"+> , CatCreateFunction "charin" [ "cstring" ] False "char"+> , CatCreateFunction "charle" [ "char" , "char" ] False "bool"+> , CatCreateFunction "charlt" [ "char" , "char" ] False "bool"+> , CatCreateFunction "charne" [ "char" , "char" ] False "bool"+> , CatCreateFunction "charout" [ "char" ] False "cstring"+> , CatCreateFunction "charrecv" [ "internal" ] False "char"+> , CatCreateFunction "charsend" [ "char" ] False "bytea"+> , CatCreateFunction "chr" [ "int4" ] False "text"+> , CatCreateFunction "cideq" [ "cid" , "cid" ] False "bool"+> , CatCreateFunction "cidin" [ "cstring" ] False "cid"+> , CatCreateFunction "cidout" [ "cid" ] False "cstring"+> , CatCreateFunction "cidr" [ "inet" ] False "cidr"+> , CatCreateFunction "cidr_in" [ "cstring" ] False "cidr"+> , CatCreateFunction "cidr_out" [ "cidr" ] False "cstring"+> , CatCreateFunction "cidr_recv" [ "internal" ] False "cidr"+> , CatCreateFunction "cidr_send" [ "cidr" ] False "bytea"+> , CatCreateFunction "cidrecv" [ "internal" ] False "cid"+> , CatCreateFunction "cidsend" [ "cid" ] False "bytea"+> , CatCreateFunction "circle" [ "point" , "float8" ] False "circle"+> , CatCreateFunction "circle" [ "polygon" ] False "circle"+> , CatCreateFunction "circle" [ "box" ] False "circle"+> , CatCreateFunction+> "circle_above" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_add_pt" [ "circle" , "point" ] False "circle"+> , CatCreateFunction+> "circle_below" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction "circle_center" [ "circle" ] False "point"+> , CatCreateFunction+> "circle_contain" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_contain_pt" [ "circle" , "point" ] False "bool"+> , CatCreateFunction+> "circle_contained" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_distance" [ "circle" , "circle" ] False "float8"+> , CatCreateFunction+> "circle_div_pt" [ "circle" , "point" ] False "circle"+> , CatCreateFunction+> "circle_eq" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_ge" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_gt" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction "circle_in" [ "cstring" ] False "circle"+> , CatCreateFunction+> "circle_le" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_left" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_lt" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_mul_pt" [ "point" , "circle" ] False "circle"+> , CatCreateFunction+> "circle_ne" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction "circle_out" [ "circle" ] False "cstring"+> , CatCreateFunction+> "circle_overabove" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_overbelow" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_overlap" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_overleft" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_overright" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction "circle_recv" [ "internal" ] False "circle"+> , CatCreateFunction+> "circle_right" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction+> "circle_same" [ "circle" , "circle" ] False "bool"+> , CatCreateFunction "circle_send" [ "circle" ] False "bytea"+> , CatCreateFunction+> "circle_sub_pt" [ "point" , "circle" ] False "circle"+> , CatCreateFunction "close_lb" [ "line" , "box" ] False "point"+> , CatCreateFunction "close_ls" [ "lseg" , "line" ] False "point"+> , CatCreateFunction "close_lseg" [ "lseg" , "lseg" ] False "point"+> , CatCreateFunction "close_pb" [ "box" , "point" ] False "point"+> , CatCreateFunction "close_pl" [ "point" , "line" ] False "point"+> , CatCreateFunction "close_ps" [ "point" , "lseg" ] False "point"+> , CatCreateFunction "close_sb" [ "lseg" , "box" ] False "point"+> , CatCreateFunction "close_sl" [ "lseg" , "line" ] False "point"+> , CatCreateFunction+> "col_description" [ "int4" , "oid" ] False "text"+> , CatCreateFunction+> "contjoinsel"+> [ "internal" , "int2" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "contsel"+> [ "int4" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "convert" [ "name" , "bytea" , "name" ] False "bytea"+> , CatCreateFunction+> "convert_from" [ "name" , "bytea" ] False "text"+> , CatCreateFunction "convert_to" [ "text" , "name" ] False "bytea"+> , CatCreateFunction "cos" [ "float8" ] False "float8"+> , CatCreateFunction "cot" [ "float8" ] False "float8"+> , CatCreateFunction "cstring_in" [ "cstring" ] False "cstring"+> , CatCreateFunction "cstring_out" [ "cstring" ] False "cstring"+> , CatCreateFunction "cstring_recv" [ "internal" ] False "cstring"+> , CatCreateFunction "cstring_send" [ "cstring" ] False "bytea"+> , CatCreateFunction "current_schemas" [ "bool" ] False "_name"+> , CatCreateFunction "current_setting" [ "text" ] False "text"+> , CatCreateFunction "currtid" [ "tid" , "oid" ] False "tid"+> , CatCreateFunction "currtid2" [ "tid" , "text" ] False "tid"+> , CatCreateFunction "currval" [ "regclass" ] False "int8"+> , CatCreateFunction+> "cursor_to_xml"+> [ "bool" , "int4" , "refcursor" , "bool" , "text" ]+> False+> "xml"+> , CatCreateFunction+> "cursor_to_xmlschema"+> [ "text" , "bool" , "bool" , "refcursor" ]+> False+> "xml"+> , CatCreateFunction+> "database_to_xml" [ "bool" , "bool" , "text" ] False "xml"+> , CatCreateFunction+> "database_to_xml_and_xmlschema"+> [ "bool" , "text" , "bool" ]+> False+> "xml"+> , CatCreateFunction+> "database_to_xmlschema" [ "text" , "bool" , "bool" ] False "xml"+> , CatCreateFunction "date" [ "timestamptz" ] False "date"+> , CatCreateFunction "date" [ "abstime" ] False "date"+> , CatCreateFunction "date" [ "timestamp" ] False "date"+> , CatCreateFunction "date_cmp" [ "date" , "date" ] False "int4"+> , CatCreateFunction+> "date_cmp_timestamp" [ "timestamp" , "date" ] False "int4"+> , CatCreateFunction+> "date_cmp_timestamptz" [ "date" , "timestamptz" ] False "int4"+> , CatCreateFunction "date_eq" [ "date" , "date" ] False "bool"+> , CatCreateFunction+> "date_eq_timestamp" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "date_eq_timestamptz" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction "date_ge" [ "date" , "date" ] False "bool"+> , CatCreateFunction+> "date_ge_timestamp" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "date_ge_timestamptz" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction "date_gt" [ "date" , "date" ] False "bool"+> , CatCreateFunction+> "date_gt_timestamp" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "date_gt_timestamptz" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction "date_in" [ "cstring" ] False "date"+> , CatCreateFunction "date_larger" [ "date" , "date" ] False "date"+> , CatCreateFunction "date_le" [ "date" , "date" ] False "bool"+> , CatCreateFunction+> "date_le_timestamp" [ "timestamp" , "date" ] False "bool"+> , CatCreateFunction+> "date_le_timestamptz" [ "date" , "timestamptz" ] False "bool"+> , CatCreateFunction "date_lt" [ "date" , "date" ] False "bool"+> , CatCreateFunction+> "date_lt_timestamp" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "date_lt_timestamptz" [ "date" , "timestamptz" ] False "bool"+> , CatCreateFunction "date_mi" [ "date" , "date" ] False "int4"+> , CatCreateFunction+> "date_mi_interval" [ "interval" , "date" ] False "timestamp"+> , CatCreateFunction "date_mii" [ "int4" , "date" ] False "date"+> , CatCreateFunction "date_ne" [ "date" , "date" ] False "bool"+> , CatCreateFunction+> "date_ne_timestamp" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "date_ne_timestamptz" [ "date" , "timestamptz" ] False "bool"+> , CatCreateFunction "date_out" [ "date" ] False "cstring"+> , CatCreateFunction+> "date_part" [ "timestamptz" , "text" ] False "float8"+> , CatCreateFunction+> "date_part" [ "interval" , "text" ] False "float8"+> , CatCreateFunction+> "date_part" [ "timetz" , "text" ] False "float8"+> , CatCreateFunction+> "date_part" [ "abstime" , "text" ] False "float8"+> , CatCreateFunction+> "date_part" [ "text" , "reltime" ] False "float8"+> , CatCreateFunction "date_part" [ "date" , "text" ] False "float8"+> , CatCreateFunction "date_part" [ "time" , "text" ] False "float8"+> , CatCreateFunction+> "date_part" [ "text" , "timestamp" ] False "float8"+> , CatCreateFunction+> "date_pl_interval" [ "interval" , "date" ] False "timestamp"+> , CatCreateFunction "date_pli" [ "int4" , "date" ] False "date"+> , CatCreateFunction "date_recv" [ "internal" ] False "date"+> , CatCreateFunction "date_send" [ "date" ] False "bytea"+> , CatCreateFunction "date_smaller" [ "date" , "date" ] False "date"+> , CatCreateFunction "date_sortsupport" [ "internal" ] False "void"+> , CatCreateFunction+> "date_trunc" [ "timestamptz" , "text" ] False "timestamptz"+> , CatCreateFunction+> "date_trunc" [ "text" , "interval" ] False "interval"+> , CatCreateFunction+> "date_trunc" [ "text" , "timestamp" ] False "timestamp"+> , CatCreateFunction+> "daterange" [ "date" , "date" ] False "daterange"+> , CatCreateFunction+> "daterange" [ "date" , "text" , "date" ] False "daterange"+> , CatCreateFunction+> "daterange_canonical" [ "daterange" ] False "daterange"+> , CatCreateFunction+> "daterange_subdiff" [ "date" , "date" ] False "float8"+> , CatCreateFunction+> "datetime_pl" [ "time" , "date" ] False "timestamp"+> , CatCreateFunction+> "datetimetz_pl" [ "date" , "timetz" ] False "timestamptz"+> , CatCreateFunction "dcbrt" [ "float8" ] False "float8"+> , CatCreateFunction "decode" [ "text" , "text" ] False "bytea"+> , CatCreateFunction "degrees" [ "float8" ] False "float8"+> , CatCreateFunction "dexp" [ "float8" ] False "float8"+> , CatCreateFunction "diagonal" [ "box" ] False "lseg"+> , CatCreateFunction "diameter" [ "circle" ] False "float8"+> , CatCreateFunction "dispell_init" [ "internal" ] False "internal"+> , CatCreateFunction+> "dispell_lexize"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "dist_cpoly" [ "polygon" , "circle" ] False "float8"+> , CatCreateFunction "dist_lb" [ "line" , "box" ] False "float8"+> , CatCreateFunction "dist_pb" [ "box" , "point" ] False "float8"+> , CatCreateFunction "dist_pc" [ "circle" , "point" ] False "float8"+> , CatCreateFunction "dist_pl" [ "point" , "line" ] False "float8"+> , CatCreateFunction+> "dist_ppath" [ "point" , "path" ] False "float8"+> , CatCreateFunction "dist_ps" [ "point" , "lseg" ] False "float8"+> , CatCreateFunction "dist_sb" [ "lseg" , "box" ] False "float8"+> , CatCreateFunction "dist_sl" [ "lseg" , "line" ] False "float8"+> , CatCreateFunction "div" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "dlog1" [ "float8" ] False "float8"+> , CatCreateFunction "dlog10" [ "float8" ] False "float8"+> , CatCreateFunction+> "domain_in" [ "oid" , "cstring" , "int4" ] False "any"+> , CatCreateFunction+> "domain_recv" [ "oid" , "int4" , "internal" ] False "any"+> , CatCreateFunction "dpow" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "dround" [ "float8" ] False "float8"+> , CatCreateFunction "dsimple_init" [ "internal" ] False "internal"+> , CatCreateFunction+> "dsimple_lexize"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "dsnowball_init" [ "internal" ] False "internal"+> , CatCreateFunction+> "dsnowball_lexize"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "dsqrt" [ "float8" ] False "float8"+> , CatCreateFunction "dsynonym_init" [ "internal" ] False "internal"+> , CatCreateFunction+> "dsynonym_lexize"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "dtrunc" [ "float8" ] False "float8"+> , CatCreateFunction+> "elem_contained_by_range"+> [ "anyrange" , "anyelement" ]+> False+> "bool"+> , CatCreateFunction "encode" [ "bytea" , "text" ] False "text"+> , CatCreateFunction+> "enum_cmp" [ "anyenum" , "anyenum" ] False "int4"+> , CatCreateFunction+> "enum_eq" [ "anyenum" , "anyenum" ] False "bool"+> , CatCreateFunction "enum_first" [ "anyenum" ] False "anyenum"+> , CatCreateFunction+> "enum_ge" [ "anyenum" , "anyenum" ] False "bool"+> , CatCreateFunction+> "enum_gt" [ "anyenum" , "anyenum" ] False "bool"+> , CatCreateFunction "enum_in" [ "oid" , "cstring" ] False "anyenum"+> , CatCreateFunction+> "enum_larger" [ "anyenum" , "anyenum" ] False "anyenum"+> , CatCreateFunction "enum_last" [ "anyenum" ] False "anyenum"+> , CatCreateFunction+> "enum_le" [ "anyenum" , "anyenum" ] False "bool"+> , CatCreateFunction+> "enum_lt" [ "anyenum" , "anyenum" ] False "bool"+> , CatCreateFunction+> "enum_ne" [ "anyenum" , "anyenum" ] False "bool"+> , CatCreateFunction "enum_out" [ "anyenum" ] False "cstring"+> , CatCreateFunction+> "enum_range" [ "anyenum" , "anyenum" ] False "anyarray"+> , CatCreateFunction "enum_range" [ "anyenum" ] False "anyarray"+> , CatCreateFunction+> "enum_recv" [ "internal" , "oid" ] False "anyenum"+> , CatCreateFunction "enum_send" [ "anyenum" ] False "bytea"+> , CatCreateFunction+> "enum_smaller" [ "anyenum" , "anyenum" ] False "anyenum"+> , CatCreateFunction+> "eqjoinsel"+> [ "internal" , "oid" , "internal" , "int2" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "eqsel" [ "internal" , "internal" , "int4" , "oid" ] False "float8"+> , CatCreateFunction+> "euc_cn_to_mic"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_cn_to_utf8"+> [ "int4" , "cstring" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_jis_2004_to_shift_jis_2004"+> [ "int4" , "cstring" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_jis_2004_to_utf8"+> [ "internal" , "int4" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_jp_to_mic"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_jp_to_sjis"+> [ "int4" , "cstring" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_jp_to_utf8"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_kr_to_mic"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_kr_to_utf8"+> [ "internal" , "int4" , "int4" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_tw_to_big5"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "euc_tw_to_mic"+> [ "cstring" , "int4" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "euc_tw_to_utf8"+> [ "int4" , "int4" , "int4" , "internal" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "event_trigger_in" [ "cstring" ] False "event_trigger"+> , CatCreateFunction+> "event_trigger_out" [ "event_trigger" ] False "cstring"+> , CatCreateFunction "exp" [ "float8" ] False "float8"+> , CatCreateFunction "exp" [ "numeric" ] False "numeric"+> , CatCreateFunction "factorial" [ "int8" ] False "numeric"+> , CatCreateFunction "family" [ "inet" ] False "int4"+> , CatCreateFunction+> "fdw_handler_in" [ "cstring" ] False "fdw_handler"+> , CatCreateFunction+> "fdw_handler_out" [ "fdw_handler" ] False "cstring"+> , CatCreateFunction "float4" [ "int2" ] False "float4"+> , CatCreateFunction "float4" [ "float8" ] False "float4"+> , CatCreateFunction "float4" [ "int4" ] False "float4"+> , CatCreateFunction "float4" [ "int8" ] False "float4"+> , CatCreateFunction "float4" [ "numeric" ] False "float4"+> , CatCreateFunction+> "float48div" [ "float8" , "float4" ] False "float8"+> , CatCreateFunction+> "float48eq" [ "float4" , "float8" ] False "bool"+> , CatCreateFunction+> "float48ge" [ "float4" , "float8" ] False "bool"+> , CatCreateFunction+> "float48gt" [ "float4" , "float8" ] False "bool"+> , CatCreateFunction+> "float48le" [ "float8" , "float4" ] False "bool"+> , CatCreateFunction+> "float48lt" [ "float4" , "float8" ] False "bool"+> , CatCreateFunction+> "float48mi" [ "float4" , "float8" ] False "float8"+> , CatCreateFunction+> "float48mul" [ "float8" , "float4" ] False "float8"+> , CatCreateFunction+> "float48ne" [ "float8" , "float4" ] False "bool"+> , CatCreateFunction+> "float48pl" [ "float4" , "float8" ] False "float8"+> , CatCreateFunction+> "float4_accum" [ "float4" , "_float8" ] False "_float8"+> , CatCreateFunction "float4abs" [ "float4" ] False "float4"+> , CatCreateFunction+> "float4div" [ "float4" , "float4" ] False "float4"+> , CatCreateFunction "float4eq" [ "float4" , "float4" ] False "bool"+> , CatCreateFunction "float4ge" [ "float4" , "float4" ] False "bool"+> , CatCreateFunction "float4gt" [ "float4" , "float4" ] False "bool"+> , CatCreateFunction "float4in" [ "cstring" ] False "float4"+> , CatCreateFunction+> "float4larger" [ "float4" , "float4" ] False "float4"+> , CatCreateFunction "float4le" [ "float4" , "float4" ] False "bool"+> , CatCreateFunction "float4lt" [ "float4" , "float4" ] False "bool"+> , CatCreateFunction+> "float4mi" [ "float4" , "float4" ] False "float4"+> , CatCreateFunction+> "float4mul" [ "float4" , "float4" ] False "float4"+> , CatCreateFunction "float4ne" [ "float4" , "float4" ] False "bool"+> , CatCreateFunction "float4out" [ "float4" ] False "cstring"+> , CatCreateFunction+> "float4pl" [ "float4" , "float4" ] False "float4"+> , CatCreateFunction "float4recv" [ "internal" ] False "float4"+> , CatCreateFunction "float4send" [ "float4" ] False "bytea"+> , CatCreateFunction+> "float4smaller" [ "float4" , "float4" ] False "float4"+> , CatCreateFunction "float4um" [ "float4" ] False "float4"+> , CatCreateFunction "float4up" [ "float4" ] False "float4"+> , CatCreateFunction "float8" [ "int2" ] False "float8"+> , CatCreateFunction "float8" [ "float4" ] False "float8"+> , CatCreateFunction "float8" [ "int4" ] False "float8"+> , CatCreateFunction "float8" [ "int8" ] False "float8"+> , CatCreateFunction "float8" [ "numeric" ] False "float8"+> , CatCreateFunction+> "float84div" [ "float4" , "float8" ] False "float8"+> , CatCreateFunction+> "float84eq" [ "float4" , "float8" ] False "bool"+> , CatCreateFunction+> "float84ge" [ "float8" , "float4" ] False "bool"+> , CatCreateFunction+> "float84gt" [ "float8" , "float4" ] False "bool"+> , CatCreateFunction+> "float84le" [ "float4" , "float8" ] False "bool"+> , CatCreateFunction+> "float84lt" [ "float8" , "float4" ] False "bool"+> , CatCreateFunction+> "float84mi" [ "float4" , "float8" ] False "float8"+> , CatCreateFunction+> "float84mul" [ "float8" , "float4" ] False "float8"+> , CatCreateFunction+> "float84ne" [ "float8" , "float4" ] False "bool"+> , CatCreateFunction+> "float84pl" [ "float8" , "float4" ] False "float8"+> , CatCreateFunction+> "float8_accum" [ "_float8" , "float8" ] False "_float8"+> , CatCreateFunction "float8_avg" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_corr" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_covar_pop" [ "_float8" ] False "float8"+> , CatCreateFunction+> "float8_covar_samp" [ "_float8" ] False "float8"+> , CatCreateFunction+> "float8_regr_accum"+> [ "float8" , "_float8" , "float8" ]+> False+> "_float8"+> , CatCreateFunction "float8_regr_avgx" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_regr_avgy" [ "_float8" ] False "float8"+> , CatCreateFunction+> "float8_regr_intercept" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_regr_r2" [ "_float8" ] False "float8"+> , CatCreateFunction+> "float8_regr_slope" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_regr_sxx" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_regr_sxy" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_regr_syy" [ "_float8" ] False "float8"+> , CatCreateFunction+> "float8_stddev_pop" [ "_float8" ] False "float8"+> , CatCreateFunction+> "float8_stddev_samp" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_var_pop" [ "_float8" ] False "float8"+> , CatCreateFunction "float8_var_samp" [ "_float8" ] False "float8"+> , CatCreateFunction "float8abs" [ "float8" ] False "float8"+> , CatCreateFunction+> "float8div" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "float8eq" [ "float8" , "float8" ] False "bool"+> , CatCreateFunction "float8ge" [ "float8" , "float8" ] False "bool"+> , CatCreateFunction "float8gt" [ "float8" , "float8" ] False "bool"+> , CatCreateFunction "float8in" [ "cstring" ] False "float8"+> , CatCreateFunction+> "float8larger" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "float8le" [ "float8" , "float8" ] False "bool"+> , CatCreateFunction "float8lt" [ "float8" , "float8" ] False "bool"+> , CatCreateFunction+> "float8mi" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction+> "float8mul" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "float8ne" [ "float8" , "float8" ] False "bool"+> , CatCreateFunction "float8out" [ "float8" ] False "cstring"+> , CatCreateFunction+> "float8pl" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "float8recv" [ "internal" ] False "float8"+> , CatCreateFunction "float8send" [ "float8" ] False "bytea"+> , CatCreateFunction+> "float8smaller" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "float8um" [ "float8" ] False "float8"+> , CatCreateFunction "float8up" [ "float8" ] False "float8"+> , CatCreateFunction "floor" [ "numeric" ] False "numeric"+> , CatCreateFunction "floor" [ "float8" ] False "float8"+> , CatCreateFunction+> "flt4_mul_cash" [ "money" , "float4" ] False "money"+> , CatCreateFunction+> "flt8_mul_cash" [ "money" , "float8" ] False "money"+> , CatCreateFunction "fmgr_c_validator" [ "oid" ] False "void"+> , CatCreateFunction+> "fmgr_internal_validator" [ "oid" ] False "void"+> , CatCreateFunction "fmgr_sql_validator" [ "oid" ] False "void"+> , CatCreateFunction "format" [ "text" ] False "text"+> , CatCreateFunction "format_type" [ "int4" , "oid" ] False "text"+> , CatCreateFunction+> "gb18030_to_utf8"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "gbk_to_utf8"+> [ "internal" , "int4" , "int4" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "generate_series"+> [ "timestamp" , "timestamp" , "interval" ]+> True+> "timestamp"+> , CatCreateFunction+> "generate_series"+> [ "timestamptz" , "interval" , "timestamptz" ]+> True+> "timestamptz"+> , CatCreateFunction+> "generate_series" [ "int4" , "int4" , "int4" ] True "int4"+> , CatCreateFunction+> "generate_series" [ "int4" , "int4" ] True "int4"+> , CatCreateFunction+> "generate_series" [ "int8" , "int8" , "int8" ] True "int8"+> , CatCreateFunction+> "generate_series" [ "int8" , "int8" ] True "int8"+> , CatCreateFunction+> "generate_subscripts" [ "int4" , "bool" , "anyarray" ] True "int4"+> , CatCreateFunction+> "generate_subscripts" [ "anyarray" , "int4" ] True "int4"+> , CatCreateFunction "get_bit" [ "bytea" , "int4" ] False "int4"+> , CatCreateFunction "get_bit" [ "bit" , "int4" ] False "int4"+> , CatCreateFunction "get_byte" [ "int4" , "bytea" ] False "int4"+> , CatCreateFunction+> "gin_cmp_prefix"+> [ "text" , "text" , "internal" , "int2" ]+> False+> "int4"+> , CatCreateFunction+> "gin_cmp_tslexeme" [ "text" , "text" ] False "int4"+> , CatCreateFunction+> "gin_compare_jsonb" [ "text" , "text" ] False "int4"+> , CatCreateFunction+> "gin_consistent_jsonb"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "int2"+> , "anyarray"+> , "int4"+> ]+> False+> "bool"+> , CatCreateFunction+> "gin_consistent_jsonb_path"+> [ "int2"+> , "anyarray"+> , "int4"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction+> "gin_extract_jsonb"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gin_extract_jsonb_path"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gin_extract_jsonb_query"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "int2"+> , "anyarray"+> , "internal"+> ]+> False+> "internal"+> , CatCreateFunction+> "gin_extract_jsonb_query_path"+> [ "internal"+> , "anyarray"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "int2"+> ]+> False+> "internal"+> , CatCreateFunction+> "gin_extract_tsquery"+> [ "tsquery" , "internal" , "int2" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gin_extract_tsquery"+> [ "internal"+> , "internal"+> , "tsquery"+> , "internal"+> , "internal"+> , "internal"+> , "int2"+> ]+> False+> "internal"+> , CatCreateFunction+> "gin_extract_tsvector" [ "internal" , "tsvector" ] False "internal"+> , CatCreateFunction+> "gin_extract_tsvector"+> [ "internal" , "internal" , "tsvector" ]+> False+> "internal"+> , CatCreateFunction+> "gin_triconsistent_jsonb"+> [ "internal"+> , "internal"+> , "int4"+> , "internal"+> , "internal"+> , "int2"+> , "anyarray"+> ]+> False+> "char"+> , CatCreateFunction+> "gin_triconsistent_jsonb_path"+> [ "int4"+> , "internal"+> , "internal"+> , "anyarray"+> , "int2"+> , "internal"+> , "internal"+> ]+> False+> "char"+> , CatCreateFunction+> "gin_tsquery_consistent"+> [ "tsquery"+> , "internal"+> , "internal"+> , "int4"+> , "int2"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction+> "gin_tsquery_consistent"+> [ "tsquery"+> , "internal"+> , "int4"+> , "internal"+> , "internal"+> , "int2"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction+> "gin_tsquery_triconsistent"+> [ "internal"+> , "internal"+> , "int2"+> , "tsquery"+> , "int4"+> , "internal"+> , "internal"+> ]+> False+> "char"+> , CatCreateFunction+> "ginarrayconsistent"+> [ "int2"+> , "int4"+> , "anyarray"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction+> "ginarrayextract"+> [ "internal" , "anyarray" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "ginarrayextract" [ "anyarray" , "internal" ] False "internal"+> , CatCreateFunction+> "ginarraytriconsistent"+> [ "int2"+> , "anyarray"+> , "int4"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "char"+> , CatCreateFunction+> "ginbeginscan"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "ginbuild"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "ginbuildempty" [ "internal" ] False "void"+> , CatCreateFunction+> "ginbulkdelete"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gincostestimate"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "void"+> , CatCreateFunction "ginendscan" [ "internal" ] False "void"+> , CatCreateFunction+> "gingetbitmap" [ "internal" , "internal" ] False "int8"+> , CatCreateFunction+> "gininsert"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction "ginmarkpos" [ "internal" ] False "void"+> , CatCreateFunction "ginoptions" [ "bool" , "_text" ] False "bytea"+> , CatCreateFunction+> "ginqueryarrayextract"+> [ "internal"+> , "int2"+> , "internal"+> , "internal"+> , "anyarray"+> , "internal"+> , "internal"+> ]+> False+> "internal"+> , CatCreateFunction+> "ginrescan"+> [ "internal" , "internal" , "internal" , "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction "ginrestrpos" [ "internal" ] False "void"+> , CatCreateFunction+> "ginvacuumcleanup" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "gist_box_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gist_box_consistent"+> [ "internal" , "internal" , "box" , "int4" , "oid" ]+> False+> "bool"+> , CatCreateFunction+> "gist_box_decompress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gist_box_penalty"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gist_box_picksplit" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "gist_box_same" [ "box" , "internal" , "box" ] False "internal"+> , CatCreateFunction+> "gist_box_union" [ "internal" , "internal" ] False "box"+> , CatCreateFunction+> "gist_circle_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gist_circle_consistent"+> [ "int4" , "internal" , "circle" , "internal" , "oid" ]+> False+> "bool"+> , CatCreateFunction+> "gist_point_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gist_point_consistent"+> [ "point" , "internal" , "oid" , "int4" , "internal" ]+> False+> "bool"+> , CatCreateFunction+> "gist_point_distance"+> [ "internal" , "int4" , "oid" , "point" ]+> False+> "float8"+> , CatCreateFunction+> "gist_poly_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gist_poly_consistent"+> [ "internal" , "polygon" , "internal" , "oid" , "int4" ]+> False+> "bool"+> , CatCreateFunction+> "gistbeginscan"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gistbuild"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "gistbuildempty" [ "internal" ] False "void"+> , CatCreateFunction+> "gistbulkdelete"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gistcostestimate"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "void"+> , CatCreateFunction "gistendscan" [ "internal" ] False "void"+> , CatCreateFunction+> "gistgetbitmap" [ "internal" , "internal" ] False "int8"+> , CatCreateFunction+> "gistgettuple" [ "internal" , "internal" ] False "bool"+> , CatCreateFunction+> "gistinsert"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction "gistmarkpos" [ "internal" ] False "void"+> , CatCreateFunction+> "gistoptions" [ "_text" , "bool" ] False "bytea"+> , CatCreateFunction+> "gistrescan"+> [ "internal" , "internal" , "internal" , "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction "gistrestrpos" [ "internal" ] False "void"+> , CatCreateFunction+> "gistvacuumcleanup" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "gtsquery_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gtsquery_consistent"+> [ "int4" , "oid" , "internal" , "internal" , "internal" ]+> False+> "bool"+> , CatCreateFunction+> "gtsquery_decompress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gtsquery_penalty"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gtsquery_picksplit" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "gtsquery_same" [ "internal" , "int8" , "int8" ] False "internal"+> , CatCreateFunction+> "gtsquery_union" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "gtsvector_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gtsvector_consistent"+> [ "int4" , "oid" , "internal" , "internal" , "gtsvector" ]+> False+> "bool"+> , CatCreateFunction+> "gtsvector_decompress" [ "internal" ] False "internal"+> , CatCreateFunction+> "gtsvector_penalty"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "gtsvector_picksplit" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "gtsvector_same"+> [ "gtsvector" , "internal" , "gtsvector" ]+> False+> "internal"+> , CatCreateFunction+> "gtsvector_union" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction "gtsvectorin" [ "cstring" ] False "gtsvector"+> , CatCreateFunction "gtsvectorout" [ "gtsvector" ] False "cstring"+> , CatCreateFunction+> "has_any_column_privilege"+> [ "name" , "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_any_column_privilege" [ "text" , "oid" , "name" ] False "bool"+> , CatCreateFunction+> "has_any_column_privilege" [ "oid" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_any_column_privilege" [ "oid" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_any_column_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_any_column_privilege" [ "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "name" , "text" , "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "int2" , "text" , "name" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "text" , "name" , "oid" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "int2" , "name" , "text" , "oid" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "text" , "oid" , "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "text" , "text" , "int2" , "oid" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "text" , "text" , "oid" , "oid" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege"+> [ "oid" , "oid" , "int2" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_column_privilege" [ "text" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_column_privilege" [ "text" , "text" , "int2" ] False "bool"+> , CatCreateFunction+> "has_column_privilege" [ "oid" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_column_privilege" [ "oid" , "text" , "int2" ] False "bool"+> , CatCreateFunction+> "has_database_privilege" [ "name" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_database_privilege" [ "text" , "oid" , "name" ] False "bool"+> , CatCreateFunction+> "has_database_privilege" [ "oid" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_database_privilege" [ "oid" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_database_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_database_privilege" [ "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_foreign_data_wrapper_privilege"+> [ "name" , "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_foreign_data_wrapper_privilege"+> [ "name" , "oid" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_foreign_data_wrapper_privilege"+> [ "oid" , "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_foreign_data_wrapper_privilege"+> [ "oid" , "text" , "oid" ]+> False+> "bool"+> , CatCreateFunction+> "has_foreign_data_wrapper_privilege"+> [ "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_foreign_data_wrapper_privilege"+> [ "oid" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_function_privilege" [ "text" , "name" , "text" ] False "bool"+> , CatCreateFunction+> "has_function_privilege" [ "name" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_function_privilege" [ "text" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_function_privilege" [ "text" , "oid" , "oid" ] False "bool"+> , CatCreateFunction+> "has_function_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_function_privilege" [ "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_language_privilege" [ "text" , "text" , "name" ] False "bool"+> , CatCreateFunction+> "has_language_privilege" [ "name" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_language_privilege" [ "text" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_language_privilege" [ "oid" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_language_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_language_privilege" [ "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_schema_privilege" [ "name" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_schema_privilege" [ "name" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_schema_privilege" [ "text" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_schema_privilege" [ "oid" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_schema_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_schema_privilege" [ "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_sequence_privilege" [ "text" , "text" , "name" ] False "bool"+> , CatCreateFunction+> "has_sequence_privilege" [ "name" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_sequence_privilege" [ "oid" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_sequence_privilege" [ "text" , "oid" , "oid" ] False "bool"+> , CatCreateFunction+> "has_sequence_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_sequence_privilege" [ "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_server_privilege" [ "name" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_server_privilege" [ "text" , "name" , "oid" ] False "bool"+> , CatCreateFunction+> "has_server_privilege" [ "oid" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_server_privilege" [ "oid" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_server_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_server_privilege" [ "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_table_privilege" [ "text" , "name" , "text" ] False "bool"+> , CatCreateFunction+> "has_table_privilege" [ "text" , "oid" , "name" ] False "bool"+> , CatCreateFunction+> "has_table_privilege" [ "oid" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_table_privilege" [ "oid" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_table_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_table_privilege" [ "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_tablespace_privilege"+> [ "name" , "text" , "text" ]+> False+> "bool"+> , CatCreateFunction+> "has_tablespace_privilege" [ "text" , "oid" , "name" ] False "bool"+> , CatCreateFunction+> "has_tablespace_privilege" [ "text" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_tablespace_privilege" [ "oid" , "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_tablespace_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_tablespace_privilege" [ "oid" , "text" ] False "bool"+> , CatCreateFunction+> "has_type_privilege" [ "name" , "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_type_privilege" [ "name" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_type_privilege" [ "text" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_type_privilege" [ "oid" , "text" , "oid" ] False "bool"+> , CatCreateFunction+> "has_type_privilege" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "has_type_privilege" [ "oid" , "text" ] False "bool"+> , CatCreateFunction "hash_aclitem" [ "aclitem" ] False "int4"+> , CatCreateFunction "hash_array" [ "anyarray" ] False "int4"+> , CatCreateFunction "hash_numeric" [ "numeric" ] False "int4"+> , CatCreateFunction "hash_range" [ "anyrange" ] False "int4"+> , CatCreateFunction+> "hashbeginscan"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "hashbpchar" [ "bpchar" ] False "int4"+> , CatCreateFunction+> "hashbuild"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "hashbuildempty" [ "internal" ] False "void"+> , CatCreateFunction+> "hashbulkdelete"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "hashchar" [ "char" ] False "int4"+> , CatCreateFunction+> "hashcostestimate"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "void"+> , CatCreateFunction "hashendscan" [ "internal" ] False "void"+> , CatCreateFunction "hashenum" [ "anyenum" ] False "int4"+> , CatCreateFunction "hashfloat4" [ "float4" ] False "int4"+> , CatCreateFunction "hashfloat8" [ "float8" ] False "int4"+> , CatCreateFunction+> "hashgetbitmap" [ "internal" , "internal" ] False "int8"+> , CatCreateFunction+> "hashgettuple" [ "internal" , "internal" ] False "bool"+> , CatCreateFunction "hashinet" [ "inet" ] False "int4"+> , CatCreateFunction+> "hashinsert"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction "hashint2" [ "int2" ] False "int4"+> , CatCreateFunction "hashint2vector" [ "int2vector" ] False "int4"+> , CatCreateFunction "hashint4" [ "int4" ] False "int4"+> , CatCreateFunction "hashint8" [ "int8" ] False "int4"+> , CatCreateFunction "hashmacaddr" [ "macaddr" ] False "int4"+> , CatCreateFunction "hashmarkpos" [ "internal" ] False "void"+> , CatCreateFunction "hashname" [ "name" ] False "int4"+> , CatCreateFunction "hashoid" [ "oid" ] False "int4"+> , CatCreateFunction "hashoidvector" [ "oidvector" ] False "int4"+> , CatCreateFunction+> "hashoptions" [ "_text" , "bool" ] False "bytea"+> , CatCreateFunction+> "hashrescan"+> [ "internal" , "internal" , "internal" , "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction "hashrestrpos" [ "internal" ] False "void"+> , CatCreateFunction "hashtext" [ "text" ] False "int4"+> , CatCreateFunction+> "hashvacuumcleanup" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction "hashvarlena" [ "internal" ] False "int4"+> , CatCreateFunction "height" [ "box" ] False "float8"+> , CatCreateFunction "host" [ "inet" ] False "text"+> , CatCreateFunction "hostmask" [ "inet" ] False "inet"+> , CatCreateFunction+> "iclikejoinsel"+> [ "int2" , "internal" , "internal" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "iclikesel"+> [ "int4" , "internal" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "icnlikejoinsel"+> [ "internal" , "int2" , "internal" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "icnlikesel"+> [ "internal" , "oid" , "int4" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "icregexeqjoinsel"+> [ "internal" , "int2" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "icregexeqsel"+> [ "internal" , "int4" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "icregexnejoinsel"+> [ "internal" , "internal" , "oid" , "internal" , "int2" ]+> False+> "float8"+> , CatCreateFunction+> "icregexnesel"+> [ "internal" , "int4" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "inet_gist_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "inet_gist_consistent"+> [ "int4" , "inet" , "oid" , "internal" , "internal" ]+> False+> "bool"+> , CatCreateFunction+> "inet_gist_decompress" [ "internal" ] False "internal"+> , CatCreateFunction+> "inet_gist_penalty"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "inet_gist_picksplit" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "inet_gist_same" [ "inet" , "inet" , "internal" ] False "internal"+> , CatCreateFunction+> "inet_gist_union" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction "inet_in" [ "cstring" ] False "inet"+> , CatCreateFunction "inet_out" [ "inet" ] False "cstring"+> , CatCreateFunction "inet_recv" [ "internal" ] False "inet"+> , CatCreateFunction "inet_send" [ "inet" ] False "bytea"+> , CatCreateFunction "inetand" [ "inet" , "inet" ] False "inet"+> , CatCreateFunction "inetmi" [ "inet" , "inet" ] False "int8"+> , CatCreateFunction "inetmi_int8" [ "int8" , "inet" ] False "inet"+> , CatCreateFunction "inetnot" [ "inet" ] False "inet"+> , CatCreateFunction "inetor" [ "inet" , "inet" ] False "inet"+> , CatCreateFunction "inetpl" [ "inet" , "int8" ] False "inet"+> , CatCreateFunction "initcap" [ "text" ] False "text"+> , CatCreateFunction "int2" [ "float8" ] False "int2"+> , CatCreateFunction "int2" [ "float4" ] False "int2"+> , CatCreateFunction "int2" [ "int4" ] False "int2"+> , CatCreateFunction "int2" [ "int8" ] False "int2"+> , CatCreateFunction "int2" [ "numeric" ] False "int2"+> , CatCreateFunction "int24div" [ "int2" , "int4" ] False "int4"+> , CatCreateFunction "int24eq" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int24ge" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int24gt" [ "int2" , "int4" ] False "bool"+> , CatCreateFunction "int24le" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int24lt" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int24mi" [ "int4" , "int2" ] False "int4"+> , CatCreateFunction "int24mul" [ "int2" , "int4" ] False "int4"+> , CatCreateFunction "int24ne" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int24pl" [ "int2" , "int4" ] False "int4"+> , CatCreateFunction "int28div" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction "int28eq" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int28ge" [ "int2" , "int8" ] False "bool"+> , CatCreateFunction "int28gt" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int28le" [ "int2" , "int8" ] False "bool"+> , CatCreateFunction "int28lt" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int28mi" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction "int28mul" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction "int28ne" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int28pl" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction+> "int2_accum" [ "internal" , "int2" ] False "internal"+> , CatCreateFunction+> "int2_accum_inv" [ "int2" , "internal" ] False "internal"+> , CatCreateFunction+> "int2_avg_accum" [ "_int8" , "int2" ] False "_int8"+> , CatCreateFunction+> "int2_avg_accum_inv" [ "_int8" , "int2" ] False "_int8"+> , CatCreateFunction+> "int2_mul_cash" [ "int2" , "money" ] False "money"+> , CatCreateFunction "int2_sum" [ "int8" , "int2" ] False "int8"+> , CatCreateFunction "int2abs" [ "int2" ] False "int2"+> , CatCreateFunction "int2and" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2div" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2eq" [ "int2" , "int2" ] False "bool"+> , CatCreateFunction "int2ge" [ "int2" , "int2" ] False "bool"+> , CatCreateFunction "int2gt" [ "int2" , "int2" ] False "bool"+> , CatCreateFunction "int2in" [ "cstring" ] False "int2"+> , CatCreateFunction "int2int4_sum" [ "_int8" ] False "int8"+> , CatCreateFunction "int2larger" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2le" [ "int2" , "int2" ] False "bool"+> , CatCreateFunction "int2lt" [ "int2" , "int2" ] False "bool"+> , CatCreateFunction "int2mi" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2mod" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2mul" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2ne" [ "int2" , "int2" ] False "bool"+> , CatCreateFunction "int2not" [ "int2" ] False "int2"+> , CatCreateFunction "int2or" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2out" [ "int2" ] False "cstring"+> , CatCreateFunction "int2pl" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2recv" [ "internal" ] False "int2"+> , CatCreateFunction "int2send" [ "int2" ] False "bytea"+> , CatCreateFunction "int2shl" [ "int2" , "int4" ] False "int2"+> , CatCreateFunction "int2shr" [ "int4" , "int2" ] False "int2"+> , CatCreateFunction "int2smaller" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int2um" [ "int2" ] False "int2"+> , CatCreateFunction "int2up" [ "int2" ] False "int2"+> , CatCreateFunction+> "int2vectoreq" [ "int2vector" , "int2vector" ] False "bool"+> , CatCreateFunction "int2vectorin" [ "cstring" ] False "int2vector"+> , CatCreateFunction+> "int2vectorout" [ "int2vector" ] False "cstring"+> , CatCreateFunction+> "int2vectorrecv" [ "internal" ] False "int2vector"+> , CatCreateFunction "int2vectorsend" [ "int2vector" ] False "bytea"+> , CatCreateFunction "int2xor" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "int4" [ "char" ] False "int4"+> , CatCreateFunction "int4" [ "int2" ] False "int4"+> , CatCreateFunction "int4" [ "float8" ] False "int4"+> , CatCreateFunction "int4" [ "float4" ] False "int4"+> , CatCreateFunction "int4" [ "int8" ] False "int4"+> , CatCreateFunction "int4" [ "bit" ] False "int4"+> , CatCreateFunction "int4" [ "numeric" ] False "int4"+> , CatCreateFunction "int4" [ "bool" ] False "int4"+> , CatCreateFunction "int42div" [ "int2" , "int4" ] False "int4"+> , CatCreateFunction "int42eq" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int42ge" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int42gt" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int42le" [ "int2" , "int4" ] False "bool"+> , CatCreateFunction "int42lt" [ "int4" , "int2" ] False "bool"+> , CatCreateFunction "int42mi" [ "int4" , "int2" ] False "int4"+> , CatCreateFunction "int42mul" [ "int4" , "int2" ] False "int4"+> , CatCreateFunction "int42ne" [ "int2" , "int4" ] False "bool"+> , CatCreateFunction "int42pl" [ "int4" , "int2" ] False "int4"+> , CatCreateFunction "int48div" [ "int8" , "int4" ] False "int8"+> , CatCreateFunction "int48eq" [ "int8" , "int4" ] False "bool"+> , CatCreateFunction "int48ge" [ "int4" , "int8" ] False "bool"+> , CatCreateFunction "int48gt" [ "int4" , "int8" ] False "bool"+> , CatCreateFunction "int48le" [ "int8" , "int4" ] False "bool"+> , CatCreateFunction "int48lt" [ "int4" , "int8" ] False "bool"+> , CatCreateFunction "int48mi" [ "int4" , "int8" ] False "int8"+> , CatCreateFunction "int48mul" [ "int4" , "int8" ] False "int8"+> , CatCreateFunction "int48ne" [ "int4" , "int8" ] False "bool"+> , CatCreateFunction "int48pl" [ "int8" , "int4" ] False "int8"+> , CatCreateFunction+> "int4_accum" [ "int4" , "internal" ] False "internal"+> , CatCreateFunction+> "int4_accum_inv" [ "internal" , "int4" ] False "internal"+> , CatCreateFunction+> "int4_avg_accum" [ "int4" , "_int8" ] False "_int8"+> , CatCreateFunction+> "int4_avg_accum_inv" [ "int4" , "_int8" ] False "_int8"+> , CatCreateFunction+> "int4_mul_cash" [ "money" , "int4" ] False "money"+> , CatCreateFunction "int4_sum" [ "int4" , "int8" ] False "int8"+> , CatCreateFunction "int4abs" [ "int4" ] False "int4"+> , CatCreateFunction "int4and" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4div" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4eq" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "int4ge" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "int4gt" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "int4in" [ "cstring" ] False "int4"+> , CatCreateFunction "int4inc" [ "int4" ] False "int4"+> , CatCreateFunction "int4larger" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4le" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "int4lt" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "int4mi" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4mod" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4mul" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4ne" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "int4not" [ "int4" ] False "int4"+> , CatCreateFunction "int4or" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4out" [ "int4" ] False "cstring"+> , CatCreateFunction "int4pl" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction+> "int4range" [ "int4" , "int4" ] False "int4range"+> , CatCreateFunction+> "int4range" [ "int4" , "text" , "int4" ] False "int4range"+> , CatCreateFunction+> "int4range_canonical" [ "int4range" ] False "int4range"+> , CatCreateFunction+> "int4range_subdiff" [ "int4" , "int4" ] False "float8"+> , CatCreateFunction "int4recv" [ "internal" ] False "int4"+> , CatCreateFunction "int4send" [ "int4" ] False "bytea"+> , CatCreateFunction "int4shl" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4shr" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4smaller" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int4um" [ "int4" ] False "int4"+> , CatCreateFunction "int4up" [ "int4" ] False "int4"+> , CatCreateFunction "int4xor" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "int8" [ "int4" ] False "int8"+> , CatCreateFunction "int8" [ "float8" ] False "int8"+> , CatCreateFunction "int8" [ "float4" ] False "int8"+> , CatCreateFunction "int8" [ "int2" ] False "int8"+> , CatCreateFunction "int8" [ "oid" ] False "int8"+> , CatCreateFunction "int8" [ "numeric" ] False "int8"+> , CatCreateFunction "int8" [ "bit" ] False "int8"+> , CatCreateFunction "int82div" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction "int82eq" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int82ge" [ "int2" , "int8" ] False "bool"+> , CatCreateFunction "int82gt" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int82le" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int82lt" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int82mi" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction "int82mul" [ "int8" , "int2" ] False "int8"+> , CatCreateFunction "int82ne" [ "int8" , "int2" ] False "bool"+> , CatCreateFunction "int82pl" [ "int2" , "int8" ] False "int8"+> , CatCreateFunction "int84div" [ "int8" , "int4" ] False "int8"+> , CatCreateFunction "int84eq" [ "int4" , "int8" ] False "bool"+> , CatCreateFunction "int84ge" [ "int8" , "int4" ] False "bool"+> , CatCreateFunction "int84gt" [ "int8" , "int4" ] False "bool"+> , CatCreateFunction "int84le" [ "int8" , "int4" ] False "bool"+> , CatCreateFunction "int84lt" [ "int8" , "int4" ] False "bool"+> , CatCreateFunction "int84mi" [ "int4" , "int8" ] False "int8"+> , CatCreateFunction "int84mul" [ "int4" , "int8" ] False "int8"+> , CatCreateFunction "int84ne" [ "int4" , "int8" ] False "bool"+> , CatCreateFunction "int84pl" [ "int4" , "int8" ] False "int8"+> , CatCreateFunction+> "int8_accum" [ "internal" , "int8" ] False "internal"+> , CatCreateFunction+> "int8_accum_inv" [ "int8" , "internal" ] False "internal"+> , CatCreateFunction "int8_avg" [ "_int8" ] False "numeric"+> , CatCreateFunction+> "int8_avg_accum" [ "internal" , "int8" ] False "internal"+> , CatCreateFunction+> "int8_sum" [ "numeric" , "int8" ] False "numeric"+> , CatCreateFunction "int8abs" [ "int8" ] False "int8"+> , CatCreateFunction "int8and" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8dec" [ "int8" ] False "int8"+> , CatCreateFunction "int8dec_any" [ "any" , "int8" ] False "int8"+> , CatCreateFunction "int8div" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8eq" [ "int8" , "int8" ] False "bool"+> , CatCreateFunction "int8ge" [ "int8" , "int8" ] False "bool"+> , CatCreateFunction "int8gt" [ "int8" , "int8" ] False "bool"+> , CatCreateFunction "int8in" [ "cstring" ] False "int8"+> , CatCreateFunction "int8inc" [ "int8" ] False "int8"+> , CatCreateFunction "int8inc_any" [ "any" , "int8" ] False "int8"+> , CatCreateFunction+> "int8inc_float8_float8"+> [ "float8" , "int8" , "float8" ]+> False+> "int8"+> , CatCreateFunction "int8larger" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8le" [ "int8" , "int8" ] False "bool"+> , CatCreateFunction "int8lt" [ "int8" , "int8" ] False "bool"+> , CatCreateFunction "int8mi" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8mod" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8mul" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8ne" [ "int8" , "int8" ] False "bool"+> , CatCreateFunction "int8not" [ "int8" ] False "int8"+> , CatCreateFunction "int8or" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8out" [ "int8" ] False "cstring"+> , CatCreateFunction "int8pl" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8pl_inet" [ "int8" , "inet" ] False "inet"+> , CatCreateFunction+> "int8range" [ "int8" , "int8" ] False "int8range"+> , CatCreateFunction+> "int8range" [ "int8" , "int8" , "text" ] False "int8range"+> , CatCreateFunction+> "int8range_canonical" [ "int8range" ] False "int8range"+> , CatCreateFunction+> "int8range_subdiff" [ "int8" , "int8" ] False "float8"+> , CatCreateFunction "int8recv" [ "internal" ] False "int8"+> , CatCreateFunction "int8send" [ "int8" ] False "bytea"+> , CatCreateFunction "int8shl" [ "int8" , "int4" ] False "int8"+> , CatCreateFunction "int8shr" [ "int8" , "int4" ] False "int8"+> , CatCreateFunction "int8smaller" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "int8um" [ "int8" ] False "int8"+> , CatCreateFunction "int8up" [ "int8" ] False "int8"+> , CatCreateFunction "int8xor" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction+> "integer_pl_date" [ "date" , "int4" ] False "date"+> , CatCreateFunction "inter_lb" [ "line" , "box" ] False "bool"+> , CatCreateFunction "inter_sb" [ "box" , "lseg" ] False "bool"+> , CatCreateFunction "inter_sl" [ "lseg" , "line" ] False "bool"+> , CatCreateFunction "internal_in" [ "cstring" ] False "internal"+> , CatCreateFunction "internal_out" [ "internal" ] False "cstring"+> , CatCreateFunction "interval" [ "reltime" ] False "interval"+> , CatCreateFunction+> "interval" [ "int4" , "interval" ] False "interval"+> , CatCreateFunction "interval" [ "time" ] False "interval"+> , CatCreateFunction+> "interval_accum" [ "interval" , "_interval" ] False "_interval"+> , CatCreateFunction+> "interval_accum_inv" [ "_interval" , "interval" ] False "_interval"+> , CatCreateFunction "interval_avg" [ "_interval" ] False "interval"+> , CatCreateFunction+> "interval_cmp" [ "interval" , "interval" ] False "int4"+> , CatCreateFunction+> "interval_div" [ "float8" , "interval" ] False "interval"+> , CatCreateFunction+> "interval_eq" [ "interval" , "interval" ] False "bool"+> , CatCreateFunction+> "interval_ge" [ "interval" , "interval" ] False "bool"+> , CatCreateFunction+> "interval_gt" [ "interval" , "interval" ] False "bool"+> , CatCreateFunction "interval_hash" [ "interval" ] False "int4"+> , CatCreateFunction+> "interval_in" [ "cstring" , "int4" , "oid" ] False "interval"+> , CatCreateFunction+> "interval_larger" [ "interval" , "interval" ] False "interval"+> , CatCreateFunction+> "interval_le" [ "interval" , "interval" ] False "bool"+> , CatCreateFunction+> "interval_lt" [ "interval" , "interval" ] False "bool"+> , CatCreateFunction+> "interval_mi" [ "interval" , "interval" ] False "interval"+> , CatCreateFunction+> "interval_mul" [ "float8" , "interval" ] False "interval"+> , CatCreateFunction+> "interval_ne" [ "interval" , "interval" ] False "bool"+> , CatCreateFunction "interval_out" [ "interval" ] False "cstring"+> , CatCreateFunction+> "interval_pl" [ "interval" , "interval" ] False "interval"+> , CatCreateFunction+> "interval_pl_date" [ "interval" , "date" ] False "timestamp"+> , CatCreateFunction+> "interval_pl_time" [ "interval" , "time" ] False "time"+> , CatCreateFunction+> "interval_pl_timestamp"+> [ "timestamp" , "interval" ]+> False+> "timestamp"+> , CatCreateFunction+> "interval_pl_timestamptz"+> [ "timestamptz" , "interval" ]+> False+> "timestamptz"+> , CatCreateFunction+> "interval_pl_timetz" [ "interval" , "timetz" ] False "timetz"+> , CatCreateFunction+> "interval_recv" [ "int4" , "oid" , "internal" ] False "interval"+> , CatCreateFunction "interval_send" [ "interval" ] False "bytea"+> , CatCreateFunction+> "interval_smaller" [ "interval" , "interval" ] False "interval"+> , CatCreateFunction+> "interval_transform" [ "internal" ] False "internal"+> , CatCreateFunction "interval_um" [ "interval" ] False "interval"+> , CatCreateFunction "intervaltypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "intervaltypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction+> "intinterval" [ "abstime" , "tinterval" ] False "bool"+> , CatCreateFunction "isclosed" [ "path" ] False "bool"+> , CatCreateFunction "isempty" [ "anyrange" ] False "bool"+> , CatCreateFunction "isfinite" [ "abstime" ] False "bool"+> , CatCreateFunction "isfinite" [ "date" ] False "bool"+> , CatCreateFunction "isfinite" [ "timestamptz" ] False "bool"+> , CatCreateFunction "isfinite" [ "interval" ] False "bool"+> , CatCreateFunction "isfinite" [ "timestamp" ] False "bool"+> , CatCreateFunction+> "ishorizontal" [ "point" , "point" ] False "bool"+> , CatCreateFunction "ishorizontal" [ "lseg" ] False "bool"+> , CatCreateFunction "ishorizontal" [ "line" ] False "bool"+> , CatCreateFunction+> "iso8859_1_to_utf8"+> [ "int4" , "internal" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "iso8859_to_utf8"+> [ "int4" , "int4" , "internal" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "iso_to_koi8r"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "iso_to_mic"+> [ "int4" , "int4" , "int4" , "cstring" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "iso_to_win1251"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "iso_to_win866"+> [ "internal" , "int4" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction "isopen" [ "path" ] False "bool"+> , CatCreateFunction "isparallel" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "isparallel" [ "line" , "line" ] False "bool"+> , CatCreateFunction "isperp" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "isperp" [ "line" , "line" ] False "bool"+> , CatCreateFunction "isvertical" [ "point" , "point" ] False "bool"+> , CatCreateFunction "isvertical" [ "lseg" ] False "bool"+> , CatCreateFunction "isvertical" [ "line" ] False "bool"+> , CatCreateFunction+> "johab_to_utf8"+> [ "int4" , "cstring" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction "json_agg_finalfn" [ "internal" ] False "json"+> , CatCreateFunction+> "json_agg_transfn" [ "internal" , "anyelement" ] False "internal"+> , CatCreateFunction+> "json_array_element" [ "int4" , "json" ] False "json"+> , CatCreateFunction+> "json_array_element_text" [ "int4" , "json" ] False "text"+> , CatCreateFunction "json_array_elements" [ "json" ] True "json"+> , CatCreateFunction+> "json_array_elements_text" [ "json" ] True "text"+> , CatCreateFunction "json_array_length" [ "json" ] False "int4"+> , CatCreateFunction "json_each" [ "json" ] True "record"+> , CatCreateFunction "json_each_text" [ "json" ] True "record"+> , CatCreateFunction "json_in" [ "cstring" ] False "json"+> , CatCreateFunction "json_object" [ "_text" ] False "json"+> , CatCreateFunction+> "json_object" [ "_text" , "_text" ] False "json"+> , CatCreateFunction+> "json_object_agg_finalfn" [ "internal" ] False "json"+> , CatCreateFunction+> "json_object_agg_transfn"+> [ "any" , "internal" , "any" ]+> False+> "internal"+> , CatCreateFunction+> "json_object_field" [ "text" , "json" ] False "json"+> , CatCreateFunction+> "json_object_field_text" [ "json" , "text" ] False "text"+> , CatCreateFunction "json_object_keys" [ "json" ] True "text"+> , CatCreateFunction "json_out" [ "json" ] False "cstring"+> , CatCreateFunction+> "json_populate_record"+> [ "json" , "anyelement" , "bool" ]+> False+> "anyelement"+> , CatCreateFunction+> "json_populate_recordset"+> [ "anyelement" , "json" , "bool" ]+> True+> "anyelement"+> , CatCreateFunction "json_recv" [ "internal" ] False "json"+> , CatCreateFunction "json_send" [ "json" ] False "bytea"+> , CatCreateFunction "json_to_record" [ "json" ] False "record"+> , CatCreateFunction "json_to_recordset" [ "json" ] True "record"+> , CatCreateFunction "json_typeof" [ "json" ] False "text"+> , CatCreateFunction+> "jsonb_array_element" [ "int4" , "jsonb" ] False "jsonb"+> , CatCreateFunction+> "jsonb_array_element_text" [ "int4" , "jsonb" ] False "text"+> , CatCreateFunction "jsonb_array_elements" [ "jsonb" ] True "jsonb"+> , CatCreateFunction+> "jsonb_array_elements_text" [ "jsonb" ] True "text"+> , CatCreateFunction "jsonb_array_length" [ "jsonb" ] False "int4"+> , CatCreateFunction "jsonb_cmp" [ "jsonb" , "jsonb" ] False "int4"+> , CatCreateFunction+> "jsonb_contained" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction+> "jsonb_contains" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction "jsonb_each" [ "jsonb" ] True "record"+> , CatCreateFunction "jsonb_each_text" [ "jsonb" ] True "record"+> , CatCreateFunction "jsonb_eq" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction+> "jsonb_exists" [ "jsonb" , "text" ] False "bool"+> , CatCreateFunction+> "jsonb_exists_all" [ "_text" , "jsonb" ] False "bool"+> , CatCreateFunction+> "jsonb_exists_any" [ "_text" , "jsonb" ] False "bool"+> , CatCreateFunction "jsonb_ge" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction "jsonb_gt" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction "jsonb_hash" [ "jsonb" ] False "int4"+> , CatCreateFunction "jsonb_in" [ "cstring" ] False "jsonb"+> , CatCreateFunction "jsonb_le" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction "jsonb_lt" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction "jsonb_ne" [ "jsonb" , "jsonb" ] False "bool"+> , CatCreateFunction+> "jsonb_object_field" [ "text" , "jsonb" ] False "jsonb"+> , CatCreateFunction+> "jsonb_object_field_text" [ "jsonb" , "text" ] False "text"+> , CatCreateFunction "jsonb_object_keys" [ "jsonb" ] True "text"+> , CatCreateFunction "jsonb_out" [ "jsonb" ] False "cstring"+> , CatCreateFunction+> "jsonb_populate_record"+> [ "jsonb" , "anyelement" ]+> False+> "anyelement"+> , CatCreateFunction+> "jsonb_populate_recordset"+> [ "anyelement" , "jsonb" ]+> True+> "anyelement"+> , CatCreateFunction "jsonb_recv" [ "internal" ] False "jsonb"+> , CatCreateFunction "jsonb_send" [ "jsonb" ] False "bytea"+> , CatCreateFunction "jsonb_to_record" [ "jsonb" ] False "record"+> , CatCreateFunction "jsonb_to_recordset" [ "jsonb" ] True "record"+> , CatCreateFunction "jsonb_typeof" [ "jsonb" ] False "text"+> , CatCreateFunction "justify_days" [ "interval" ] False "interval"+> , CatCreateFunction "justify_hours" [ "interval" ] False "interval"+> , CatCreateFunction+> "justify_interval" [ "interval" ] False "interval"+> , CatCreateFunction+> "koi8r_to_iso"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "koi8r_to_mic"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "koi8r_to_utf8"+> [ "int4" , "cstring" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "koi8r_to_win1251"+> [ "int4" , "internal" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "koi8r_to_win866"+> [ "cstring" , "int4" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "koi8u_to_utf8"+> [ "internal" , "int4" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "language_handler_in" [ "cstring" ] False "language_handler"+> , CatCreateFunction+> "language_handler_out" [ "language_handler" ] False "cstring"+> , CatCreateFunction+> "latin1_to_mic"+> [ "int4" , "cstring" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "latin2_to_mic"+> [ "int4" , "int4" , "cstring" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "latin2_to_win1250"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "latin3_to_mic"+> [ "int4" , "int4" , "int4" , "cstring" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "latin4_to_mic"+> [ "internal" , "int4" , "int4" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction "left" [ "int4" , "text" ] False "text"+> , CatCreateFunction "length" [ "text" ] False "int4"+> , CatCreateFunction "length" [ "bpchar" ] False "int4"+> , CatCreateFunction "length" [ "lseg" ] False "float8"+> , CatCreateFunction "length" [ "path" ] False "float8"+> , CatCreateFunction "length" [ "bit" ] False "int4"+> , CatCreateFunction "length" [ "bytea" , "name" ] False "int4"+> , CatCreateFunction "length" [ "bytea" ] False "int4"+> , CatCreateFunction "length" [ "tsvector" ] False "int4"+> , CatCreateFunction "like" [ "text" , "text" ] False "bool"+> , CatCreateFunction "like" [ "text" , "name" ] False "bool"+> , CatCreateFunction "like" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "like_escape" [ "text" , "text" ] False "text"+> , CatCreateFunction+> "like_escape" [ "bytea" , "bytea" ] False "bytea"+> , CatCreateFunction+> "likejoinsel"+> [ "int2" , "internal" , "internal" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "likesel"+> [ "int4" , "oid" , "internal" , "internal" ]+> False+> "float8"+> , CatCreateFunction "line" [ "point" , "point" ] False "line"+> , CatCreateFunction+> "line_distance" [ "line" , "line" ] False "float8"+> , CatCreateFunction "line_eq" [ "line" , "line" ] False "bool"+> , CatCreateFunction "line_horizontal" [ "line" ] False "bool"+> , CatCreateFunction "line_in" [ "cstring" ] False "line"+> , CatCreateFunction+> "line_interpt" [ "line" , "line" ] False "point"+> , CatCreateFunction+> "line_intersect" [ "line" , "line" ] False "bool"+> , CatCreateFunction "line_out" [ "line" ] False "cstring"+> , CatCreateFunction+> "line_parallel" [ "line" , "line" ] False "bool"+> , CatCreateFunction "line_perp" [ "line" , "line" ] False "bool"+> , CatCreateFunction "line_recv" [ "internal" ] False "line"+> , CatCreateFunction "line_send" [ "line" ] False "bytea"+> , CatCreateFunction "line_vertical" [ "line" ] False "bool"+> , CatCreateFunction "ln" [ "float8" ] False "float8"+> , CatCreateFunction "ln" [ "numeric" ] False "numeric"+> , CatCreateFunction "lo_close" [ "int4" ] False "int4"+> , CatCreateFunction "lo_creat" [ "int4" ] False "oid"+> , CatCreateFunction "lo_create" [ "oid" ] False "oid"+> , CatCreateFunction "lo_export" [ "text" , "oid" ] False "int4"+> , CatCreateFunction "lo_from_bytea" [ "oid" , "bytea" ] False "oid"+> , CatCreateFunction "lo_get" [ "oid" ] False "bytea"+> , CatCreateFunction+> "lo_get" [ "int8" , "int4" , "oid" ] False "bytea"+> , CatCreateFunction "lo_import" [ "text" ] False "oid"+> , CatCreateFunction "lo_import" [ "oid" , "text" ] False "oid"+> , CatCreateFunction+> "lo_lseek" [ "int4" , "int4" , "int4" ] False "int4"+> , CatCreateFunction+> "lo_lseek64" [ "int4" , "int8" , "int4" ] False "int8"+> , CatCreateFunction "lo_open" [ "int4" , "oid" ] False "int4"+> , CatCreateFunction+> "lo_put" [ "bytea" , "oid" , "int8" ] False "void"+> , CatCreateFunction "lo_tell" [ "int4" ] False "int4"+> , CatCreateFunction "lo_tell64" [ "int4" ] False "int8"+> , CatCreateFunction "lo_truncate" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction+> "lo_truncate64" [ "int4" , "int8" ] False "int4"+> , CatCreateFunction "lo_unlink" [ "oid" ] False "int4"+> , CatCreateFunction "log" [ "float8" ] False "float8"+> , CatCreateFunction "log" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "log" [ "numeric" ] False "numeric"+> , CatCreateFunction "loread" [ "int4" , "int4" ] False "bytea"+> , CatCreateFunction "lower" [ "text" ] False "text"+> , CatCreateFunction "lower" [ "anyrange" ] False "anyelement"+> , CatCreateFunction "lower_inc" [ "anyrange" ] False "bool"+> , CatCreateFunction "lower_inf" [ "anyrange" ] False "bool"+> , CatCreateFunction "lowrite" [ "bytea" , "int4" ] False "int4"+> , CatCreateFunction+> "lpad" [ "int4" , "text" , "text" ] False "text"+> , CatCreateFunction "lpad" [ "text" , "int4" ] False "text"+> , CatCreateFunction "lseg" [ "point" , "point" ] False "lseg"+> , CatCreateFunction "lseg" [ "box" ] False "lseg"+> , CatCreateFunction "lseg_center" [ "lseg" ] False "point"+> , CatCreateFunction+> "lseg_distance" [ "lseg" , "lseg" ] False "float8"+> , CatCreateFunction "lseg_eq" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_ge" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_gt" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_horizontal" [ "lseg" ] False "bool"+> , CatCreateFunction "lseg_in" [ "cstring" ] False "lseg"+> , CatCreateFunction+> "lseg_interpt" [ "lseg" , "lseg" ] False "point"+> , CatCreateFunction+> "lseg_intersect" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_le" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_length" [ "lseg" ] False "float8"+> , CatCreateFunction "lseg_lt" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_ne" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_out" [ "lseg" ] False "cstring"+> , CatCreateFunction+> "lseg_parallel" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_perp" [ "lseg" , "lseg" ] False "bool"+> , CatCreateFunction "lseg_recv" [ "internal" ] False "lseg"+> , CatCreateFunction "lseg_send" [ "lseg" ] False "bytea"+> , CatCreateFunction "lseg_vertical" [ "lseg" ] False "bool"+> , CatCreateFunction "ltrim" [ "text" , "text" ] False "text"+> , CatCreateFunction "ltrim" [ "text" ] False "text"+> , CatCreateFunction+> "macaddr_and" [ "macaddr" , "macaddr" ] False "macaddr"+> , CatCreateFunction+> "macaddr_cmp" [ "macaddr" , "macaddr" ] False "int4"+> , CatCreateFunction+> "macaddr_eq" [ "macaddr" , "macaddr" ] False "bool"+> , CatCreateFunction+> "macaddr_ge" [ "macaddr" , "macaddr" ] False "bool"+> , CatCreateFunction+> "macaddr_gt" [ "macaddr" , "macaddr" ] False "bool"+> , CatCreateFunction "macaddr_in" [ "cstring" ] False "macaddr"+> , CatCreateFunction+> "macaddr_le" [ "macaddr" , "macaddr" ] False "bool"+> , CatCreateFunction+> "macaddr_lt" [ "macaddr" , "macaddr" ] False "bool"+> , CatCreateFunction+> "macaddr_ne" [ "macaddr" , "macaddr" ] False "bool"+> , CatCreateFunction "macaddr_not" [ "macaddr" ] False "macaddr"+> , CatCreateFunction+> "macaddr_or" [ "macaddr" , "macaddr" ] False "macaddr"+> , CatCreateFunction "macaddr_out" [ "macaddr" ] False "cstring"+> , CatCreateFunction "macaddr_recv" [ "internal" ] False "macaddr"+> , CatCreateFunction "macaddr_send" [ "macaddr" ] False "bytea"+> , CatCreateFunction+> "make_date" [ "int4" , "int4" , "int4" ] False "date"+> , CatCreateFunction+> "make_interval"+> [ "int4" , "int4" , "float8" , "int4" , "int4" , "int4" , "int4" ]+> False+> "interval"+> , CatCreateFunction+> "make_time" [ "int4" , "float8" , "int4" ] False "time"+> , CatCreateFunction+> "make_timestamp"+> [ "float8" , "int4" , "int4" , "int4" , "int4" , "int4" ]+> False+> "timestamp"+> , CatCreateFunction+> "make_timestamptz"+> [ "int4" , "int4" , "float8" , "int4" , "int4" , "int4" ]+> False+> "timestamptz"+> , CatCreateFunction+> "make_timestamptz"+> [ "float8" , "int4" , "int4" , "int4" , "int4" , "int4" , "text" ]+> False+> "timestamptz"+> , CatCreateFunction+> "makeaclitem" [ "oid" , "oid" , "text" , "bool" ] False "aclitem"+> , CatCreateFunction "masklen" [ "inet" ] False "int4"+> , CatCreateFunction "md5" [ "text" ] False "text"+> , CatCreateFunction "md5" [ "bytea" ] False "text"+> , CatCreateFunction+> "mic_to_ascii"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_big5"+> [ "int4" , "int4" , "int4" , "cstring" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_euc_cn"+> [ "int4" , "int4" , "internal" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_euc_jp"+> [ "int4" , "int4" , "cstring" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_euc_kr"+> [ "cstring" , "int4" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_euc_tw"+> [ "int4" , "internal" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_iso"+> [ "int4" , "cstring" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_koi8r"+> [ "int4" , "cstring" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_latin1"+> [ "cstring" , "int4" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_latin2"+> [ "int4" , "internal" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_latin3"+> [ "internal" , "int4" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_latin4"+> [ "int4" , "internal" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_sjis"+> [ "cstring" , "int4" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_win1250"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_win1251"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mic_to_win866"+> [ "int4" , "cstring" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "mktinterval" [ "abstime" , "abstime" ] False "tinterval"+> , CatCreateFunction "mod" [ "int2" , "int2" ] False "int2"+> , CatCreateFunction "mod" [ "int4" , "int4" ] False "int4"+> , CatCreateFunction "mod" [ "int8" , "int8" ] False "int8"+> , CatCreateFunction "mod" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "mode_final" [ "internal" , "anyelement" ] False "anyelement"+> , CatCreateFunction "money" [ "int4" ] False "money"+> , CatCreateFunction "money" [ "int8" ] False "money"+> , CatCreateFunction "money" [ "numeric" ] False "money"+> , CatCreateFunction+> "mul_d_interval" [ "interval" , "float8" ] False "interval"+> , CatCreateFunction "name" [ "text" ] False "name"+> , CatCreateFunction "name" [ "bpchar" ] False "name"+> , CatCreateFunction "name" [ "varchar" ] False "name"+> , CatCreateFunction "nameeq" [ "name" , "name" ] False "bool"+> , CatCreateFunction "namege" [ "name" , "name" ] False "bool"+> , CatCreateFunction "namegt" [ "name" , "name" ] False "bool"+> , CatCreateFunction "nameiclike" [ "text" , "name" ] False "bool"+> , CatCreateFunction "nameicnlike" [ "name" , "text" ] False "bool"+> , CatCreateFunction+> "nameicregexeq" [ "name" , "text" ] False "bool"+> , CatCreateFunction+> "nameicregexne" [ "text" , "name" ] False "bool"+> , CatCreateFunction "namein" [ "cstring" ] False "name"+> , CatCreateFunction "namele" [ "name" , "name" ] False "bool"+> , CatCreateFunction "namelike" [ "name" , "text" ] False "bool"+> , CatCreateFunction "namelt" [ "name" , "name" ] False "bool"+> , CatCreateFunction "namene" [ "name" , "name" ] False "bool"+> , CatCreateFunction "namenlike" [ "name" , "text" ] False "bool"+> , CatCreateFunction "nameout" [ "name" ] False "cstring"+> , CatCreateFunction "namerecv" [ "internal" ] False "name"+> , CatCreateFunction "nameregexeq" [ "name" , "text" ] False "bool"+> , CatCreateFunction "nameregexne" [ "text" , "name" ] False "bool"+> , CatCreateFunction "namesend" [ "name" ] False "bytea"+> , CatCreateFunction+> "neqjoinsel"+> [ "internal" , "int2" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "neqsel"+> [ "int4" , "oid" , "internal" , "internal" ]+> False+> "float8"+> , CatCreateFunction "netmask" [ "inet" ] False "inet"+> , CatCreateFunction "network" [ "inet" ] False "cidr"+> , CatCreateFunction "network_cmp" [ "inet" , "inet" ] False "int4"+> , CatCreateFunction "network_eq" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_ge" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_gt" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_le" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_lt" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_ne" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction+> "network_overlap" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_sub" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction+> "network_subeq" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction "network_sup" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction+> "network_supeq" [ "inet" , "inet" ] False "bool"+> , CatCreateFunction+> "networkjoinsel"+> [ "int2" , "internal" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "networksel"+> [ "internal" , "int4" , "internal" , "oid" ]+> False+> "float8"+> , CatCreateFunction "nextval" [ "regclass" ] False "int8"+> , CatCreateFunction+> "nlikejoinsel"+> [ "int2" , "internal" , "oid" , "internal" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "nlikesel"+> [ "internal" , "internal" , "int4" , "oid" ]+> False+> "float8"+> , CatCreateFunction "notlike" [ "text" , "text" ] False "bool"+> , CatCreateFunction "notlike" [ "text" , "name" ] False "bool"+> , CatCreateFunction "notlike" [ "bytea" , "bytea" ] False "bool"+> , CatCreateFunction "npoints" [ "path" ] False "int4"+> , CatCreateFunction "npoints" [ "polygon" ] False "int4"+> , CatCreateFunction+> "numeric" [ "int4" , "numeric" ] False "numeric"+> , CatCreateFunction "numeric" [ "int4" ] False "numeric"+> , CatCreateFunction "numeric" [ "float4" ] False "numeric"+> , CatCreateFunction "numeric" [ "float8" ] False "numeric"+> , CatCreateFunction "numeric" [ "int8" ] False "numeric"+> , CatCreateFunction "numeric" [ "int2" ] False "numeric"+> , CatCreateFunction "numeric" [ "money" ] False "numeric"+> , CatCreateFunction "numeric_abs" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_accum" [ "internal" , "numeric" ] False "internal"+> , CatCreateFunction+> "numeric_accum_inv" [ "numeric" , "internal" ] False "internal"+> , CatCreateFunction+> "numeric_add" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "numeric_avg" [ "internal" ] False "numeric"+> , CatCreateFunction+> "numeric_avg_accum" [ "internal" , "numeric" ] False "internal"+> , CatCreateFunction+> "numeric_cmp" [ "numeric" , "numeric" ] False "int4"+> , CatCreateFunction+> "numeric_div" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_div_trunc" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_eq" [ "numeric" , "numeric" ] False "bool"+> , CatCreateFunction "numeric_exp" [ "numeric" ] False "numeric"+> , CatCreateFunction "numeric_fac" [ "int8" ] False "numeric"+> , CatCreateFunction+> "numeric_ge" [ "numeric" , "numeric" ] False "bool"+> , CatCreateFunction+> "numeric_gt" [ "numeric" , "numeric" ] False "bool"+> , CatCreateFunction+> "numeric_in" [ "cstring" , "oid" , "int4" ] False "numeric"+> , CatCreateFunction "numeric_inc" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_larger" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_le" [ "numeric" , "numeric" ] False "bool"+> , CatCreateFunction "numeric_ln" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_log" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_lt" [ "numeric" , "numeric" ] False "bool"+> , CatCreateFunction+> "numeric_mod" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_mul" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_ne" [ "numeric" , "numeric" ] False "bool"+> , CatCreateFunction "numeric_out" [ "numeric" ] False "cstring"+> , CatCreateFunction+> "numeric_power" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_recv" [ "internal" , "oid" , "int4" ] False "numeric"+> , CatCreateFunction "numeric_send" [ "numeric" ] False "bytea"+> , CatCreateFunction+> "numeric_smaller" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "numeric_sqrt" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_stddev_pop" [ "internal" ] False "numeric"+> , CatCreateFunction+> "numeric_stddev_samp" [ "internal" ] False "numeric"+> , CatCreateFunction+> "numeric_sub" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "numeric_sum" [ "internal" ] False "numeric"+> , CatCreateFunction+> "numeric_transform" [ "internal" ] False "internal"+> , CatCreateFunction "numeric_uminus" [ "numeric" ] False "numeric"+> , CatCreateFunction "numeric_uplus" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "numeric_var_pop" [ "internal" ] False "numeric"+> , CatCreateFunction+> "numeric_var_samp" [ "internal" ] False "numeric"+> , CatCreateFunction "numerictypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "numerictypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "numnode" [ "tsquery" ] False "int4"+> , CatCreateFunction+> "numrange" [ "numeric" , "numeric" ] False "numrange"+> , CatCreateFunction+> "numrange" [ "text" , "numeric" , "numeric" ] False "numrange"+> , CatCreateFunction+> "numrange_subdiff" [ "numeric" , "numeric" ] False "float8"+> , CatCreateFunction+> "obj_description" [ "name" , "oid" ] False "text"+> , CatCreateFunction "obj_description" [ "oid" ] False "text"+> , CatCreateFunction "octet_length" [ "bytea" ] False "int4"+> , CatCreateFunction "octet_length" [ "text" ] False "int4"+> , CatCreateFunction "octet_length" [ "bpchar" ] False "int4"+> , CatCreateFunction "octet_length" [ "bit" ] False "int4"+> , CatCreateFunction "oid" [ "int8" ] False "oid"+> , CatCreateFunction "oideq" [ "oid" , "oid" ] False "bool"+> , CatCreateFunction "oidge" [ "oid" , "oid" ] False "bool"+> , CatCreateFunction "oidgt" [ "oid" , "oid" ] False "bool"+> , CatCreateFunction "oidin" [ "cstring" ] False "oid"+> , CatCreateFunction "oidlarger" [ "oid" , "oid" ] False "oid"+> , CatCreateFunction "oidle" [ "oid" , "oid" ] False "bool"+> , CatCreateFunction "oidlt" [ "oid" , "oid" ] False "bool"+> , CatCreateFunction "oidne" [ "oid" , "oid" ] False "bool"+> , CatCreateFunction "oidout" [ "oid" ] False "cstring"+> , CatCreateFunction "oidrecv" [ "internal" ] False "oid"+> , CatCreateFunction "oidsend" [ "oid" ] False "bytea"+> , CatCreateFunction "oidsmaller" [ "oid" , "oid" ] False "oid"+> , CatCreateFunction+> "oidvectoreq" [ "oidvector" , "oidvector" ] False "bool"+> , CatCreateFunction+> "oidvectorge" [ "oidvector" , "oidvector" ] False "bool"+> , CatCreateFunction+> "oidvectorgt" [ "oidvector" , "oidvector" ] False "bool"+> , CatCreateFunction "oidvectorin" [ "cstring" ] False "oidvector"+> , CatCreateFunction+> "oidvectorle" [ "oidvector" , "oidvector" ] False "bool"+> , CatCreateFunction+> "oidvectorlt" [ "oidvector" , "oidvector" ] False "bool"+> , CatCreateFunction+> "oidvectorne" [ "oidvector" , "oidvector" ] False "bool"+> , CatCreateFunction "oidvectorout" [ "oidvector" ] False "cstring"+> , CatCreateFunction+> "oidvectorrecv" [ "internal" ] False "oidvector"+> , CatCreateFunction "oidvectorsend" [ "oidvector" ] False "bytea"+> , CatCreateFunction "oidvectortypes" [ "oidvector" ] False "text"+> , CatCreateFunction "on_pb" [ "box" , "point" ] False "bool"+> , CatCreateFunction "on_pl" [ "point" , "line" ] False "bool"+> , CatCreateFunction "on_ppath" [ "path" , "point" ] False "bool"+> , CatCreateFunction "on_ps" [ "lseg" , "point" ] False "bool"+> , CatCreateFunction "on_sb" [ "box" , "lseg" ] False "bool"+> , CatCreateFunction "on_sl" [ "lseg" , "line" ] False "bool"+> , CatCreateFunction "opaque_in" [ "cstring" ] False "opaque"+> , CatCreateFunction "opaque_out" [ "opaque" ] False "cstring"+> , CatCreateFunction+> "ordered_set_transition" [ "internal" , "any" ] False "internal"+> , CatCreateFunction+> "overlaps"+> [ "timetz" , "timetz" , "timetz" , "timetz" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "timestamptz" , "timestamptz" , "timestamptz" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "interval" , "timestamptz" , "interval" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "interval" , "timestamptz" , "timestamptz" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "timestamptz" , "timestamptz" , "interval" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps" [ "time" , "time" , "time" , "time" ] False "bool"+> , CatCreateFunction+> "overlaps"+> [ "time" , "interval" , "time" , "interval" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps" [ "interval" , "time" , "time" , "time" ] False "bool"+> , CatCreateFunction+> "overlaps" [ "time" , "time" , "interval" , "time" ] False "bool"+> , CatCreateFunction+> "overlaps"+> [ "timestamp" , "timestamp" , "timestamp" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "timestamp" , "interval" , "timestamp" , "interval" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "timestamp" , "timestamp" , "timestamp" , "interval" ]+> False+> "bool"+> , CatCreateFunction+> "overlaps"+> [ "timestamp" , "interval" , "timestamp" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "overlay" [ "bytea" , "bytea" , "int4" , "int4" ] False "bytea"+> , CatCreateFunction+> "overlay" [ "int4" , "bytea" , "bytea" ] False "bytea"+> , CatCreateFunction+> "overlay" [ "int4" , "int4" , "text" , "text" ] False "text"+> , CatCreateFunction+> "overlay" [ "text" , "text" , "int4" ] False "text"+> , CatCreateFunction+> "overlay" [ "bit" , "int4" , "int4" , "bit" ] False "bit"+> , CatCreateFunction+> "overlay" [ "int4" , "bit" , "bit" ] False "bit"+> , CatCreateFunction "path" [ "polygon" ] False "path"+> , CatCreateFunction "path_add" [ "path" , "path" ] False "path"+> , CatCreateFunction "path_add_pt" [ "path" , "point" ] False "path"+> , CatCreateFunction "path_center" [ "path" ] False "point"+> , CatCreateFunction+> "path_contain_pt" [ "point" , "path" ] False "bool"+> , CatCreateFunction+> "path_distance" [ "path" , "path" ] False "float8"+> , CatCreateFunction "path_div_pt" [ "point" , "path" ] False "path"+> , CatCreateFunction "path_in" [ "cstring" ] False "path"+> , CatCreateFunction "path_inter" [ "path" , "path" ] False "bool"+> , CatCreateFunction "path_length" [ "path" ] False "float8"+> , CatCreateFunction "path_mul_pt" [ "path" , "point" ] False "path"+> , CatCreateFunction "path_n_eq" [ "path" , "path" ] False "bool"+> , CatCreateFunction "path_n_ge" [ "path" , "path" ] False "bool"+> , CatCreateFunction "path_n_gt" [ "path" , "path" ] False "bool"+> , CatCreateFunction "path_n_le" [ "path" , "path" ] False "bool"+> , CatCreateFunction "path_n_lt" [ "path" , "path" ] False "bool"+> , CatCreateFunction "path_npoints" [ "path" ] False "int4"+> , CatCreateFunction "path_out" [ "path" ] False "cstring"+> , CatCreateFunction "path_recv" [ "internal" ] False "path"+> , CatCreateFunction "path_send" [ "path" ] False "bytea"+> , CatCreateFunction "path_sub_pt" [ "path" , "point" ] False "path"+> , CatCreateFunction "pclose" [ "path" ] False "path"+> , CatCreateFunction+> "percentile_cont_float8_final"+> [ "internal" , "float8" ]+> False+> "float8"+> , CatCreateFunction+> "percentile_cont_float8_multi_final"+> [ "_float8" , "internal" ]+> False+> "_float8"+> , CatCreateFunction+> "percentile_cont_interval_final"+> [ "internal" , "float8" ]+> False+> "interval"+> , CatCreateFunction+> "percentile_cont_interval_multi_final"+> [ "_float8" , "internal" ]+> False+> "_interval"+> , CatCreateFunction+> "percentile_disc_final"+> [ "float8" , "anyelement" , "internal" ]+> False+> "anyelement"+> , CatCreateFunction+> "percentile_disc_multi_final"+> [ "internal" , "_float8" , "anyelement" ]+> False+> "anyarray"+> , CatCreateFunction "pg_advisory_lock" [ "int8" ] False "void"+> , CatCreateFunction+> "pg_advisory_lock" [ "int4" , "int4" ] False "void"+> , CatCreateFunction+> "pg_advisory_lock_shared" [ "int8" ] False "void"+> , CatCreateFunction+> "pg_advisory_lock_shared" [ "int4" , "int4" ] False "void"+> , CatCreateFunction "pg_advisory_unlock" [ "int8" ] False "bool"+> , CatCreateFunction+> "pg_advisory_unlock" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction+> "pg_advisory_unlock_shared" [ "int8" ] False "bool"+> , CatCreateFunction+> "pg_advisory_unlock_shared" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction "pg_advisory_xact_lock" [ "int8" ] False "void"+> , CatCreateFunction+> "pg_advisory_xact_lock" [ "int4" , "int4" ] False "void"+> , CatCreateFunction+> "pg_advisory_xact_lock_shared" [ "int8" ] False "void"+> , CatCreateFunction+> "pg_advisory_xact_lock_shared" [ "int4" , "int4" ] False "void"+> , CatCreateFunction "pg_cancel_backend" [ "int4" ] False "bool"+> , CatCreateFunction "pg_char_to_encoding" [ "name" ] False "int4"+> , CatCreateFunction "pg_collation_for" [ "any" ] False "text"+> , CatCreateFunction+> "pg_collation_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction+> "pg_column_is_updatable"+> [ "regclass" , "int2" , "bool" ]+> False+> "bool"+> , CatCreateFunction "pg_column_size" [ "any" ] False "int4"+> , CatCreateFunction+> "pg_conversion_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction+> "pg_create_logical_replication_slot"+> [ "name" , "name" ]+> False+> "record"+> , CatCreateFunction+> "pg_create_physical_replication_slot" [ "name" ] False "record"+> , CatCreateFunction+> "pg_create_restore_point" [ "text" ] False "pg_lsn"+> , CatCreateFunction "pg_database_size" [ "name" ] False "int8"+> , CatCreateFunction "pg_database_size" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_describe_object" [ "oid" , "oid" , "int4" ] False "text"+> , CatCreateFunction+> "pg_drop_replication_slot" [ "name" ] False "void"+> , CatCreateFunction+> "pg_encoding_max_length" [ "int4" ] False "int4"+> , CatCreateFunction "pg_encoding_to_char" [ "int4" ] False "name"+> , CatCreateFunction+> "pg_extension_config_dump" [ "regclass" , "text" ] False "void"+> , CatCreateFunction+> "pg_extension_update_paths" [ "name" ] True "record"+> , CatCreateFunction+> "pg_filenode_relation" [ "oid" , "oid" ] False "regclass"+> , CatCreateFunction "pg_function_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_get_constraintdef" [ "oid" ] False "text"+> , CatCreateFunction+> "pg_get_constraintdef" [ "oid" , "bool" ] False "text"+> , CatCreateFunction+> "pg_get_expr" [ "oid" , "pg_node_tree" ] False "text"+> , CatCreateFunction+> "pg_get_expr" [ "oid" , "bool" , "pg_node_tree" ] False "text"+> , CatCreateFunction+> "pg_get_function_arg_default" [ "oid" , "int4" ] False "text"+> , CatCreateFunction+> "pg_get_function_arguments" [ "oid" ] False "text"+> , CatCreateFunction+> "pg_get_function_identity_arguments" [ "oid" ] False "text"+> , CatCreateFunction "pg_get_function_result" [ "oid" ] False "text"+> , CatCreateFunction "pg_get_functiondef" [ "oid" ] False "text"+> , CatCreateFunction "pg_get_indexdef" [ "oid" ] False "text"+> , CatCreateFunction+> "pg_get_indexdef" [ "oid" , "int4" , "bool" ] False "text"+> , CatCreateFunction+> "pg_get_multixact_members" [ "xid" ] True "record"+> , CatCreateFunction "pg_get_ruledef" [ "oid" ] False "text"+> , CatCreateFunction+> "pg_get_ruledef" [ "oid" , "bool" ] False "text"+> , CatCreateFunction+> "pg_get_serial_sequence" [ "text" , "text" ] False "text"+> , CatCreateFunction "pg_get_triggerdef" [ "oid" ] False "text"+> , CatCreateFunction+> "pg_get_triggerdef" [ "bool" , "oid" ] False "text"+> , CatCreateFunction "pg_get_userbyid" [ "oid" ] False "name"+> , CatCreateFunction "pg_get_viewdef" [ "text" ] False "text"+> , CatCreateFunction "pg_get_viewdef" [ "oid" ] False "text"+> , CatCreateFunction+> "pg_get_viewdef" [ "bool" , "text" ] False "text"+> , CatCreateFunction+> "pg_get_viewdef" [ "oid" , "bool" ] False "text"+> , CatCreateFunction+> "pg_get_viewdef" [ "int4" , "oid" ] False "text"+> , CatCreateFunction+> "pg_has_role" [ "text" , "name" , "name" ] False "bool"+> , CatCreateFunction+> "pg_has_role" [ "text" , "name" , "oid" ] False "bool"+> , CatCreateFunction+> "pg_has_role" [ "oid" , "name" , "text" ] False "bool"+> , CatCreateFunction+> "pg_has_role" [ "oid" , "oid" , "text" ] False "bool"+> , CatCreateFunction "pg_has_role" [ "text" , "name" ] False "bool"+> , CatCreateFunction "pg_has_role" [ "oid" , "text" ] False "bool"+> , CatCreateFunction+> "pg_identify_object" [ "oid" , "int4" , "oid" ] False "record"+> , CatCreateFunction "pg_indexes_size" [ "regclass" ] False "int8"+> , CatCreateFunction+> "pg_is_other_temp_schema" [ "oid" ] False "bool"+> , CatCreateFunction "pg_ls_dir" [ "text" ] True "text"+> , CatCreateFunction+> "pg_lsn_cmp" [ "pg_lsn" , "pg_lsn" ] False "int4"+> , CatCreateFunction+> "pg_lsn_eq" [ "pg_lsn" , "pg_lsn" ] False "bool"+> , CatCreateFunction+> "pg_lsn_ge" [ "pg_lsn" , "pg_lsn" ] False "bool"+> , CatCreateFunction+> "pg_lsn_gt" [ "pg_lsn" , "pg_lsn" ] False "bool"+> , CatCreateFunction "pg_lsn_hash" [ "pg_lsn" ] False "int4"+> , CatCreateFunction "pg_lsn_in" [ "cstring" ] False "pg_lsn"+> , CatCreateFunction+> "pg_lsn_le" [ "pg_lsn" , "pg_lsn" ] False "bool"+> , CatCreateFunction+> "pg_lsn_lt" [ "pg_lsn" , "pg_lsn" ] False "bool"+> , CatCreateFunction+> "pg_lsn_mi" [ "pg_lsn" , "pg_lsn" ] False "numeric"+> , CatCreateFunction+> "pg_lsn_ne" [ "pg_lsn" , "pg_lsn" ] False "bool"+> , CatCreateFunction "pg_lsn_out" [ "pg_lsn" ] False "cstring"+> , CatCreateFunction "pg_lsn_recv" [ "internal" ] False "pg_lsn"+> , CatCreateFunction "pg_lsn_send" [ "pg_lsn" ] False "bytea"+> , CatCreateFunction+> "pg_node_tree_in" [ "cstring" ] False "pg_node_tree"+> , CatCreateFunction+> "pg_node_tree_out" [ "pg_node_tree" ] False "cstring"+> , CatCreateFunction+> "pg_node_tree_recv" [ "internal" ] False "pg_node_tree"+> , CatCreateFunction+> "pg_node_tree_send" [ "pg_node_tree" ] False "bytea"+> , CatCreateFunction "pg_notify" [ "text" , "text" ] False "void"+> , CatCreateFunction "pg_opclass_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_operator_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_opfamily_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_options_to_table" [ "_text" ] True "record"+> , CatCreateFunction+> "pg_read_binary_file" [ "int8" , "text" , "int8" ] False "bytea"+> , CatCreateFunction "pg_read_binary_file" [ "text" ] False "bytea"+> , CatCreateFunction+> "pg_read_file" [ "text" , "int8" , "int8" ] False "text"+> , CatCreateFunction "pg_read_file" [ "text" ] False "text"+> , CatCreateFunction+> "pg_relation_filenode" [ "regclass" ] False "oid"+> , CatCreateFunction+> "pg_relation_filepath" [ "regclass" ] False "text"+> , CatCreateFunction+> "pg_relation_is_updatable" [ "bool" , "regclass" ] False "int4"+> , CatCreateFunction "pg_relation_size" [ "regclass" ] False "int8"+> , CatCreateFunction+> "pg_relation_size" [ "regclass" , "text" ] False "int8"+> , CatCreateFunction+> "pg_sequence_parameters" [ "oid" ] False "record"+> , CatCreateFunction "pg_size_pretty" [ "int8" ] False "text"+> , CatCreateFunction "pg_size_pretty" [ "numeric" ] False "text"+> , CatCreateFunction "pg_sleep" [ "float8" ] False "void"+> , CatCreateFunction "pg_sleep_for" [ "interval" ] False "void"+> , CatCreateFunction "pg_sleep_until" [ "timestamptz" ] False "void"+> , CatCreateFunction+> "pg_start_backup" [ "bool" , "text" ] False "pg_lsn"+> , CatCreateFunction "pg_stat_file" [ "text" ] False "record"+> , CatCreateFunction "pg_stat_get_activity" [ "int4" ] True "record"+> , CatCreateFunction+> "pg_stat_get_analyze_count" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_autoanalyze_count" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_autovacuum_count" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_backend_activity" [ "int4" ] False "text"+> , CatCreateFunction+> "pg_stat_get_backend_activity_start" [ "int4" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_backend_client_addr" [ "int4" ] False "inet"+> , CatCreateFunction+> "pg_stat_get_backend_client_port" [ "int4" ] False "int4"+> , CatCreateFunction+> "pg_stat_get_backend_dbid" [ "int4" ] False "oid"+> , CatCreateFunction+> "pg_stat_get_backend_pid" [ "int4" ] False "int4"+> , CatCreateFunction+> "pg_stat_get_backend_start" [ "int4" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_backend_userid" [ "int4" ] False "oid"+> , CatCreateFunction+> "pg_stat_get_backend_waiting" [ "int4" ] False "bool"+> , CatCreateFunction+> "pg_stat_get_backend_xact_start" [ "int4" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_blocks_fetched" [ "oid" ] False "int8"+> , CatCreateFunction "pg_stat_get_blocks_hit" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_blk_read_time" [ "oid" ] False "float8"+> , CatCreateFunction+> "pg_stat_get_db_blk_write_time" [ "oid" ] False "float8"+> , CatCreateFunction+> "pg_stat_get_db_blocks_fetched" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_blocks_hit" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_conflict_all" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_conflict_bufferpin" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_conflict_lock" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_conflict_snapshot" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_conflict_startup_deadlock" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_conflict_tablespace" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_deadlocks" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_numbackends" [ "oid" ] False "int4"+> , CatCreateFunction+> "pg_stat_get_db_stat_reset_time" [ "oid" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_db_temp_bytes" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_temp_files" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_tuples_deleted" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_tuples_fetched" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_tuples_inserted" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_tuples_returned" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_tuples_updated" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_xact_commit" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_db_xact_rollback" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_dead_tuples" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_function_calls" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_function_self_time" [ "oid" ] False "float8"+> , CatCreateFunction+> "pg_stat_get_function_total_time" [ "oid" ] False "float8"+> , CatCreateFunction+> "pg_stat_get_last_analyze_time" [ "oid" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_last_autoanalyze_time" [ "oid" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_last_autovacuum_time" [ "oid" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_last_vacuum_time" [ "oid" ] False "timestamptz"+> , CatCreateFunction+> "pg_stat_get_live_tuples" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_mod_since_analyze" [ "oid" ] False "int8"+> , CatCreateFunction "pg_stat_get_numscans" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_tuples_deleted" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_tuples_fetched" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_tuples_hot_updated" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_tuples_inserted" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_tuples_returned" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_tuples_updated" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_vacuum_count" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_blocks_fetched" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_blocks_hit" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_function_calls" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_function_self_time" [ "oid" ] False "float8"+> , CatCreateFunction+> "pg_stat_get_xact_function_total_time" [ "oid" ] False "float8"+> , CatCreateFunction+> "pg_stat_get_xact_numscans" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_tuples_deleted" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_tuples_fetched" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_tuples_hot_updated" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_tuples_inserted" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_tuples_returned" [ "oid" ] False "int8"+> , CatCreateFunction+> "pg_stat_get_xact_tuples_updated" [ "oid" ] False "int8"+> , CatCreateFunction "pg_stat_reset_shared" [ "text" ] False "void"+> , CatCreateFunction+> "pg_stat_reset_single_function_counters" [ "oid" ] False "void"+> , CatCreateFunction+> "pg_stat_reset_single_table_counters" [ "oid" ] False "void"+> , CatCreateFunction "pg_table_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_table_size" [ "regclass" ] False "int8"+> , CatCreateFunction "pg_tablespace_databases" [ "oid" ] True "oid"+> , CatCreateFunction "pg_tablespace_location" [ "oid" ] False "text"+> , CatCreateFunction "pg_tablespace_size" [ "oid" ] False "int8"+> , CatCreateFunction "pg_tablespace_size" [ "name" ] False "int8"+> , CatCreateFunction "pg_terminate_backend" [ "int4" ] False "bool"+> , CatCreateFunction+> "pg_total_relation_size" [ "regclass" ] False "int8"+> , CatCreateFunction "pg_try_advisory_lock" [ "int8" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_lock" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_lock_shared" [ "int8" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_lock_shared" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_xact_lock" [ "int8" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_xact_lock" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_xact_lock_shared" [ "int8" ] False "bool"+> , CatCreateFunction+> "pg_try_advisory_xact_lock_shared" [ "int4" , "int4" ] False "bool"+> , CatCreateFunction+> "pg_ts_config_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_ts_dict_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction+> "pg_ts_parser_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction+> "pg_ts_template_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_type_is_visible" [ "oid" ] False "bool"+> , CatCreateFunction "pg_typeof" [ "any" ] False "regtype"+> , CatCreateFunction+> "pg_xlog_location_diff" [ "pg_lsn" , "pg_lsn" ] False "numeric"+> , CatCreateFunction "pg_xlogfile_name" [ "pg_lsn" ] False "text"+> , CatCreateFunction+> "pg_xlogfile_name_offset" [ "pg_lsn" ] False "record"+> , CatCreateFunction+> "plainto_tsquery" [ "regconfig" , "text" ] False "tsquery"+> , CatCreateFunction "plainto_tsquery" [ "text" ] False "tsquery"+> , CatCreateFunction+> "plpgsql_inline_handler" [ "internal" ] False "void"+> , CatCreateFunction "plpgsql_validator" [ "oid" ] False "void"+> , CatCreateFunction "point" [ "circle" ] False "point"+> , CatCreateFunction "point" [ "float8" , "float8" ] False "point"+> , CatCreateFunction "point" [ "lseg" ] False "point"+> , CatCreateFunction "point" [ "path" ] False "point"+> , CatCreateFunction "point" [ "box" ] False "point"+> , CatCreateFunction "point" [ "polygon" ] False "point"+> , CatCreateFunction+> "point_above" [ "point" , "point" ] False "bool"+> , CatCreateFunction "point_add" [ "point" , "point" ] False "point"+> , CatCreateFunction+> "point_below" [ "point" , "point" ] False "bool"+> , CatCreateFunction+> "point_distance" [ "point" , "point" ] False "float8"+> , CatCreateFunction "point_div" [ "point" , "point" ] False "point"+> , CatCreateFunction "point_eq" [ "point" , "point" ] False "bool"+> , CatCreateFunction+> "point_horiz" [ "point" , "point" ] False "bool"+> , CatCreateFunction "point_in" [ "cstring" ] False "point"+> , CatCreateFunction "point_left" [ "point" , "point" ] False "bool"+> , CatCreateFunction "point_mul" [ "point" , "point" ] False "point"+> , CatCreateFunction "point_ne" [ "point" , "point" ] False "bool"+> , CatCreateFunction "point_out" [ "point" ] False "cstring"+> , CatCreateFunction "point_recv" [ "internal" ] False "point"+> , CatCreateFunction+> "point_right" [ "point" , "point" ] False "bool"+> , CatCreateFunction "point_send" [ "point" ] False "bytea"+> , CatCreateFunction "point_sub" [ "point" , "point" ] False "point"+> , CatCreateFunction "point_vert" [ "point" , "point" ] False "bool"+> , CatCreateFunction+> "poly_above" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_below" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction "poly_center" [ "polygon" ] False "point"+> , CatCreateFunction+> "poly_contain" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_contain_pt" [ "polygon" , "point" ] False "bool"+> , CatCreateFunction+> "poly_contained" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_distance" [ "polygon" , "polygon" ] False "float8"+> , CatCreateFunction "poly_in" [ "cstring" ] False "polygon"+> , CatCreateFunction+> "poly_left" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction "poly_npoints" [ "polygon" ] False "int4"+> , CatCreateFunction "poly_out" [ "polygon" ] False "cstring"+> , CatCreateFunction+> "poly_overabove" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_overbelow" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_overlap" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_overleft" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_overright" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction "poly_recv" [ "internal" ] False "polygon"+> , CatCreateFunction+> "poly_right" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction+> "poly_same" [ "polygon" , "polygon" ] False "bool"+> , CatCreateFunction "poly_send" [ "polygon" ] False "bytea"+> , CatCreateFunction "polygon" [ "box" ] False "polygon"+> , CatCreateFunction "polygon" [ "path" ] False "polygon"+> , CatCreateFunction "polygon" [ "circle" , "int4" ] False "polygon"+> , CatCreateFunction "polygon" [ "circle" ] False "polygon"+> , CatCreateFunction "popen" [ "path" ] False "path"+> , CatCreateFunction "position" [ "text" , "text" ] False "int4"+> , CatCreateFunction "position" [ "bit" , "bit" ] False "int4"+> , CatCreateFunction "position" [ "bytea" , "bytea" ] False "int4"+> , CatCreateFunction+> "positionjoinsel"+> [ "int2" , "internal" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "positionsel"+> [ "oid" , "internal" , "int4" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "postgresql_fdw_validator" [ "_text" , "oid" ] False "bool"+> , CatCreateFunction "pow" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction "pow" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "power" [ "float8" , "float8" ] False "float8"+> , CatCreateFunction+> "power" [ "numeric" , "numeric" ] False "numeric"+> , CatCreateFunction "prsd_end" [ "internal" ] False "void"+> , CatCreateFunction+> "prsd_headline"+> [ "internal" , "tsquery" , "internal" ]+> False+> "internal"+> , CatCreateFunction "prsd_lextype" [ "internal" ] False "internal"+> , CatCreateFunction+> "prsd_nexttoken"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "prsd_start" [ "int4" , "internal" ] False "internal"+> , CatCreateFunction+> "pt_contained_circle" [ "circle" , "point" ] False "bool"+> , CatCreateFunction+> "pt_contained_poly" [ "polygon" , "point" ] False "bool"+> , CatCreateFunction+> "query_to_xml" [ "text" , "text" , "bool" , "bool" ] False "xml"+> , CatCreateFunction+> "query_to_xml_and_xmlschema"+> [ "text" , "bool" , "text" , "bool" ]+> False+> "xml"+> , CatCreateFunction+> "query_to_xmlschema"+> [ "bool" , "text" , "text" , "bool" ]+> False+> "xml"+> , CatCreateFunction "querytree" [ "tsquery" ] False "text"+> , CatCreateFunction "quote_ident" [ "text" ] False "text"+> , CatCreateFunction "quote_literal" [ "text" ] False "text"+> , CatCreateFunction "quote_literal" [ "anyelement" ] False "text"+> , CatCreateFunction "quote_nullable" [ "text" ] False "text"+> , CatCreateFunction "quote_nullable" [ "anyelement" ] False "text"+> , CatCreateFunction "radians" [ "float8" ] False "float8"+> , CatCreateFunction "radius" [ "circle" ] False "float8"+> , CatCreateFunction+> "range_adjacent" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_after" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_before" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_cmp" [ "anyrange" , "anyrange" ] False "int4"+> , CatCreateFunction+> "range_contained_by" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_contains" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_contains_elem" [ "anyelement" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_eq" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_ge" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_gist_compress" [ "internal" ] False "internal"+> , CatCreateFunction+> "range_gist_consistent"+> [ "oid" , "internal" , "int4" , "internal" , "anyrange" ]+> False+> "bool"+> , CatCreateFunction+> "range_gist_decompress" [ "internal" ] False "internal"+> , CatCreateFunction+> "range_gist_penalty"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "range_gist_picksplit" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "range_gist_same"+> [ "internal" , "anyrange" , "anyrange" ]+> False+> "internal"+> , CatCreateFunction+> "range_gist_union" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "range_gt" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_in" [ "cstring" , "oid" , "int4" ] False "anyrange"+> , CatCreateFunction+> "range_intersect" [ "anyrange" , "anyrange" ] False "anyrange"+> , CatCreateFunction+> "range_le" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_lt" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_minus" [ "anyrange" , "anyrange" ] False "anyrange"+> , CatCreateFunction+> "range_ne" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction "range_out" [ "anyrange" ] False "cstring"+> , CatCreateFunction+> "range_overlaps" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_overleft" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_overright" [ "anyrange" , "anyrange" ] False "bool"+> , CatCreateFunction+> "range_recv" [ "internal" , "oid" , "int4" ] False "anyrange"+> , CatCreateFunction "range_send" [ "anyrange" ] False "bytea"+> , CatCreateFunction "range_typanalyze" [ "internal" ] False "bool"+> , CatCreateFunction+> "range_union" [ "anyrange" , "anyrange" ] False "anyrange"+> , CatCreateFunction+> "rangesel"+> [ "internal" , "internal" , "oid" , "int4" ]+> False+> "float8"+> , CatCreateFunction+> "record_eq" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_ge" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_gt" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_image_eq" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_image_ge" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_image_gt" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_image_le" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_image_lt" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_image_ne" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_in" [ "int4" , "cstring" , "oid" ] False "record"+> , CatCreateFunction+> "record_le" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_lt" [ "record" , "record" ] False "bool"+> , CatCreateFunction+> "record_ne" [ "record" , "record" ] False "bool"+> , CatCreateFunction "record_out" [ "record" ] False "cstring"+> , CatCreateFunction+> "record_recv" [ "oid" , "int4" , "internal" ] False "record"+> , CatCreateFunction "record_send" [ "record" ] False "bytea"+> , CatCreateFunction "regclass" [ "text" ] False "regclass"+> , CatCreateFunction "regclassin" [ "cstring" ] False "regclass"+> , CatCreateFunction "regclassout" [ "regclass" ] False "cstring"+> , CatCreateFunction "regclassrecv" [ "internal" ] False "regclass"+> , CatCreateFunction "regclasssend" [ "regclass" ] False "bytea"+> , CatCreateFunction "regconfigin" [ "cstring" ] False "regconfig"+> , CatCreateFunction "regconfigout" [ "regconfig" ] False "cstring"+> , CatCreateFunction+> "regconfigrecv" [ "internal" ] False "regconfig"+> , CatCreateFunction "regconfigsend" [ "regconfig" ] False "bytea"+> , CatCreateFunction+> "regdictionaryin" [ "cstring" ] False "regdictionary"+> , CatCreateFunction+> "regdictionaryout" [ "regdictionary" ] False "cstring"+> , CatCreateFunction+> "regdictionaryrecv" [ "internal" ] False "regdictionary"+> , CatCreateFunction+> "regdictionarysend" [ "regdictionary" ] False "bytea"+> , CatCreateFunction+> "regexeqjoinsel"+> [ "internal" , "oid" , "internal" , "internal" , "int2" ]+> False+> "float8"+> , CatCreateFunction+> "regexeqsel"+> [ "internal" , "oid" , "int4" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "regexnejoinsel"+> [ "int2" , "internal" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "regexnesel"+> [ "internal" , "oid" , "internal" , "int4" ]+> False+> "float8"+> , CatCreateFunction+> "regexp_matches" [ "text" , "text" ] True "_text"+> , CatCreateFunction+> "regexp_matches" [ "text" , "text" , "text" ] True "_text"+> , CatCreateFunction+> "regexp_replace" [ "text" , "text" , "text" ] False "text"+> , CatCreateFunction+> "regexp_replace" [ "text" , "text" , "text" , "text" ] False "text"+> , CatCreateFunction+> "regexp_split_to_array" [ "text" , "text" ] False "_text"+> , CatCreateFunction+> "regexp_split_to_array" [ "text" , "text" , "text" ] False "_text"+> , CatCreateFunction+> "regexp_split_to_table" [ "text" , "text" ] True "text"+> , CatCreateFunction+> "regexp_split_to_table" [ "text" , "text" , "text" ] True "text"+> , CatCreateFunction+> "regoperatorin" [ "cstring" ] False "regoperator"+> , CatCreateFunction+> "regoperatorout" [ "regoperator" ] False "cstring"+> , CatCreateFunction+> "regoperatorrecv" [ "internal" ] False "regoperator"+> , CatCreateFunction+> "regoperatorsend" [ "regoperator" ] False "bytea"+> , CatCreateFunction "regoperin" [ "cstring" ] False "regoper"+> , CatCreateFunction "regoperout" [ "regoper" ] False "cstring"+> , CatCreateFunction "regoperrecv" [ "internal" ] False "regoper"+> , CatCreateFunction "regopersend" [ "regoper" ] False "bytea"+> , CatCreateFunction+> "regprocedurein" [ "cstring" ] False "regprocedure"+> , CatCreateFunction+> "regprocedureout" [ "regprocedure" ] False "cstring"+> , CatCreateFunction+> "regprocedurerecv" [ "internal" ] False "regprocedure"+> , CatCreateFunction+> "regproceduresend" [ "regprocedure" ] False "bytea"+> , CatCreateFunction "regprocin" [ "cstring" ] False "regproc"+> , CatCreateFunction "regprocout" [ "regproc" ] False "cstring"+> , CatCreateFunction "regprocrecv" [ "internal" ] False "regproc"+> , CatCreateFunction "regprocsend" [ "regproc" ] False "bytea"+> , CatCreateFunction "regtypein" [ "cstring" ] False "regtype"+> , CatCreateFunction "regtypeout" [ "regtype" ] False "cstring"+> , CatCreateFunction "regtyperecv" [ "internal" ] False "regtype"+> , CatCreateFunction "regtypesend" [ "regtype" ] False "bytea"+> , CatCreateFunction "reltime" [ "interval" ] False "reltime"+> , CatCreateFunction+> "reltimeeq" [ "reltime" , "reltime" ] False "bool"+> , CatCreateFunction+> "reltimege" [ "reltime" , "reltime" ] False "bool"+> , CatCreateFunction+> "reltimegt" [ "reltime" , "reltime" ] False "bool"+> , CatCreateFunction "reltimein" [ "cstring" ] False "reltime"+> , CatCreateFunction+> "reltimele" [ "reltime" , "reltime" ] False "bool"+> , CatCreateFunction+> "reltimelt" [ "reltime" , "reltime" ] False "bool"+> , CatCreateFunction+> "reltimene" [ "reltime" , "reltime" ] False "bool"+> , CatCreateFunction "reltimeout" [ "reltime" ] False "cstring"+> , CatCreateFunction "reltimerecv" [ "internal" ] False "reltime"+> , CatCreateFunction "reltimesend" [ "reltime" ] False "bytea"+> , CatCreateFunction "repeat" [ "int4" , "text" ] False "text"+> , CatCreateFunction+> "replace" [ "text" , "text" , "text" ] False "text"+> , CatCreateFunction "reverse" [ "text" ] False "text"+> , CatCreateFunction "right" [ "text" , "int4" ] False "text"+> , CatCreateFunction "round" [ "float8" ] False "float8"+> , CatCreateFunction "round" [ "int4" , "numeric" ] False "numeric"+> , CatCreateFunction "round" [ "numeric" ] False "numeric"+> , CatCreateFunction "row_to_json" [ "record" ] False "json"+> , CatCreateFunction+> "row_to_json" [ "record" , "bool" ] False "json"+> , CatCreateFunction+> "rpad" [ "text" , "int4" , "text" ] False "text"+> , CatCreateFunction "rpad" [ "int4" , "text" ] False "text"+> , CatCreateFunction "rtrim" [ "text" , "text" ] False "text"+> , CatCreateFunction "rtrim" [ "text" ] False "text"+> , CatCreateFunction+> "scalargtjoinsel"+> [ "internal" , "internal" , "internal" , "int2" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "scalargtsel"+> [ "internal" , "internal" , "int4" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "scalarltjoinsel"+> [ "internal" , "internal" , "internal" , "int2" , "oid" ]+> False+> "float8"+> , CatCreateFunction+> "scalarltsel"+> [ "oid" , "internal" , "int4" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "schema_to_xml" [ "bool" , "text" , "bool" , "name" ] False "xml"+> , CatCreateFunction+> "schema_to_xml_and_xmlschema"+> [ "name" , "bool" , "text" , "bool" ]+> False+> "xml"+> , CatCreateFunction+> "schema_to_xmlschema"+> [ "bool" , "bool" , "name" , "text" ]+> False+> "xml"+> , CatCreateFunction+> "set_bit" [ "int4" , "bytea" , "int4" ] False "bytea"+> , CatCreateFunction+> "set_bit" [ "int4" , "bit" , "int4" ] False "bit"+> , CatCreateFunction+> "set_byte" [ "int4" , "bytea" , "int4" ] False "bytea"+> , CatCreateFunction+> "set_config" [ "text" , "text" , "bool" ] False "text"+> , CatCreateFunction "set_masklen" [ "int4" , "inet" ] False "inet"+> , CatCreateFunction "set_masklen" [ "int4" , "cidr" ] False "cidr"+> , CatCreateFunction "setseed" [ "float8" ] False "void"+> , CatCreateFunction "setval" [ "regclass" , "int8" ] False "int8"+> , CatCreateFunction+> "setval" [ "regclass" , "int8" , "bool" ] False "int8"+> , CatCreateFunction+> "setweight" [ "tsvector" , "char" ] False "tsvector"+> , CatCreateFunction "shell_in" [ "cstring" ] False "opaque"+> , CatCreateFunction "shell_out" [ "opaque" ] False "cstring"+> , CatCreateFunction+> "shift_jis_2004_to_euc_jis_2004"+> [ "int4" , "cstring" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "shift_jis_2004_to_utf8"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "shobj_description" [ "name" , "oid" ] False "text"+> , CatCreateFunction "sign" [ "numeric" ] False "numeric"+> , CatCreateFunction "sign" [ "float8" ] False "float8"+> , CatCreateFunction+> "similar_escape" [ "text" , "text" ] False "text"+> , CatCreateFunction "sin" [ "float8" ] False "float8"+> , CatCreateFunction+> "sjis_to_euc_jp"+> [ "int4" , "int4" , "int4" , "internal" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "sjis_to_mic"+> [ "internal" , "int4" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "sjis_to_utf8"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction "slope" [ "point" , "point" ] False "float8"+> , CatCreateFunction "smgreq" [ "smgr" , "smgr" ] False "bool"+> , CatCreateFunction "smgrin" [ "cstring" ] False "smgr"+> , CatCreateFunction "smgrne" [ "smgr" , "smgr" ] False "bool"+> , CatCreateFunction "smgrout" [ "smgr" ] False "cstring"+> , CatCreateFunction+> "spg_kd_choose" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_kd_config" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_kd_inner_consistent" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_kd_picksplit" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_quad_choose" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_quad_config" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_quad_inner_consistent"+> [ "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "spg_quad_leaf_consistent" [ "internal" , "internal" ] False "bool"+> , CatCreateFunction+> "spg_quad_picksplit" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_range_quad_choose" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_range_quad_config" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_range_quad_inner_consistent"+> [ "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "spg_range_quad_leaf_consistent"+> [ "internal" , "internal" ]+> False+> "bool"+> , CatCreateFunction+> "spg_range_quad_picksplit" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_text_choose" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_text_config" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spg_text_inner_consistent"+> [ "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "spg_text_leaf_consistent" [ "internal" , "internal" ] False "bool"+> , CatCreateFunction+> "spg_text_picksplit" [ "internal" , "internal" ] False "void"+> , CatCreateFunction+> "spgbeginscan"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction+> "spgbuild"+> [ "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "spgbuildempty" [ "internal" ] False "void"+> , CatCreateFunction+> "spgbulkdelete"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "spgcanreturn" [ "internal" ] False "bool"+> , CatCreateFunction+> "spgcostestimate"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "void"+> , CatCreateFunction "spgendscan" [ "internal" ] False "void"+> , CatCreateFunction+> "spggetbitmap" [ "internal" , "internal" ] False "int8"+> , CatCreateFunction+> "spggettuple" [ "internal" , "internal" ] False "bool"+> , CatCreateFunction+> "spginsert"+> [ "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> , "internal"+> ]+> False+> "bool"+> , CatCreateFunction "spgmarkpos" [ "internal" ] False "void"+> , CatCreateFunction "spgoptions" [ "bool" , "_text" ] False "bytea"+> , CatCreateFunction+> "spgrescan"+> [ "internal" , "internal" , "internal" , "internal" , "internal" ]+> False+> "void"+> , CatCreateFunction "spgrestrpos" [ "internal" ] False "void"+> , CatCreateFunction+> "spgvacuumcleanup" [ "internal" , "internal" ] False "internal"+> , CatCreateFunction+> "split_part" [ "text" , "int4" , "text" ] False "text"+> , CatCreateFunction "sqrt" [ "float8" ] False "float8"+> , CatCreateFunction "sqrt" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "string_agg_finalfn" [ "internal" ] False "text"+> , CatCreateFunction+> "string_agg_transfn"+> [ "internal" , "text" , "text" ]+> False+> "internal"+> , CatCreateFunction+> "string_to_array" [ "text" , "text" , "text" ] False "_text"+> , CatCreateFunction+> "string_to_array" [ "text" , "text" ] False "_text"+> , CatCreateFunction "strip" [ "tsvector" ] False "tsvector"+> , CatCreateFunction "strpos" [ "text" , "text" ] False "int4"+> , CatCreateFunction+> "substr" [ "text" , "int4" , "int4" ] False "text"+> , CatCreateFunction "substr" [ "text" , "int4" ] False "text"+> , CatCreateFunction+> "substr" [ "int4" , "bytea" , "int4" ] False "bytea"+> , CatCreateFunction "substr" [ "int4" , "bytea" ] False "bytea"+> , CatCreateFunction+> "substring" [ "text" , "int4" , "int4" ] False "text"+> , CatCreateFunction "substring" [ "int4" , "text" ] False "text"+> , CatCreateFunction+> "substring" [ "bit" , "int4" , "int4" ] False "bit"+> , CatCreateFunction "substring" [ "int4" , "bit" ] False "bit"+> , CatCreateFunction+> "substring" [ "int4" , "int4" , "bytea" ] False "bytea"+> , CatCreateFunction "substring" [ "bytea" , "int4" ] False "bytea"+> , CatCreateFunction "substring" [ "text" , "text" ] False "text"+> , CatCreateFunction+> "substring" [ "text" , "text" , "text" ] False "text"+> , CatCreateFunction+> "table_to_xml"+> [ "regclass" , "bool" , "bool" , "text" ]+> False+> "xml"+> , CatCreateFunction+> "table_to_xml_and_xmlschema"+> [ "bool" , "text" , "bool" , "regclass" ]+> False+> "xml"+> , CatCreateFunction+> "table_to_xmlschema"+> [ "text" , "regclass" , "bool" , "bool" ]+> False+> "xml"+> , CatCreateFunction "tan" [ "float8" ] False "float8"+> , CatCreateFunction "text" [ "bpchar" ] False "text"+> , CatCreateFunction "text" [ "name" ] False "text"+> , CatCreateFunction "text" [ "inet" ] False "text"+> , CatCreateFunction "text" [ "char" ] False "text"+> , CatCreateFunction "text" [ "xml" ] False "text"+> , CatCreateFunction "text" [ "bool" ] False "text"+> , CatCreateFunction "text_ge" [ "text" , "text" ] False "bool"+> , CatCreateFunction "text_gt" [ "text" , "text" ] False "bool"+> , CatCreateFunction "text_larger" [ "text" , "text" ] False "text"+> , CatCreateFunction "text_le" [ "text" , "text" ] False "bool"+> , CatCreateFunction "text_lt" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "text_pattern_ge" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "text_pattern_gt" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "text_pattern_le" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "text_pattern_lt" [ "text" , "text" ] False "bool"+> , CatCreateFunction "text_smaller" [ "text" , "text" ] False "text"+> , CatCreateFunction+> "textanycat" [ "anynonarray" , "text" ] False "text"+> , CatCreateFunction "textcat" [ "text" , "text" ] False "text"+> , CatCreateFunction "texteq" [ "text" , "text" ] False "bool"+> , CatCreateFunction "texticlike" [ "text" , "text" ] False "bool"+> , CatCreateFunction "texticnlike" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "texticregexeq" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "texticregexne" [ "text" , "text" ] False "bool"+> , CatCreateFunction "textin" [ "cstring" ] False "text"+> , CatCreateFunction "textlen" [ "text" ] False "int4"+> , CatCreateFunction "textlike" [ "text" , "text" ] False "bool"+> , CatCreateFunction "textne" [ "text" , "text" ] False "bool"+> , CatCreateFunction "textnlike" [ "text" , "text" ] False "bool"+> , CatCreateFunction "textout" [ "text" ] False "cstring"+> , CatCreateFunction "textrecv" [ "internal" ] False "text"+> , CatCreateFunction "textregexeq" [ "text" , "text" ] False "bool"+> , CatCreateFunction "textregexne" [ "text" , "text" ] False "bool"+> , CatCreateFunction "textsend" [ "text" ] False "bytea"+> , CatCreateFunction+> "thesaurus_init" [ "internal" ] False "internal"+> , CatCreateFunction+> "thesaurus_lexize"+> [ "internal" , "internal" , "internal" , "internal" ]+> False+> "internal"+> , CatCreateFunction "tideq" [ "tid" , "tid" ] False "bool"+> , CatCreateFunction "tidge" [ "tid" , "tid" ] False "bool"+> , CatCreateFunction "tidgt" [ "tid" , "tid" ] False "bool"+> , CatCreateFunction "tidin" [ "cstring" ] False "tid"+> , CatCreateFunction "tidlarger" [ "tid" , "tid" ] False "tid"+> , CatCreateFunction "tidle" [ "tid" , "tid" ] False "bool"+> , CatCreateFunction "tidlt" [ "tid" , "tid" ] False "bool"+> , CatCreateFunction "tidne" [ "tid" , "tid" ] False "bool"+> , CatCreateFunction "tidout" [ "tid" ] False "cstring"+> , CatCreateFunction "tidrecv" [ "internal" ] False "tid"+> , CatCreateFunction "tidsend" [ "tid" ] False "bytea"+> , CatCreateFunction "tidsmaller" [ "tid" , "tid" ] False "tid"+> , CatCreateFunction "time" [ "timestamp" ] False "time"+> , CatCreateFunction "time" [ "abstime" ] False "time"+> , CatCreateFunction "time" [ "interval" ] False "time"+> , CatCreateFunction "time" [ "time" , "int4" ] False "time"+> , CatCreateFunction "time" [ "timestamptz" ] False "time"+> , CatCreateFunction "time" [ "timetz" ] False "time"+> , CatCreateFunction "time_cmp" [ "time" , "time" ] False "int4"+> , CatCreateFunction "time_eq" [ "time" , "time" ] False "bool"+> , CatCreateFunction "time_ge" [ "time" , "time" ] False "bool"+> , CatCreateFunction "time_gt" [ "time" , "time" ] False "bool"+> , CatCreateFunction "time_hash" [ "time" ] False "int4"+> , CatCreateFunction+> "time_in" [ "int4" , "cstring" , "oid" ] False "time"+> , CatCreateFunction "time_larger" [ "time" , "time" ] False "time"+> , CatCreateFunction "time_le" [ "time" , "time" ] False "bool"+> , CatCreateFunction "time_lt" [ "time" , "time" ] False "bool"+> , CatCreateFunction+> "time_mi_interval" [ "interval" , "time" ] False "time"+> , CatCreateFunction+> "time_mi_time" [ "time" , "time" ] False "interval"+> , CatCreateFunction "time_ne" [ "time" , "time" ] False "bool"+> , CatCreateFunction "time_out" [ "time" ] False "cstring"+> , CatCreateFunction+> "time_pl_interval" [ "time" , "interval" ] False "time"+> , CatCreateFunction+> "time_recv" [ "internal" , "oid" , "int4" ] False "time"+> , CatCreateFunction "time_send" [ "time" ] False "bytea"+> , CatCreateFunction "time_smaller" [ "time" , "time" ] False "time"+> , CatCreateFunction+> "time_transform" [ "internal" ] False "internal"+> , CatCreateFunction+> "timedate_pl" [ "time" , "date" ] False "timestamp"+> , CatCreateFunction+> "timemi" [ "abstime" , "reltime" ] False "abstime"+> , CatCreateFunction+> "timepl" [ "abstime" , "reltime" ] False "abstime"+> , CatCreateFunction+> "timestamp" [ "timestamp" , "int4" ] False "timestamp"+> , CatCreateFunction "timestamp" [ "abstime" ] False "timestamp"+> , CatCreateFunction "timestamp" [ "date" ] False "timestamp"+> , CatCreateFunction+> "timestamp" [ "date" , "time" ] False "timestamp"+> , CatCreateFunction "timestamp" [ "timestamptz" ] False "timestamp"+> , CatCreateFunction+> "timestamp_cmp" [ "timestamp" , "timestamp" ] False "int4"+> , CatCreateFunction+> "timestamp_cmp_date" [ "date" , "timestamp" ] False "int4"+> , CatCreateFunction+> "timestamp_cmp_timestamptz"+> [ "timestamptz" , "timestamp" ]+> False+> "int4"+> , CatCreateFunction+> "timestamp_eq" [ "timestamp" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_eq_date" [ "timestamp" , "date" ] False "bool"+> , CatCreateFunction+> "timestamp_eq_timestamptz"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "timestamp_ge" [ "timestamp" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_ge_date" [ "timestamp" , "date" ] False "bool"+> , CatCreateFunction+> "timestamp_ge_timestamptz"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "timestamp_gt" [ "timestamp" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_gt_date" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_gt_timestamptz"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction "timestamp_hash" [ "timestamp" ] False "int4"+> , CatCreateFunction+> "timestamp_in" [ "cstring" , "oid" , "int4" ] False "timestamp"+> , CatCreateFunction+> "timestamp_larger" [ "timestamp" , "timestamp" ] False "timestamp"+> , CatCreateFunction+> "timestamp_le" [ "timestamp" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_le_date" [ "timestamp" , "date" ] False "bool"+> , CatCreateFunction+> "timestamp_le_timestamptz"+> [ "timestamp" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "timestamp_lt" [ "timestamp" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_lt_date" [ "date" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_lt_timestamptz"+> [ "timestamp" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "timestamp_mi" [ "timestamp" , "timestamp" ] False "interval"+> , CatCreateFunction+> "timestamp_mi_interval"+> [ "timestamp" , "interval" ]+> False+> "timestamp"+> , CatCreateFunction+> "timestamp_ne" [ "timestamp" , "timestamp" ] False "bool"+> , CatCreateFunction+> "timestamp_ne_date" [ "timestamp" , "date" ] False "bool"+> , CatCreateFunction+> "timestamp_ne_timestamptz"+> [ "timestamp" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction "timestamp_out" [ "timestamp" ] False "cstring"+> , CatCreateFunction+> "timestamp_pl_interval"+> [ "timestamp" , "interval" ]+> False+> "timestamp"+> , CatCreateFunction+> "timestamp_recv" [ "internal" , "int4" , "oid" ] False "timestamp"+> , CatCreateFunction "timestamp_send" [ "timestamp" ] False "bytea"+> , CatCreateFunction+> "timestamp_smaller" [ "timestamp" , "timestamp" ] False "timestamp"+> , CatCreateFunction+> "timestamp_sortsupport" [ "internal" ] False "void"+> , CatCreateFunction+> "timestamp_transform" [ "internal" ] False "internal"+> , CatCreateFunction "timestamptypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "timestamptypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "timestamptz" [ "abstime" ] False "timestamptz"+> , CatCreateFunction "timestamptz" [ "date" ] False "timestamptz"+> , CatCreateFunction+> "timestamptz" [ "time" , "date" ] False "timestamptz"+> , CatCreateFunction+> "timestamptz" [ "timetz" , "date" ] False "timestamptz"+> , CatCreateFunction+> "timestamptz" [ "timestamptz" , "int4" ] False "timestamptz"+> , CatCreateFunction+> "timestamptz" [ "timestamp" ] False "timestamptz"+> , CatCreateFunction+> "timestamptz_cmp" [ "timestamptz" , "timestamptz" ] False "int4"+> , CatCreateFunction+> "timestamptz_cmp_date" [ "date" , "timestamptz" ] False "int4"+> , CatCreateFunction+> "timestamptz_cmp_timestamp"+> [ "timestamp" , "timestamptz" ]+> False+> "int4"+> , CatCreateFunction+> "timestamptz_eq" [ "timestamptz" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_eq_date" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction+> "timestamptz_eq_timestamp"+> [ "timestamp" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "timestamptz_ge" [ "timestamptz" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_ge_date" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction+> "timestamptz_ge_timestamp"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "timestamptz_gt" [ "timestamptz" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_gt_date" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction+> "timestamptz_gt_timestamp"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "timestamptz_in" [ "oid" , "cstring" , "int4" ] False "timestamptz"+> , CatCreateFunction+> "timestamptz_larger"+> [ "timestamptz" , "timestamptz" ]+> False+> "timestamptz"+> , CatCreateFunction+> "timestamptz_le" [ "timestamptz" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_le_date" [ "date" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_le_timestamp"+> [ "timestamp" , "timestamptz" ]+> False+> "bool"+> , CatCreateFunction+> "timestamptz_lt" [ "timestamptz" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_lt_date" [ "timestamptz" , "date" ] False "bool"+> , CatCreateFunction+> "timestamptz_lt_timestamp"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "timestamptz_mi" [ "timestamptz" , "timestamptz" ] False "interval"+> , CatCreateFunction+> "timestamptz_mi_interval"+> [ "timestamptz" , "interval" ]+> False+> "timestamptz"+> , CatCreateFunction+> "timestamptz_ne" [ "timestamptz" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_ne_date" [ "date" , "timestamptz" ] False "bool"+> , CatCreateFunction+> "timestamptz_ne_timestamp"+> [ "timestamptz" , "timestamp" ]+> False+> "bool"+> , CatCreateFunction+> "timestamptz_out" [ "timestamptz" ] False "cstring"+> , CatCreateFunction+> "timestamptz_pl_interval"+> [ "timestamptz" , "interval" ]+> False+> "timestamptz"+> , CatCreateFunction+> "timestamptz_recv"+> [ "oid" , "int4" , "internal" ]+> False+> "timestamptz"+> , CatCreateFunction+> "timestamptz_send" [ "timestamptz" ] False "bytea"+> , CatCreateFunction+> "timestamptz_smaller"+> [ "timestamptz" , "timestamptz" ]+> False+> "timestamptz"+> , CatCreateFunction+> "timestamptztypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction+> "timestamptztypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "timetypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "timetypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "timetz" [ "timestamptz" ] False "timetz"+> , CatCreateFunction "timetz" [ "int4" , "timetz" ] False "timetz"+> , CatCreateFunction "timetz" [ "time" ] False "timetz"+> , CatCreateFunction+> "timetz_cmp" [ "timetz" , "timetz" ] False "int4"+> , CatCreateFunction+> "timetz_eq" [ "timetz" , "timetz" ] False "bool"+> , CatCreateFunction+> "timetz_ge" [ "timetz" , "timetz" ] False "bool"+> , CatCreateFunction+> "timetz_gt" [ "timetz" , "timetz" ] False "bool"+> , CatCreateFunction "timetz_hash" [ "timetz" ] False "int4"+> , CatCreateFunction+> "timetz_in" [ "int4" , "oid" , "cstring" ] False "timetz"+> , CatCreateFunction+> "timetz_larger" [ "timetz" , "timetz" ] False "timetz"+> , CatCreateFunction+> "timetz_le" [ "timetz" , "timetz" ] False "bool"+> , CatCreateFunction+> "timetz_lt" [ "timetz" , "timetz" ] False "bool"+> , CatCreateFunction+> "timetz_mi_interval" [ "interval" , "timetz" ] False "timetz"+> , CatCreateFunction+> "timetz_ne" [ "timetz" , "timetz" ] False "bool"+> , CatCreateFunction "timetz_out" [ "timetz" ] False "cstring"+> , CatCreateFunction+> "timetz_pl_interval" [ "interval" , "timetz" ] False "timetz"+> , CatCreateFunction+> "timetz_recv" [ "oid" , "internal" , "int4" ] False "timetz"+> , CatCreateFunction "timetz_send" [ "timetz" ] False "bytea"+> , CatCreateFunction+> "timetz_smaller" [ "timetz" , "timetz" ] False "timetz"+> , CatCreateFunction+> "timetzdate_pl" [ "date" , "timetz" ] False "timestamptz"+> , CatCreateFunction "timetztypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "timetztypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction+> "timezone" [ "interval" , "timestamptz" ] False "timestamp"+> , CatCreateFunction+> "timezone" [ "text" , "timestamptz" ] False "timestamp"+> , CatCreateFunction "timezone" [ "text" , "timetz" ] False "timetz"+> , CatCreateFunction+> "timezone" [ "interval" , "timetz" ] False "timetz"+> , CatCreateFunction+> "timezone" [ "text" , "timestamp" ] False "timestamptz"+> , CatCreateFunction+> "timezone" [ "timestamp" , "interval" ] False "timestamptz"+> , CatCreateFunction+> "tinterval" [ "abstime" , "abstime" ] False "tinterval"+> , CatCreateFunction+> "tintervalct" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction "tintervalend" [ "tinterval" ] False "abstime"+> , CatCreateFunction+> "tintervaleq" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervalge" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervalgt" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction "tintervalin" [ "cstring" ] False "tinterval"+> , CatCreateFunction+> "tintervalle" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervalleneq" [ "reltime" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervallenge" [ "reltime" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervallengt" [ "reltime" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervallenle" [ "tinterval" , "reltime" ] False "bool"+> , CatCreateFunction+> "tintervallenlt" [ "tinterval" , "reltime" ] False "bool"+> , CatCreateFunction+> "tintervallenne" [ "reltime" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervallt" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervalne" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction "tintervalout" [ "tinterval" ] False "cstring"+> , CatCreateFunction+> "tintervalov" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction+> "tintervalrecv" [ "internal" ] False "tinterval"+> , CatCreateFunction "tintervalrel" [ "tinterval" ] False "reltime"+> , CatCreateFunction+> "tintervalsame" [ "tinterval" , "tinterval" ] False "bool"+> , CatCreateFunction "tintervalsend" [ "tinterval" ] False "bytea"+> , CatCreateFunction+> "tintervalstart" [ "tinterval" ] False "abstime"+> , CatCreateFunction "to_ascii" [ "text" ] False "text"+> , CatCreateFunction "to_ascii" [ "text" , "int4" ] False "text"+> , CatCreateFunction "to_ascii" [ "text" , "name" ] False "text"+> , CatCreateFunction "to_char" [ "text" , "interval" ] False "text"+> , CatCreateFunction+> "to_char" [ "timestamptz" , "text" ] False "text"+> , CatCreateFunction "to_char" [ "text" , "numeric" ] False "text"+> , CatCreateFunction "to_char" [ "text" , "int4" ] False "text"+> , CatCreateFunction "to_char" [ "text" , "int8" ] False "text"+> , CatCreateFunction "to_char" [ "float4" , "text" ] False "text"+> , CatCreateFunction "to_char" [ "text" , "float8" ] False "text"+> , CatCreateFunction "to_char" [ "timestamp" , "text" ] False "text"+> , CatCreateFunction "to_date" [ "text" , "text" ] False "date"+> , CatCreateFunction "to_hex" [ "int4" ] False "text"+> , CatCreateFunction "to_hex" [ "int8" ] False "text"+> , CatCreateFunction "to_json" [ "anyelement" ] False "json"+> , CatCreateFunction "to_number" [ "text" , "text" ] False "numeric"+> , CatCreateFunction "to_regclass" [ "cstring" ] False "regclass"+> , CatCreateFunction "to_regoper" [ "cstring" ] False "regoper"+> , CatCreateFunction+> "to_regoperator" [ "cstring" ] False "regoperator"+> , CatCreateFunction "to_regproc" [ "cstring" ] False "regproc"+> , CatCreateFunction+> "to_regprocedure" [ "cstring" ] False "regprocedure"+> , CatCreateFunction "to_regtype" [ "cstring" ] False "regtype"+> , CatCreateFunction "to_timestamp" [ "float8" ] False "timestamptz"+> , CatCreateFunction+> "to_timestamp" [ "text" , "text" ] False "timestamptz"+> , CatCreateFunction+> "to_tsquery" [ "regconfig" , "text" ] False "tsquery"+> , CatCreateFunction "to_tsquery" [ "text" ] False "tsquery"+> , CatCreateFunction+> "to_tsvector" [ "regconfig" , "text" ] False "tsvector"+> , CatCreateFunction "to_tsvector" [ "text" ] False "tsvector"+> , CatCreateFunction+> "translate" [ "text" , "text" , "text" ] False "text"+> , CatCreateFunction "trigger_in" [ "cstring" ] False "trigger"+> , CatCreateFunction "trigger_out" [ "trigger" ] False "cstring"+> , CatCreateFunction "trunc" [ "macaddr" ] False "macaddr"+> , CatCreateFunction "trunc" [ "float8" ] False "float8"+> , CatCreateFunction "trunc" [ "int4" , "numeric" ] False "numeric"+> , CatCreateFunction "trunc" [ "numeric" ] False "numeric"+> , CatCreateFunction+> "ts_debug" [ "text" , "regconfig" ] True "record"+> , CatCreateFunction "ts_debug" [ "text" ] True "record"+> , CatCreateFunction+> "ts_headline"+> [ "text" , "tsquery" , "text" , "regconfig" ]+> False+> "text"+> , CatCreateFunction+> "ts_headline" [ "text" , "regconfig" , "tsquery" ] False "text"+> , CatCreateFunction+> "ts_headline" [ "text" , "text" , "tsquery" ] False "text"+> , CatCreateFunction+> "ts_headline" [ "text" , "tsquery" ] False "text"+> , CatCreateFunction+> "ts_lexize" [ "regdictionary" , "text" ] False "_text"+> , CatCreateFunction+> "ts_match_qv" [ "tsquery" , "tsvector" ] False "bool"+> , CatCreateFunction+> "ts_match_tq" [ "tsquery" , "text" ] False "bool"+> , CatCreateFunction "ts_match_tt" [ "text" , "text" ] False "bool"+> , CatCreateFunction+> "ts_match_vq" [ "tsquery" , "tsvector" ] False "bool"+> , CatCreateFunction "ts_parse" [ "oid" , "text" ] True "record"+> , CatCreateFunction "ts_parse" [ "text" , "text" ] True "record"+> , CatCreateFunction+> "ts_rank"+> [ "int4" , "_float4" , "tsvector" , "tsquery" ]+> False+> "float4"+> , CatCreateFunction+> "ts_rank" [ "tsvector" , "tsquery" , "_float4" ] False "float4"+> , CatCreateFunction+> "ts_rank" [ "tsquery" , "int4" , "tsvector" ] False "float4"+> , CatCreateFunction+> "ts_rank" [ "tsvector" , "tsquery" ] False "float4"+> , CatCreateFunction+> "ts_rank_cd"+> [ "tsvector" , "_float4" , "tsquery" , "int4" ]+> False+> "float4"+> , CatCreateFunction+> "ts_rank_cd" [ "_float4" , "tsvector" , "tsquery" ] False "float4"+> , CatCreateFunction+> "ts_rank_cd" [ "tsquery" , "tsvector" , "int4" ] False "float4"+> , CatCreateFunction+> "ts_rank_cd" [ "tsvector" , "tsquery" ] False "float4"+> , CatCreateFunction+> "ts_rewrite" [ "tsquery" , "tsquery" , "tsquery" ] False "tsquery"+> , CatCreateFunction+> "ts_rewrite" [ "text" , "tsquery" ] False "tsquery"+> , CatCreateFunction "ts_stat" [ "text" ] True "record"+> , CatCreateFunction "ts_stat" [ "text" , "text" ] True "record"+> , CatCreateFunction "ts_token_type" [ "oid" ] True "record"+> , CatCreateFunction "ts_token_type" [ "text" ] True "record"+> , CatCreateFunction "ts_typanalyze" [ "internal" ] False "bool"+> , CatCreateFunction+> "tsmatchjoinsel"+> [ "oid" , "internal" , "internal" , "int2" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "tsmatchsel"+> [ "int4" , "internal" , "oid" , "internal" ]+> False+> "float8"+> , CatCreateFunction+> "tsq_mcontained" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsq_mcontains" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsquery_and" [ "tsquery" , "tsquery" ] False "tsquery"+> , CatCreateFunction+> "tsquery_cmp" [ "tsquery" , "tsquery" ] False "int4"+> , CatCreateFunction+> "tsquery_eq" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsquery_ge" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsquery_gt" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsquery_le" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsquery_lt" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction+> "tsquery_ne" [ "tsquery" , "tsquery" ] False "bool"+> , CatCreateFunction "tsquery_not" [ "tsquery" ] False "tsquery"+> , CatCreateFunction+> "tsquery_or" [ "tsquery" , "tsquery" ] False "tsquery"+> , CatCreateFunction "tsqueryin" [ "cstring" ] False "tsquery"+> , CatCreateFunction "tsqueryout" [ "tsquery" ] False "cstring"+> , CatCreateFunction "tsqueryrecv" [ "internal" ] False "tsquery"+> , CatCreateFunction "tsquerysend" [ "tsquery" ] False "bytea"+> , CatCreateFunction+> "tsrange" [ "timestamp" , "timestamp" ] False "tsrange"+> , CatCreateFunction+> "tsrange" [ "timestamp" , "timestamp" , "text" ] False "tsrange"+> , CatCreateFunction+> "tsrange_subdiff" [ "timestamp" , "timestamp" ] False "float8"+> , CatCreateFunction+> "tstzrange" [ "timestamptz" , "timestamptz" ] False "tstzrange"+> , CatCreateFunction+> "tstzrange"+> [ "timestamptz" , "text" , "timestamptz" ]+> False+> "tstzrange"+> , CatCreateFunction+> "tstzrange_subdiff"+> [ "timestamptz" , "timestamptz" ]+> False+> "float8"+> , CatCreateFunction+> "tsvector_cmp" [ "tsvector" , "tsvector" ] False "int4"+> , CatCreateFunction+> "tsvector_concat" [ "tsvector" , "tsvector" ] False "tsvector"+> , CatCreateFunction+> "tsvector_eq" [ "tsvector" , "tsvector" ] False "bool"+> , CatCreateFunction+> "tsvector_ge" [ "tsvector" , "tsvector" ] False "bool"+> , CatCreateFunction+> "tsvector_gt" [ "tsvector" , "tsvector" ] False "bool"+> , CatCreateFunction+> "tsvector_le" [ "tsvector" , "tsvector" ] False "bool"+> , CatCreateFunction+> "tsvector_lt" [ "tsvector" , "tsvector" ] False "bool"+> , CatCreateFunction+> "tsvector_ne" [ "tsvector" , "tsvector" ] False "bool"+> , CatCreateFunction "tsvectorin" [ "cstring" ] False "tsvector"+> , CatCreateFunction "tsvectorout" [ "tsvector" ] False "cstring"+> , CatCreateFunction "tsvectorrecv" [ "internal" ] False "tsvector"+> , CatCreateFunction "tsvectorsend" [ "tsvector" ] False "bytea"+> , CatCreateFunction+> "txid_snapshot_in" [ "cstring" ] False "txid_snapshot"+> , CatCreateFunction+> "txid_snapshot_out" [ "txid_snapshot" ] False "cstring"+> , CatCreateFunction+> "txid_snapshot_recv" [ "internal" ] False "txid_snapshot"+> , CatCreateFunction+> "txid_snapshot_send" [ "txid_snapshot" ] False "bytea"+> , CatCreateFunction+> "txid_snapshot_xip" [ "txid_snapshot" ] True "int8"+> , CatCreateFunction+> "txid_snapshot_xmax" [ "txid_snapshot" ] False "int8"+> , CatCreateFunction+> "txid_snapshot_xmin" [ "txid_snapshot" ] False "int8"+> , CatCreateFunction+> "txid_visible_in_snapshot"+> [ "int8" , "txid_snapshot" ]+> False+> "bool"+> , CatCreateFunction+> "uhc_to_utf8"+> [ "internal" , "int4" , "int4" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction "unknownin" [ "cstring" ] False "unknown"+> , CatCreateFunction "unknownout" [ "unknown" ] False "cstring"+> , CatCreateFunction "unknownrecv" [ "internal" ] False "unknown"+> , CatCreateFunction "unknownsend" [ "unknown" ] False "bytea"+> , CatCreateFunction "unnest" [ "anyarray" ] True "anyelement"+> , CatCreateFunction "upper" [ "text" ] False "text"+> , CatCreateFunction "upper" [ "anyrange" ] False "anyelement"+> , CatCreateFunction "upper_inc" [ "anyrange" ] False "bool"+> , CatCreateFunction "upper_inf" [ "anyrange" ] False "bool"+> , CatCreateFunction+> "utf8_to_ascii"+> [ "internal" , "int4" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_big5"+> [ "int4" , "int4" , "internal" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_euc_cn"+> [ "cstring" , "int4" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_euc_jis_2004"+> [ "int4" , "internal" , "int4" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_euc_jp"+> [ "cstring" , "int4" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_euc_kr"+> [ "int4" , "int4" , "int4" , "internal" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_euc_tw"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_gb18030"+> [ "internal" , "int4" , "int4" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_gbk"+> [ "int4" , "int4" , "int4" , "cstring" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_iso8859"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_iso8859_1"+> [ "internal" , "int4" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_johab"+> [ "internal" , "cstring" , "int4" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_koi8r"+> [ "internal" , "int4" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_koi8u"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_shift_jis_2004"+> [ "int4" , "internal" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_sjis"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_uhc"+> [ "int4" , "int4" , "int4" , "internal" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "utf8_to_win"+> [ "internal" , "int4" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction "uuid_cmp" [ "uuid" , "uuid" ] False "int4"+> , CatCreateFunction "uuid_eq" [ "uuid" , "uuid" ] False "bool"+> , CatCreateFunction "uuid_ge" [ "uuid" , "uuid" ] False "bool"+> , CatCreateFunction "uuid_gt" [ "uuid" , "uuid" ] False "bool"+> , CatCreateFunction "uuid_hash" [ "uuid" ] False "int4"+> , CatCreateFunction "uuid_in" [ "cstring" ] False "uuid"+> , CatCreateFunction "uuid_le" [ "uuid" , "uuid" ] False "bool"+> , CatCreateFunction "uuid_lt" [ "uuid" , "uuid" ] False "bool"+> , CatCreateFunction "uuid_ne" [ "uuid" , "uuid" ] False "bool"+> , CatCreateFunction "uuid_out" [ "uuid" ] False "cstring"+> , CatCreateFunction "uuid_recv" [ "internal" ] False "uuid"+> , CatCreateFunction "uuid_send" [ "uuid" ] False "bytea"+> , CatCreateFunction+> "varbit" [ "bool" , "int4" , "varbit" ] False "varbit"+> , CatCreateFunction+> "varbit_in" [ "int4" , "oid" , "cstring" ] False "varbit"+> , CatCreateFunction "varbit_out" [ "varbit" ] False "cstring"+> , CatCreateFunction+> "varbit_recv" [ "internal" , "int4" , "oid" ] False "varbit"+> , CatCreateFunction "varbit_send" [ "varbit" ] False "bytea"+> , CatCreateFunction+> "varbit_transform" [ "internal" ] False "internal"+> , CatCreateFunction+> "varbitcmp" [ "varbit" , "varbit" ] False "int4"+> , CatCreateFunction "varbiteq" [ "varbit" , "varbit" ] False "bool"+> , CatCreateFunction "varbitge" [ "varbit" , "varbit" ] False "bool"+> , CatCreateFunction "varbitgt" [ "varbit" , "varbit" ] False "bool"+> , CatCreateFunction "varbitle" [ "varbit" , "varbit" ] False "bool"+> , CatCreateFunction "varbitlt" [ "varbit" , "varbit" ] False "bool"+> , CatCreateFunction "varbitne" [ "varbit" , "varbit" ] False "bool"+> , CatCreateFunction "varbittypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "varbittypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction+> "varchar" [ "bool" , "int4" , "varchar" ] False "varchar"+> , CatCreateFunction "varchar" [ "name" ] False "varchar"+> , CatCreateFunction+> "varchar_transform" [ "internal" ] False "internal"+> , CatCreateFunction+> "varcharin" [ "int4" , "oid" , "cstring" ] False "varchar"+> , CatCreateFunction "varcharout" [ "varchar" ] False "cstring"+> , CatCreateFunction+> "varcharrecv" [ "internal" , "oid" , "int4" ] False "varchar"+> , CatCreateFunction "varcharsend" [ "varchar" ] False "bytea"+> , CatCreateFunction "varchartypmodin" [ "_cstring" ] False "int4"+> , CatCreateFunction "varchartypmodout" [ "int4" ] False "cstring"+> , CatCreateFunction "void_in" [ "cstring" ] False "void"+> , CatCreateFunction "void_out" [ "void" ] False "cstring"+> , CatCreateFunction "void_recv" [ "internal" ] False "void"+> , CatCreateFunction "void_send" [ "void" ] False "bytea"+> , CatCreateFunction "width" [ "box" ] False "float8"+> , CatCreateFunction+> "width_bucket"+> [ "int4" , "float8" , "float8" , "float8" ]+> False+> "int4"+> , CatCreateFunction+> "width_bucket"+> [ "numeric" , "numeric" , "int4" , "numeric" ]+> False+> "int4"+> , CatCreateFunction+> "win1250_to_latin2"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win1250_to_mic"+> [ "internal" , "int4" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "win1251_to_iso"+> [ "cstring" , "int4" , "internal" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win1251_to_koi8r"+> [ "int4" , "internal" , "cstring" , "int4" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win1251_to_mic"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win1251_to_win866"+> [ "int4" , "int4" , "internal" , "cstring" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win866_to_iso"+> [ "int4" , "int4" , "cstring" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win866_to_koi8r"+> [ "cstring" , "int4" , "int4" , "internal" , "int4" ]+> False+> "void"+> , CatCreateFunction+> "win866_to_mic"+> [ "cstring" , "int4" , "int4" , "int4" , "internal" ]+> False+> "void"+> , CatCreateFunction+> "win866_to_win1251"+> [ "internal" , "int4" , "int4" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction+> "win_to_utf8"+> [ "int4" , "int4" , "internal" , "int4" , "cstring" ]+> False+> "void"+> , CatCreateFunction "xideq" [ "xid" , "xid" ] False "bool"+> , CatCreateFunction "xideqint4" [ "xid" , "int4" ] False "bool"+> , CatCreateFunction "xidin" [ "cstring" ] False "xid"+> , CatCreateFunction "xidout" [ "xid" ] False "cstring"+> , CatCreateFunction "xidrecv" [ "internal" ] False "xid"+> , CatCreateFunction "xidsend" [ "xid" ] False "bytea"+> , CatCreateFunction "xml" [ "text" ] False "xml"+> , CatCreateFunction "xml_in" [ "cstring" ] False "xml"+> , CatCreateFunction "xml_is_well_formed" [ "text" ] False "bool"+> , CatCreateFunction+> "xml_is_well_formed_content" [ "text" ] False "bool"+> , CatCreateFunction+> "xml_is_well_formed_document" [ "text" ] False "bool"+> , CatCreateFunction "xml_out" [ "xml" ] False "cstring"+> , CatCreateFunction "xml_recv" [ "internal" ] False "xml"+> , CatCreateFunction "xml_send" [ "xml" ] False "bytea"+> , CatCreateFunction "xmlcomment" [ "text" ] False "xml"+> , CatCreateFunction "xmlconcat2" [ "xml" , "xml" ] False "xml"+> , CatCreateFunction "xmlexists" [ "xml" , "text" ] False "bool"+> , CatCreateFunction "xmlvalidate" [ "xml" , "text" ] False "bool"+> , CatCreateFunction+> "xpath" [ "xml" , "text" , "_text" ] False "_xml"+> , CatCreateFunction "xpath" [ "text" , "xml" ] False "_xml"+> , CatCreateFunction+> "xpath_exists" [ "text" , "_text" , "xml" ] False "bool"+> , CatCreateFunction "xpath_exists" [ "text" , "xml" ] False "bool"+> , CatCreateAggregate "array_agg" [ "anyelement" ] "anyarray"+> , CatCreateAggregate "avg" [ "int8" ] "numeric"+> , CatCreateAggregate "avg" [ "int4" ] "numeric"+> , CatCreateAggregate "avg" [ "int2" ] "numeric"+> , CatCreateAggregate "avg" [ "numeric" ] "numeric"+> , CatCreateAggregate "avg" [ "float4" ] "float8"+> , CatCreateAggregate "avg" [ "float8" ] "float8"+> , CatCreateAggregate "avg" [ "interval" ] "interval"+> , CatCreateAggregate "bit_and" [ "int2" ] "int2"+> , CatCreateAggregate "bit_and" [ "int4" ] "int4"+> , CatCreateAggregate "bit_and" [ "int8" ] "int8"+> , CatCreateAggregate "bit_and" [ "bit" ] "bit"+> , CatCreateAggregate "bit_or" [ "int2" ] "int2"+> , CatCreateAggregate "bit_or" [ "int4" ] "int4"+> , CatCreateAggregate "bit_or" [ "int8" ] "int8"+> , CatCreateAggregate "bit_or" [ "bit" ] "bit"+> , CatCreateAggregate "bool_and" [ "bool" ] "bool"+> , CatCreateAggregate "bool_or" [ "bool" ] "bool"+> , CatCreateAggregate "corr" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "count" [ "any" ] "int8"+> , CatCreateAggregate "covar_pop" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "covar_samp" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "every" [ "bool" ] "bool"+> , CatCreateAggregate "json_agg" [ "anyelement" ] "json"+> , CatCreateAggregate "json_object_agg" [ "any" , "any" ] "json"+> , CatCreateAggregate "max" [ "anyarray" ] "anyarray"+> , CatCreateAggregate "max" [ "int8" ] "int8"+> , CatCreateAggregate "max" [ "int4" ] "int4"+> , CatCreateAggregate "max" [ "int2" ] "int2"+> , CatCreateAggregate "max" [ "oid" ] "oid"+> , CatCreateAggregate "max" [ "float4" ] "float4"+> , CatCreateAggregate "max" [ "float8" ] "float8"+> , CatCreateAggregate "max" [ "abstime" ] "abstime"+> , CatCreateAggregate "max" [ "date" ] "date"+> , CatCreateAggregate "max" [ "time" ] "time"+> , CatCreateAggregate "max" [ "timetz" ] "timetz"+> , CatCreateAggregate "max" [ "money" ] "money"+> , CatCreateAggregate "max" [ "timestamp" ] "timestamp"+> , CatCreateAggregate "max" [ "timestamptz" ] "timestamptz"+> , CatCreateAggregate "max" [ "interval" ] "interval"+> , CatCreateAggregate "max" [ "text" ] "text"+> , CatCreateAggregate "max" [ "numeric" ] "numeric"+> , CatCreateAggregate "max" [ "bpchar" ] "bpchar"+> , CatCreateAggregate "max" [ "tid" ] "tid"+> , CatCreateAggregate "max" [ "anyenum" ] "anyenum"+> , CatCreateAggregate "min" [ "anyarray" ] "anyarray"+> , CatCreateAggregate "min" [ "int8" ] "int8"+> , CatCreateAggregate "min" [ "int4" ] "int4"+> , CatCreateAggregate "min" [ "int2" ] "int2"+> , CatCreateAggregate "min" [ "oid" ] "oid"+> , CatCreateAggregate "min" [ "float4" ] "float4"+> , CatCreateAggregate "min" [ "float8" ] "float8"+> , CatCreateAggregate "min" [ "abstime" ] "abstime"+> , CatCreateAggregate "min" [ "date" ] "date"+> , CatCreateAggregate "min" [ "time" ] "time"+> , CatCreateAggregate "min" [ "timetz" ] "timetz"+> , CatCreateAggregate "min" [ "money" ] "money"+> , CatCreateAggregate "min" [ "timestamp" ] "timestamp"+> , CatCreateAggregate "min" [ "timestamptz" ] "timestamptz"+> , CatCreateAggregate "min" [ "interval" ] "interval"+> , CatCreateAggregate "min" [ "text" ] "text"+> , CatCreateAggregate "min" [ "numeric" ] "numeric"+> , CatCreateAggregate "min" [ "bpchar" ] "bpchar"+> , CatCreateAggregate "min" [ "tid" ] "tid"+> , CatCreateAggregate "min" [ "anyenum" ] "anyenum"+> , CatCreateAggregate "mode" [ "anyelement" ] "anyelement"+> , CatCreateAggregate+> "percentile_cont" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate+> "percentile_cont" [ "float8" , "interval" ] "interval"+> , CatCreateAggregate+> "percentile_cont" [ "float8" , "_float8" ] "_float8"+> , CatCreateAggregate+> "percentile_cont" [ "interval" , "_float8" ] "_interval"+> , CatCreateAggregate+> "percentile_disc" [ "float8" , "anyelement" ] "anyelement"+> , CatCreateAggregate+> "percentile_disc" [ "anyelement" , "_float8" ] "anyarray"+> , CatCreateAggregate "regr_avgx" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_avgy" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_count" [ "float8" , "float8" ] "int8"+> , CatCreateAggregate+> "regr_intercept" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_r2" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_slope" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_sxx" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_sxy" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "regr_syy" [ "float8" , "float8" ] "float8"+> , CatCreateAggregate "stddev" [ "int8" ] "numeric"+> , CatCreateAggregate "stddev" [ "int4" ] "numeric"+> , CatCreateAggregate "stddev" [ "int2" ] "numeric"+> , CatCreateAggregate "stddev" [ "float4" ] "float8"+> , CatCreateAggregate "stddev" [ "float8" ] "float8"+> , CatCreateAggregate "stddev" [ "numeric" ] "numeric"+> , CatCreateAggregate "stddev_pop" [ "int8" ] "numeric"+> , CatCreateAggregate "stddev_pop" [ "int4" ] "numeric"+> , CatCreateAggregate "stddev_pop" [ "int2" ] "numeric"+> , CatCreateAggregate "stddev_pop" [ "float4" ] "float8"+> , CatCreateAggregate "stddev_pop" [ "float8" ] "float8"+> , CatCreateAggregate "stddev_pop" [ "numeric" ] "numeric"+> , CatCreateAggregate "stddev_samp" [ "int8" ] "numeric"+> , CatCreateAggregate "stddev_samp" [ "int4" ] "numeric"+> , CatCreateAggregate "stddev_samp" [ "int2" ] "numeric"+> , CatCreateAggregate "stddev_samp" [ "float4" ] "float8"+> , CatCreateAggregate "stddev_samp" [ "float8" ] "float8"+> , CatCreateAggregate "stddev_samp" [ "numeric" ] "numeric"+> , CatCreateAggregate "string_agg" [ "text" , "text" ] "text"+> , CatCreateAggregate "string_agg" [ "bytea" , "bytea" ] "bytea"+> , CatCreateAggregate "sum" [ "int8" ] "numeric"+> , CatCreateAggregate "sum" [ "int4" ] "int8"+> , CatCreateAggregate "sum" [ "int2" ] "int8"+> , CatCreateAggregate "sum" [ "float4" ] "float4"+> , CatCreateAggregate "sum" [ "float8" ] "float8"+> , CatCreateAggregate "sum" [ "money" ] "money"+> , CatCreateAggregate "sum" [ "interval" ] "interval"+> , CatCreateAggregate "sum" [ "numeric" ] "numeric"+> , CatCreateAggregate "var_pop" [ "int8" ] "numeric"+> , CatCreateAggregate "var_pop" [ "int4" ] "numeric"+> , CatCreateAggregate "var_pop" [ "int2" ] "numeric"+> , CatCreateAggregate "var_pop" [ "float4" ] "float8"+> , CatCreateAggregate "var_pop" [ "float8" ] "float8"+> , CatCreateAggregate "var_pop" [ "numeric" ] "numeric"+> , CatCreateAggregate "var_samp" [ "int8" ] "numeric"+> , CatCreateAggregate "var_samp" [ "int4" ] "numeric"+> , CatCreateAggregate "var_samp" [ "int2" ] "numeric"+> , CatCreateAggregate "var_samp" [ "float4" ] "float8"+> , CatCreateAggregate "var_samp" [ "float8" ] "float8"+> , CatCreateAggregate "var_samp" [ "numeric" ] "numeric"+> , CatCreateAggregate "variance" [ "int8" ] "numeric"+> , CatCreateAggregate "variance" [ "int4" ] "numeric"+> , CatCreateAggregate "variance" [ "int2" ] "numeric"+> , CatCreateAggregate "variance" [ "float4" ] "float8"+> , CatCreateAggregate "variance" [ "float8" ] "float8"+> , CatCreateAggregate "variance" [ "numeric" ] "numeric"+> , CatCreateAggregate "xmlagg" [ "xml" ] "xml"+> , CatCreateCast "abstime" "date" AssignmentCastContext+> , CatCreateCast "abstime" "int4" ExplicitCastContext+> , CatCreateCast "abstime" "time" AssignmentCastContext+> , CatCreateCast "abstime" "timestamp" ImplicitCastContext+> , CatCreateCast "abstime" "timestamptz" ImplicitCastContext+> , CatCreateCast "bit" "bit" ImplicitCastContext+> , CatCreateCast "bit" "int4" ExplicitCastContext+> , CatCreateCast "bit" "int8" ExplicitCastContext+> , CatCreateCast "bit" "varbit" ImplicitCastContext+> , CatCreateCast "bool" "bpchar" AssignmentCastContext+> , CatCreateCast "bool" "int4" ExplicitCastContext+> , CatCreateCast "bool" "text" AssignmentCastContext+> , CatCreateCast "bool" "varchar" AssignmentCastContext+> , CatCreateCast "box" "circle" ExplicitCastContext+> , CatCreateCast "box" "lseg" ExplicitCastContext+> , CatCreateCast "box" "point" ExplicitCastContext+> , CatCreateCast "box" "polygon" AssignmentCastContext+> , CatCreateCast "bpchar" "bpchar" ImplicitCastContext+> , CatCreateCast "bpchar" "char" AssignmentCastContext+> , CatCreateCast "bpchar" "name" ImplicitCastContext+> , CatCreateCast "bpchar" "text" ImplicitCastContext+> , CatCreateCast "bpchar" "varchar" ImplicitCastContext+> , CatCreateCast "bpchar" "xml" ExplicitCastContext+> , CatCreateCast "char" "bpchar" AssignmentCastContext+> , CatCreateCast "char" "int4" ExplicitCastContext+> , CatCreateCast "char" "text" ImplicitCastContext+> , CatCreateCast "char" "varchar" AssignmentCastContext+> , CatCreateCast "cidr" "bpchar" AssignmentCastContext+> , CatCreateCast "cidr" "inet" ImplicitCastContext+> , CatCreateCast "cidr" "text" AssignmentCastContext+> , CatCreateCast "cidr" "varchar" AssignmentCastContext+> , CatCreateCast "circle" "box" ExplicitCastContext+> , CatCreateCast "circle" "point" ExplicitCastContext+> , CatCreateCast "circle" "polygon" ExplicitCastContext+> , CatCreateCast "date" "timestamp" ImplicitCastContext+> , CatCreateCast "date" "timestamptz" ImplicitCastContext+> , CatCreateCast "float4" "float8" ImplicitCastContext+> , CatCreateCast "float4" "int2" AssignmentCastContext+> , CatCreateCast "float4" "int4" AssignmentCastContext+> , CatCreateCast "float4" "int8" AssignmentCastContext+> , CatCreateCast "float4" "numeric" AssignmentCastContext+> , CatCreateCast "float8" "float4" AssignmentCastContext+> , CatCreateCast "float8" "int2" AssignmentCastContext+> , CatCreateCast "float8" "int4" AssignmentCastContext+> , CatCreateCast "float8" "int8" AssignmentCastContext+> , CatCreateCast "float8" "numeric" AssignmentCastContext+> , CatCreateCast "inet" "bpchar" AssignmentCastContext+> , CatCreateCast "inet" "cidr" AssignmentCastContext+> , CatCreateCast "inet" "text" AssignmentCastContext+> , CatCreateCast "inet" "varchar" AssignmentCastContext+> , CatCreateCast "int2" "float4" ImplicitCastContext+> , CatCreateCast "int2" "float8" ImplicitCastContext+> , CatCreateCast "int2" "int4" ImplicitCastContext+> , CatCreateCast "int2" "int8" ImplicitCastContext+> , CatCreateCast "int2" "numeric" ImplicitCastContext+> , CatCreateCast "int2" "oid" ImplicitCastContext+> , CatCreateCast "int2" "regclass" ImplicitCastContext+> , CatCreateCast "int2" "regconfig" ImplicitCastContext+> , CatCreateCast "int2" "regdictionary" ImplicitCastContext+> , CatCreateCast "int2" "regoper" ImplicitCastContext+> , CatCreateCast "int2" "regoperator" ImplicitCastContext+> , CatCreateCast "int2" "regproc" ImplicitCastContext+> , CatCreateCast "int2" "regprocedure" ImplicitCastContext+> , CatCreateCast "int2" "regtype" ImplicitCastContext+> , CatCreateCast "int4" "abstime" ExplicitCastContext+> , CatCreateCast "int4" "bit" ExplicitCastContext+> , CatCreateCast "int4" "bool" ExplicitCastContext+> , CatCreateCast "int4" "char" ExplicitCastContext+> , CatCreateCast "int4" "float4" ImplicitCastContext+> , CatCreateCast "int4" "float8" ImplicitCastContext+> , CatCreateCast "int4" "int2" AssignmentCastContext+> , CatCreateCast "int4" "int8" ImplicitCastContext+> , CatCreateCast "int4" "money" AssignmentCastContext+> , CatCreateCast "int4" "numeric" ImplicitCastContext+> , CatCreateCast "int4" "oid" ImplicitCastContext+> , CatCreateCast "int4" "regclass" ImplicitCastContext+> , CatCreateCast "int4" "regconfig" ImplicitCastContext+> , CatCreateCast "int4" "regdictionary" ImplicitCastContext+> , CatCreateCast "int4" "regoper" ImplicitCastContext+> , CatCreateCast "int4" "regoperator" ImplicitCastContext+> , CatCreateCast "int4" "regproc" ImplicitCastContext+> , CatCreateCast "int4" "regprocedure" ImplicitCastContext+> , CatCreateCast "int4" "regtype" ImplicitCastContext+> , CatCreateCast "int4" "reltime" ExplicitCastContext+> , CatCreateCast "int8" "bit" ExplicitCastContext+> , CatCreateCast "int8" "float4" ImplicitCastContext+> , CatCreateCast "int8" "float8" ImplicitCastContext+> , CatCreateCast "int8" "int2" AssignmentCastContext+> , CatCreateCast "int8" "int4" AssignmentCastContext+> , CatCreateCast "int8" "money" AssignmentCastContext+> , CatCreateCast "int8" "numeric" ImplicitCastContext+> , CatCreateCast "int8" "oid" ImplicitCastContext+> , CatCreateCast "int8" "regclass" ImplicitCastContext+> , CatCreateCast "int8" "regconfig" ImplicitCastContext+> , CatCreateCast "int8" "regdictionary" ImplicitCastContext+> , CatCreateCast "int8" "regoper" ImplicitCastContext+> , CatCreateCast "int8" "regoperator" ImplicitCastContext+> , CatCreateCast "int8" "regproc" ImplicitCastContext+> , CatCreateCast "int8" "regprocedure" ImplicitCastContext+> , CatCreateCast "int8" "regtype" ImplicitCastContext+> , CatCreateCast "interval" "interval" ImplicitCastContext+> , CatCreateCast "interval" "reltime" AssignmentCastContext+> , CatCreateCast "interval" "time" AssignmentCastContext+> , CatCreateCast "json" "jsonb" ExplicitCastContext+> , CatCreateCast "jsonb" "json" ExplicitCastContext+> , CatCreateCast "lseg" "point" ExplicitCastContext+> , CatCreateCast "money" "numeric" AssignmentCastContext+> , CatCreateCast "name" "bpchar" AssignmentCastContext+> , CatCreateCast "name" "text" ImplicitCastContext+> , CatCreateCast "name" "varchar" AssignmentCastContext+> , CatCreateCast "numeric" "float4" ImplicitCastContext+> , CatCreateCast "numeric" "float8" ImplicitCastContext+> , CatCreateCast "numeric" "int2" AssignmentCastContext+> , CatCreateCast "numeric" "int4" AssignmentCastContext+> , CatCreateCast "numeric" "int8" AssignmentCastContext+> , CatCreateCast "numeric" "money" AssignmentCastContext+> , CatCreateCast "numeric" "numeric" ImplicitCastContext+> , CatCreateCast "oid" "int4" AssignmentCastContext+> , CatCreateCast "oid" "int8" AssignmentCastContext+> , CatCreateCast "oid" "regclass" ImplicitCastContext+> , CatCreateCast "oid" "regconfig" ImplicitCastContext+> , CatCreateCast "oid" "regdictionary" ImplicitCastContext+> , CatCreateCast "oid" "regoper" ImplicitCastContext+> , CatCreateCast "oid" "regoperator" ImplicitCastContext+> , CatCreateCast "oid" "regproc" ImplicitCastContext+> , CatCreateCast "oid" "regprocedure" ImplicitCastContext+> , CatCreateCast "oid" "regtype" ImplicitCastContext+> , CatCreateCast "path" "point" ExplicitCastContext+> , CatCreateCast "path" "polygon" AssignmentCastContext+> , CatCreateCast "pg_node_tree" "text" ImplicitCastContext+> , CatCreateCast "polygon" "box" ExplicitCastContext+> , CatCreateCast "polygon" "circle" ExplicitCastContext+> , CatCreateCast "polygon" "path" AssignmentCastContext+> , CatCreateCast "polygon" "point" ExplicitCastContext+> , CatCreateCast "regclass" "int4" AssignmentCastContext+> , CatCreateCast "regclass" "int8" AssignmentCastContext+> , CatCreateCast "regclass" "oid" ImplicitCastContext+> , CatCreateCast "regconfig" "int4" AssignmentCastContext+> , CatCreateCast "regconfig" "int8" AssignmentCastContext+> , CatCreateCast "regconfig" "oid" ImplicitCastContext+> , CatCreateCast "regdictionary" "int4" AssignmentCastContext+> , CatCreateCast "regdictionary" "int8" AssignmentCastContext+> , CatCreateCast "regdictionary" "oid" ImplicitCastContext+> , CatCreateCast "regoper" "int4" AssignmentCastContext+> , CatCreateCast "regoper" "int8" AssignmentCastContext+> , CatCreateCast "regoper" "oid" ImplicitCastContext+> , CatCreateCast "regoper" "regoperator" ImplicitCastContext+> , CatCreateCast "regoperator" "int4" AssignmentCastContext+> , CatCreateCast "regoperator" "int8" AssignmentCastContext+> , CatCreateCast "regoperator" "oid" ImplicitCastContext+> , CatCreateCast "regoperator" "regoper" ImplicitCastContext+> , CatCreateCast "regproc" "int4" AssignmentCastContext+> , CatCreateCast "regproc" "int8" AssignmentCastContext+> , CatCreateCast "regproc" "oid" ImplicitCastContext+> , CatCreateCast "regproc" "regprocedure" ImplicitCastContext+> , CatCreateCast "regprocedure" "int4" AssignmentCastContext+> , CatCreateCast "regprocedure" "int8" AssignmentCastContext+> , CatCreateCast "regprocedure" "oid" ImplicitCastContext+> , CatCreateCast "regprocedure" "regproc" ImplicitCastContext+> , CatCreateCast "regtype" "int4" AssignmentCastContext+> , CatCreateCast "regtype" "int8" AssignmentCastContext+> , CatCreateCast "regtype" "oid" ImplicitCastContext+> , CatCreateCast "reltime" "int4" ExplicitCastContext+> , CatCreateCast "reltime" "interval" ImplicitCastContext+> , CatCreateCast "text" "bpchar" ImplicitCastContext+> , CatCreateCast "text" "char" AssignmentCastContext+> , CatCreateCast "text" "name" ImplicitCastContext+> , CatCreateCast "text" "regclass" ImplicitCastContext+> , CatCreateCast "text" "varchar" ImplicitCastContext+> , CatCreateCast "text" "xml" ExplicitCastContext+> , CatCreateCast "time" "interval" ImplicitCastContext+> , CatCreateCast "time" "time" ImplicitCastContext+> , CatCreateCast "time" "timetz" ImplicitCastContext+> , CatCreateCast "timestamp" "abstime" AssignmentCastContext+> , CatCreateCast "timestamp" "date" AssignmentCastContext+> , CatCreateCast "timestamp" "time" AssignmentCastContext+> , CatCreateCast "timestamp" "timestamp" ImplicitCastContext+> , CatCreateCast "timestamp" "timestamptz" ImplicitCastContext+> , CatCreateCast "timestamptz" "abstime" AssignmentCastContext+> , CatCreateCast "timestamptz" "date" AssignmentCastContext+> , CatCreateCast "timestamptz" "time" AssignmentCastContext+> , CatCreateCast "timestamptz" "timestamp" AssignmentCastContext+> , CatCreateCast "timestamptz" "timestamptz" ImplicitCastContext+> , CatCreateCast "timestamptz" "timetz" AssignmentCastContext+> , CatCreateCast "timetz" "time" AssignmentCastContext+> , CatCreateCast "timetz" "timetz" ImplicitCastContext+> , CatCreateCast "varbit" "bit" ImplicitCastContext+> , CatCreateCast "varbit" "varbit" ImplicitCastContext+> , CatCreateCast "varchar" "bpchar" ImplicitCastContext+> , CatCreateCast "varchar" "char" AssignmentCastContext+> , CatCreateCast "varchar" "name" ImplicitCastContext+> , CatCreateCast "varchar" "regclass" ImplicitCastContext+> , CatCreateCast "varchar" "text" ImplicitCastContext+> , CatCreateCast "varchar" "varchar" ImplicitCastContext+> , CatCreateCast "varchar" "xml" ExplicitCastContext+> , CatCreateCast "xml" "bpchar" AssignmentCastContext+> , CatCreateCast "xml" "text" AssignmentCastContext+> , CatCreateCast "xml" "varchar" AssignmentCastContext+> , CatCreateTypeCategoryEntry "abstime" ( "D" , False )+> , CatCreateTypeCategoryEntry "aclitem" ( "U" , False )+> , CatCreateTypeCategoryEntry "bit" ( "V" , False )+> , CatCreateTypeCategoryEntry "bool" ( "B" , True )+> , CatCreateTypeCategoryEntry "box" ( "G" , False )+> , CatCreateTypeCategoryEntry "bpchar" ( "S" , False )+> , CatCreateTypeCategoryEntry "bytea" ( "U" , False )+> , CatCreateTypeCategoryEntry "char" ( "S" , False )+> , CatCreateTypeCategoryEntry "cid" ( "U" , False )+> , CatCreateTypeCategoryEntry "cidr" ( "I" , False )+> , CatCreateTypeCategoryEntry "circle" ( "G" , False )+> , CatCreateTypeCategoryEntry "date" ( "D" , False )+> , CatCreateTypeCategoryEntry "float4" ( "N" , False )+> , CatCreateTypeCategoryEntry "float8" ( "N" , True )+> , CatCreateTypeCategoryEntry "gtsvector" ( "U" , False )+> , CatCreateTypeCategoryEntry "inet" ( "I" , True )+> , CatCreateTypeCategoryEntry "int2" ( "N" , False )+> , CatCreateTypeCategoryEntry "int2vector" ( "A" , False )+> , CatCreateTypeCategoryEntry "int4" ( "N" , False )+> , CatCreateTypeCategoryEntry "int8" ( "N" , False )+> , CatCreateTypeCategoryEntry "interval" ( "T" , True )+> , CatCreateTypeCategoryEntry "json" ( "U" , False )+> , CatCreateTypeCategoryEntry "jsonb" ( "U" , False )+> , CatCreateTypeCategoryEntry "line" ( "G" , False )+> , CatCreateTypeCategoryEntry "lseg" ( "G" , False )+> , CatCreateTypeCategoryEntry "macaddr" ( "U" , False )+> , CatCreateTypeCategoryEntry "money" ( "N" , False )+> , CatCreateTypeCategoryEntry "name" ( "S" , False )+> , CatCreateTypeCategoryEntry "numeric" ( "N" , False )+> , CatCreateTypeCategoryEntry "oid" ( "N" , True )+> , CatCreateTypeCategoryEntry "oidvector" ( "A" , False )+> , CatCreateTypeCategoryEntry "path" ( "G" , False )+> , CatCreateTypeCategoryEntry "pg_lsn" ( "U" , False )+> , CatCreateTypeCategoryEntry "point" ( "G" , False )+> , CatCreateTypeCategoryEntry "polygon" ( "G" , False )+> , CatCreateTypeCategoryEntry "refcursor" ( "U" , False )+> , CatCreateTypeCategoryEntry "regclass" ( "N" , False )+> , CatCreateTypeCategoryEntry "regconfig" ( "N" , False )+> , CatCreateTypeCategoryEntry "regdictionary" ( "N" , False )+> , CatCreateTypeCategoryEntry "regoper" ( "N" , False )+> , CatCreateTypeCategoryEntry "regoperator" ( "N" , False )+> , CatCreateTypeCategoryEntry "regproc" ( "N" , False )+> , CatCreateTypeCategoryEntry "regprocedure" ( "N" , False )+> , CatCreateTypeCategoryEntry "regtype" ( "N" , False )+> , CatCreateTypeCategoryEntry "reltime" ( "T" , False )+> , CatCreateTypeCategoryEntry "text" ( "S" , True )+> , CatCreateTypeCategoryEntry "tid" ( "U" , False )+> , CatCreateTypeCategoryEntry "time" ( "D" , False )+> , CatCreateTypeCategoryEntry "timestamp" ( "D" , False )+> , CatCreateTypeCategoryEntry "timestamptz" ( "D" , True )+> , CatCreateTypeCategoryEntry "timetz" ( "D" , False )+> , CatCreateTypeCategoryEntry "tinterval" ( "T" , False )+> , CatCreateTypeCategoryEntry "tsquery" ( "U" , False )+> , CatCreateTypeCategoryEntry "tsvector" ( "U" , False )+> , CatCreateTypeCategoryEntry "txid_snapshot" ( "U" , False )+> , CatCreateTypeCategoryEntry "uuid" ( "U" , False )+> , CatCreateTypeCategoryEntry "varbit" ( "V" , True )+> , CatCreateTypeCategoryEntry "varchar" ( "S" , False )+> , CatCreateTypeCategoryEntry "xid" ( "U" , False )+> , CatCreateTypeCategoryEntry "xml" ( "U" , False )+> ]++
+ src/Database/HsSqlPpp/Dialects/OdbcCatalog.lhs view
@@ -0,0 +1,629 @@++This is the catalog for the odbc scalar functions.++https://msdn.microsoft.com/en-us/library/ms711813(v=vs.85).aspx++TODO: this needs finishing++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Dialects.OdbcCatalog+> (odbcCatalog,odbcConvertTypes,odbcIntervalTypes) where+>+> --import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes++todo: refactor this so we only have the names in this file and get rid+of the leakage of Type into here.++> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Internals.TypesInternal++todo: we have to add odbc on top of different dialects, do some tests+then figure out how to handle e.g. the canonical type names being+different in different dialects.++> typeBigInt,typeFloat8,typeChar,typeNumeric,typeFloat4,+> typeSmallInt,typeInt,typeDate,typeTimestamp,typeVarChar :: Type+> typeBigInt = ScalarType "int8"+> typeFloat8 = ScalarType "float8"+> typeChar = ScalarType "char"+> typeNumeric = ScalarType "numeric"+> typeFloat4 = ScalarType "float4"+> typeSmallInt = ScalarType "int2"+> typeInt = ScalarType "int4"+> typeDate = ScalarType "date"+> typeTimestamp = ScalarType "timestamp"+> typeVarChar = ScalarType "varchar"++> -- | The odbc catalog contains the odbc specific functions+> -- if you want to type check sql with odbc specific functions, you+> -- can add these catalog updates to your catalog and then it should+> -- work+> odbcCatalog :: [CatalogUpdate]+> odbcCatalog = [++string functions++ASCII(string_exp) (ODBC 1.0)+Returns the ASCII code value of the leftmost character of string_exp as an integer.++> CatCreateFunction "!odbc-ascii" ["text"] False "int4"+> ,CatCreateFunction "!odbc-ascii" ["char"] False "int4"+> ,CatCreateFunction "!odbc-ascii" ["varchar"] False "int4"++BIT_LENGTH(string_exp) (ODBC 3.0)+Returns the length in bits of the string expression.+Does not work only for string data types, therefore will not implicitly convert string_exp to string but instead will return the (internal) size of whatever datatype it is given.++> ,CatCreateFunction "!odbc-bit_length" ["text"] False "int4"+> ,CatCreateFunction "!odbc-bit_length" ["char"] False "int4"+> ,CatCreateFunction "!odbc-bit_length" ["varchar"] False "int4"++CHAR(code) (ODBC 1.0)+Returns the character that has the ASCII code value specified by code. The value of code should be between 0 and 255; otherwise, the return value is data source–dependent.++> ,CatCreateFunction "!odbc-char" ["int4"] False "char"++CHAR_LENGTH(string_exp) (ODBC 3.0)+Returns the length in characters of the string expression, if the string expression is of a character data type; otherwise, returns the length in bytes of the string expression (the smallest integer not less than the number of bits divided by 8). (This function is the same as the CHARACTER_LENGTH function.)++> ,CatCreateFunction "!odbc-char_length" ["text"] False "int4"+> ,CatCreateFunction "!odbc-char_length" ["char"] False "int4"+> ,CatCreateFunction "!odbc-char_length" ["varchar"] False "int4"++CHARACTER_LENGTH(string_exp) (ODBC 3.0)+Returns the length in characters of the string expression, if the string expression is of a character data type; otherwise, returns the length in bytes of the string expression (the smallest integer not less tha the number of bits divided by 8). (This function is the same as the CHAR_LENGTH function.)++> ,CatCreateFunction "!odbc-character_length" ["text"] False "int4"+> ,CatCreateFunction "!odbc-character_length" ["char"] False "int4"+> ,CatCreateFunction "!odbc-character_length" ["varchar"] False "int4"++CONCAT(string_exp1,string_exp2) (ODBC 1.0)+Returns a character string that is the result of concatenating string_exp2 to string_exp1. The resulting string is DBMS-dependent. For example, if the column represented by string_exp1 contained a NULL value, DB2 would return NULL but SQL Server would return the non-NULL string.++concat not in pg++> ,CatCreateFunction "!odbc-concat" ["text","text"] False "text"+> ,CatCreateFunction "!odbc-concat" ["char","char"] False "char"+> ,CatCreateFunction "!odbc-concat" ["varchar","varchar"] False "varchar"++DIFFERENCE(string_exp1,string_exp2) (ODBC 2.0)+Returns an integer value that indicates the difference between the values returned by the SOUNDEX function for string_exp1 and string_exp2.++difference not in pg++> ,CatCreateFunction "!odbc-difference" ["text","text"] False "int4"+> ,CatCreateFunction "!odbc-difference" ["char","char"] False "int4"+> ,CatCreateFunction "!odbc-difference" ["varchar","varchar"] False "int4"++INSERT(string_exp1, start, length, string_exp2) (ODBC 1.0)+Returns a character string where length characters have been deleted from string_exp1, beginning at start, and where string_exp2 has been inserted into string_exp, beginning at start.++insert not in pg++> ,CatCreateFunction "!odbc-insert" ["text","int4","int4","text"] False "text"+> ,CatCreateFunction "!odbc-insert" ["char","int4","int4","char"] False "char"+> ,CatCreateFunction "!odbc-insert" ["varchar","int4","int4","varchar"] False "varchar"++lcase not in pg++LCASE(string_exp) (ODBC 1.0)+Returns a string equal to that in string_exp, with all uppercase characters converted to lowercase.++> ,CatCreateFunction "!odbc-lcase" ["text"] False "text"+> ,CatCreateFunction "!odbc-lcase" ["char"] False "char"+> ,CatCreateFunction "!odbc-lcase" ["varchar"] False "varchar"++left is opposite in pg++LEFT(string_exp, count) (ODBC 1.0)+Returns the leftmost count characters of string_exp.++> ,CatCreateFunction "!odbc-left" ["text","int4"] False "text"+> ,CatCreateFunction "!odbc-left" ["char","int4"] False "char"+> ,CatCreateFunction "!odbc-left" ["varchar","int4"] False "varchar"++LENGTH(string_exp) (ODBC 1.0)+Returns the number of characters in string_exp, excluding trailing blanks.+LENGTH only accepts strings. Therefore will implicitly convert string_exp to a string, and return the length of this string (not the internal size of the datatype).++TODO: we don't support the custom implicit conversion to string unless+there is a standard implicit conversion usable.++> ,CatCreateFunction "!odbc-length" ["text"] False "text"+> ,CatCreateFunction "!odbc-length" ["char"] False "char"+> ,CatCreateFunction "!odbc-length" ["varchar"] False "varchar"+++LOCATE(string_exp1, string_exp2[, start]) (ODBC 1.0)+Returns the starting position of the first occurrence of string_exp1 within string_exp2. The search for the first occurrence of string_exp1 begins with the first character position in string_exp2 unless the optional argument, start, is specified. If start is specified, the search begins with the character position indicated by the value of start. The first character position in string_exp2 is indicated by the value 1. If string_exp1 is not found within string_exp2, the value 0 is returned.+If an application can call the LOCATE scalar function with the string_exp1, string_exp2, and start arguments, the driver returns SQL_FN_STR_LOCATE when SQLGetInfo is called with an Option of SQL_STRING_FUNCTIONS. If the application can call the LOCATE scalar function with only the string_exp1 and string_exp2 arguments, the driver returns SQL_FN_STR_LOCATE_2 when SQLGetInfo is called with an Option of SQL_STRING_FUNCTIONS. Drivers that support calling the LOCATE function with either two or three arguments return both SQL_FN_STR_LOCATE and SQL_FN_STR_LOCATE_2.++> ,CatCreateFunction "!odbc-locate" ["text","text"] False "int4"+> ,CatCreateFunction "!odbc-locate" ["text","text","int4"] False "int4"+> ,CatCreateFunction "!odbc-locate" ["char","char"] False "int4"+> ,CatCreateFunction "!odbc-locate" ["char","char","int4"] False "int4"+> ,CatCreateFunction "!odbc-locate" ["varchar","varchar"] False "int4"+> ,CatCreateFunction "!odbc-locate" ["varchar","varchar","int4"] False "int4"++LTRIM(string_exp) (ODBC 1.0)+Returns the characters of string_exp, with leading blanks removed.++> ,CatCreateFunction "!odbc-ltrim" ["text"] False "text"+> ,CatCreateFunction "!odbc-ltrim" ["char"] False "char"+> ,CatCreateFunction "!odbc-ltrim" ["varchar"] False "varchar"+++OCTET_LENGTH(string_exp) (ODBC 3.0)+Returns the length in bytes of the string expression. The result is the smallest integer not less than the number of bits divided by 8.+Does not work only for string data types, therefore will not implicitly convert string_exp to string but instead will return the (internal) size of whatever datatype it is given.++> ,CatCreateFunction "!odbc-octet_length" ["text"] False "int4"+> ,CatCreateFunction "!odbc-octet_length" ["char"] False "int4"+> ,CatCreateFunction "!odbc-octet_length" ["varchar"] False "int4"++POSITION(character_exp IN character_exp) (ODBC 3.0)+Returns the position of the first character expression in the second character expression. The result is an exact numeric with an implementation-defined precision and a scale of 0.++we don't support position for now since we this is a ansi sql syntax+which we also don't currently support++REPEAT(string_exp, count) (ODBC 1.0)+Returns a character string composed of string_exp repeated count times.++> ,CatCreateFunction "!odbc-repeat" ["text","int4"] False "text"+> ,CatCreateFunction "!odbc-repeat" ["char","int4"] False "char"+> ,CatCreateFunction "!odbc-repeat" ["varchar","int4"] False "varchar"++REPLACE(string_exp1, string_exp2, string_exp3) (ODBC 1.0)+Search string_exp1 foroccurrences of string_exp2, and replace with string_exp3.++> ,CatCreateFunction "!odbc-replace" ["text","text","text"] False "text"+> ,CatCreateFunction "!odbc-replace" ["char","char","char"] False "char"+> ,CatCreateFunction "!odbc-replace" ["varchar","varchar","varchar"] False "varchar"++RIGHT(string_exp, count) (ODBC 1.0)+Returns the rightmost count characters of string_exp.++> ,CatCreateFunction "!odbc-right" ["text","int4"] False "text"+> ,CatCreateFunction "!odbc-right" ["char","int4"] False "char"+> ,CatCreateFunction "!odbc-right" ["varchar","int4"] False "varchar"+++RTRIM(string_exp) (ODBC 1.0)+Returns the characters of string_exp with trailing blanks removed.++> ,CatCreateFunction "!odbc-rtrim" ["text"] False "text"+> ,CatCreateFunction "!odbc-rtrim" ["char"] False "char"+> ,CatCreateFunction "!odbc-rtrim" ["varchar"] False "varchar"++SOUNDEX(string_exp) (ODBC 2.0)+Returns a data source–dependent character string representing the sound of the words in string_exp. For example, SQL Server returns a 4-digit SOUNDEX code; Oracle returns a phonetic representation of each word.++> ,CatCreateFunction "!odbc-soundex" ["text"] False "text"+> ,CatCreateFunction "!odbc-soundex" ["char"] False "char"+> ,CatCreateFunction "!odbc-soundex" ["varchar"] False "varchar"+++SPACE(count) (ODBC 2.0)+Returns a character string consisting of count spaces.++> ,CatCreateFunction "!odbc-space" ["int4"] False "char"++SUBSTRING(string_exp, start, length) (ODBC 1.0)+Returns a character string that is derived from string_exp, beginning at the character position specified by start for length characters.++> ,CatCreateFunction "!odbc-substring" ["text","int4","int4"] False "text"+> ,CatCreateFunction "!odbc-substring" ["char","int4","int4"] False "char"+> ,CatCreateFunction "!odbc-substring" ["varchar","int4","int4"] False "varchar"++UCASE(string_exp) (ODBC 1.0)+Returns a string equal to that in string_exp, with all lowercase characters converted to uppercase.++> ,CatCreateFunction "!odbc-ucase" ["text"] False "text"+> ,CatCreateFunction "!odbc-ucase" ["char"] False "char"+> ,CatCreateFunction "!odbc-ucase" ["varchar"] False "varchar"++numeric functions++> ]++ABS(numeric_exp) (ODBC 1.0)+Returns the absolute value of numeric_exp.++> ++ [CatCreateFunction "!odbc-abs" [n] False n | n <- numTypes]++ACOS(float_exp) (ODBC 1.0)+Returns the arccosine of float_exp as an angle, expressed in radians.++> ++ [CatCreateFunction "!odbc-acos" [n] False n | n <- floatTypes]++ASIN(float_exp) (ODBC 1.0)+Returns the arcsine of float_exp as an angle, expressed in radians.++> ++ [CatCreateFunction "!odbc-asin" [n] False n | n <- floatTypes]++ATAN(float_exp) (ODBC 1.0)+Returns the arctangent of float_exp as an angle, expressed in radians.++> ++ [CatCreateFunction "!odbc-atan" [n] False n | n <- floatTypes]++ATAN2(float_exp1, float_exp2) (ODBC 2.0)+Returns the arctangent of the x and y coordinates, specified by float_exp1 and float_exp2, respectively, as an angle, expressed in radians.++> ++ [CatCreateFunction "!odbc-atan2" [n] False n | n <- floatTypes]++CEILING(numeric_exp) (ODBC 1.0)+Returns the smallest integer greater than or equal to numeric_exp. The return value is of the same data type as the input parameter.++> ++ [CatCreateFunction "!odbc-ceiling" [n] False n | n <- numTypes]++COS(float_exp) (ODBC 1.0)+Returns the cosine of float_exp, where float_exp is an angle expressed in radians.++> ++ [CatCreateFunction "!odbc-cos" [n] False n | n <- floatTypes]++COT(float_exp) (ODBC 1.0)+Returns the cotangent of float_exp, where float_exp is an angle expressed in radians.++> ++ [CatCreateFunction "!odbc-cot" [n] False n | n <- floatTypes]++DEGREES(numeric_exp) (ODBC 2.0)+Returns the number of degrees converted from numeric_exp radians.++> ++ [CatCreateFunction "!odbc-degrees" [n] False n | n <- numTypes]++EXP(float_exp) (ODBC 1.0)+Returns the exponential value of float_exp.++> ++ [CatCreateFunction "!odbc-exp" [n] False n | n <- floatTypes]++FLOOR(numeric_exp) (ODBC 1.0)+Returns the largest integer less than or equal to numeric_exp. The return value is of the same data type as the input parameter.++> ++ [CatCreateFunction "!odbc-floor" [n] False n | n <- numTypes]++LOG(float_exp) (ODBC 1.0)+Returns the natural logarithm of float_exp.++> ++ [CatCreateFunction "!odbc-log" [n] False n | n <- floatTypes]++LOG10(float_exp) (ODBC 2.0)+Returns the base 10 logarithm of float_exp.++> ++ [CatCreateFunction "!odbc-log10" [n] False n | n <- floatTypes]++MOD(integer_exp1, integer_exp2) (ODBC 1.0)+Returns the remainder (modulus) of integer_exp1 divided by integer_exp2.++> ++ [CatCreateFunction "!odbc-mod" [n] False n | n <- intTypes]++PI( ) (ODBC 1.0)+Returns the constant value of pi as a floating-point value.++> ++ [CatCreateFunction "!odbc-pi" [] False "float8"]++POWER(numeric_exp, integer_exp) (ODBC 2.0)+Returns the value of numeric_exp to the power of integer_exp.++> ++ [CatCreateFunction "!odbc-power" [n,m] False n | n <- numTypes, m <- intTypes]++RADIANS(numeric_exp) (ODBC 2.0)+Returns the number of radians converted from numeric_exp degrees.++> ++ [CatCreateFunction "!odbc-radians" [n] False n | n <- numTypes]++RAND([integer_exp]) (ODBC 1.0)+Returns a random floating-point value using integer_exp as the optional seed value.++> ++ [CatCreateFunction "!odbc-rand" [n] False n | n <- intTypes]++ROUND(numeric_exp, integer_exp) (ODBC 2.0)+Returns numeric_exp rounded to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is rounded to |integer_exp| places to the left of the decimal point.++> ++ [CatCreateFunction "!odbc-round" [n,m] False n | n <- numTypes, m <- intTypes]++SIGN(numeric_exp) (ODBC 1.0)+Returns an indicator of the sign of numeric_exp. If numeric_exp is less than zero, –1 is returned. If numeric_exp equals zero, 0 is returned. If numeric_exp is greater than zero, 1 is returned.++> ++ [CatCreateFunction "!odbc-sign" [n] False n | n <- numTypes]++SIN(float_exp) (ODBC 1.0)+Returns the sine of float_exp, where float_exp is an angle expressed in radians.++> ++ [CatCreateFunction "!odbc-sin" [n] False n | n <- floatTypes]++SQRT(float_exp) (ODBC 1.0)+Returns the square root of float_exp.++> ++ [CatCreateFunction "!odbc-sqrt" [n] False n | n <- floatTypes]++TAN(float_exp) (ODBC 1.0)+Returns the tangent of float_exp, where float_exp is an angle expressed in radians.++> ++ [CatCreateFunction "!odbc-tan" [n] False n | n <- floatTypes]++TRUNCATE(numeric_exp, integer_exp) (ODBC 2.0)+Returns numeric_exp truncated to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is truncated to |integer_exp| places to the left of the decimal point.++> ++ [CatCreateFunction "!odbc-log10" [n,m] False n | n <- numTypes, m <- intTypes]++> ++ [++time++CURRENT_DATE( ) (ODBC 3.0)+Returns the current date.++> CatCreateFunction "!odbc-current_date" [] False "date"++CURRENT_TIME[(time-precision)] (ODBC 3.0)+Returns the current local time. The time-precision argument determines the seconds precision of the returned value.++> ,CatCreateFunction "!odbc-current_time" [] False "time"++CURRENT_TIMESTAMP [(timestamp-precision)] (ODBC 3.0)+Returns the current local date and local time as a timestamp value. The timestamp-precision argument determines the seconds precision of the returned timestamp.++> ,CatCreateFunction "!odbc-current_timestamp" [] False "timestamp"++CURDATE( ) (ODBC 1.0)+Returns the current date.++> ,CatCreateFunction "!odbc-curdate" [] False "date"++CURTIME( ) (ODBC 1.0)+Returns the current local time.++> ,CatCreateFunction "!odbc-curtime" [] False "time"]++DAYNAME(date_exp) (ODBC 2.0)+Returns a character string containing the data source–specific name of the day (for example, Sunday through Saturday or Sun. through Sat. for a data source that uses English, or Sonntag through Samstag for a data source that uses German) for the day portion of date_exp.++> ++ [CatCreateFunction "!odbc-dayname" [d] False "varchar" | d <- dateTypes]++DAYOFMONTH(date_exp) (ODBC 1.0)+Returns the day of the month based on the month field in date_exp as an integer value in the range of 1–31.++> ++ [CatCreateFunction "!odbc-dayofmonth" [d] False "int4" | d <- dateTypes]++DAYOFWEEK(date_exp) (ODBC 1.0)+Returns the day of the week based on the week field in date_exp as an integer value in the range of 1–7, where 1 represents Sunday.++> ++ [CatCreateFunction "!odbc-dayofweek" [d] False "int4" | d <- dateTypes]++DAYOFYEAR(date_exp) (ODBC 1.0)+Returns the day of the year based on the year field in date_exp as an integer value in the range of 1–366.++> ++ [CatCreateFunction "!odbc-dayofyear" [d] False "int4" | d <- dateTypes]++EXTRACT(extract-field FROM extract-source) (ODBC 3.0)+Returns the extract-field portion of the extract-source. The extract-source argument is a datetime or interval expression. The extract-field argument can be one of the following keywords:+YEAR MONTH DAY HOUR MINUTE SECOND+The precision of the returned value is implementation-defined. The scale is 0 unless SECOND is specified, in which case the scale is not less than the fractional seconds precision of the extract-source field.++This is a special case and handled purely in the typechecker++HOUR(time_exp) (ODBC 1.0)+Returns the hour based on the hour field in time_exp as an integer value in the range of 0–23.++> ++ [CatCreateFunction "!odbc-hour" [d] False "int4" | d <- timeTypes]++MINUTE(time_exp) (ODBC 1.0)+Returns the minute based on the minute field in time_exp as an integer value in the range of 0–59.++> ++ [CatCreateFunction "!odbc-minute" [d] False "int4" | d <- timeTypes]++MONTH(date_exp) (ODBC 1.0)+Returns the month based on the month field in date_exp as an integer value in the range of 1–12.++> ++ [CatCreateFunction "!odbc-month" [d] False "int4" | d <- dateTypes]++MONTHNAME(date_exp) (ODBC 2.0)+Returns a character string containing the data source–specific name of the month (for example, January through December or Jan. through Dec. for a data source that uses English, or Januar through Dezember for a data source that uses German) for the month portion of date_exp.++> ++ [CatCreateFunction "!odbc-monthname" [d] False "varchar" | d <- dateTypes]++NOW( ) (ODBC 1.0)+Returns current date and time as a timestamp value.++> ++ [CatCreateFunction "!odbc-now" [] False "timestamp"]++QUARTER(date_exp) (ODBC 1.0)+Returns the quarter in date_exp as an integer value in the range of 1–4, where 1 represents January 1 through March 31.++> ++ [CatCreateFunction "!odbc-quarter" [d] False "int4" | d <- dateTypes]++SECOND(time_exp) (ODBC 1.0)+Returns the second based on the second field in time_exp as an integer value in the range of 0–59.++> ++ [CatCreateFunction "!odbc-second" [d] False "int4" | d <- timeTypes]++TIMESTAMPADD(interval, integer_exp, timestamp_exp) (ODBC 2.0)+Returns the timestamp calculated by adding integer_exp intervals of type interval to timestamp_exp. Valid values of interval are the following keywords:+SQL_TSI_FRAC_SECOND+SQL_TSI_SECOND+SQL_TSI_MINUTE+SQL_TSI_HOUR+SQL_TSI_DAY+SQL_TSI_WEEK+SQL_TSI_MONTH+SQL_TSI_QUARTER+SQL_TSI_YEAR+where fractional seconds are expressed in billionths of a second. For example, the following SQL statement returns the name of each employee and his or her one-year anniversary date:+SELECT NAME, {fn TIMESTAMPADD(SQL_TSI_YEAR, 1, HIRE_DATE)} FROM EMPLOYEES+If timestamp_exp is a time value and interval specifies days, weeks, months, quarters, or years, the date portion of timestamp_exp is set to the current date before calculating the resulting timestamp.+If timestamp_exp is a date value and interval specifies fractional seconds, seconds, minutes, or hours, the time portion of timestamp_exp is set to 0 before calculating the resulting timestamp.+An application determines which intervals a data source supports by calling SQLGetInfo with the SQL_TIMEDATE_ADD_INTERVALS option.++> ++ [CatCreateFunction "!odbc-timestampadd" ["int4","int4","date"] False "date"+> ,CatCreateFunction "!odbc-timestampadd" ["int4","int4","time"] False "time"+> ,CatCreateFunction "!odbc-timestampadd" ["int4","int4","timestamp"] False "timestamp"++TIMESTAMPDIFF(interval, timestamp_exp1, timestamp_exp2) (ODBC 2.0)+Returns the integer number of intervals of type interval by which timestamp_exp2 is greater than timestamp_exp1. Valid values of interval are the following keywords:+SQL_TSI_FRAC_SECOND+SQL_TSI_SECOND+SQL_TSI_MINUTE+SQL_TSI_HOUR+SQL_TSI_DAY+SQL_TSI_WEEK+SQL_TSI_MONTH+SQL_TSI_QUARTER+SQL_TSI_YEAR+where fractional seconds are expressed in billionths of a second. For example, the following SQL statement returns the name of each employee and the number of years he or she has been employed:+SELECT NAME, {fn TIMESTAMPDIFF(SQL_TSI_YEAR, {fn CURDATE()}, HIRE_DATE)} FROM EMPLOYEES+If either timestamp expression is a time value and interval specifies days, weeks, months, quarters, or years, the date portion of that timestamp is set to the current date before calculating the difference between the timestamps.+If either timestamp expression is a date value and interval specifies fractional seconds, seconds, minutes, or hours, the time portion of that timestamp is set to 0 before calculating the difference between the timestamps.+An application determines which intervals a data source supports by calling SQLGetInfo with the SQL_TIMEDATE_DIFF_INTERVALS option.++> ,CatCreateFunction "!odbc-timestampdiff" ["int4","time","time"] False "int4"+> ,CatCreateFunction "!odbc-timestampdiff" ["int4","date","date"] False "int4"+> ,CatCreateFunction "!odbc-timestampdiff" ["int4","timestamp","timestamp"] False "int4"]+++WEEK(date_exp) (ODBC 1.0)+Returns the week of the year based on the week field in date_exp as an integer value in the range of 1–53.++> ++ [CatCreateFunction "!odbc-week" [d] False "int4" | d <- dateTypes]++YEAR(date_exp) (ODBC 1.0)+Returns the year based on the year field in date_exp as an integer value. The range is data source–dependent.++> ++ [CatCreateFunction "!odbc-year" [d] False "int4" | d <- dateTypes]++system++DATABASE( ) (ODBC 1.0)+Returns the name of the database corresponding to the connection handle. (The name of the database is also available by calling SQLGetConnectOption with the SQL_CURRENT_QUALIFIER connection option.)++> ++ [CatCreateFunction "!odbc-database" [] False "varchar"]++IFNULL(exp,value) (ODBC 1.0)+If exp is null, value is returned. If exp is not null, exp is returned. The possible data type or types of value must be compatible with the data type of exp.++> ++ [CatCreateFunction "!odbc-ifnull" [t,t] False t | t <- allTypes]++USER( ) (ODBC 1.0)+Returns the user name in the DBMS. (The user name is also available by way of SQLGetInfo by specifying the information type: SQL_USER_NAME.) This can be different than the login name.++> ++ [CatCreateFunction "!odbc-user" [] False "varchar"]++conversion function++CONVERT(value_exp, data_type)+The function returns the value specified by value_exp converted to the specified data_type, where data_type is one of the following keywords:+SQL_BIGINT+SQL_INTERVAL_HOUR_TO_MINUTE+SQL_BINARY+SQL_INTERVAL_HOUR_TO_SECOND+SQL_BIT+SQL_INTERVAL_MINUTE_TO_SECOND+SQL_CHAR+SQL_LONGVARBINARY+SQL_DECIMAL+SQL_LONGVARCHAR+SQL_DOUBLE+SQL_NUMERIC+SQL_FLOAT+SQL_REAL+SQL_GUID+SQL_SMALLINT+SQL_INTEGER+SQL_DATE+SQL_INTERVAL_MONTH+SQL_TIME+SQL_INTERVAL_YEAR+SQL_TIMESTAMP+SQL_INTERVAL_YEAR_TO_MONTH+SQL_TINYINT+SQL_INTERVAL_DAY+SQL_VARBINARY+SQL_INTERVAL_HOUR+SQL_VARCHAR+SQL_INTERVAL_MINUTE+SQL_WCHAR+SQL_INTERVAL_SECOND+SQL_WLONGVARCHAR+SQL_INTERVAL_DAY_TO_HOUR+SQL_WVARCHAR+SQL_INTERVAL_DAY_TO_MINUTE+ +SQL_INTERVAL_DAY_TO_SECOND+++> ++ [CatCreateFunction "!odbc-convert" [t,"int4"] False t+> | t <- ["int2","int4","int8", "float4", "float8", "numeric"+> ,"date","time","timestamp","char","varchar","text"+> ,"bool"]+> ]+> where+> floatTypes = ["float4","float8"]+> numTypes = ["int2","int4","int8", "float4", "float8", "numeric"]+> -- if a numeric with a fraction part is used, then maybe+> -- it is a runtime error, or maybe the typechecker can understand this+> -- most of the time and give a compile error, or maybe+> -- it should cast it?+> intTypes = ["int2","int4","int8", "numeric"]+> timeTypes = ["time","timestamp"]+> dateTypes = ["date","timestamp"]+> allTypes = ["int2","int4","int8", "float4", "float8", "numeric"+> ,"date","time","timestamp","char","varchar","text"+> ,"bool"]++TODO : all the weird ones are commented out. I couldn't find a clear+reference on what the correspondence between the convert enum+identifiers and sql types are. The interval ones are the most likely+to be needed out of the commented out ones. Maybe they return smallint+or int or something.++> odbcConvertTypes :: [(String,Type)]+> odbcConvertTypes = [("sql_bigint", typeBigInt)+> ,("sql_float", typeFloat8)+> --,("sql_interval_hour_to_minute", typeFloat8)+> --,("sql_binary", $ ScalarType "unknown")+> --,("sql_interval_hour_to_second", typeFloat8)+> --,("sql_bit", $ ScalarType "unknown")+> --,("sql_interval_minute_to_second", typeFloat8)+> ,("sql_char", typeChar)+> --,("sql_longvarbinary", $ ScalarType "unknown")+> ,("sql_decimal", typeNumeric)+> --,("sql_longvarchar", typeVarChar)+> ,("sql_double", typeFloat8)+> ,("sql_numeric", typeNumeric)+> ,("sql_float", typeFloat8)+> ,("sql_real", typeFloat4)+> --,("sql_guid", $ ScalarType "unknown")+> ,("sql_smallint", typeSmallInt)+> ,("sql_integer", typeInt)+> ,("sql_date", typeDate)+> --,("sql_interval_month", typeFloat8)+> ,("sql_time", ScalarType "time")+> --,("sql_interval_year", typeFloat8)+> ,("sql_timestamp", typeTimestamp)+> --,("sql_interval_year_to_month", typeFloat8)+> --,("sql_tinyint", $ ScalarType "unknown")+> --,("sql_interval_day", typeFloat8)+> --,("sql_varbinary", $ ScalarType "unknown")+> --,("sql_interval_hour", typeFloat8)+> ,("sql_varchar", typeVarChar)+> --,("sql_interval_minute", typeFloat8)+> --,("sql_wchar", $ ScalarType "unknown")+> --,("sql_interval_second", typeFloat8)+> --,("sql_wlongvarchar", typeVarChar)+> --,("sql_interval_day_to_hour", typeFloat8)+> --,("sql_wvarchar", $ ScalarType "unknown")+> --,("sql_interval_day_to_minute", typeFloat8)+> --,("sql_interval_day_to_second", typeFloat8)+> ]++> odbcIntervalTypes :: [String]+> odbcIntervalTypes = ["sql_tsi_frac_second"+> ,"sql_tsi_second"+> ,"sql_tsi_minute"+> ,"sql_tsi_hour"+> ,"sql_tsi_day"+> ,"sql_tsi_week"+> ,"sql_tsi_month"+> ,"sql_tsi_quarter"+> ,"sql_tsi_year"]
+ src/Database/HsSqlPpp/Dialects/Oracle.lhs view
@@ -0,0 +1,47 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Dialects.Oracle (oracleDialect) where++> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Dialects.Postgres++Oracle is a very small hack based on postgres. This should be fixed+after adding some more tests. It is particularly bad since we don't+use oracle style 'numeric' for ints, so it is not very compatible with+oracle (there are lots of other standard oracle types missing, which+is probably the biggest issue at the moment.++> oracleDialect :: Dialect+> oracleDialect = Dialect+> {diName = "oracle"+> ,diSyntaxFlavour = Oracle+> ,diCanonicalTypeNames = [("timestamp", ["datetime"])+> -- todo: temp before sqlserver dialect is done properly+> -- this hack should probably move to the ansi dialect first+> ,("int1", ["tinyint"])+> ,("int2", ["smallint"])+> ,("int4", ["integer","int"])+> ,("int8", ["bigint"])+> ,("numeric", ["decimal"])+> ,("float4", ["real"])+> ,("float8", ["double precision","float","double"])+> -- probably some missing here+> ,("varchar", ["character varying"])+> ,("char", ["character"])+> ,("bool", ["boolean"])]+> ,diTextTypes = ["char","varchar","text"]+> ,diDatetimeTypes = ["date","time","timestamp","interval"]+> ,diNumberTypes = ["int2","int4","int8","numeric","float4","float8"]+> ,namesForAnsiTypes = [("char","char")+> ,("varchar","varchar")+> ,("bigint","int8")+> ,("boolean","bool")+> ,("numeric","numeric")+> ,("int","int4")+> ,("date","date")+> ,("time","time")+> ,("timestamp","timestamp")+> ] -- todo: these are postgres names+> ,diDefaultCatalog = diDefaultCatalog postgresDialect+> }+
+ src/Database/HsSqlPpp/Dialects/Postgres.lhs view
@@ -0,0 +1,83 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Dialects.Postgres (postgresDialect) where++> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Dialects.GeneratedPostgres+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> import Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+> import Database.HsSqlPpp.Dialects.OdbcCatalog+> import Database.HsSqlPpp.Dialects.BaseCatalog++> postgresDialect :: Dialect+> postgresDialect = Dialect+> {diName = "postgres"+> ,diSyntaxFlavour = Postgres+> ,diCanonicalTypeNames = [("timestamp", ["datetime"])+> -- todo: temp before sqlserver dialect is done properly+> -- this hack should probably move to the ansi dialect first+> ,("int1", ["tinyint"])+> ,("int2", ["smallint"])+> ,("int4", ["integer","int"])+> ,("int8", ["bigint"])+> ,("numeric", ["decimal"])+> ,("float4", ["real"])+> ,("float8", ["double precision","float","double"])+> -- probably some missing here+> ,("varchar", ["character varying"])+> ,("char", ["character"])+> ,("bool", ["boolean"])]+> ,diTextTypes = ["char","varchar","text"]+> ,diDatetimeTypes = ["date","time","timestamp","interval"]+> ,diNumberTypes = ["int2","int4","int8","numeric","float4","float8"]+> ,namesForAnsiTypes = [("char","char")+> ,("varchar","varchar")+> ,("bigint","int8")+> ,("boolean","bool")+> ,("numeric","numeric")+> ,("int","int4")+> ,("date","date")+> ,("time","time")+> ,("timestamp","timestamp")+> ] -- todo: finish this+> ,diDefaultCatalog = postgresCatalog+> }++built in range types in postgresql++todo: maybe these are in the catalog somewhere and should come from+postgres?++> postgresCatalog :: Catalog+> postgresCatalog =+> (\l -> case l of+> Left x -> error $ show x+> Right e -> e) $+> flip updateCatalog emptyCatalog (+> nonSpecialPseudoTypes ++ rangeTypes ++ generatedPostgresCatalogEntries+> ++ extraDefs+> ++ baseCatalog "bool" "int4" ["char", "varchar", "text"]+> ++ odbcCatalog)+> where+> extraDefs = [CatCreateBinaryOp "=" "anyelement" "anyelement" "bool"+> ,CatCreateVariadicFunction "arrayctor" ["anyelement"] False "anyarray"+> ,CatCreateFunction "arraysub" ["anyarray","int4"] False "anyelement"+> ,CatCreateVariadicFunction "greatest" ["anyelement"] False "anyelement"+> ,CatCreateVariadicFunction "least" ["anyelement"] False "anyelement"+> ] ++ concat [ [CatCreateBinaryOp "rlike" t t "bool"+> ,CatCreateBinaryOp "notrlike" t t "bool"]+> | t <- ["char", "varchar", "text"] ]+> rangeTypes = map CatCreateScalarType+> ["int4range", "int8range"+> ,"numrange","daterange"+> ,"tsrange","tstzrange"]+> nonSpecialPseudoTypes = map CatCreateScalarType+> ["cstring"+> ,"trigger"+> ,"event_trigger"+> ,"_cstring"+> ,"internal"+> ,"language_handler"+> ,"opaque"+> ,"fdw_handler"]
+ src/Database/HsSqlPpp/Dialects/SqlServer.lhs view
@@ -0,0 +1,161 @@++> {-# LANGUAGE OverloadedStrings,ScopedTypeVariables #-}+> module Database.HsSqlPpp.Dialects.SqlServer (sqlServerDialect) where++> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Dialects.BaseCatalog+> import Database.HsSqlPpp.Dialects.Postgres+> --import Database.HsSqlPpp.Internals.Dialect+> --import Data.List+> import Data.Generics.Uniplate.Data++The sql server dialect is a crap modification to the postgresql+dialect at the moment. After a bunch more tests are written, it+should be reimplemented separately from scratch++> sqlServerDialect :: Dialect+> sqlServerDialect = Dialect+> {diName = "sqlServer"+> ,diSyntaxFlavour = SqlServer+> ,diCanonicalTypeNames = [("timestamp", ["datetime"])+> -- todo: temp before sqlserver dialect is done properly+> -- this hack should probably move to the ansi dialect first+> ,("int1", ["tinyint"])+> ,("int2", ["smallint"])+> ,("int4", ["integer","int"])+> ,("int8", ["bigint"])+> ,("float4", ["real"])+> ,("float8", ["double precision","float","double"])+> -- probably some missing here+> ,("varchar", ["character varying"])+> ,("char", ["character"])+> ,("bool", ["boolean"])]+> ,diTextTypes = ["char","varchar", "nvarchar"]+> ,diDatetimeTypes = ["date","time","timestamp","interval"]+> ,diNumberTypes = ["int2","int4","int8","numeric","float4","float8"]+> ,namesForAnsiTypes = [("char","char")+> ,("varchar","varchar")+> ,("nvarchar","nvarchar")+> ,("bigint","int8")+> ,("boolean","bool")+> ,("numeric","numeric")+> ,("int","int4")+> ,("date","date")+> ,("time","time")+> ,("timestamp","timestamp")+> ] -- todo: these are postgres names+> ,diDefaultCatalog = tsqlCatalog+> }++> tsqlCatalog :: Catalog+> tsqlCatalog = either (error . show) id catr+> where+> catr = updateCatalog+> (alterUpdates (deconstructCatalog+> (diDefaultCatalog postgresDialect)+> ++ additionalEntries))+> emptyCatalog+> -- change the counts to return int instead of long+> alterUpdates = map $ \u -> case u of+> CatCreateAggregate "count" ["any"] "int8" ->+> CatCreateAggregate "count" ["any"] "int4"+> CatCreateAggregate f [e] _ | f `elem` ["sum","avg"]+> , e `elem` ["int1"+> ,"int2"+> ,"int4"] ->+> CatCreateAggregate f [e] "int4"+> CatCreateAggregate f ["float4"] _ | f `elem` ["sum","avg"] ->+> CatCreateAggregate f ["float4"] "float8"+> CatCreateAggregate f ["int8"] _ | f `elem` ["sum","avg"] ->+> CatCreateAggregate f ["int8"] "int8"+> _ -> u++> additionalEntries =+> int1fns +++> int12fns +++> [CatCreateScalarType "nvarchar"+> ,CatCreateTypeCategoryEntry "nvarchar" ("S", False)+> ,CatCreateBinaryOp "+" "varchar" "varchar" "varchar"+> ,CatCreateFunction "getdate" [] False "timestamp"+> ,CatCreateFunction "isnumeric" ["anyelement"] False "int4"+> ,CatCreateFunction "grt_lengthconv" ["int4"] False "int4"+> ,CatCreateFunction "isnull" ["anyelement","anyelement"] False "anyelement"+> -- put these in to stop use the text only version and a bunch of casts+> ,CatCreateFunction "replace" ["char", "char", "char"] False "char"+> ,CatCreateFunction "replace" ["varchar", "varchar", "varchar"] False "varchar"+> ,CatCreateFunction "replace" ["nvarchar", "nvarchar", "nvarchar"] False "nvarchar"+> ,CatCreateFunction "patindex" ["char","char"] False "int4"+> ,CatCreateFunction "patindex" ["varchar","varchar"] False "int4"+> ,CatCreateFunction "patindex" ["nvarchar","nvarchar"] False "int4"+> ,CatCreateFunction "isdate" ["varchar"] False "bool"+> ,CatCreateFunction "isdate" ["char"] False "int4"+> ,CatCreateFunction "isdate" ["nvarchar"] False "int4"+> ,CatCreateFunction "len" ["nvarchar"] False "int4"+> ,CatCreateFunction "len" ["varchar"] False "int4"+> ,CatCreateAggregate "count_big" ["any"] "int8"+> ,CatCreateFunction "datediff" ["int4","date","date"] False "int4"+> ,CatCreateFunction "datediff" ["int4","timestamp","timestamp"] False "int4"+> ,CatCreateFunction "dateadd" ["int4","int4","date"] False "date"+> ,CatCreateFunction "dateadd" ["int4","int4","timestamp"] False "timestamp"+> ,CatCreateFunction "datepart" ["int4","date"] False "int4"+> ,CatCreateFunction "datepart" ["int4","timestamp"] False "int4"+> ,CatCreateFunction "trunc" ["timestamp"] False "timestamp"+> ,CatCreateCast "char" "varchar" ImplicitCastContext++> ,CatCreateFunction "substring" ["nvarchar","int4","int4"] False "nvarchar"+> ,CatCreateFunction "like" [ "nvarchar" , "nvarchar" ] False "bool"++postponed until we have better design+ example of a problem: in "float4 < int4", both arguments are cast to text,+ because it has higher priority (see CatCreateTypeCategoryEntry)++> --,CatCreateCast "int1" "varchar" ImplicitCastContext+> --,CatCreateCast "int2" "varchar" ImplicitCastContext+> --,CatCreateCast "int4" "varchar" ImplicitCastContext+> --,CatCreateCast "int8" "varchar" ImplicitCastContext+> --,CatCreateCast "float4" "varchar" ImplicitCastContext+> --,CatCreateCast "float8" "varchar" ImplicitCastContext+> --,CatCreateCast "int1" "text" ImplicitCastContext+> --,CatCreateCast "int2" "text" ImplicitCastContext+> --,CatCreateCast "int4" "text" ImplicitCastContext+> --,CatCreateCast "int8" "text" ImplicitCastContext+> --,CatCreateCast "float4" "text" ImplicitCastContext+> --,CatCreateCast "float8" "text" ImplicitCastContext+> ]+> -- find all the functions on int2 and replace int2 with int1+> -- then find all the functions with int2 and int4, and+> -- replace int2 with int1 and int4 with int2+> -- really hacky+> int1fns = let s = filter (\x -> replaceItp x && hasInt2 x)+> (deconstructCatalog (diDefaultCatalog postgresDialect))+> in flip transformBi s $ \x -> case (x :: CatName) of+> "int2" -> "int1"+> _ -> x+> int12fns = let s = filter (\x -> replaceItp x && hasInt2Int4 x)+> (deconstructCatalog (diDefaultCatalog postgresDialect))+> in flip transformBi s $ \x -> case (x :: CatName) of+> "int2" -> "int1"+> "int4" -> "int2"+> _ -> x+> hasInt2 x = not $ null [() | ("int2" :: CatName) <- universeBi x]+> hasInt2Int4 x = not $ null [() | ("int2" :: CatName) <- universeBi x+> , ("int4" :: CatName) <- universeBi x]+> replaceItp x = case x of+> CatCreateScalarType {} -> True+> CatCreateArrayType {} -> True+> CatCreatePrefixOp {} -> True+> CatCreateBinaryOp {} -> True+> CatCreateFunction f _ _ _ | f `elem` ["abs","float4","float8","int2","int4","mod","numeric"] -> True+> CatCreateAggregate f _ _ | f `elem` ["avg","max","min","sum"] -> True+> CatCreateCast a b _ | a == "int2" || b == "int2" -> True+> CatCreateTypeCategoryEntry {} -> True+> _ -> False++comparisons with all ints+abs+cast functions+avg to numeric max min sum+catcreatecast: float4,float8, int4,int8,numeric, from+
+ src/Database/HsSqlPpp/Internals/AstInternal.hs view
@@ -0,0 +1,30152 @@+++{-# LANGUAGE TupleSections,ScopedTypeVariables,DeriveDataTypeable,OverloadedStrings #-}+-- UUAGC 0.9.52.2 (hssqlppp/src/Database/HsSqlPpp/Internals/AstInterna)+module Database.HsSqlPpp.Internals.AstInternal(+ --from the ag files:+ --ast nodes+ Statement (..)+ ,QueryExpr (..)+ ,WithQueryList+ ,WithQuery(..)+ ,FnBody (..)+ ,SetClause (..)+ ,SetClauseList+ ,TableRef (..)+ ,JoinExpr (..)+ ,JoinType (..)+ ,JoinHint (..)+ ,SelectList (..)+ ,SelectItem (..)+ ,CopyFromSource (..)+ ,CopyToSource(..)+ ,CopyToOption(..)+ ,CopyFromOption(..)+ ,TablePartitionDef(..)+ ,TablePartitionDateTimeInterval(..)+ ,AttributeDef (..)+ ,RowConstraint (..)+ ,TableOption(..)+ ,AlterDatabaseOperation(..)+ ,AlterTableOperation(..)+ ,AlterTableAction(..)+ ,AlterSequenceOperation(..)+ ,AlterSequenceAction(..)+ ,AlterColumnAction(..)+ ,AlterSchemaOperation(..)+ ,Constraint (..)+ ,TypeAttributeDef (..)+ ,ParamDef (..)+ ,VarDef (..)+ ,RaiseType (..)+ ,CombineType (..)+ ,Volatility (..)+ ,Language (..)+ ,TypeName (..)+ ,DropType (..)+ ,Cascade (..)+ ,Direction (..)+ ,Distinct (..)+ ,NullsOrder(..)+ ,Natural (..)+ ,IfExists (..)+ ,Replace(..)+ ,RestartIdentity (..)+ ,ScalarExpr (..)+ ,Name(..)+ ,nameComponents+ ,NameComponent(..)+ ,ncStr+ ,IntervalField(..)+ ,ExtractField(..)+ ,FrameClause(..)+ ,OdbcLiteralType(..)+ ,InList (..)+ ,LiftFlavour(..)+ ,TriggerWhen(..)+ ,TriggerEvent(..)+ ,TriggerFire(..)+ ,QueryHint(..)+ ,StatementList+ ,ScalarExprListStatementListTripleList+ ,ScalarExprListStatementListTriple+ ,ScalarExprList+ ,ParamDefList+ ,AttributeDefList+ ,ConstraintList+ ,TypeAttributeDefList+ ,TypeNameList+ ,NameTypeNameListPair+ ,NameTypeNameListPairList+ ,ScalarExprStatementListPairList+ --,SetClauseList+ ,CaseScalarExprListScalarExprPairList+ ,MaybeScalarExpr+ ,TableRefList+ ,ScalarExprListList+ ,SelectItemList+ ,OnExpr+ ,RowConstraintList+ ,VarDefList+ ,ScalarExprStatementListPair+ ,CaseScalarExprListScalarExprPair+ ,ScalarExprDirectionPair+ ,ScalarExprDirectionPairList+ ,MaybeBoolExpr+ ,MaybeSelectList+ ,SetValue(..)+ ,AlterTableActionList+ ,NameComponentList+ ,MaybeNameComponentList+ -- typechecking+ ,typeCheckStatements+ --,typeCheckParameterizedStatement+ ,typeCheckScalarExpr+ --,typeCheckScalarExprEnv+ ,typeCheckQueryExpr+ ,TypeCheckFlags(..)+ ,addExplicitCasts+ ,addImplicitCasts+ -- annotation+ ,Annotation(..)+ --,TypeExtra(..)+ ,SourcePosition+ ,ParameterizedStatementType+ ,getAnnotation+ ,updateAnnotation+ ,emptyAnnotation+ ,makeSelect+ --,canonicalizeTypeNames+) where++--import Data.Maybe+--import Data.Either+--import Data.List+--import Control.Applicative+import Data.Data+--import Data.Char+--import Control.Monad.State+--import Control.Arrow++import Data.Generics+import Data.Generics.Uniplate.Data+--import Debug.Trace+--import Text.Show.Pretty+++--import Database.HsSqlPpp.Internals.TypesInternal++--import Database.HsSqlPpp.Internals.TypeChecking.TypeConversion+--import Database.HsSqlPpp.Internals.TypeChecking.Environment hiding (JoinType(..))++--import Database.HsSqlPpp.Internals.Catalog.CatalogInternal (NameComponent(..),ncStr)++--import Database.HsSqlPpp.Utils.Utils+--import Database.HsSqlPpp.Internals.Dialect+--import Data.Text (Text)+import qualified Data.Text as T+--import qualified Data.Text.Lazy as LT++-- very bad, we use types in the syntax outside of the already exception+-- in the annotation (which can be removed when the annotation type+-- becomes a type parameters+-- can replace the use of type extra with (typename,int,int) triple+-- to fix this+--import Database.HsSqlPpp.Internals.TypesInternal (TypeExtra)++++{-# LINE 2 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}++import Data.Text (Text)+import qualified Database.HsSqlPpp.Internals.TypeChecking.Environment as E+import Database.HsSqlPpp.Internals.TypeChecking.Environment (Environment)+import Database.HsSqlPpp.Internals.TypesInternal+import Database.HsSqlPpp.Internals.Dialect+import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+import Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+import Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion++-- todo: find a better way to do this, this information should come+-- via the dialect or catalog in the attributes+import Database.HsSqlPpp.Dialects.OdbcCatalog++import Control.Monad+import Data.List+import Data.Maybe+import Data.Char+import Text.Read+import Control.Applicative+{-# LINE 182 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 14 "hssqlppp/src/Database/HsSqlPpp/Internals/Annotation.ag" #-}++import qualified Database.HsSqlPpp.Internals.TypesInternal as T+import qualified Database.HsSqlPpp.Internals.Catalog.CatalogTypes as C++{-# LINE 189 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+{-# LINE 62 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}++-- todo: replace the other nmcString function with this one+-- which uses either instead of error+xnmcString :: NameComponent -> Either [TypeError] Text+xnmcString (QNmc n) = Right $ T.pack n+xnmcString (Nmc n) = Right $ T.pack $ map toLower n+xnmcString (AntiNameComponent _) = Left [InternalError "tried to get nmc string from antinamecomponent"]+{-# LINE 198 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 191 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}++splitTypeExtraList:: Maybe [TypeExtra] -> Maybe (TypeExtra,[TypeExtra])+splitTypeExtraList mte = mte >>= f+ where+ f [] = Nothing+ f (et:ets') = Just (et,ets')+{-# LINE 207 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 212 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+++-- | thet name to choose for a column in a select list which doesn't+-- have an explicit name - these are postgresql's rules+columnName :: ScalarExpr -> NameComponent+columnName (Identifier _ i) = last $ nameComponents i+columnName (App _ (Name _ ncs) _) = last ncs+columnName (Cast _ _ (SimpleTypeName _ (Name _ ncs))) = last ncs+columnName (ImplicitCast _ e _) = columnName e+columnName (WindowApp _ (App _ (Name _ ncs) _) _ _ _) = last ncs+columnName (AggregateApp _ _ (App _ (Name _ ncs) _) _) = last ncs+columnName _ = QNmc "?column?"+{-# LINE 222 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 160 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}++convertJoinType:: JoinType -> E.JoinType+convertJoinType LeftOuter = E.LeftOuter+convertJoinType RightOuter = E.RightOuter+convertJoinType FullOuter = E.FullOuter+convertJoinType _ = E.Inner+{-# LINE 231 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 82 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}++secondM :: Functor f => (t -> f a) -> (t1, t) -> f (t1, a)+secondM f (a,b) = (a,) <$> f b+{-# LINE 237 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 47 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}++needsImplicitCast:: Bool -> TypeExtra -> TypeExtra -> Bool+needsImplicitCast expectedCast upType expType+ = tePrecision upType /= tePrecision expType+ || teScale upType /= teScale expType+ || teNullable upType /= teNullable expType+ && nullabilityCast+ || teType upType /= teType expType+ && (not . null) (nub [teType upType, teType expType] \\ [ScalarType "varchar", ScalarType "text",ScalarType "nvarchar"])+ where+ nullabilityCast = expectedCast+-- this function appeared because nullability does not always influence the type to cast to+implicitCastType:: Bool -> TypeExtra -> TypeExtra -> TypeExtra+implicitCastType expectedCast upType expType+ = expType{tePrecision = precision, teScale = scale, teNullable = nullability}+ where+ nullabilityCast = expectedCast+ nullabilitySource = if nullabilityCast then expType else upType+ precisionSource = expType+ nullability = teNullable nullabilitySource+ precision = tePrecision precisionSource+ scale = teScale precisionSource+{-# LINE 262 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 513 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}++getMaybeIntsFromLiterals :: [ScalarExpr] -> MatchAppLiteralList+getMaybeIntsFromLiterals sel = map extractor sel+ where+ extractor :: ScalarExpr -> Maybe Int+ extractor (NumberLit _ s) = readMaybe s :: Maybe Int+ extractor _ = Nothing+{-# LINE 272 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 796 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}++classifyInteger :: Dialect -> String -> Either [TypeError] Text+classifyInteger d s = maybe (Left []) Right $ case (readMaybe s :: Maybe Integer) of+ -- assuming number literals are always positive+ Just n | n < (2 ^ (31 :: Integer)) -> ansiTypeNameToDialect d "int"+ | n < (2 ^ (63 :: Integer)) -> ansiTypeNameToDialect d "bigint"+ _ -> ansiTypeNameToDialect d "numeric"+{-# LINE 282 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 26 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+++-- | some options when typechecking+data TypeCheckFlags =+ TypeCheckFlags+ { -- | add qualifiers to unqualified ids where possible+ tcfAddQualifiers :: Bool+ -- | add full aliases to every tableref and subselect+ ,tcfAddFullTablerefAliases :: Bool+ -- | add explicit aliases to all select items+ ,tcfAddSelectItemAliases :: Bool+ -- | expand stars in select lists to explicit list columns+ ,tcfExpandStars :: Bool+ ,tcfDialect :: Dialect}+ deriving (Show,Eq)++-- | Typechecks the ast, and returns the updated catalog (which+-- includes changes from any ddl statements in the ast).+typeCheckStatements :: TypeCheckFlags -> Catalog -> [Statement] -> (Catalog,[Statement])+typeCheckStatements f cat sts =+ let t = _sem_Root (Root sts)+ ta = _wrap_Root t Inh_Root {_cat_Inh_Root = cat+ ,_flags_Inh_Root = f+ {-,_lib_Inh_Root = emptyBindings+ ,_idenv_Inh_Root = emptyIDEnv "tcs"-}}+ tl = _annotatedTree_Syn_Root ta+ cat1 = cat --_producedCat_Syn_Root ta+ in case tl of+ Root r -> (cat1,fixTree (tcfDialect f) r)+-- | Typecheck a query expr+typeCheckQueryExpr :: TypeCheckFlags -> Catalog -> QueryExpr -> QueryExpr+typeCheckQueryExpr f cat qe =+ let (_,[QueryStatement _ qe']) = typeCheckStatements f cat [QueryStatement emptyAnnotation qe]+ in qe'++-- | Not working yet. Typechecks a statement possibly containing ?+-- placeholders. These are annotated with the 'inferred type', and the+-- stType annotation on the return value can be used to get this info+-- easily. Returns Left if the statement is not a query,insert,update or delete+-- statement+{-typeCheckParameterizedStatement :: TypeCheckFlags -> Catalog -> Statement -> Either String Statement+typeCheckParameterizedStatement f cat st =+ case st of+ QueryStatement _ _ -> tc+ Insert _ _ _ _ _ -> tc+ Update _ _ _ _ _ _ -> tc+ Delete _ _ _ _ _ -> tc+ _ -> Left "requires select, update, insert or delete statement"+ where+ tc = let tl = typeCheckStatements f cat [st]+ in case tl of+ (_,[st1]) -> Right st1+ _ -> error "impossible happened in typeCheckPS!"+-}+{-+-- | type check a scalar expr+typeCheckScalarExpr :: TypeCheckFlags -> Catalog -> ScalarExpr -> ScalarExpr+typeCheckScalarExpr f cat ex =+ let t = _sem_ScalarExprRoot (ScalarExprRoot ex)+ rt = (_annotatedTree_Syn_ScalarExprRoot+ (_wrap_ScalarExprRoot t Inh_ScalarExprRoot {_cat_Inh_ScalarExprRoot = cat+ ,_flags_Inh_ScalarExprRoot = f+ ,_downEnv_Inh_ScalarExprRoot = E.emptyEnvironment+ {-,_lib_Inh_ScalarExprRoot = emptyBindings+ ,_idenv_Inh_ScalarExprRoot = emptyIDEnv "t+cse"-}}))+ in case rt of+ ScalarExprRoot e -> fixTree e -}++typeCheckScalarExpr :: TypeCheckFlags -> Catalog -> Environment+ -> ScalarExpr -> ScalarExpr+typeCheckScalarExpr f cat env ex =+ let t = _sem_ScalarExprRoot (ScalarExprRoot ex)+ rt = _annotatedTree_Syn_ScalarExprRoot+ $ _wrap_ScalarExprRoot t+ Inh_ScalarExprRoot{_cat_Inh_ScalarExprRoot = cat+ ,_flags_Inh_ScalarExprRoot = f+ ,_downEnv_Inh_ScalarExprRoot = env}+ in case rt of+ ScalarExprRoot e -> fixTree (tcfDialect f) e++{-# LINE 366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 158 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+++-- | run on a typechecked tree. Finds all the places where an implicit+-- cast has been used in the typechecking and inserts an explicit cast+addExplicitCasts :: Data a => a -> a+addExplicitCasts = transformBi removeDoubleCasts . transformBi addCast+ where+ addCast :: ScalarExpr -> ScalarExpr+ addCast e = fromMaybe e $ do+ t <- anImplicitCast (getAnnotation e)+ n <- nameOfType $ teType t+ return $ Cast emptyAnnotation e n+ -- addCast isn't very smart, so remove any unneeded casts+ -- that it has inserted. Only do this when have two+ -- nested casts which cast to the same type, so this+ -- shouldn't cause problems with sane sql+ removeDoubleCasts :: ScalarExpr -> ScalarExpr+ removeDoubleCasts e = case e of+ (Cast a (Cast _ e' t1) t)+ | resetAnnotations t1 == resetAnnotations t -> Cast a e' t+ e' -> e'+ resetAnnotations = transformBi (const emptyAnnotation)+-- | variation of the above, which uses ImplicitCast ctor+addImplicitCasts :: Data a => Catalog -> a -> a+addImplicitCasts cat = transformBi removeDoubleCasts . transformBi addCast+ where+ addCast:: ScalarExpr -> ScalarExpr+ addCast e = fromMaybe e $ do+ te <- anImplicitCast ann'+ -- ImplicitCastToDo: why anImplicitCast is not Nothing above Star+ _ <- nameOfType $ teType te -- in order to preserve the old logic+ -- guard $ isCastable e $ teType te+ guard $ anType ann' /= Just te+ return $ ImplicitCast emptyAnnotation e te+ where+ _isCastable:: ScalarExpr -> Type -> Bool+ _isCastable e' to = fromMaybe False $ do+ from <- liftM teType $ anType $ getAnnotation e'+ either (const $ if from == UnknownType then Just True else Nothing) Just+ $ catCast cat ImplicitCastContext from to+ ann' = getAnnotation e+ removeDoubleCasts:: ScalarExpr -> ScalarExpr+ removeDoubleCasts e = fst $ accumulateCasts e+ -- For each implicit cast, if there is a sequence of implicit casts right under it,+ -- that remained after bottom-up application of the algorithm being described:+ -- 1. Check if there is a type in the sequence (of argument types of implicit casts),+ -- which is implicitly castable to the target type of the current implicit cast,+ -- according to the current catalog.+ -- 2. If there is such a type, replace a sequence of casts that starts at this type with+ -- a single cast, and shorten the list of casts to be further investigated (snd of+ -- output type of this function).+ -- 2.1. Analyze the list bottom-up, so that the longest possible sequence of casts is+ -- replaced.+ -- 3. If there is no such a type, just add the current cast to the list.+ -- Reset the list on a node other than ImplicitCast.+ accumulateCasts:: ScalarExpr -> (ScalarExpr,[(ScalarExpr,Type)])+ accumulateCasts e = case e of+ ImplicitCast a e' te+ -> let (e1,ets) = accumulateCasts e'+ eStart = ImplicitCast a e1 te+ isCastable (_,t) = either (const False) id+ $ catCast cat ImplicitCastContext t $ teType te+ f z xs = case dropWhile (not . isCastable) xs of+ [] -> z+ xs'@((e'',_):rest) -> f (ImplicitCast a e'' te, xs') rest+ in case anType $ getAnnotation e1 of+ Nothing -> (eStart,[]) -- cut here (should not happen in practice)+ Just te1 -> f (eStart, (e1, teType te1):ets) ets+ _ -> (e,[])++nameOfType :: Type -> Maybe TypeName+nameOfType (ScalarType t) = Just $ SimpleTypeName emptyAnnotation (Name emptyAnnotation [Nmc $ T.unpack t])+-- a hack to support precision cast from string literals+nameOfType UnknownType = Just $ SimpleTypeName emptyAnnotation (Name emptyAnnotation [Nmc "unknown"])+nameOfType (DomainType t) = Just $ SimpleTypeName emptyAnnotation (Name emptyAnnotation [Nmc $ T.unpack t])+nameOfType (EnumType t) = Just $ SimpleTypeName emptyAnnotation (Name emptyAnnotation [Nmc $ T.unpack t])+nameOfType (NamedCompositeType t) = Just $ SimpleTypeName emptyAnnotation (Name emptyAnnotation [Nmc $ T.unpack t])+nameOfType _ = Nothing++-- hack for various fixups+fixTree :: Data a => Dialect -> a -> a+fixTree = fixMssqlDates++{-+++disgusting hack to fix up datediff,datepart, convert and other+functions which accept a fixed list of keywords for one or more of the+arguments for sql server: set the type for the first argument to type+in if it is in the acceptable list.++This is really bad. What happens is that the normal typechecker will+check the keyword as an identifier and (usually!) put in unknown+identifier error. Then, when the function is typechecked, it will+ignore the type for this argument. After we've finished, the type+error is replaced with int type here.++The proper fix:++I think a good way to look at these is to consider them fixed enums+which can only accept a literal (and not an enum valued+expression). We set a flag/enum thing in the typecheck environment of+the identifier, so that it can check the identifier fits one of the+valid functions in the identifier itself. Then, there doesn't need to+be a fix here, and typechecking the function should work without a+hack here too. The typechecking of the function itself still needs+some special casing (e.g. for the convert function in odbc (and+similar in regular sql server syntax), the result type depends on the+value of the 'enum'. This can be implemented in a similar way to the+literal ints being passed to the function type checker.++This will be fixed with the rewrite of the findcallmatch/matchapp/a+million different fns for precision and nullability/tcApplike mess.++-}++fixMssqlDates :: Data a => Dialect -> a -> a+fixMssqlDates d = transformBi $ \x -> case x of+ App aa nm@(Name _ [Nmc fn]) [Identifier ai tn@(Name _ [Nmc tnn]),a,b]+ | map toLower fn `elem` ["datediff","dateadd"]+ , map toLower tnn `elem` dateparts ->+ App aa nm [Identifier (nai ai) tn,a,b]+ App aa nm@(Name _ [Nmc fn]) [Identifier ai tn@(Name _ [Nmc tnn]),a]+ | map toLower fn == "datepart"+ , map toLower tnn `elem` dateparts ->+ App aa nm [Identifier (nai ai) tn,a]+ App aa nm@(Name _ [Nmc fn]) [a,Identifier ai tn@(Name _ [Nmc tnn])]+ | map toLower fn == "convert"+ , map toLower tnn `elem` map fst odbcConvertTypes ->+ App aa nm [a,Identifier (nai ai) tn]+ App aa nm@(Name _ [Nmc fn]) (Identifier ai tn@(Name _ [Nmc tnn]):as)+ | map toLower fn `elem` ["timestampadd","timestampdiff"]+ , map toLower tnn `elem` odbcIntervalTypes ->+ App aa nm (Identifier (nai ai) tn:as)+ x' -> x'+ where+ dateparts :: [String]+ dateparts = ["day","dd","d","month","mm","m","year","yyyy"+ ,"yy","quarter","qq","q","dayofyear","doy","dy","y"+ ,"weekday","dw","week","ww","wk","hour","hh"+ ,"minute","mi","n","second","ss","s","millisecond","ms"+ ,"microsecond","mcs","nanosecond","ns"]+ -- todo: use canonical tsql name for typeInt+ nai ai = ai {anType = (mkTypeExtraNN . ScalarType) <$> ansiTypeNameToDialect d "int"+ ,anErrs = []}+++-- temp utility function++{-canonicalizeType :: Dialect -> Type -> Type+canonicalizeType d (ScalarType t) = ScalarType $ canonicalizeTypeName d t+canonicalizeType _ t = t-}++{-# LINE 522 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 20 "hssqlppp/src/Database/HsSqlPpp/Internals/Annotation.ag" #-}++-- | Represents a source file position, usually set by the parser.+type SourcePosition = (FilePath,Int,Int)++-- | Statement type is used for getting type information for a+-- parameterized statement. The first part is the args that the+-- parameterized statement needs, and the second is the names and types+-- of the output columns. No way to signal that a statement returns+-- exactly one row at the moment+type ParameterizedStatementType = ([T.Type],[(String,T.Type)])++{-# LINE 536 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 52 "hssqlppp/src/Database/HsSqlPpp/Internals/Annotation.ag" #-}+++--some simple wrappers around uniplate for internal use. I'm not sure+--which of these are actually used++-- | An annotation value with no information.+emptyAnnotation :: Annotation+emptyAnnotation = Annotation Nothing Nothing [] Nothing []++-- | get the annotation for the root element of the tree passed+getAnnotation :: Data a => a -> Annotation+getAnnotation = head . childrenBi++--don't know how to do this one with uniplate++-- | Update the first annotation in a tree using the function supplied+updateAnnotation :: Data a => (Annotation -> Annotation) -> a -> a+updateAnnotation f = gmapT (mkT f)++{-# LINE 558 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 519 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++nameComponents :: Name -> [NameComponent]+nameComponents (Name _ is) = is+-- todo: don't use error+nameComponents (AntiName _) = error "tried to get namecomponents of antiname"+{-# LINE 566 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 539 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++++data LiftFlavour = LiftAny | LiftAll+ deriving (Show,Eq,Typeable,Data)++data Direction = Asc | Desc+ deriving (Show,Eq,Typeable,Data)++data NullsOrder = NullsDefault | NullsFirst | NullsLast+ deriving (Show,Eq,Typeable,Data)++data Distinct = Distinct | All+ deriving (Show,Eq,Typeable,Data)++-- maybe should improve this, since you can have at least union+-- distinct and union all just like select distinct and select all++data CombineType = Except | Union | Intersect | UnionAll+ deriving (Show,Eq,Typeable,Data)++data IntervalField = IntervalYear+ | IntervalMonth+ | IntervalDay+ | IntervalHour+ | IntervalMinute+ | IntervalSecond+ | IntervalYearToMonth+ | IntervalDayToHour+ | IntervalDayToMinute+ | IntervalDayToSecond+ | IntervalHourToMinute+ | IntervalHourToSecond+ | IntervalMinuteToSecond+ deriving (Show,Eq,Typeable,Data)++data ExtractField = ExtractCentury+ | ExtractDay+ | ExtractDecade+ | ExtractDow+ | ExtractDoy+ | ExtractEpoch+ | ExtractHour+ | ExtractIsodow+ | ExtractIsoyear+ | ExtractMicroseconds+ | ExtractMillennium+ | ExtractMilliseconds+ | ExtractMinute+ | ExtractMonth+ | ExtractQuarter+ | ExtractSecond+ | ExtractTimezone+ | ExtractTimezoneHour+ | ExtractTimezoneMinute+ | ExtractWeek+ | ExtractYear+ deriving (Show,Eq,Typeable,Data)++-- todo: this needs fixing, it is currently based on limited frame options+data FrameClause = FrameUnboundedPreceding+ | FrameUnboundedFull+ | FrameRowsUnboundedPreceding+ deriving (Show,Eq,Typeable,Data)+++data OdbcLiteralType = OLDate+ | OLTime+ | OLTimestamp+ deriving (Show,Eq,Typeable,Data)+{-# LINE 639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 693 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data JoinType = Inner | LeftOuter| RightOuter | FullOuter | Cross+ deriving (Show,Eq,Typeable,Data)+data JoinHint = Loop | Hash | Merge+ deriving (Show,Eq,Typeable,Data)+data Natural = Natural | Unnatural+ deriving (Show,Eq,Typeable,Data)+{-# LINE 649 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 711 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++-- | 'default' valued select, use for creating select values+--+-- > makeSelect :: QueryExpr+-- > makeSelect = Select+-- > {ann = emptyAnnotation+-- > ,selDistinct = All+-- > ,selSelectList = (SelectList emptyAnnotation [])+-- > ,selTref = []+-- > ,selWhere = Nothing+-- > ,selGroupBy = []+-- > ,selHaving = Nothing+-- > ,selOrderBy = []+-- > ,selLimit = Nothing+-- > ,selOffset = Nothing+-- > ,selOption = []}+--+-- On its own, it isn't valid syntax: to use it you have to replace+-- the select list at minimum+--+-- use something like this+--+-- > s = makeSelect {selSelectList = sl [se $ i "a"]+-- > ,selTref = [tref "t"]}+-- > where+-- > a = emptyAnnotation+-- > sl = SelectList a+-- > se = SelExp a+-- > i = Identifier a+-- > tref t = Tref a (Name a [Nmc t])++makeSelect :: QueryExpr+makeSelect = Select+ {ann = emptyAnnotation+ ,selDistinct = All+ ,selSelectList = (SelectList emptyAnnotation [])+ ,selTref = []+ ,selWhere = Nothing+ ,selGroupBy = []+ ,selHaving = Nothing+ ,selOrderBy = []+ ,selLimit = Nothing+ ,selOffset = Nothing+ ,selOption = []}+{-# LINE 696 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1021 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data CopyFromSource = CopyFilename String+ | Stdin+ deriving (Show,Eq,Typeable,Data)+data CopyToSource = CopyTable Name [NameComponent]+ | CopyQuery QueryExpr+ deriving (Show,Eq,Typeable,Data)++data CopyFromOption = CopyFromFormat String+ | CopyFromDelimiter String+ | CopyFromErrorLog String+ | CopyFromErrorVerbosity Int+ | CopyFromParsers String+ | CopyFromDirectory+ | CopyFromOffset Integer+ | CopyFromLimit Integer+ | CopyFromErrorThreshold Int+ | CopyFromNewlineFormat String+ deriving (Show,Eq,Typeable,Data)++data CopyToOption = CopyToFormat String+ | CopyToDelimiter String+ | CopyToErrorLog String+ | CopyToErrorVerbosity Int+ deriving (Show,Eq,Typeable,Data)++{-# LINE 725 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1099 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data TableOption =+ TableOptionStringVal [String] String+ | TableOptionNameVal [String] [Name]+ | TableOptionNumberVal [String] String+ | TableOptionKeywords [String]+ deriving (Show,Eq,Typeable,Data)++{-# LINE 736 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1122 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data TablePartitionDateTimeInterval = Year | Month | Day | Hour | Minute | Second | Millisecond+ deriving (Show,Eq,Typeable,Data)+{-# LINE 742 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1185 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data SetValue+ = SetStr Annotation String+ | SetId Annotation String+ | SetNum Annotation Double+ deriving (Show,Eq,Typeable,Data)+++data TriggerWhen = TriggerBefore | TriggerAfter+ deriving (Show,Eq,Typeable,Data)+data TriggerEvent = TInsert| TUpdate | TDelete | AntiTriggerEvent String+ deriving (Show,Eq,Typeable,Data)+data TriggerFire = EachRow | EachStatement+ deriving (Show,Eq,Typeable,Data)++data DropType = Table+ | Domain+ | View+ | Type+ | Database+ | User+ | Login+ | Schema+ deriving (Show,Eq,Typeable,Data)++data Cascade = Cascade | Restrict+ deriving (Show,Eq,Typeable,Data)++++data IfExists = Require | IfExists+ deriving (Show,Eq,Typeable,Data)+++data RestartIdentity = RestartIdentity | ContinueIdentity+ deriving (Show,Eq,Typeable,Data)++{-# LINE 782 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1228 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data Replace = Replace | NoReplace+ deriving (Show,Eq,Typeable,Data)++data Volatility = Volatile | Stable | Immutable+ deriving (Show,Eq,Typeable,Data)++-- todo: fix the fn body to support to support other languages+-- just as as string for now+-- probably change Language to be a string also++data Language = Sql | Plpgsql+ deriving (Show,Eq,Typeable,Data)+{-# LINE 798 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1267 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data RaiseType = RNotice | RException | RError+ deriving (Show,Eq,Typeable,Data)++{-# LINE 805 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++data QueryHint = QueryHintPartitionGroup | QueryHintColumnarHostGroup+ deriving (Show,Eq,Typeable,Data)++{-# LINE 812 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}++{-# LINE 1387 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag" #-}++-- TODO: move this somewhere better+-- | run canonicalizeTypeName on all the TypeName nodes in an ast+{-canonicalizeTypeNames :: Data a => Dialect -> a -> a+canonicalizeTypeNames d =+ (transformBi $ \x ->+ case x of+ ScalarType s -> ScalarType $ canonicalizeTypeName d s+ x' -> x')+ . (transformBi $ \x ->+ case x of+ SimpleTypeName a tn -> SimpleTypeName a (c tn)+ PrecTypeName a tn i -> PrecTypeName a (c tn) i+ Prec2TypeName a tn i i1 -> Prec2TypeName a (c tn) i i1+ x' -> x')+ where+ c (Name a [Nmc nc]) = Name a [Nmc $ T.unpack $ canonicalizeTypeName d $ T.pack nc]+ c z = z-}++{-# LINE 834 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+-- AlterColumnAction -------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterColumnAction + originalTree : AlterColumnAction + alternatives:+ alternative SetDataType:+ child ann : Annotation + child typ : TypeName + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative SetNotNull:+ child ann : Annotation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DropNotNull:+ child ann : Annotation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative SetDefault:+ child ann : Annotation + child def : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DropDefault:+ child ann : Annotation + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterColumnAction = SetDataType (Annotation) (TypeName)+ | SetNotNull (Annotation)+ | DropNotNull (Annotation)+ | SetDefault (Annotation) (ScalarExpr)+ | DropDefault (Annotation)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterColumnAction :: AlterColumnAction ->+ T_AlterColumnAction+_sem_AlterColumnAction (SetDataType _ann _typ) =+ (_sem_AlterColumnAction_SetDataType (_sem_Annotation _ann) (_sem_TypeName _typ))+_sem_AlterColumnAction (SetNotNull _ann) =+ (_sem_AlterColumnAction_SetNotNull (_sem_Annotation _ann))+_sem_AlterColumnAction (DropNotNull _ann) =+ (_sem_AlterColumnAction_DropNotNull (_sem_Annotation _ann))+_sem_AlterColumnAction (SetDefault _ann _def) =+ (_sem_AlterColumnAction_SetDefault (_sem_Annotation _ann) (_sem_ScalarExpr _def))+_sem_AlterColumnAction (DropDefault _ann) =+ (_sem_AlterColumnAction_DropDefault (_sem_Annotation _ann))+-- semantic domain+type T_AlterColumnAction = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterColumnAction,AlterColumnAction)+data Inh_AlterColumnAction = Inh_AlterColumnAction {_cat_Inh_AlterColumnAction :: Catalog,_flags_Inh_AlterColumnAction :: TypeCheckFlags,_imCast_Inh_AlterColumnAction :: (Maybe TypeExtra)}+data Syn_AlterColumnAction = Syn_AlterColumnAction {_annotatedTree_Syn_AlterColumnAction :: AlterColumnAction,_originalTree_Syn_AlterColumnAction :: AlterColumnAction}+_wrap_AlterColumnAction :: T_AlterColumnAction ->+ Inh_AlterColumnAction ->+ Syn_AlterColumnAction+_wrap_AlterColumnAction sem (Inh_AlterColumnAction _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterColumnAction _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterColumnAction_SetDataType :: T_Annotation ->+ T_TypeName ->+ T_AlterColumnAction+_sem_AlterColumnAction_SetDataType ann_ typ_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterColumnAction+ _lhsOoriginalTree :: AlterColumnAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 24, column 37)+ _annOtpe =+ ({-# LINE 24 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 931 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetDataType _annIannotatedTree _typIannotatedTree+ {-# LINE 937 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetDataType _annIoriginalTree _typIoriginalTree+ {-# LINE 943 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 949 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 955 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 961 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 967 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 973 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 979 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 985 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 991 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterColumnAction_SetNotNull :: T_Annotation ->+ T_AlterColumnAction+_sem_AlterColumnAction_SetNotNull ann_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterColumnAction+ _lhsOoriginalTree :: AlterColumnAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 29, column 36)+ _annOtpe =+ ({-# LINE 29 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetNotNull _annIannotatedTree+ {-# LINE 1022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetNotNull _annIoriginalTree+ {-# LINE 1028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1040 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1046 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1052 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1058 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterColumnAction_DropNotNull :: T_Annotation ->+ T_AlterColumnAction+_sem_AlterColumnAction_DropNotNull ann_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterColumnAction+ _lhsOoriginalTree :: AlterColumnAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 23, column 37)+ _annOtpe =+ ({-# LINE 23 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1081 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropNotNull _annIannotatedTree+ {-# LINE 1087 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropNotNull _annIoriginalTree+ {-# LINE 1093 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1099 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1105 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1111 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1117 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1123 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterColumnAction_SetDefault :: T_Annotation ->+ T_ScalarExpr ->+ T_AlterColumnAction+_sem_AlterColumnAction_SetDefault ann_ def_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _defOdownEnv :: Environment+ _defOexpectedCast :: Bool+ _defOexpectedType :: (Maybe TypeExtra)+ _defOodbcFunction :: Bool+ _defOassignmentCastContext :: Bool+ _lhsOannotatedTree :: AlterColumnAction+ _lhsOoriginalTree :: AlterColumnAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _defOcat :: Catalog+ _defOflags :: TypeCheckFlags+ _defOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _defIannotatedTree :: ScalarExpr+ _defIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _defIoriginalTree :: ScalarExpr+ _defIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 25, column 36)+ _annOtpe =+ ({-# LINE 25 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1159 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 26, column 36)+ _defOdownEnv =+ ({-# LINE 26 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 1165 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 27, column 36)+ _defOexpectedCast =+ ({-# LINE 27 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 1171 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 28, column 36)+ _defOexpectedType =+ ({-# LINE 28 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 1177 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 131, column 18)+ _defOodbcFunction =+ ({-# LINE 131 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 1183 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 807, column 36)+ _defOassignmentCastContext =+ ({-# LINE 807 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 1189 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetDefault _annIannotatedTree _defIannotatedTree+ {-# LINE 1195 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetDefault _annIoriginalTree _defIoriginalTree+ {-# LINE 1201 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1207 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1213 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1219 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1225 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1231 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _defOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1237 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _defOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1243 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _defOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1249 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _defIannotatedTree,_defIcolExprs,_defIoriginalTree,_defIupType) =+ def_ _defOassignmentCastContext _defOcat _defOdownEnv _defOexpectedCast _defOexpectedType _defOflags _defOimCast _defOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterColumnAction_DropDefault :: T_Annotation ->+ T_AlterColumnAction+_sem_AlterColumnAction_DropDefault ann_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterColumnAction+ _lhsOoriginalTree :: AlterColumnAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 22, column 37)+ _annOtpe =+ ({-# LINE 22 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1274 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropDefault _annIannotatedTree+ {-# LINE 1280 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropDefault _annIoriginalTree+ {-# LINE 1286 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1292 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1298 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1304 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1310 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1316 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterDatabaseOperation --------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterDatabaseOperation + originalTree : AlterDatabaseOperation + alternatives:+ alternative RenameDatabase:+ child ann : Annotation + child newName : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterDatabaseOperation = RenameDatabase (Annotation) (Name)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterDatabaseOperation :: AlterDatabaseOperation ->+ T_AlterDatabaseOperation+_sem_AlterDatabaseOperation (RenameDatabase _ann _newName) =+ (_sem_AlterDatabaseOperation_RenameDatabase (_sem_Annotation _ann) (_sem_Name _newName))+-- semantic domain+type T_AlterDatabaseOperation = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterDatabaseOperation,AlterDatabaseOperation)+data Inh_AlterDatabaseOperation = Inh_AlterDatabaseOperation {_cat_Inh_AlterDatabaseOperation :: Catalog,_flags_Inh_AlterDatabaseOperation :: TypeCheckFlags,_imCast_Inh_AlterDatabaseOperation :: (Maybe TypeExtra)}+data Syn_AlterDatabaseOperation = Syn_AlterDatabaseOperation {_annotatedTree_Syn_AlterDatabaseOperation :: AlterDatabaseOperation,_originalTree_Syn_AlterDatabaseOperation :: AlterDatabaseOperation}+_wrap_AlterDatabaseOperation :: T_AlterDatabaseOperation ->+ Inh_AlterDatabaseOperation ->+ Syn_AlterDatabaseOperation+_wrap_AlterDatabaseOperation sem (Inh_AlterDatabaseOperation _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterDatabaseOperation _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterDatabaseOperation_RenameDatabase :: T_Annotation ->+ T_Name ->+ T_AlterDatabaseOperation+_sem_AlterDatabaseOperation_RenameDatabase ann_ newName_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _newNameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterDatabaseOperation+ _lhsOoriginalTree :: AlterDatabaseOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _newNameOcat :: Catalog+ _newNameOflags :: TypeCheckFlags+ _newNameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _newNameIannotatedTree :: Name+ _newNameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 30, column 45)+ _annOtpe =+ ({-# LINE 30 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1384 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 31, column 45)+ _newNameOtpe =+ ({-# LINE 31 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1390 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RenameDatabase _annIannotatedTree _newNameIannotatedTree+ {-# LINE 1396 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RenameDatabase _annIoriginalTree _newNameIoriginalTree+ {-# LINE 1402 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1408 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1414 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1420 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1426 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1432 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1438 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1444 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1450 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _newNameIannotatedTree,_newNameIoriginalTree) =+ newName_ _newNameOcat _newNameOflags _newNameOimCast _newNameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterSchemaOperation ----------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterSchemaOperation + originalTree : AlterSchemaOperation + alternatives:+ alternative AlterSchemaName:+ child ann : Annotation + child newName : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSchemaOwner:+ child ann : Annotation + child newName : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterSchemaOperation = AlterSchemaName (Annotation) (Name)+ | AlterSchemaOwner (Annotation) (Name)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterSchemaOperation :: AlterSchemaOperation ->+ T_AlterSchemaOperation+_sem_AlterSchemaOperation (AlterSchemaName _ann _newName) =+ (_sem_AlterSchemaOperation_AlterSchemaName (_sem_Annotation _ann) (_sem_Name _newName))+_sem_AlterSchemaOperation (AlterSchemaOwner _ann _newName) =+ (_sem_AlterSchemaOperation_AlterSchemaOwner (_sem_Annotation _ann) (_sem_Name _newName))+-- semantic domain+type T_AlterSchemaOperation = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterSchemaOperation,AlterSchemaOperation)+data Inh_AlterSchemaOperation = Inh_AlterSchemaOperation {_cat_Inh_AlterSchemaOperation :: Catalog,_flags_Inh_AlterSchemaOperation :: TypeCheckFlags,_imCast_Inh_AlterSchemaOperation :: (Maybe TypeExtra)}+data Syn_AlterSchemaOperation = Syn_AlterSchemaOperation {_annotatedTree_Syn_AlterSchemaOperation :: AlterSchemaOperation,_originalTree_Syn_AlterSchemaOperation :: AlterSchemaOperation}+_wrap_AlterSchemaOperation :: T_AlterSchemaOperation ->+ Inh_AlterSchemaOperation ->+ Syn_AlterSchemaOperation+_wrap_AlterSchemaOperation sem (Inh_AlterSchemaOperation _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterSchemaOperation _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterSchemaOperation_AlterSchemaName :: T_Annotation ->+ T_Name ->+ T_AlterSchemaOperation+_sem_AlterSchemaOperation_AlterSchemaName ann_ newName_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSchemaOperation+ _lhsOoriginalTree :: AlterSchemaOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _newNameOcat :: Catalog+ _newNameOflags :: TypeCheckFlags+ _newNameOimCast :: (Maybe TypeExtra)+ _newNameOtpe :: (Either [TypeError] TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _newNameIannotatedTree :: Name+ _newNameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 32, column 44)+ _annOtpe =+ ({-# LINE 32 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1529 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSchemaName _annIannotatedTree _newNameIannotatedTree+ {-# LINE 1535 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSchemaName _annIoriginalTree _newNameIoriginalTree+ {-# LINE 1541 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1547 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1553 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1559 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1565 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1571 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1577 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1583 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1589 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (chain)+ _newNameOtpe =+ ({-# LINE 46 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ error "missing rule: AlterSchemaOperation.AlterSchemaName.newName.tpe"+ {-# LINE 1595 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _newNameIannotatedTree,_newNameIoriginalTree) =+ newName_ _newNameOcat _newNameOflags _newNameOimCast _newNameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSchemaOperation_AlterSchemaOwner :: T_Annotation ->+ T_Name ->+ T_AlterSchemaOperation+_sem_AlterSchemaOperation_AlterSchemaOwner ann_ newName_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _newNameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSchemaOperation+ _lhsOoriginalTree :: AlterSchemaOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _newNameOcat :: Catalog+ _newNameOflags :: TypeCheckFlags+ _newNameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _newNameIannotatedTree :: Name+ _newNameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 33, column 45)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1627 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 34, column 45)+ _newNameOtpe =+ ({-# LINE 34 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1633 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSchemaOwner _annIannotatedTree _newNameIannotatedTree+ {-# LINE 1639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSchemaOwner _annIoriginalTree _newNameIoriginalTree+ {-# LINE 1645 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1651 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1657 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1663 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1669 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1675 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1681 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1687 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1693 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _newNameIannotatedTree,_newNameIoriginalTree) =+ newName_ _newNameOcat _newNameOflags _newNameOimCast _newNameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterSequenceAction -----------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterSequenceAction + originalTree : AlterSequenceAction + alternatives:+ alternative AlterSequenceIncrement:+ child ann : Annotation + child incr : {Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceMin:+ child ann : Annotation + child min : {Maybe Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceMax:+ child ann : Annotation + child max : {Maybe Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceStart:+ child ann : Annotation + child start : {Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceRestart:+ child ann : Annotation + child restart : {Maybe Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceCache:+ child ann : Annotation + child cache : {Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterSequenceAction = AlterSequenceIncrement (Annotation) (Integer)+ | AlterSequenceMin (Annotation) ((Maybe Integer))+ | AlterSequenceMax (Annotation) ((Maybe Integer))+ | AlterSequenceStart (Annotation) (Integer)+ | AlterSequenceRestart (Annotation) ((Maybe Integer))+ | AlterSequenceCache (Annotation) (Integer)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterSequenceAction :: AlterSequenceAction ->+ T_AlterSequenceAction+_sem_AlterSequenceAction (AlterSequenceIncrement _ann _incr) =+ (_sem_AlterSequenceAction_AlterSequenceIncrement (_sem_Annotation _ann) _incr)+_sem_AlterSequenceAction (AlterSequenceMin _ann _min) =+ (_sem_AlterSequenceAction_AlterSequenceMin (_sem_Annotation _ann) _min)+_sem_AlterSequenceAction (AlterSequenceMax _ann _max) =+ (_sem_AlterSequenceAction_AlterSequenceMax (_sem_Annotation _ann) _max)+_sem_AlterSequenceAction (AlterSequenceStart _ann _start) =+ (_sem_AlterSequenceAction_AlterSequenceStart (_sem_Annotation _ann) _start)+_sem_AlterSequenceAction (AlterSequenceRestart _ann _restart) =+ (_sem_AlterSequenceAction_AlterSequenceRestart (_sem_Annotation _ann) _restart)+_sem_AlterSequenceAction (AlterSequenceCache _ann _cache) =+ (_sem_AlterSequenceAction_AlterSequenceCache (_sem_Annotation _ann) _cache)+-- semantic domain+type T_AlterSequenceAction = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterSequenceAction,AlterSequenceAction)+data Inh_AlterSequenceAction = Inh_AlterSequenceAction {_cat_Inh_AlterSequenceAction :: Catalog,_flags_Inh_AlterSequenceAction :: TypeCheckFlags,_imCast_Inh_AlterSequenceAction :: (Maybe TypeExtra)}+data Syn_AlterSequenceAction = Syn_AlterSequenceAction {_annotatedTree_Syn_AlterSequenceAction :: AlterSequenceAction,_originalTree_Syn_AlterSequenceAction :: AlterSequenceAction}+_wrap_AlterSequenceAction :: T_AlterSequenceAction ->+ Inh_AlterSequenceAction ->+ Syn_AlterSequenceAction+_wrap_AlterSequenceAction sem (Inh_AlterSequenceAction _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterSequenceAction _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterSequenceAction_AlterSequenceIncrement :: T_Annotation ->+ Integer ->+ T_AlterSequenceAction+_sem_AlterSequenceAction_AlterSequenceIncrement ann_ incr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceAction+ _lhsOoriginalTree :: AlterSequenceAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 35, column 50)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1802 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceIncrement _annIannotatedTree incr_+ {-# LINE 1808 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceIncrement _annIoriginalTree incr_+ {-# LINE 1814 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1820 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1826 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1832 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1838 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1844 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceAction_AlterSequenceMin :: T_Annotation ->+ (Maybe Integer) ->+ T_AlterSequenceAction+_sem_AlterSequenceAction_AlterSequenceMin ann_ min_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceAction+ _lhsOoriginalTree :: AlterSequenceAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 36, column 44)+ _annOtpe =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1868 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceMin _annIannotatedTree min_+ {-# LINE 1874 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceMin _annIoriginalTree min_+ {-# LINE 1880 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1886 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1892 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1898 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1904 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1910 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceAction_AlterSequenceMax :: T_Annotation ->+ (Maybe Integer) ->+ T_AlterSequenceAction+_sem_AlterSequenceAction_AlterSequenceMax ann_ max_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceAction+ _lhsOoriginalTree :: AlterSequenceAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 37, column 44)+ _annOtpe =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 1934 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceMax _annIannotatedTree max_+ {-# LINE 1940 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceMax _annIoriginalTree max_+ {-# LINE 1946 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 1952 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 1958 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 1964 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 1970 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 1976 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceAction_AlterSequenceStart :: T_Annotation ->+ Integer ->+ T_AlterSequenceAction+_sem_AlterSequenceAction_AlterSequenceStart ann_ start_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceAction+ _lhsOoriginalTree :: AlterSequenceAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 38, column 46)+ _annOtpe =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2000 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceStart _annIannotatedTree start_+ {-# LINE 2006 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceStart _annIoriginalTree start_+ {-# LINE 2012 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2018 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2024 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2030 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2036 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2042 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceAction_AlterSequenceRestart :: T_Annotation ->+ (Maybe Integer) ->+ T_AlterSequenceAction+_sem_AlterSequenceAction_AlterSequenceRestart ann_ restart_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceAction+ _lhsOoriginalTree :: AlterSequenceAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 39, column 48)+ _annOtpe =+ ({-# LINE 39 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2066 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceRestart _annIannotatedTree restart_+ {-# LINE 2072 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceRestart _annIoriginalTree restart_+ {-# LINE 2078 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2084 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2090 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2096 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2102 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2108 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceAction_AlterSequenceCache :: T_Annotation ->+ Integer ->+ T_AlterSequenceAction+_sem_AlterSequenceAction_AlterSequenceCache ann_ cache_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceAction+ _lhsOoriginalTree :: AlterSequenceAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 40, column 46)+ _annOtpe =+ ({-# LINE 40 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceCache _annIannotatedTree cache_+ {-# LINE 2138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceCache _annIoriginalTree cache_+ {-# LINE 2144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2150 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2156 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2162 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2168 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2174 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterSequenceActionList -------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterSequenceActionList + originalTree : AlterSequenceActionList + alternatives:+ alternative Cons:+ child hd : AlterSequenceAction + child tl : AlterSequenceActionList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type AlterSequenceActionList = [AlterSequenceAction]+-- cata+_sem_AlterSequenceActionList :: AlterSequenceActionList ->+ T_AlterSequenceActionList+_sem_AlterSequenceActionList list =+ (Prelude.foldr _sem_AlterSequenceActionList_Cons _sem_AlterSequenceActionList_Nil (Prelude.map _sem_AlterSequenceAction list))+-- semantic domain+type T_AlterSequenceActionList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterSequenceActionList,AlterSequenceActionList)+data Inh_AlterSequenceActionList = Inh_AlterSequenceActionList {_cat_Inh_AlterSequenceActionList :: Catalog,_flags_Inh_AlterSequenceActionList :: TypeCheckFlags,_imCast_Inh_AlterSequenceActionList :: (Maybe TypeExtra)}+data Syn_AlterSequenceActionList = Syn_AlterSequenceActionList {_annotatedTree_Syn_AlterSequenceActionList :: AlterSequenceActionList,_originalTree_Syn_AlterSequenceActionList :: AlterSequenceActionList}+_wrap_AlterSequenceActionList :: T_AlterSequenceActionList ->+ Inh_AlterSequenceActionList ->+ Syn_AlterSequenceActionList+_wrap_AlterSequenceActionList sem (Inh_AlterSequenceActionList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterSequenceActionList _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterSequenceActionList_Cons :: T_AlterSequenceAction ->+ T_AlterSequenceActionList ->+ T_AlterSequenceActionList+_sem_AlterSequenceActionList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: AlterSequenceActionList+ _lhsOoriginalTree :: AlterSequenceActionList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: AlterSequenceAction+ _hdIoriginalTree :: AlterSequenceAction+ _tlIannotatedTree :: AlterSequenceActionList+ _tlIoriginalTree :: AlterSequenceActionList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 2243 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 2249 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2255 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2261 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2267 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2273 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2279 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2285 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2291 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2297 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceActionList_Nil :: T_AlterSequenceActionList+_sem_AlterSequenceActionList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: AlterSequenceActionList+ _lhsOoriginalTree :: AlterSequenceActionList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 2315 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 2321 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2327 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2333 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterSequenceOperation --------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterSequenceOperation + originalTree : AlterSequenceOperation + alternatives:+ alternative AlterSequenceOwned:+ child ann : Annotation + child owned : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceRename:+ child ann : Annotation + child name : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequenceActions:+ child ann : Annotation + child actions : AlterSequenceActionList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterSequenceOperation = AlterSequenceOwned (Annotation) (Name)+ | AlterSequenceRename (Annotation) (Name)+ | AlterSequenceActions (Annotation) (AlterSequenceActionList)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterSequenceOperation :: AlterSequenceOperation ->+ T_AlterSequenceOperation+_sem_AlterSequenceOperation (AlterSequenceOwned _ann _owned) =+ (_sem_AlterSequenceOperation_AlterSequenceOwned (_sem_Annotation _ann) (_sem_Name _owned))+_sem_AlterSequenceOperation (AlterSequenceRename _ann _name) =+ (_sem_AlterSequenceOperation_AlterSequenceRename (_sem_Annotation _ann) (_sem_Name _name))+_sem_AlterSequenceOperation (AlterSequenceActions _ann _actions) =+ (_sem_AlterSequenceOperation_AlterSequenceActions (_sem_Annotation _ann) (_sem_AlterSequenceActionList _actions))+-- semantic domain+type T_AlterSequenceOperation = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterSequenceOperation,AlterSequenceOperation)+data Inh_AlterSequenceOperation = Inh_AlterSequenceOperation {_cat_Inh_AlterSequenceOperation :: Catalog,_flags_Inh_AlterSequenceOperation :: TypeCheckFlags,_imCast_Inh_AlterSequenceOperation :: (Maybe TypeExtra)}+data Syn_AlterSequenceOperation = Syn_AlterSequenceOperation {_annotatedTree_Syn_AlterSequenceOperation :: AlterSequenceOperation,_originalTree_Syn_AlterSequenceOperation :: AlterSequenceOperation}+_wrap_AlterSequenceOperation :: T_AlterSequenceOperation ->+ Inh_AlterSequenceOperation ->+ Syn_AlterSequenceOperation+_wrap_AlterSequenceOperation sem (Inh_AlterSequenceOperation _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterSequenceOperation _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterSequenceOperation_AlterSequenceOwned :: T_Annotation ->+ T_Name ->+ T_AlterSequenceOperation+_sem_AlterSequenceOperation_AlterSequenceOwned ann_ owned_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _ownedOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceOperation+ _lhsOoriginalTree :: AlterSequenceOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _ownedOcat :: Catalog+ _ownedOflags :: TypeCheckFlags+ _ownedOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _ownedIannotatedTree :: Name+ _ownedIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 41, column 49)+ _annOtpe =+ ({-# LINE 41 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 42, column 49)+ _ownedOtpe =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceOwned _annIannotatedTree _ownedIannotatedTree+ {-# LINE 2429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceOwned _annIoriginalTree _ownedIoriginalTree+ {-# LINE 2435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2447 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2453 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2459 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2465 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _ownedOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2471 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _ownedOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2477 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _ownedOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2483 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _ownedIannotatedTree,_ownedIoriginalTree) =+ owned_ _ownedOcat _ownedOflags _ownedOimCast _ownedOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceOperation_AlterSequenceRename :: T_Annotation ->+ T_Name ->+ T_AlterSequenceOperation+_sem_AlterSequenceOperation_AlterSequenceRename ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceOperation+ _lhsOoriginalTree :: AlterSequenceOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 43, column 50)+ _annOtpe =+ ({-# LINE 43 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2515 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 44, column 50)+ _nameOtpe =+ ({-# LINE 44 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2521 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceRename _annIannotatedTree _nameIannotatedTree+ {-# LINE 2527 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceRename _annIoriginalTree _nameIoriginalTree+ {-# LINE 2533 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2539 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2545 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2551 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2557 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2563 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2569 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2575 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2581 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterSequenceOperation_AlterSequenceActions :: T_Annotation ->+ T_AlterSequenceActionList ->+ T_AlterSequenceOperation+_sem_AlterSequenceOperation_AlterSequenceActions ann_ actions_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterSequenceOperation+ _lhsOoriginalTree :: AlterSequenceOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _actionsOcat :: Catalog+ _actionsOflags :: TypeCheckFlags+ _actionsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _actionsIannotatedTree :: AlterSequenceActionList+ _actionsIoriginalTree :: AlterSequenceActionList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 45, column 51)+ _annOtpe =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2612 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceActions _annIannotatedTree _actionsIannotatedTree+ {-# LINE 2618 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequenceActions _annIoriginalTree _actionsIoriginalTree+ {-# LINE 2624 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2630 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2636 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2642 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2648 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2654 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actionsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2660 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actionsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2666 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actionsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2672 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _actionsIannotatedTree,_actionsIoriginalTree) =+ actions_ _actionsOcat _actionsOflags _actionsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterTableAction --------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterTableAction + originalTree : AlterTableAction + alternatives:+ alternative AddColumn:+ child ann : Annotation + child att : AttributeDef + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DropColumn:+ child ann : Annotation + child nm : {NameComponent}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterColumn:+ child ann : Annotation + child nm : {NameComponent}+ child act : AlterColumnAction + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AddConstraint:+ child ann : Annotation + child con : Constraint + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterTableAction = AddColumn (Annotation) (AttributeDef)+ | DropColumn (Annotation) (NameComponent)+ | AlterColumn (Annotation) (NameComponent) (AlterColumnAction)+ | AddConstraint (Annotation) (Constraint)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterTableAction :: AlterTableAction ->+ T_AlterTableAction+_sem_AlterTableAction (AddColumn _ann _att) =+ (_sem_AlterTableAction_AddColumn (_sem_Annotation _ann) (_sem_AttributeDef _att))+_sem_AlterTableAction (DropColumn _ann _nm) =+ (_sem_AlterTableAction_DropColumn (_sem_Annotation _ann) _nm)+_sem_AlterTableAction (AlterColumn _ann _nm _act) =+ (_sem_AlterTableAction_AlterColumn (_sem_Annotation _ann) _nm (_sem_AlterColumnAction _act))+_sem_AlterTableAction (AddConstraint _ann _con) =+ (_sem_AlterTableAction_AddConstraint (_sem_Annotation _ann) (_sem_Constraint _con))+-- semantic domain+type T_AlterTableAction = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterTableAction,AlterTableAction)+data Inh_AlterTableAction = Inh_AlterTableAction {_cat_Inh_AlterTableAction :: Catalog,_flags_Inh_AlterTableAction :: TypeCheckFlags,_imCast_Inh_AlterTableAction :: (Maybe TypeExtra)}+data Syn_AlterTableAction = Syn_AlterTableAction {_annotatedTree_Syn_AlterTableAction :: AlterTableAction,_originalTree_Syn_AlterTableAction :: AlterTableAction}+_wrap_AlterTableAction :: T_AlterTableAction ->+ Inh_AlterTableAction ->+ Syn_AlterTableAction+_wrap_AlterTableAction sem (Inh_AlterTableAction _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterTableAction _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterTableAction_AddColumn :: T_Annotation ->+ T_AttributeDef ->+ T_AlterTableAction+_sem_AlterTableAction_AddColumn ann_ att_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableAction+ _lhsOoriginalTree :: AlterTableAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _attOcat :: Catalog+ _attOflags :: TypeCheckFlags+ _attOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _attIannotatedTree :: AttributeDef+ _attIoriginalTree :: AttributeDef+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 46, column 34)+ _annOtpe =+ ({-# LINE 46 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2769 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AddColumn _annIannotatedTree _attIannotatedTree+ {-# LINE 2775 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AddColumn _annIoriginalTree _attIoriginalTree+ {-# LINE 2781 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2787 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2793 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2799 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2805 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2811 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2817 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2823 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2829 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _attIannotatedTree,_attIoriginalTree) =+ att_ _attOcat _attOflags _attOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterTableAction_DropColumn :: T_Annotation ->+ NameComponent ->+ T_AlterTableAction+_sem_AlterTableAction_DropColumn ann_ nm_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableAction+ _lhsOoriginalTree :: AlterTableAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 49, column 35)+ _annOtpe =+ ({-# LINE 49 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2855 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropColumn _annIannotatedTree nm_+ {-# LINE 2861 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropColumn _annIoriginalTree nm_+ {-# LINE 2867 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2873 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2879 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2885 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2891 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2897 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterTableAction_AlterColumn :: T_Annotation ->+ NameComponent ->+ T_AlterColumnAction ->+ T_AlterTableAction+_sem_AlterTableAction_AlterColumn ann_ nm_ act_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableAction+ _lhsOoriginalTree :: AlterTableAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _actOcat :: Catalog+ _actOflags :: TypeCheckFlags+ _actOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _actIannotatedTree :: AlterColumnAction+ _actIoriginalTree :: AlterColumnAction+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 48, column 36)+ _annOtpe =+ ({-# LINE 48 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 2927 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterColumn _annIannotatedTree nm_ _actIannotatedTree+ {-# LINE 2933 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterColumn _annIoriginalTree nm_ _actIoriginalTree+ {-# LINE 2939 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 2945 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 2951 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2957 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2963 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2969 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 2975 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 2981 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 2987 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _actIannotatedTree,_actIoriginalTree) =+ act_ _actOcat _actOflags _actOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterTableAction_AddConstraint :: T_Annotation ->+ T_Constraint ->+ T_AlterTableAction+_sem_AlterTableAction_AddConstraint ann_ con_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableAction+ _lhsOoriginalTree :: AlterTableAction+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _conOcat :: Catalog+ _conOflags :: TypeCheckFlags+ _conOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _conIannotatedTree :: Constraint+ _conIoriginalTree :: Constraint+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 47, column 38)+ _annOtpe =+ ({-# LINE 47 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 3018 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AddConstraint _annIannotatedTree _conIannotatedTree+ {-# LINE 3024 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AddConstraint _annIoriginalTree _conIoriginalTree+ {-# LINE 3030 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3036 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3042 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3048 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3054 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3060 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _conOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3066 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _conOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3072 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _conOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3078 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _conIannotatedTree,_conIoriginalTree) =+ con_ _conOcat _conOflags _conOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterTableActionList ----------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterTableActionList + originalTree : AlterTableActionList + alternatives:+ alternative Cons:+ child hd : AlterTableAction + child tl : AlterTableActionList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type AlterTableActionList = [AlterTableAction]+-- cata+_sem_AlterTableActionList :: AlterTableActionList ->+ T_AlterTableActionList+_sem_AlterTableActionList list =+ (Prelude.foldr _sem_AlterTableActionList_Cons _sem_AlterTableActionList_Nil (Prelude.map _sem_AlterTableAction list))+-- semantic domain+type T_AlterTableActionList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterTableActionList,AlterTableActionList)+data Inh_AlterTableActionList = Inh_AlterTableActionList {_cat_Inh_AlterTableActionList :: Catalog,_flags_Inh_AlterTableActionList :: TypeCheckFlags,_imCast_Inh_AlterTableActionList :: (Maybe TypeExtra)}+data Syn_AlterTableActionList = Syn_AlterTableActionList {_annotatedTree_Syn_AlterTableActionList :: AlterTableActionList,_originalTree_Syn_AlterTableActionList :: AlterTableActionList}+_wrap_AlterTableActionList :: T_AlterTableActionList ->+ Inh_AlterTableActionList ->+ Syn_AlterTableActionList+_wrap_AlterTableActionList sem (Inh_AlterTableActionList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterTableActionList _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterTableActionList_Cons :: T_AlterTableAction ->+ T_AlterTableActionList ->+ T_AlterTableActionList+_sem_AlterTableActionList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: AlterTableActionList+ _lhsOoriginalTree :: AlterTableActionList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: AlterTableAction+ _hdIoriginalTree :: AlterTableAction+ _tlIannotatedTree :: AlterTableActionList+ _tlIoriginalTree :: AlterTableActionList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 3149 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 3155 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3161 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3167 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3173 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3179 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3185 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3191 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3197 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3203 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterTableActionList_Nil :: T_AlterTableActionList+_sem_AlterTableActionList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: AlterTableActionList+ _lhsOoriginalTree :: AlterTableActionList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 3221 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 3227 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3233 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3239 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AlterTableOperation -----------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AlterTableOperation + originalTree : AlterTableOperation + alternatives:+ alternative RenameTable:+ child ann : Annotation + child newName : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative RenameColumn:+ child ann : Annotation + child oldName : {NameComponent}+ child newName : {NameComponent}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterTableActions:+ child ann : Annotation + child actions : AlterTableActionList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AlterTableOperation = RenameTable (Annotation) (Name)+ | RenameColumn (Annotation) (NameComponent) (NameComponent)+ | AlterTableActions (Annotation) (AlterTableActionList)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AlterTableOperation :: AlterTableOperation ->+ T_AlterTableOperation+_sem_AlterTableOperation (RenameTable _ann _newName) =+ (_sem_AlterTableOperation_RenameTable (_sem_Annotation _ann) (_sem_Name _newName))+_sem_AlterTableOperation (RenameColumn _ann _oldName _newName) =+ (_sem_AlterTableOperation_RenameColumn (_sem_Annotation _ann) _oldName _newName)+_sem_AlterTableOperation (AlterTableActions _ann _actions) =+ (_sem_AlterTableOperation_AlterTableActions (_sem_Annotation _ann) (_sem_AlterTableActionList _actions))+-- semantic domain+type T_AlterTableOperation = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AlterTableOperation,AlterTableOperation)+data Inh_AlterTableOperation = Inh_AlterTableOperation {_cat_Inh_AlterTableOperation :: Catalog,_flags_Inh_AlterTableOperation :: TypeCheckFlags,_imCast_Inh_AlterTableOperation :: (Maybe TypeExtra)}+data Syn_AlterTableOperation = Syn_AlterTableOperation {_annotatedTree_Syn_AlterTableOperation :: AlterTableOperation,_originalTree_Syn_AlterTableOperation :: AlterTableOperation}+_wrap_AlterTableOperation :: T_AlterTableOperation ->+ Inh_AlterTableOperation ->+ Syn_AlterTableOperation+_wrap_AlterTableOperation sem (Inh_AlterTableOperation _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AlterTableOperation _lhsOannotatedTree _lhsOoriginalTree))+_sem_AlterTableOperation_RenameTable :: T_Annotation ->+ T_Name ->+ T_AlterTableOperation+_sem_AlterTableOperation_RenameTable ann_ newName_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _newNameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableOperation+ _lhsOoriginalTree :: AlterTableOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _newNameOcat :: Catalog+ _newNameOflags :: TypeCheckFlags+ _newNameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _newNameIannotatedTree :: Name+ _newNameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 52, column 39)+ _annOtpe =+ ({-# LINE 52 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 3324 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 53, column 39)+ _newNameOtpe =+ ({-# LINE 53 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 3330 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RenameTable _annIannotatedTree _newNameIannotatedTree+ {-# LINE 3336 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RenameTable _annIoriginalTree _newNameIoriginalTree+ {-# LINE 3342 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3348 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3354 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3372 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3378 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3384 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _newNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3390 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _newNameIannotatedTree,_newNameIoriginalTree) =+ newName_ _newNameOcat _newNameOflags _newNameOimCast _newNameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterTableOperation_RenameColumn :: T_Annotation ->+ NameComponent ->+ NameComponent ->+ T_AlterTableOperation+_sem_AlterTableOperation_RenameColumn ann_ oldName_ newName_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableOperation+ _lhsOoriginalTree :: AlterTableOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 51, column 40)+ _annOtpe =+ ({-# LINE 51 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 3417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RenameColumn _annIannotatedTree oldName_ newName_+ {-# LINE 3423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RenameColumn _annIoriginalTree oldName_ newName_+ {-# LINE 3429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3447 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3453 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3459 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AlterTableOperation_AlterTableActions :: T_Annotation ->+ T_AlterTableActionList ->+ T_AlterTableOperation+_sem_AlterTableOperation_AlterTableActions ann_ actions_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AlterTableOperation+ _lhsOoriginalTree :: AlterTableOperation+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _actionsOcat :: Catalog+ _actionsOflags :: TypeCheckFlags+ _actionsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _actionsIannotatedTree :: AlterTableActionList+ _actionsIoriginalTree :: AlterTableActionList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 50, column 45)+ _annOtpe =+ ({-# LINE 50 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 3488 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterTableActions _annIannotatedTree _actionsIannotatedTree+ {-# LINE 3494 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterTableActions _annIoriginalTree _actionsIoriginalTree+ {-# LINE 3500 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3506 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3512 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3518 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3524 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3530 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actionsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3536 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actionsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3542 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _actionsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3548 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _actionsIannotatedTree,_actionsIoriginalTree) =+ actions_ _actionsOcat _actionsOflags _actionsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- Annotation --------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ tpe : Either [TypeError] TypeExtra+ synthesized attributes:+ annotatedTree : Annotation + originalTree : Annotation + alternatives:+ alternative Annotation:+ child anSrc : {Maybe SourcePosition}+ child anType : {Maybe T.TypeExtra}+ child anErrs : {[T.TypeError]}+ child anImplicitCast : {Maybe T.TypeExtra}+ child anCatUpd : {[C.CatalogUpdate]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}++-- | Annotation type - one of these is attached to most of the+-- data types used in the ast.+-- the fields in order are:+data Annotation = Annotation {+ -- | source position for this node+ anSrc :: ( Maybe SourcePosition)+ -- | type of the node, 'Nothing' if the tree hasn't been typechecked or if a type error elsewhere prevents determining this node's type+ ,anType :: ( Maybe T.TypeExtra)+ -- | any type errors+ ,anErrs :: ( [T.TypeError])+ -- | if an implicit cast is needed between this node an its parent, this the target type of cast. If no implicit cast is needed, this is Nothing+ ,anImplicitCast :: ( Maybe T.TypeExtra)+ -- | any catalog updates that a statement produces, used only for ddl Statements+ ,anCatUpd :: ( [C.CatalogUpdate])++ } deriving (Eq,Show,Data,Typeable)++-- cata+_sem_Annotation :: Annotation ->+ T_Annotation+_sem_Annotation (Annotation _anSrc _anType _anErrs _anImplicitCast _anCatUpd) =+ (_sem_Annotation_Annotation _anSrc _anType _anErrs _anImplicitCast _anCatUpd)+-- semantic domain+type T_Annotation = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ (Either [TypeError] TypeExtra) ->+ ( Annotation,Annotation)+data Inh_Annotation = Inh_Annotation {_cat_Inh_Annotation :: Catalog,_flags_Inh_Annotation :: TypeCheckFlags,_imCast_Inh_Annotation :: (Maybe TypeExtra),_tpe_Inh_Annotation :: (Either [TypeError] TypeExtra)}+data Syn_Annotation = Syn_Annotation {_annotatedTree_Syn_Annotation :: Annotation,_originalTree_Syn_Annotation :: Annotation}+_wrap_Annotation :: T_Annotation ->+ Inh_Annotation ->+ Syn_Annotation+_wrap_Annotation sem (Inh_Annotation _lhsIcat _lhsIflags _lhsIimCast _lhsItpe) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast _lhsItpe+ in (Syn_Annotation _lhsOannotatedTree _lhsOoriginalTree))+_sem_Annotation_Annotation :: (Maybe SourcePosition) ->+ (Maybe T.TypeExtra) ->+ ([T.TypeError]) ->+ (Maybe T.TypeExtra) ->+ ([C.CatalogUpdate]) ->+ T_Annotation+_sem_Annotation_Annotation anSrc_ anType_ anErrs_ anImplicitCast_ anCatUpd_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast+ _lhsItpe ->+ (let _lhsOannotatedTree :: Annotation+ _lhsOoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag"(line 140, column 7)+ _lhsOannotatedTree =+ ({-# LINE 140 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ let t = either (const Nothing) Just _lhsItpe+ es = either id (const []) _lhsItpe+ in Annotation anSrc_ t es _lhsIimCast anCatUpd_+ {-# LINE 3617 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Annotation anSrc_ anType_ anErrs_ anImplicitCast_ anCatUpd_+ {-# LINE 3623 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Annotation anSrc_ anType_ anErrs_ anImplicitCast_ anCatUpd_+ {-# LINE 3629 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3635 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AttributeDef ------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AttributeDef + originalTree : AttributeDef + alternatives:+ alternative AttributeDef:+ child ann : Annotation + child name : {NameComponent}+ child typ : TypeName + child cons : RowConstraintList + child options : {[TableOption]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data AttributeDef = AttributeDef (Annotation) (NameComponent) (TypeName) (RowConstraintList) (([TableOption]))+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_AttributeDef :: AttributeDef ->+ T_AttributeDef+_sem_AttributeDef (AttributeDef _ann _name _typ _cons _options) =+ (_sem_AttributeDef_AttributeDef (_sem_Annotation _ann) _name (_sem_TypeName _typ) (_sem_RowConstraintList _cons) _options)+-- semantic domain+type T_AttributeDef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AttributeDef,AttributeDef)+data Inh_AttributeDef = Inh_AttributeDef {_cat_Inh_AttributeDef :: Catalog,_flags_Inh_AttributeDef :: TypeCheckFlags,_imCast_Inh_AttributeDef :: (Maybe TypeExtra)}+data Syn_AttributeDef = Syn_AttributeDef {_annotatedTree_Syn_AttributeDef :: AttributeDef,_originalTree_Syn_AttributeDef :: AttributeDef}+_wrap_AttributeDef :: T_AttributeDef ->+ Inh_AttributeDef ->+ Syn_AttributeDef+_wrap_AttributeDef sem (Inh_AttributeDef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AttributeDef _lhsOannotatedTree _lhsOoriginalTree))+_sem_AttributeDef_AttributeDef :: T_Annotation ->+ NameComponent ->+ T_TypeName ->+ T_RowConstraintList ->+ ([TableOption]) ->+ T_AttributeDef+_sem_AttributeDef_AttributeDef ann_ name_ typ_ cons_ options_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: AttributeDef+ _lhsOoriginalTree :: AttributeDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _consOcat :: Catalog+ _consOflags :: TypeCheckFlags+ _consOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ _consIannotatedTree :: RowConstraintList+ _consIoriginalTree :: RowConstraintList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 54, column 33)+ _annOtpe =+ ({-# LINE 54 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 3712 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AttributeDef _annIannotatedTree name_ _typIannotatedTree _consIannotatedTree options_+ {-# LINE 3718 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AttributeDef _annIoriginalTree name_ _typIoriginalTree _consIoriginalTree options_+ {-# LINE 3724 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3730 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3736 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3742 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3748 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3754 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3760 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3766 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3772 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _consOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3778 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _consOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3784 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _consOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3790 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ ( _consIannotatedTree,_consIoriginalTree) =+ cons_ _consOcat _consOflags _consOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- AttributeDefList --------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : AttributeDefList + originalTree : AttributeDefList + alternatives:+ alternative Cons:+ child hd : AttributeDef + child tl : AttributeDefList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type AttributeDefList = [AttributeDef]+-- cata+_sem_AttributeDefList :: AttributeDefList ->+ T_AttributeDefList+_sem_AttributeDefList list =+ (Prelude.foldr _sem_AttributeDefList_Cons _sem_AttributeDefList_Nil (Prelude.map _sem_AttributeDef list))+-- semantic domain+type T_AttributeDefList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( AttributeDefList,AttributeDefList)+data Inh_AttributeDefList = Inh_AttributeDefList {_cat_Inh_AttributeDefList :: Catalog,_flags_Inh_AttributeDefList :: TypeCheckFlags,_imCast_Inh_AttributeDefList :: (Maybe TypeExtra)}+data Syn_AttributeDefList = Syn_AttributeDefList {_annotatedTree_Syn_AttributeDefList :: AttributeDefList,_originalTree_Syn_AttributeDefList :: AttributeDefList}+_wrap_AttributeDefList :: T_AttributeDefList ->+ Inh_AttributeDefList ->+ Syn_AttributeDefList+_wrap_AttributeDefList sem (Inh_AttributeDefList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_AttributeDefList _lhsOannotatedTree _lhsOoriginalTree))+_sem_AttributeDefList_Cons :: T_AttributeDef ->+ T_AttributeDefList ->+ T_AttributeDefList+_sem_AttributeDefList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: AttributeDefList+ _lhsOoriginalTree :: AttributeDefList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: AttributeDef+ _hdIoriginalTree :: AttributeDef+ _tlIannotatedTree :: AttributeDefList+ _tlIoriginalTree :: AttributeDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 3863 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 3869 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3875 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3881 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3887 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3893 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3899 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 3905 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 3911 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 3917 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_AttributeDefList_Nil :: T_AttributeDefList+_sem_AttributeDefList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: AttributeDefList+ _lhsOoriginalTree :: AttributeDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 3935 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 3941 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 3947 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 3953 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- CaseScalarExprListScalarExprPair ----------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ thenExpectedType : Maybe TypeExtra+ whenExpectedType : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : CaseScalarExprListScalarExprPair + originalTree : CaseScalarExprListScalarExprPair + thenType : Maybe TypeExtra+ upTypes : [Maybe TypeExtra]+ whenTypes : [Maybe TypeExtra]+ alternatives:+ alternative Tuple:+ child x1 : ScalarExprList + child x2 : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type CaseScalarExprListScalarExprPair = ( ScalarExprList,ScalarExpr)+-- cata+_sem_CaseScalarExprListScalarExprPair :: CaseScalarExprListScalarExprPair ->+ T_CaseScalarExprListScalarExprPair+_sem_CaseScalarExprListScalarExprPair ( x1,x2) =+ (_sem_CaseScalarExprListScalarExprPair_Tuple (_sem_ScalarExprList x1) (_sem_ScalarExpr x2))+-- semantic domain+type T_CaseScalarExprListScalarExprPair = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ (Maybe TypeExtra) ->+ (Maybe TypeExtra) ->+ ( CaseScalarExprListScalarExprPair,CaseScalarExprListScalarExprPair,(Maybe TypeExtra),([Maybe TypeExtra]),([Maybe TypeExtra]))+data Inh_CaseScalarExprListScalarExprPair = Inh_CaseScalarExprListScalarExprPair {_cat_Inh_CaseScalarExprListScalarExprPair :: Catalog,_downEnv_Inh_CaseScalarExprListScalarExprPair :: Environment,_flags_Inh_CaseScalarExprListScalarExprPair :: TypeCheckFlags,_imCast_Inh_CaseScalarExprListScalarExprPair :: (Maybe TypeExtra),_thenExpectedType_Inh_CaseScalarExprListScalarExprPair :: (Maybe TypeExtra),_whenExpectedType_Inh_CaseScalarExprListScalarExprPair :: (Maybe TypeExtra)}+data Syn_CaseScalarExprListScalarExprPair = Syn_CaseScalarExprListScalarExprPair {_annotatedTree_Syn_CaseScalarExprListScalarExprPair :: CaseScalarExprListScalarExprPair,_originalTree_Syn_CaseScalarExprListScalarExprPair :: CaseScalarExprListScalarExprPair,_thenType_Syn_CaseScalarExprListScalarExprPair :: (Maybe TypeExtra),_upTypes_Syn_CaseScalarExprListScalarExprPair :: ([Maybe TypeExtra]),_whenTypes_Syn_CaseScalarExprListScalarExprPair :: ([Maybe TypeExtra])}+_wrap_CaseScalarExprListScalarExprPair :: T_CaseScalarExprListScalarExprPair ->+ Inh_CaseScalarExprListScalarExprPair ->+ Syn_CaseScalarExprListScalarExprPair+_wrap_CaseScalarExprListScalarExprPair sem (Inh_CaseScalarExprListScalarExprPair _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast _lhsIthenExpectedType _lhsIwhenExpectedType) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOthenType,_lhsOupTypes,_lhsOwhenTypes) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast _lhsIthenExpectedType _lhsIwhenExpectedType+ in (Syn_CaseScalarExprListScalarExprPair _lhsOannotatedTree _lhsOoriginalTree _lhsOthenType _lhsOupTypes _lhsOwhenTypes))+_sem_CaseScalarExprListScalarExprPair_Tuple :: T_ScalarExprList ->+ T_ScalarExpr ->+ T_CaseScalarExprListScalarExprPair+_sem_CaseScalarExprListScalarExprPair_Tuple x1_ x2_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast+ _lhsIthenExpectedType+ _lhsIwhenExpectedType ->+ (let _x2OodbcFunction :: Bool+ _lhsOwhenTypes :: ([Maybe TypeExtra])+ _lhsOthenType :: (Maybe TypeExtra)+ _x1OexpectedTypes :: ([TypeExtra])+ _x1OexpectedCast :: Bool+ _x2OexpectedType :: (Maybe TypeExtra)+ _x2OexpectedCast :: Bool+ _x1OassignmentCastContext :: Bool+ _x2OassignmentCastContext :: Bool+ _lhsOannotatedTree :: CaseScalarExprListScalarExprPair+ _lhsOoriginalTree :: CaseScalarExprListScalarExprPair+ _lhsOupTypes :: ([Maybe TypeExtra])+ _x1Ocat :: Catalog+ _x1OdownEnv :: Environment+ _x1Oflags :: TypeCheckFlags+ _x1OimCast :: (Maybe TypeExtra)+ _x2Ocat :: Catalog+ _x2OdownEnv :: Environment+ _x2Oflags :: TypeCheckFlags+ _x2OimCast :: (Maybe TypeExtra)+ _x1IannotatedTree :: ScalarExprList+ _x1IoriginalTree :: ScalarExprList+ _x1IupTypes :: ([Maybe TypeExtra])+ _x2IannotatedTree :: ScalarExpr+ _x2IcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _x2IoriginalTree :: ScalarExpr+ _x2IupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 134, column 13)+ _x2OodbcFunction =+ ({-# LINE 134 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 4043 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 550, column 13)+ _lhsOwhenTypes =+ ({-# LINE 550 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _x1IupTypes+ {-# LINE 4049 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 551, column 13)+ _lhsOthenType =+ ({-# LINE 551 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _x2IupType+ {-# LINE 4055 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 606, column 11)+ _x1OexpectedTypes =+ ({-# LINE 606 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe [] repeat _lhsIwhenExpectedType+ {-# LINE 4061 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 607, column 11)+ _x1OexpectedCast =+ ({-# LINE 607 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 4067 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 608, column 11)+ _x2OexpectedType =+ ({-# LINE 608 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIthenExpectedType+ {-# LINE 4073 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 609, column 11)+ _x2OexpectedCast =+ ({-# LINE 609 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ True+ {-# LINE 4079 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 808, column 46)+ _x1OassignmentCastContext =+ ({-# LINE 808 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 4085 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 809, column 46)+ _x2OassignmentCastContext =+ ({-# LINE 809 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 4091 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IannotatedTree,_x2IannotatedTree)+ {-# LINE 4097 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IoriginalTree,_x2IoriginalTree)+ {-# LINE 4103 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4109 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4115 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOupTypes =+ ({-# LINE 555 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _x1IupTypes+ {-# LINE 4121 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4127 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 4133 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4139 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4145 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4151 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2OdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 4157 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4163 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4169 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _x1IannotatedTree,_x1IoriginalTree,_x1IupTypes) =+ x1_ _x1OassignmentCastContext _x1Ocat _x1OdownEnv _x1OexpectedCast _x1OexpectedTypes _x1Oflags _x1OimCast+ ( _x2IannotatedTree,_x2IcolExprs,_x2IoriginalTree,_x2IupType) =+ x2_ _x2OassignmentCastContext _x2Ocat _x2OdownEnv _x2OexpectedCast _x2OexpectedType _x2Oflags _x2OimCast _x2OodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOthenType,_lhsOupTypes,_lhsOwhenTypes)))+-- CaseScalarExprListScalarExprPairList ------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ thenExpectedType : Maybe TypeExtra+ whenExpectedType : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : CaseScalarExprListScalarExprPairList + originalTree : CaseScalarExprListScalarExprPairList + thenTypes : [Maybe TypeExtra]+ upTypes : [Maybe TypeExtra]+ whenTypes : [[Maybe TypeExtra]]+ alternatives:+ alternative Cons:+ child hd : CaseScalarExprListScalarExprPair + child tl : CaseScalarExprListScalarExprPairList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type CaseScalarExprListScalarExprPairList = [CaseScalarExprListScalarExprPair]+-- cata+_sem_CaseScalarExprListScalarExprPairList :: CaseScalarExprListScalarExprPairList ->+ T_CaseScalarExprListScalarExprPairList+_sem_CaseScalarExprListScalarExprPairList list =+ (Prelude.foldr _sem_CaseScalarExprListScalarExprPairList_Cons _sem_CaseScalarExprListScalarExprPairList_Nil (Prelude.map _sem_CaseScalarExprListScalarExprPair list))+-- semantic domain+type T_CaseScalarExprListScalarExprPairList = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ (Maybe TypeExtra) ->+ (Maybe TypeExtra) ->+ ( CaseScalarExprListScalarExprPairList,CaseScalarExprListScalarExprPairList,([Maybe TypeExtra]),([Maybe TypeExtra]),([[Maybe TypeExtra]]))+data Inh_CaseScalarExprListScalarExprPairList = Inh_CaseScalarExprListScalarExprPairList {_cat_Inh_CaseScalarExprListScalarExprPairList :: Catalog,_downEnv_Inh_CaseScalarExprListScalarExprPairList :: Environment,_flags_Inh_CaseScalarExprListScalarExprPairList :: TypeCheckFlags,_imCast_Inh_CaseScalarExprListScalarExprPairList :: (Maybe TypeExtra),_thenExpectedType_Inh_CaseScalarExprListScalarExprPairList :: (Maybe TypeExtra),_whenExpectedType_Inh_CaseScalarExprListScalarExprPairList :: (Maybe TypeExtra)}+data Syn_CaseScalarExprListScalarExprPairList = Syn_CaseScalarExprListScalarExprPairList {_annotatedTree_Syn_CaseScalarExprListScalarExprPairList :: CaseScalarExprListScalarExprPairList,_originalTree_Syn_CaseScalarExprListScalarExprPairList :: CaseScalarExprListScalarExprPairList,_thenTypes_Syn_CaseScalarExprListScalarExprPairList :: ([Maybe TypeExtra]),_upTypes_Syn_CaseScalarExprListScalarExprPairList :: ([Maybe TypeExtra]),_whenTypes_Syn_CaseScalarExprListScalarExprPairList :: ([[Maybe TypeExtra]])}+_wrap_CaseScalarExprListScalarExprPairList :: T_CaseScalarExprListScalarExprPairList ->+ Inh_CaseScalarExprListScalarExprPairList ->+ Syn_CaseScalarExprListScalarExprPairList+_wrap_CaseScalarExprListScalarExprPairList sem (Inh_CaseScalarExprListScalarExprPairList _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast _lhsIthenExpectedType _lhsIwhenExpectedType) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOthenTypes,_lhsOupTypes,_lhsOwhenTypes) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast _lhsIthenExpectedType _lhsIwhenExpectedType+ in (Syn_CaseScalarExprListScalarExprPairList _lhsOannotatedTree _lhsOoriginalTree _lhsOthenTypes _lhsOupTypes _lhsOwhenTypes))+_sem_CaseScalarExprListScalarExprPairList_Cons :: T_CaseScalarExprListScalarExprPair ->+ T_CaseScalarExprListScalarExprPairList ->+ T_CaseScalarExprListScalarExprPairList+_sem_CaseScalarExprListScalarExprPairList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast+ _lhsIthenExpectedType+ _lhsIwhenExpectedType ->+ (let _lhsOwhenTypes :: ([[Maybe TypeExtra]])+ _lhsOthenTypes :: ([Maybe TypeExtra])+ _lhsOannotatedTree :: CaseScalarExprListScalarExprPairList+ _lhsOoriginalTree :: CaseScalarExprListScalarExprPairList+ _lhsOupTypes :: ([Maybe TypeExtra])+ _hdOcat :: Catalog+ _hdOdownEnv :: Environment+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _hdOthenExpectedType :: (Maybe TypeExtra)+ _hdOwhenExpectedType :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOdownEnv :: Environment+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _tlOthenExpectedType :: (Maybe TypeExtra)+ _tlOwhenExpectedType :: (Maybe TypeExtra)+ _hdIannotatedTree :: CaseScalarExprListScalarExprPair+ _hdIoriginalTree :: CaseScalarExprListScalarExprPair+ _hdIthenType :: (Maybe TypeExtra)+ _hdIupTypes :: ([Maybe TypeExtra])+ _hdIwhenTypes :: ([Maybe TypeExtra])+ _tlIannotatedTree :: CaseScalarExprListScalarExprPairList+ _tlIoriginalTree :: CaseScalarExprListScalarExprPairList+ _tlIthenTypes :: ([Maybe TypeExtra])+ _tlIupTypes :: ([Maybe TypeExtra])+ _tlIwhenTypes :: ([[Maybe TypeExtra]])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 539, column 10)+ _lhsOwhenTypes =+ ({-# LINE 539 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _hdIwhenTypes : _tlIwhenTypes+ {-# LINE 4267 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 540, column 10)+ _lhsOthenTypes =+ ({-# LINE 540 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _hdIthenType : _tlIthenTypes+ {-# LINE 4273 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 4279 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 4285 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4291 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4297 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOupTypes =+ ({-# LINE 555 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tlIupTypes+ {-# LINE 4303 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4309 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOdownEnv =+ ({-# LINE 554 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 4315 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4321 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4327 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOthenExpectedType =+ ({-# LINE 602 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIthenExpectedType+ {-# LINE 4333 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOwhenExpectedType =+ ({-# LINE 603 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIwhenExpectedType+ {-# LINE 4339 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4345 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOdownEnv =+ ({-# LINE 554 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 4351 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4357 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4363 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOthenExpectedType =+ ({-# LINE 602 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIthenExpectedType+ {-# LINE 4369 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOwhenExpectedType =+ ({-# LINE 603 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIwhenExpectedType+ {-# LINE 4375 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree,_hdIthenType,_hdIupTypes,_hdIwhenTypes) =+ hd_ _hdOcat _hdOdownEnv _hdOflags _hdOimCast _hdOthenExpectedType _hdOwhenExpectedType+ ( _tlIannotatedTree,_tlIoriginalTree,_tlIthenTypes,_tlIupTypes,_tlIwhenTypes) =+ tl_ _tlOcat _tlOdownEnv _tlOflags _tlOimCast _tlOthenExpectedType _tlOwhenExpectedType+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOthenTypes,_lhsOupTypes,_lhsOwhenTypes)))+_sem_CaseScalarExprListScalarExprPairList_Nil :: T_CaseScalarExprListScalarExprPairList+_sem_CaseScalarExprListScalarExprPairList_Nil =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast+ _lhsIthenExpectedType+ _lhsIwhenExpectedType ->+ (let _lhsOwhenTypes :: ([[Maybe TypeExtra]])+ _lhsOthenTypes :: ([Maybe TypeExtra])+ _lhsOupTypes :: ([Maybe TypeExtra])+ _lhsOannotatedTree :: CaseScalarExprListScalarExprPairList+ _lhsOoriginalTree :: CaseScalarExprListScalarExprPairList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 541, column 9)+ _lhsOwhenTypes =+ ({-# LINE 541 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 4399 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 542, column 9)+ _lhsOthenTypes =+ ({-# LINE 542 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 4405 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 543, column 9)+ _lhsOupTypes =+ ({-# LINE 543 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 4411 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 4417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 4423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOthenTypes,_lhsOupTypes,_lhsOwhenTypes)))+-- Constraint --------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : Constraint + originalTree : Constraint + alternatives:+ alternative UniqueConstraint:+ child ann : Annotation + child name : {String}+ child x : {[NameComponent]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative PrimaryKeyConstraint:+ child ann : Annotation + child name : {String}+ child x : {[NameComponent]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CheckConstraint:+ child ann : Annotation + child name : {String}+ child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ReferenceConstraint:+ child ann : Annotation + child name : {String}+ child atts : {[NameComponent]}+ child table : Name + child tableAtts : {[NameComponent]}+ child onUpdate : {Cascade}+ child onDelete : {Cascade}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data Constraint = UniqueConstraint (Annotation) (String) (([NameComponent]))+ | PrimaryKeyConstraint (Annotation) (String) (([NameComponent]))+ | CheckConstraint (Annotation) (String) (ScalarExpr)+ | ReferenceConstraint (Annotation) (String) (([NameComponent])) (Name) (([NameComponent])) (Cascade) (Cascade)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_Constraint :: Constraint ->+ T_Constraint+_sem_Constraint (UniqueConstraint _ann _name _x) =+ (_sem_Constraint_UniqueConstraint (_sem_Annotation _ann) _name _x)+_sem_Constraint (PrimaryKeyConstraint _ann _name _x) =+ (_sem_Constraint_PrimaryKeyConstraint (_sem_Annotation _ann) _name _x)+_sem_Constraint (CheckConstraint _ann _name _expr) =+ (_sem_Constraint_CheckConstraint (_sem_Annotation _ann) _name (_sem_ScalarExpr _expr))+_sem_Constraint (ReferenceConstraint _ann _name _atts _table _tableAtts _onUpdate _onDelete) =+ (_sem_Constraint_ReferenceConstraint (_sem_Annotation _ann) _name _atts (_sem_Name _table) _tableAtts _onUpdate _onDelete)+-- semantic domain+type T_Constraint = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( Constraint,Constraint)+data Inh_Constraint = Inh_Constraint {_cat_Inh_Constraint :: Catalog,_flags_Inh_Constraint :: TypeCheckFlags,_imCast_Inh_Constraint :: (Maybe TypeExtra)}+data Syn_Constraint = Syn_Constraint {_annotatedTree_Syn_Constraint :: Constraint,_originalTree_Syn_Constraint :: Constraint}+_wrap_Constraint :: T_Constraint ->+ Inh_Constraint ->+ Syn_Constraint+_wrap_Constraint sem (Inh_Constraint _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_Constraint _lhsOannotatedTree _lhsOoriginalTree))+_sem_Constraint_UniqueConstraint :: T_Annotation ->+ String ->+ ([NameComponent]) ->+ T_Constraint+_sem_Constraint_UniqueConstraint ann_ name_ x_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Constraint+ _lhsOoriginalTree :: Constraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 62, column 35)+ _annOtpe =+ ({-# LINE 62 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 4531 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ UniqueConstraint _annIannotatedTree name_ x_+ {-# LINE 4537 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ UniqueConstraint _annIoriginalTree name_ x_+ {-# LINE 4543 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4549 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4555 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4561 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4567 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4573 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Constraint_PrimaryKeyConstraint :: T_Annotation ->+ String ->+ ([NameComponent]) ->+ T_Constraint+_sem_Constraint_PrimaryKeyConstraint ann_ name_ x_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Constraint+ _lhsOoriginalTree :: Constraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 59, column 39)+ _annOtpe =+ ({-# LINE 59 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 4598 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PrimaryKeyConstraint _annIannotatedTree name_ x_+ {-# LINE 4604 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PrimaryKeyConstraint _annIoriginalTree name_ x_+ {-# LINE 4610 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4616 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4622 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4628 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4634 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4640 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Constraint_CheckConstraint :: T_Annotation ->+ String ->+ T_ScalarExpr ->+ T_Constraint+_sem_Constraint_CheckConstraint ann_ name_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Constraint+ _lhsOoriginalTree :: Constraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 55, column 34)+ _annOtpe =+ ({-# LINE 55 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 4677 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 56, column 34)+ _exprOdownEnv =+ ({-# LINE 56 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 4683 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 57, column 34)+ _exprOexpectedCast =+ ({-# LINE 57 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 4689 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 58, column 34)+ _exprOexpectedType =+ ({-# LINE 58 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 4695 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 137, column 23)+ _exprOodbcFunction =+ ({-# LINE 137 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 4701 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 810, column 34)+ _exprOassignmentCastContext =+ ({-# LINE 810 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 4707 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CheckConstraint _annIannotatedTree name_ _exprIannotatedTree+ {-# LINE 4713 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CheckConstraint _annIoriginalTree name_ _exprIoriginalTree+ {-# LINE 4719 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4725 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4731 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4737 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4743 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4749 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4755 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4761 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4767 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Constraint_ReferenceConstraint :: T_Annotation ->+ String ->+ ([NameComponent]) ->+ T_Name ->+ ([NameComponent]) ->+ Cascade ->+ Cascade ->+ T_Constraint+_sem_Constraint_ReferenceConstraint ann_ name_ atts_ table_ tableAtts_ onUpdate_ onDelete_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _tableOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Constraint+ _lhsOoriginalTree :: Constraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tableOcat :: Catalog+ _tableOflags :: TypeCheckFlags+ _tableOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tableIannotatedTree :: Name+ _tableIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 60, column 38)+ _annOtpe =+ ({-# LINE 60 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 4804 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 61, column 38)+ _tableOtpe =+ ({-# LINE 61 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 4810 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ReferenceConstraint _annIannotatedTree name_ atts_ _tableIannotatedTree tableAtts_ onUpdate_ onDelete_+ {-# LINE 4816 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ReferenceConstraint _annIoriginalTree name_ atts_ _tableIoriginalTree tableAtts_ onUpdate_ onDelete_+ {-# LINE 4822 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4828 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4834 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4840 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4846 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4852 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4858 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4864 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4870 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tableIannotatedTree,_tableIoriginalTree) =+ table_ _tableOcat _tableOflags _tableOimCast _tableOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ConstraintList ----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ConstraintList + originalTree : ConstraintList + alternatives:+ alternative Cons:+ child hd : Constraint + child tl : ConstraintList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ConstraintList = [Constraint]+-- cata+_sem_ConstraintList :: ConstraintList ->+ T_ConstraintList+_sem_ConstraintList list =+ (Prelude.foldr _sem_ConstraintList_Cons _sem_ConstraintList_Nil (Prelude.map _sem_Constraint list))+-- semantic domain+type T_ConstraintList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ConstraintList,ConstraintList)+data Inh_ConstraintList = Inh_ConstraintList {_cat_Inh_ConstraintList :: Catalog,_flags_Inh_ConstraintList :: TypeCheckFlags,_imCast_Inh_ConstraintList :: (Maybe TypeExtra)}+data Syn_ConstraintList = Syn_ConstraintList {_annotatedTree_Syn_ConstraintList :: ConstraintList,_originalTree_Syn_ConstraintList :: ConstraintList}+_wrap_ConstraintList :: T_ConstraintList ->+ Inh_ConstraintList ->+ Syn_ConstraintList+_wrap_ConstraintList sem (Inh_ConstraintList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ConstraintList _lhsOannotatedTree _lhsOoriginalTree))+_sem_ConstraintList_Cons :: T_Constraint ->+ T_ConstraintList ->+ T_ConstraintList+_sem_ConstraintList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ConstraintList+ _lhsOoriginalTree :: ConstraintList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: Constraint+ _hdIoriginalTree :: Constraint+ _tlIannotatedTree :: ConstraintList+ _tlIoriginalTree :: ConstraintList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 4941 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 4947 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 4953 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 4959 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4965 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4971 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4977 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 4983 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 4989 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 4995 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_ConstraintList_Nil :: T_ConstraintList+_sem_ConstraintList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ConstraintList+ _lhsOoriginalTree :: ConstraintList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 5013 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 5019 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5025 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5031 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- FnBody ------------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : FnBody + originalTree : FnBody + alternatives:+ alternative SqlFnBody:+ child ann : Annotation + child sts : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative PlpgsqlFnBody:+ child ann : Annotation + child blk : Statement + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data FnBody = SqlFnBody (Annotation) (StatementList)+ | PlpgsqlFnBody (Annotation) (Statement)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_FnBody :: FnBody ->+ T_FnBody+_sem_FnBody (SqlFnBody _ann _sts) =+ (_sem_FnBody_SqlFnBody (_sem_Annotation _ann) (_sem_StatementList _sts))+_sem_FnBody (PlpgsqlFnBody _ann _blk) =+ (_sem_FnBody_PlpgsqlFnBody (_sem_Annotation _ann) (_sem_Statement _blk))+-- semantic domain+type T_FnBody = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( FnBody,FnBody)+data Inh_FnBody = Inh_FnBody {_cat_Inh_FnBody :: Catalog,_flags_Inh_FnBody :: TypeCheckFlags,_imCast_Inh_FnBody :: (Maybe TypeExtra)}+data Syn_FnBody = Syn_FnBody {_annotatedTree_Syn_FnBody :: FnBody,_originalTree_Syn_FnBody :: FnBody}+_wrap_FnBody :: T_FnBody ->+ Inh_FnBody ->+ Syn_FnBody+_wrap_FnBody sem (Inh_FnBody _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_FnBody _lhsOannotatedTree _lhsOoriginalTree))+_sem_FnBody_SqlFnBody :: T_Annotation ->+ T_StatementList ->+ T_FnBody+_sem_FnBody_SqlFnBody ann_ sts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: FnBody+ _lhsOoriginalTree :: FnBody+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _stsOcat :: Catalog+ _stsOflags :: TypeCheckFlags+ _stsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _stsIannotatedTree :: StatementList+ _stsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 64, column 24)+ _annOtpe =+ ({-# LINE 64 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 5105 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SqlFnBody _annIannotatedTree _stsIannotatedTree+ {-# LINE 5111 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SqlFnBody _annIoriginalTree _stsIoriginalTree+ {-# LINE 5117 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5123 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5129 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5135 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5141 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5147 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5153 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5159 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5165 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _stsIannotatedTree,_stsIoriginalTree) =+ sts_ _stsOcat _stsOflags _stsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_FnBody_PlpgsqlFnBody :: T_Annotation ->+ T_Statement ->+ T_FnBody+_sem_FnBody_PlpgsqlFnBody ann_ blk_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: FnBody+ _lhsOoriginalTree :: FnBody+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _blkOcat :: Catalog+ _blkOflags :: TypeCheckFlags+ _blkOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _blkIannotatedTree :: Statement+ _blkIoriginalTree :: Statement+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 63, column 28)+ _annOtpe =+ ({-# LINE 63 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 5196 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PlpgsqlFnBody _annIannotatedTree _blkIannotatedTree+ {-# LINE 5202 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PlpgsqlFnBody _annIoriginalTree _blkIoriginalTree+ {-# LINE 5208 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5214 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5220 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5226 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5232 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5238 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _blkOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5244 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _blkOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5250 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _blkOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5256 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _blkIannotatedTree,_blkIoriginalTree) =+ blk_ _blkOcat _blkOflags _blkOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- InList ------------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe TypeExtra+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : InList + listType : Either [TypeError] TypeExtra+ originalTree : InList + alternatives:+ alternative InList:+ child ann : Annotation + child exprs : ScalarExprList + visit 0:+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative InQueryExpr:+ child ann : Annotation + child sel : QueryExpr + visit 0:+ local tpe : _+ local annotatedTree : _+ local originalTree : _+-}+data InList = InList (Annotation) (ScalarExprList)+ | InQueryExpr (Annotation) (QueryExpr)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_InList :: InList ->+ T_InList+_sem_InList (InList _ann _exprs) =+ (_sem_InList_InList (_sem_Annotation _ann) (_sem_ScalarExprList _exprs))+_sem_InList (InQueryExpr _ann _sel) =+ (_sem_InList_InQueryExpr (_sem_Annotation _ann) (_sem_QueryExpr _sel))+-- semantic domain+type T_InList = Catalog ->+ Environment ->+ Bool ->+ (Maybe TypeExtra) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( InList,(Either [TypeError] TypeExtra),InList)+data Inh_InList = Inh_InList {_cat_Inh_InList :: Catalog,_downEnv_Inh_InList :: Environment,_expectedCast_Inh_InList :: Bool,_expectedType_Inh_InList :: (Maybe TypeExtra),_flags_Inh_InList :: TypeCheckFlags,_imCast_Inh_InList :: (Maybe TypeExtra)}+data Syn_InList = Syn_InList {_annotatedTree_Syn_InList :: InList,_listType_Syn_InList :: (Either [TypeError] TypeExtra),_originalTree_Syn_InList :: InList}+_wrap_InList :: T_InList ->+ Inh_InList ->+ Syn_InList+_wrap_InList sem (Inh_InList _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_InList _lhsOannotatedTree _lhsOlistType _lhsOoriginalTree))+_sem_InList_InList :: T_Annotation ->+ T_ScalarExprList ->+ T_InList+_sem_InList_InList ann_ exprs_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOlistType :: (Either [TypeError] TypeExtra)+ _exprsOexpectedTypes :: ([TypeExtra])+ _exprsOexpectedCast :: Bool+ _annOimCast :: (Maybe TypeExtra)+ _exprsOassignmentCastContext :: Bool+ _lhsOannotatedTree :: InList+ _lhsOoriginalTree :: InList+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOtpe :: (Either [TypeError] TypeExtra)+ _exprsOcat :: Catalog+ _exprsOdownEnv :: Environment+ _exprsOflags :: TypeCheckFlags+ _exprsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprsIannotatedTree :: ScalarExprList+ _exprsIoriginalTree :: ScalarExprList+ _exprsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 219, column 9)+ _tpe =+ ({-# LINE 219 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Left []+ {-# LINE 5352 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 682, column 9)+ _lhsOlistType =+ ({-# LINE 682 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ mapM (maybe (Left []) Right) _exprsIupTypes+ >>= resolveResultSetTypeExtra _lhsIcat+ {-# LINE 5359 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 684, column 9)+ _exprsOexpectedTypes =+ ({-# LINE 684 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe [] repeat _lhsIexpectedType+ {-# LINE 5365 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 686, column 9)+ _exprsOexpectedCast =+ ({-# LINE 686 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5371 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 782, column 12)+ _annOimCast =+ ({-# LINE 782 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 5377 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 811, column 21)+ _exprsOassignmentCastContext =+ ({-# LINE 811 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5383 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ InList _annIannotatedTree _exprsIannotatedTree+ {-# LINE 5389 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ InList _annIoriginalTree _exprsIoriginalTree+ {-# LINE 5395 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5401 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5407 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5413 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5419 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 5425 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5431 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprsOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 5437 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5443 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5449 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprsIannotatedTree,_exprsIoriginalTree,_exprsIupTypes) =+ exprs_ _exprsOassignmentCastContext _exprsOcat _exprsOdownEnv _exprsOexpectedCast _exprsOexpectedTypes _exprsOflags _exprsOimCast+ in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))+_sem_InList_InQueryExpr :: T_Annotation ->+ T_QueryExpr ->+ T_InList+_sem_InList_InQueryExpr ann_ sel_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _selOouterDownEnv :: (Maybe Environment)+ _lhsOlistType :: (Either [TypeError] TypeExtra)+ _selOexpectedType :: (Maybe [TypeExtra])+ _annOimCast :: (Maybe TypeExtra)+ _selOassignmentCastContext :: Bool+ _lhsOannotatedTree :: InList+ _lhsOoriginalTree :: InList+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOtpe :: (Either [TypeError] TypeExtra)+ _selOcat :: Catalog+ _selOflags :: TypeCheckFlags+ _selOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selIannotatedTree :: QueryExpr+ _selIoriginalTree :: QueryExpr+ _selIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 97, column 17)+ _selOouterDownEnv =+ ({-# LINE 97 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Nothing+ {-# LINE 5488 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 219, column 9)+ _tpe =+ ({-# LINE 219 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Left []+ {-# LINE 5494 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 689, column 9)+ _lhsOlistType =+ ({-# LINE 689 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ st <- maybe (Left []) Right (map snd <$> _selIupType)+ case length st of+ 0 -> Left [InternalError+ "got subquery with no columns? in inselect"]+ 1 -> Right $ head st+ _ -> Right $ mkTypeExtra $ AnonymousCompositeType+ $ map teType st+ {-# LINE 5507 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 699, column 9)+ _selOexpectedType =+ ({-# LINE 699 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ liftM (map snd) _selIupType+ {-# LINE 5513 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 783, column 17)+ _annOimCast =+ ({-# LINE 783 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 5519 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 812, column 26)+ _selOassignmentCastContext =+ ({-# LINE 812 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5525 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ InQueryExpr _annIannotatedTree _selIannotatedTree+ {-# LINE 5531 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ InQueryExpr _annIoriginalTree _selIoriginalTree+ {-# LINE 5537 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5543 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5549 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5555 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5561 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 5567 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5573 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5579 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5585 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selIannotatedTree,_selIoriginalTree,_selIupType) =+ sel_ _selOassignmentCastContext _selOcat _selOexpectedType _selOflags _selOimCast _selOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOlistType,_lhsOoriginalTree)))+-- JoinExpr ----------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : JoinExpr + originalTree : JoinExpr + alternatives:+ alternative JoinOn:+ child ann : Annotation + child expr : ScalarExpr + visit 0:+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative JoinUsing:+ child ann : Annotation + child x : {[NameComponent]}+ visit 0:+ local tpe : _+ local annotatedTree : _+ local originalTree : _+-}+data JoinExpr = JoinOn (Annotation) (ScalarExpr)+ | JoinUsing (Annotation) (([NameComponent]))+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_JoinExpr :: JoinExpr ->+ T_JoinExpr+_sem_JoinExpr (JoinOn _ann _expr) =+ (_sem_JoinExpr_JoinOn (_sem_Annotation _ann) (_sem_ScalarExpr _expr))+_sem_JoinExpr (JoinUsing _ann _x) =+ (_sem_JoinExpr_JoinUsing (_sem_Annotation _ann) _x)+-- semantic domain+type T_JoinExpr = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( JoinExpr,JoinExpr)+data Inh_JoinExpr = Inh_JoinExpr {_cat_Inh_JoinExpr :: Catalog,_downEnv_Inh_JoinExpr :: Environment,_flags_Inh_JoinExpr :: TypeCheckFlags,_imCast_Inh_JoinExpr :: (Maybe TypeExtra)}+data Syn_JoinExpr = Syn_JoinExpr {_annotatedTree_Syn_JoinExpr :: JoinExpr,_originalTree_Syn_JoinExpr :: JoinExpr}+_wrap_JoinExpr :: T_JoinExpr ->+ Inh_JoinExpr ->+ Syn_JoinExpr+_wrap_JoinExpr sem (Inh_JoinExpr _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast+ in (Syn_JoinExpr _lhsOannotatedTree _lhsOoriginalTree))+_sem_JoinExpr_JoinOn :: T_Annotation ->+ T_ScalarExpr ->+ T_JoinExpr+_sem_JoinExpr_JoinOn ann_ expr_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _exprOodbcFunction :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOexpectedCast :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: JoinExpr+ _lhsOoriginalTree :: JoinExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOcat :: Catalog+ _exprOdownEnv :: Environment+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 223, column 9)+ _tpe =+ ({-# LINE 223 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Left []+ {-# LINE 5675 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 140, column 14)+ _exprOodbcFunction =+ ({-# LINE 140 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5681 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 746, column 7)+ _exprOexpectedType =+ ({-# LINE 746 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ bt <- ansiTypeNameToDialect (tcfDialect _lhsIflags) "boolean"+ Just $ TypeExtra (ScalarType bt) Nothing Nothing+ $ maybe False teNullable _exprIupType+ {-# LINE 5690 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 750, column 7)+ _exprOexpectedCast =+ ({-# LINE 750 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5696 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 813, column 23)+ _exprOassignmentCastContext =+ ({-# LINE 813 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5702 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ JoinOn _annIannotatedTree _exprIannotatedTree+ {-# LINE 5708 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ JoinOn _annIoriginalTree _exprIoriginalTree+ {-# LINE 5714 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5720 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5726 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5732 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5738 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5744 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 5750 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5756 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 5762 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5768 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5774 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_JoinExpr_JoinUsing :: T_Annotation ->+ ([NameComponent]) ->+ T_JoinExpr+_sem_JoinExpr_JoinUsing ann_ x_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: JoinExpr+ _lhsOoriginalTree :: JoinExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 223, column 9)+ _tpe =+ ({-# LINE 223 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Left []+ {-# LINE 5801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ JoinUsing _annIannotatedTree x_+ {-# LINE 5807 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ JoinUsing _annIoriginalTree x_+ {-# LINE 5813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5819 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5825 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5831 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5837 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5843 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 5849 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- MaybeBoolExpr -----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : MaybeBoolExpr + originalTree : MaybeBoolExpr + alternatives:+ alternative Just:+ child just : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nothing:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type MaybeBoolExpr = Maybe (ScalarExpr)+-- cata+_sem_MaybeBoolExpr :: MaybeBoolExpr ->+ T_MaybeBoolExpr+_sem_MaybeBoolExpr (Prelude.Just x) =+ (_sem_MaybeBoolExpr_Just (_sem_ScalarExpr x))+_sem_MaybeBoolExpr Prelude.Nothing =+ _sem_MaybeBoolExpr_Nothing+-- semantic domain+type T_MaybeBoolExpr = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( MaybeBoolExpr,MaybeBoolExpr)+data Inh_MaybeBoolExpr = Inh_MaybeBoolExpr {_cat_Inh_MaybeBoolExpr :: Catalog,_downEnv_Inh_MaybeBoolExpr :: Environment,_flags_Inh_MaybeBoolExpr :: TypeCheckFlags,_imCast_Inh_MaybeBoolExpr :: (Maybe TypeExtra)}+data Syn_MaybeBoolExpr = Syn_MaybeBoolExpr {_annotatedTree_Syn_MaybeBoolExpr :: MaybeBoolExpr,_originalTree_Syn_MaybeBoolExpr :: MaybeBoolExpr}+_wrap_MaybeBoolExpr :: T_MaybeBoolExpr ->+ Inh_MaybeBoolExpr ->+ Syn_MaybeBoolExpr+_wrap_MaybeBoolExpr sem (Inh_MaybeBoolExpr _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast+ in (Syn_MaybeBoolExpr _lhsOannotatedTree _lhsOoriginalTree))+_sem_MaybeBoolExpr_Just :: T_ScalarExpr ->+ T_MaybeBoolExpr+_sem_MaybeBoolExpr_Just just_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _justOodbcFunction :: Bool+ _justOexpectedType :: (Maybe TypeExtra)+ _justOexpectedCast :: Bool+ _justOassignmentCastContext :: Bool+ _lhsOannotatedTree :: MaybeBoolExpr+ _lhsOoriginalTree :: MaybeBoolExpr+ _justOcat :: Catalog+ _justOdownEnv :: Environment+ _justOflags :: TypeCheckFlags+ _justOimCast :: (Maybe TypeExtra)+ _justIannotatedTree :: ScalarExpr+ _justIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _justIoriginalTree :: ScalarExpr+ _justIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 143, column 12)+ _justOodbcFunction =+ ({-# LINE 143 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5923 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 762, column 7)+ _justOexpectedType =+ ({-# LINE 762 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 5929 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 763, column 7)+ _justOexpectedCast =+ ({-# LINE 763 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5935 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 814, column 26)+ _justOassignmentCastContext =+ ({-# LINE 814 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 5941 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIannotatedTree+ {-# LINE 5947 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIoriginalTree+ {-# LINE 5953 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 5959 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 5965 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 5971 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 5977 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 5983 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 5989 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _justIannotatedTree,_justIcolExprs,_justIoriginalTree,_justIupType) =+ just_ _justOassignmentCastContext _justOcat _justOdownEnv _justOexpectedCast _justOexpectedType _justOflags _justOimCast _justOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_MaybeBoolExpr_Nothing :: T_MaybeBoolExpr+_sem_MaybeBoolExpr_Nothing =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: MaybeBoolExpr+ _lhsOoriginalTree :: MaybeBoolExpr+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6006 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6012 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6018 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6024 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- MaybeNameComponentList --------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : MaybeNameComponentList + originalTree : MaybeNameComponentList + alternatives:+ alternative Just:+ child just : NameComponentList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nothing:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type MaybeNameComponentList = Maybe (NameComponentList)+-- cata+_sem_MaybeNameComponentList :: MaybeNameComponentList ->+ T_MaybeNameComponentList+_sem_MaybeNameComponentList (Prelude.Just x) =+ (_sem_MaybeNameComponentList_Just (_sem_NameComponentList x))+_sem_MaybeNameComponentList Prelude.Nothing =+ _sem_MaybeNameComponentList_Nothing+-- semantic domain+type T_MaybeNameComponentList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( MaybeNameComponentList,MaybeNameComponentList)+data Inh_MaybeNameComponentList = Inh_MaybeNameComponentList {_cat_Inh_MaybeNameComponentList :: Catalog,_flags_Inh_MaybeNameComponentList :: TypeCheckFlags,_imCast_Inh_MaybeNameComponentList :: (Maybe TypeExtra)}+data Syn_MaybeNameComponentList = Syn_MaybeNameComponentList {_annotatedTree_Syn_MaybeNameComponentList :: MaybeNameComponentList,_originalTree_Syn_MaybeNameComponentList :: MaybeNameComponentList}+_wrap_MaybeNameComponentList :: T_MaybeNameComponentList ->+ Inh_MaybeNameComponentList ->+ Syn_MaybeNameComponentList+_wrap_MaybeNameComponentList sem (Inh_MaybeNameComponentList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_MaybeNameComponentList _lhsOannotatedTree _lhsOoriginalTree))+_sem_MaybeNameComponentList_Just :: T_NameComponentList ->+ T_MaybeNameComponentList+_sem_MaybeNameComponentList_Just just_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: MaybeNameComponentList+ _lhsOoriginalTree :: MaybeNameComponentList+ _justOcat :: Catalog+ _justOflags :: TypeCheckFlags+ _justOimCast :: (Maybe TypeExtra)+ _justIannotatedTree :: NameComponentList+ _justIoriginalTree :: NameComponentList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIannotatedTree+ {-# LINE 6086 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIoriginalTree+ {-# LINE 6092 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6098 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6104 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 6110 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 6116 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 6122 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _justIannotatedTree,_justIoriginalTree) =+ just_ _justOcat _justOflags _justOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_MaybeNameComponentList_Nothing :: T_MaybeNameComponentList+_sem_MaybeNameComponentList_Nothing =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: MaybeNameComponentList+ _lhsOoriginalTree :: MaybeNameComponentList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6150 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6156 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- MaybeScalarExpr ---------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe TypeExtra+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : MaybeScalarExpr + originalTree : MaybeScalarExpr + upType : Maybe TypeExtra+ alternatives:+ alternative Just:+ child just : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nothing:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type MaybeScalarExpr = Maybe (ScalarExpr)+-- cata+_sem_MaybeScalarExpr :: MaybeScalarExpr ->+ T_MaybeScalarExpr+_sem_MaybeScalarExpr (Prelude.Just x) =+ (_sem_MaybeScalarExpr_Just (_sem_ScalarExpr x))+_sem_MaybeScalarExpr Prelude.Nothing =+ _sem_MaybeScalarExpr_Nothing+-- semantic domain+type T_MaybeScalarExpr = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ (Maybe TypeExtra) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( MaybeScalarExpr,MaybeScalarExpr,(Maybe TypeExtra))+data Inh_MaybeScalarExpr = Inh_MaybeScalarExpr {_assignmentCastContext_Inh_MaybeScalarExpr :: Bool,_cat_Inh_MaybeScalarExpr :: Catalog,_downEnv_Inh_MaybeScalarExpr :: Environment,_expectedCast_Inh_MaybeScalarExpr :: Bool,_expectedType_Inh_MaybeScalarExpr :: (Maybe TypeExtra),_flags_Inh_MaybeScalarExpr :: TypeCheckFlags,_imCast_Inh_MaybeScalarExpr :: (Maybe TypeExtra)}+data Syn_MaybeScalarExpr = Syn_MaybeScalarExpr {_annotatedTree_Syn_MaybeScalarExpr :: MaybeScalarExpr,_originalTree_Syn_MaybeScalarExpr :: MaybeScalarExpr,_upType_Syn_MaybeScalarExpr :: (Maybe TypeExtra)}+_wrap_MaybeScalarExpr :: T_MaybeScalarExpr ->+ Inh_MaybeScalarExpr ->+ Syn_MaybeScalarExpr+_wrap_MaybeScalarExpr sem (Inh_MaybeScalarExpr _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_MaybeScalarExpr _lhsOannotatedTree _lhsOoriginalTree _lhsOupType))+_sem_MaybeScalarExpr_Just :: T_ScalarExpr ->+ T_MaybeScalarExpr+_sem_MaybeScalarExpr_Just just_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _justOodbcFunction :: Bool+ _lhsOannotatedTree :: MaybeScalarExpr+ _lhsOoriginalTree :: MaybeScalarExpr+ _lhsOupType :: (Maybe TypeExtra)+ _justOassignmentCastContext :: Bool+ _justOcat :: Catalog+ _justOdownEnv :: Environment+ _justOexpectedCast :: Bool+ _justOexpectedType :: (Maybe TypeExtra)+ _justOflags :: TypeCheckFlags+ _justOimCast :: (Maybe TypeExtra)+ _justIannotatedTree :: ScalarExpr+ _justIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _justIoriginalTree :: ScalarExpr+ _justIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 146, column 12)+ _justOodbcFunction =+ ({-# LINE 146 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 6239 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIannotatedTree+ {-# LINE 6245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIoriginalTree+ {-# LINE 6251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOupType =+ ({-# LINE 109 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _justIupType+ {-# LINE 6269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 6275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 6281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 6287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOexpectedCast =+ ({-# LINE 111 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 6293 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOexpectedType =+ ({-# LINE 110 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 6299 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 6305 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 6311 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _justIannotatedTree,_justIcolExprs,_justIoriginalTree,_justIupType) =+ just_ _justOassignmentCastContext _justOcat _justOdownEnv _justOexpectedCast _justOexpectedType _justOflags _justOimCast _justOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+_sem_MaybeScalarExpr_Nothing :: T_MaybeScalarExpr+_sem_MaybeScalarExpr_Nothing =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupType :: (Maybe TypeExtra)+ _lhsOannotatedTree :: MaybeScalarExpr+ _lhsOoriginalTree :: MaybeScalarExpr+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 120, column 15)+ _lhsOupType =+ ({-# LINE 120 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 6332 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6338 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6344 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6350 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6356 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+-- MaybeSelectList ---------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : MaybeSelectList + originalTree : MaybeSelectList + alternatives:+ alternative Just:+ child just : SelectList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nothing:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type MaybeSelectList = Maybe (SelectList)+-- cata+_sem_MaybeSelectList :: MaybeSelectList ->+ T_MaybeSelectList+_sem_MaybeSelectList (Prelude.Just x) =+ (_sem_MaybeSelectList_Just (_sem_SelectList x))+_sem_MaybeSelectList Prelude.Nothing =+ _sem_MaybeSelectList_Nothing+-- semantic domain+type T_MaybeSelectList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( MaybeSelectList,MaybeSelectList)+data Inh_MaybeSelectList = Inh_MaybeSelectList {_cat_Inh_MaybeSelectList :: Catalog,_flags_Inh_MaybeSelectList :: TypeCheckFlags,_imCast_Inh_MaybeSelectList :: (Maybe TypeExtra)}+data Syn_MaybeSelectList = Syn_MaybeSelectList {_annotatedTree_Syn_MaybeSelectList :: MaybeSelectList,_originalTree_Syn_MaybeSelectList :: MaybeSelectList}+_wrap_MaybeSelectList :: T_MaybeSelectList ->+ Inh_MaybeSelectList ->+ Syn_MaybeSelectList+_wrap_MaybeSelectList sem (Inh_MaybeSelectList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_MaybeSelectList _lhsOannotatedTree _lhsOoriginalTree))+_sem_MaybeSelectList_Just :: T_SelectList ->+ T_MaybeSelectList+_sem_MaybeSelectList_Just just_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _justOdownEnv :: Environment+ _justOexpectedCast :: Bool+ _justOexpectedType :: (Maybe [TypeExtra])+ _justOassignmentCastContext :: Bool+ _lhsOannotatedTree :: MaybeSelectList+ _lhsOoriginalTree :: MaybeSelectList+ _justOcat :: Catalog+ _justOflags :: TypeCheckFlags+ _justOimCast :: (Maybe TypeExtra)+ _justIannotatedTree :: SelectList+ _justIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _justIoriginalTree :: SelectList+ _justIupEnv :: Environment+ _justIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 65, column 28)+ _justOdownEnv =+ ({-# LINE 65 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 6425 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 66, column 28)+ _justOexpectedCast =+ ({-# LINE 66 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 6431 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 67, column 28)+ _justOexpectedType =+ ({-# LINE 67 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 6437 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 815, column 28)+ _justOassignmentCastContext =+ ({-# LINE 815 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 6443 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIannotatedTree+ {-# LINE 6449 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIoriginalTree+ {-# LINE 6455 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6461 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6467 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 6473 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 6479 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 6485 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _justIannotatedTree,_justIcolExprs,_justIoriginalTree,_justIupEnv,_justIupType) =+ just_ _justOassignmentCastContext _justOcat _justOdownEnv _justOexpectedCast _justOexpectedType _justOflags _justOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_MaybeSelectList_Nothing :: T_MaybeSelectList+_sem_MaybeSelectList_Nothing =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: MaybeSelectList+ _lhsOoriginalTree :: MaybeSelectList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6501 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6507 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6513 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6519 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- MaybeTablePartitionDef --------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : MaybeTablePartitionDef + originalTree : MaybeTablePartitionDef + alternatives:+ alternative Just:+ child just : TablePartitionDef + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nothing:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type MaybeTablePartitionDef = Maybe (TablePartitionDef)+-- cata+_sem_MaybeTablePartitionDef :: MaybeTablePartitionDef ->+ T_MaybeTablePartitionDef+_sem_MaybeTablePartitionDef (Prelude.Just x) =+ (_sem_MaybeTablePartitionDef_Just (_sem_TablePartitionDef x))+_sem_MaybeTablePartitionDef Prelude.Nothing =+ _sem_MaybeTablePartitionDef_Nothing+-- semantic domain+type T_MaybeTablePartitionDef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( MaybeTablePartitionDef,MaybeTablePartitionDef)+data Inh_MaybeTablePartitionDef = Inh_MaybeTablePartitionDef {_cat_Inh_MaybeTablePartitionDef :: Catalog,_flags_Inh_MaybeTablePartitionDef :: TypeCheckFlags,_imCast_Inh_MaybeTablePartitionDef :: (Maybe TypeExtra)}+data Syn_MaybeTablePartitionDef = Syn_MaybeTablePartitionDef {_annotatedTree_Syn_MaybeTablePartitionDef :: MaybeTablePartitionDef,_originalTree_Syn_MaybeTablePartitionDef :: MaybeTablePartitionDef}+_wrap_MaybeTablePartitionDef :: T_MaybeTablePartitionDef ->+ Inh_MaybeTablePartitionDef ->+ Syn_MaybeTablePartitionDef+_wrap_MaybeTablePartitionDef sem (Inh_MaybeTablePartitionDef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_MaybeTablePartitionDef _lhsOannotatedTree _lhsOoriginalTree))+_sem_MaybeTablePartitionDef_Just :: T_TablePartitionDef ->+ T_MaybeTablePartitionDef+_sem_MaybeTablePartitionDef_Just just_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: MaybeTablePartitionDef+ _lhsOoriginalTree :: MaybeTablePartitionDef+ _justOcat :: Catalog+ _justOflags :: TypeCheckFlags+ _justOimCast :: (Maybe TypeExtra)+ _justIannotatedTree :: TablePartitionDef+ _justIoriginalTree :: TablePartitionDef+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIannotatedTree+ {-# LINE 6581 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIoriginalTree+ {-# LINE 6587 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6593 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6599 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 6605 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 6611 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 6617 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _justIannotatedTree,_justIoriginalTree) =+ just_ _justOcat _justOflags _justOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_MaybeTablePartitionDef_Nothing :: T_MaybeTablePartitionDef+_sem_MaybeTablePartitionDef_Nothing =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: MaybeTablePartitionDef+ _lhsOoriginalTree :: MaybeTablePartitionDef+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6633 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 6639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6645 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6651 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- Name --------------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ tpe : Either [TypeError] TypeExtra+ synthesized attributes:+ annotatedTree : Name + originalTree : Name + alternatives:+ alternative Name:+ child ann : Annotation + child is : {[NameComponent]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AntiName:+ child string : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data Name = Name (Annotation) (([NameComponent]))+ | AntiName (String)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_Name :: Name ->+ T_Name+_sem_Name (Name _ann _is) =+ (_sem_Name_Name (_sem_Annotation _ann) _is)+_sem_Name (AntiName _string) =+ (_sem_Name_AntiName _string)+-- semantic domain+type T_Name = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ (Either [TypeError] TypeExtra) ->+ ( Name,Name)+data Inh_Name = Inh_Name {_cat_Inh_Name :: Catalog,_flags_Inh_Name :: TypeCheckFlags,_imCast_Inh_Name :: (Maybe TypeExtra),_tpe_Inh_Name :: (Either [TypeError] TypeExtra)}+data Syn_Name = Syn_Name {_annotatedTree_Syn_Name :: Name,_originalTree_Syn_Name :: Name}+_wrap_Name :: T_Name ->+ Inh_Name ->+ Syn_Name+_wrap_Name sem (Inh_Name _lhsIcat _lhsIflags _lhsIimCast _lhsItpe) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast _lhsItpe+ in (Syn_Name _lhsOannotatedTree _lhsOoriginalTree))+_sem_Name_Name :: T_Annotation ->+ ([NameComponent]) ->+ T_Name+_sem_Name_Name ann_ is_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast+ _lhsItpe ->+ (let _lhsOannotatedTree :: Name+ _lhsOoriginalTree :: Name+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Name _annIannotatedTree is_+ {-# LINE 6722 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Name _annIoriginalTree is_+ {-# LINE 6728 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6734 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6740 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 6746 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 6752 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 6758 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsItpe+ {-# LINE 6764 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Name_AntiName :: String ->+ T_Name+_sem_Name_AntiName string_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast+ _lhsItpe ->+ (let _lhsOannotatedTree :: Name+ _lhsOoriginalTree :: Name+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AntiName string_+ {-# LINE 6782 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AntiName string_+ {-# LINE 6788 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6794 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6800 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- NameComponentList -------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : NameComponentList + originalTree : NameComponentList + alternatives:+ alternative Cons:+ child hd : {NameComponent}+ child tl : NameComponentList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type NameComponentList = [(NameComponent)]+-- cata+_sem_NameComponentList :: NameComponentList ->+ T_NameComponentList+_sem_NameComponentList list =+ (Prelude.foldr _sem_NameComponentList_Cons _sem_NameComponentList_Nil list)+-- semantic domain+type T_NameComponentList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( NameComponentList,NameComponentList)+data Inh_NameComponentList = Inh_NameComponentList {_cat_Inh_NameComponentList :: Catalog,_flags_Inh_NameComponentList :: TypeCheckFlags,_imCast_Inh_NameComponentList :: (Maybe TypeExtra)}+data Syn_NameComponentList = Syn_NameComponentList {_annotatedTree_Syn_NameComponentList :: NameComponentList,_originalTree_Syn_NameComponentList :: NameComponentList}+_wrap_NameComponentList :: T_NameComponentList ->+ Inh_NameComponentList ->+ Syn_NameComponentList+_wrap_NameComponentList sem (Inh_NameComponentList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_NameComponentList _lhsOannotatedTree _lhsOoriginalTree))+_sem_NameComponentList_Cons :: NameComponent ->+ T_NameComponentList ->+ T_NameComponentList+_sem_NameComponentList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: NameComponentList+ _lhsOoriginalTree :: NameComponentList+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _tlIannotatedTree :: NameComponentList+ _tlIoriginalTree :: NameComponentList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) hd_ _tlIannotatedTree+ {-# LINE 6862 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) hd_ _tlIoriginalTree+ {-# LINE 6868 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6874 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6880 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 6886 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 6892 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 6898 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_NameComponentList_Nil :: T_NameComponentList+_sem_NameComponentList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: NameComponentList+ _lhsOoriginalTree :: NameComponentList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 6914 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 6920 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 6926 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 6932 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- NameTypeNameListPair ----------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : NameTypeNameListPair + originalTree : NameTypeNameListPair + alternatives:+ alternative Tuple:+ child x1 : Name + child x2 : TypeNameList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type NameTypeNameListPair = ( Name,TypeNameList)+-- cata+_sem_NameTypeNameListPair :: NameTypeNameListPair ->+ T_NameTypeNameListPair+_sem_NameTypeNameListPair ( x1,x2) =+ (_sem_NameTypeNameListPair_Tuple (_sem_Name x1) (_sem_TypeNameList x2))+-- semantic domain+type T_NameTypeNameListPair = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( NameTypeNameListPair,NameTypeNameListPair)+data Inh_NameTypeNameListPair = Inh_NameTypeNameListPair {_cat_Inh_NameTypeNameListPair :: Catalog,_flags_Inh_NameTypeNameListPair :: TypeCheckFlags,_imCast_Inh_NameTypeNameListPair :: (Maybe TypeExtra)}+data Syn_NameTypeNameListPair = Syn_NameTypeNameListPair {_annotatedTree_Syn_NameTypeNameListPair :: NameTypeNameListPair,_originalTree_Syn_NameTypeNameListPair :: NameTypeNameListPair}+_wrap_NameTypeNameListPair :: T_NameTypeNameListPair ->+ Inh_NameTypeNameListPair ->+ Syn_NameTypeNameListPair+_wrap_NameTypeNameListPair sem (Inh_NameTypeNameListPair _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_NameTypeNameListPair _lhsOannotatedTree _lhsOoriginalTree))+_sem_NameTypeNameListPair_Tuple :: T_Name ->+ T_TypeNameList ->+ T_NameTypeNameListPair+_sem_NameTypeNameListPair_Tuple x1_ x2_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _x1Otpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: NameTypeNameListPair+ _lhsOoriginalTree :: NameTypeNameListPair+ _x1Ocat :: Catalog+ _x1Oflags :: TypeCheckFlags+ _x1OimCast :: (Maybe TypeExtra)+ _x2Ocat :: Catalog+ _x2Oflags :: TypeCheckFlags+ _x2OimCast :: (Maybe TypeExtra)+ _x1IannotatedTree :: Name+ _x1IoriginalTree :: Name+ _x2IannotatedTree :: TypeNameList+ _x2IoriginalTree :: TypeNameList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 68, column 34)+ _x1Otpe =+ ({-# LINE 68 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 6996 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IannotatedTree,_x2IannotatedTree)+ {-# LINE 7002 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IoriginalTree,_x2IoriginalTree)+ {-# LINE 7008 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7014 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7020 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7026 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7032 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7038 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7044 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7050 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7056 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _x1IannotatedTree,_x1IoriginalTree) =+ x1_ _x1Ocat _x1Oflags _x1OimCast _x1Otpe+ ( _x2IannotatedTree,_x2IoriginalTree) =+ x2_ _x2Ocat _x2Oflags _x2OimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- NameTypeNameListPairList ------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : NameTypeNameListPairList + originalTree : NameTypeNameListPairList + alternatives:+ alternative Cons:+ child hd : NameTypeNameListPair + child tl : NameTypeNameListPairList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type NameTypeNameListPairList = [NameTypeNameListPair]+-- cata+_sem_NameTypeNameListPairList :: NameTypeNameListPairList ->+ T_NameTypeNameListPairList+_sem_NameTypeNameListPairList list =+ (Prelude.foldr _sem_NameTypeNameListPairList_Cons _sem_NameTypeNameListPairList_Nil (Prelude.map _sem_NameTypeNameListPair list))+-- semantic domain+type T_NameTypeNameListPairList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( NameTypeNameListPairList,NameTypeNameListPairList)+data Inh_NameTypeNameListPairList = Inh_NameTypeNameListPairList {_cat_Inh_NameTypeNameListPairList :: Catalog,_flags_Inh_NameTypeNameListPairList :: TypeCheckFlags,_imCast_Inh_NameTypeNameListPairList :: (Maybe TypeExtra)}+data Syn_NameTypeNameListPairList = Syn_NameTypeNameListPairList {_annotatedTree_Syn_NameTypeNameListPairList :: NameTypeNameListPairList,_originalTree_Syn_NameTypeNameListPairList :: NameTypeNameListPairList}+_wrap_NameTypeNameListPairList :: T_NameTypeNameListPairList ->+ Inh_NameTypeNameListPairList ->+ Syn_NameTypeNameListPairList+_wrap_NameTypeNameListPairList sem (Inh_NameTypeNameListPairList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_NameTypeNameListPairList _lhsOannotatedTree _lhsOoriginalTree))+_sem_NameTypeNameListPairList_Cons :: T_NameTypeNameListPair ->+ T_NameTypeNameListPairList ->+ T_NameTypeNameListPairList+_sem_NameTypeNameListPairList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: NameTypeNameListPairList+ _lhsOoriginalTree :: NameTypeNameListPairList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: NameTypeNameListPair+ _hdIoriginalTree :: NameTypeNameListPair+ _tlIannotatedTree :: NameTypeNameListPairList+ _tlIoriginalTree :: NameTypeNameListPairList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 7127 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 7133 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7139 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7145 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7151 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7157 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7163 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7169 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7175 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7181 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_NameTypeNameListPairList_Nil :: T_NameTypeNameListPairList+_sem_NameTypeNameListPairList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: NameTypeNameListPairList+ _lhsOoriginalTree :: NameTypeNameListPairList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 7199 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 7205 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7211 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7217 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- OnExpr ------------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : OnExpr + originalTree : OnExpr + alternatives:+ alternative Just:+ child just : JoinExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nothing:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type OnExpr = Maybe (JoinExpr)+-- cata+_sem_OnExpr :: OnExpr ->+ T_OnExpr+_sem_OnExpr (Prelude.Just x) =+ (_sem_OnExpr_Just (_sem_JoinExpr x))+_sem_OnExpr Prelude.Nothing =+ _sem_OnExpr_Nothing+-- semantic domain+type T_OnExpr = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( OnExpr,OnExpr)+data Inh_OnExpr = Inh_OnExpr {_cat_Inh_OnExpr :: Catalog,_downEnv_Inh_OnExpr :: Environment,_flags_Inh_OnExpr :: TypeCheckFlags,_imCast_Inh_OnExpr :: (Maybe TypeExtra)}+data Syn_OnExpr = Syn_OnExpr {_annotatedTree_Syn_OnExpr :: OnExpr,_originalTree_Syn_OnExpr :: OnExpr}+_wrap_OnExpr :: T_OnExpr ->+ Inh_OnExpr ->+ Syn_OnExpr+_wrap_OnExpr sem (Inh_OnExpr _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast+ in (Syn_OnExpr _lhsOannotatedTree _lhsOoriginalTree))+_sem_OnExpr_Just :: T_JoinExpr ->+ T_OnExpr+_sem_OnExpr_Just just_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: OnExpr+ _lhsOoriginalTree :: OnExpr+ _justOcat :: Catalog+ _justOdownEnv :: Environment+ _justOflags :: TypeCheckFlags+ _justOimCast :: (Maybe TypeExtra)+ _justIannotatedTree :: JoinExpr+ _justIoriginalTree :: JoinExpr+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIannotatedTree+ {-# LINE 7283 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Just _justIoriginalTree+ {-# LINE 7289 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7295 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7301 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7307 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOdownEnv =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 7313 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7319 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _justOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7325 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _justIannotatedTree,_justIoriginalTree) =+ just_ _justOcat _justOdownEnv _justOflags _justOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_OnExpr_Nothing :: T_OnExpr+_sem_OnExpr_Nothing =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: OnExpr+ _lhsOoriginalTree :: OnExpr+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 7342 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 7348 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7354 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ParamDef ----------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ParamDef + originalTree : ParamDef + alternatives:+ alternative ParamDef:+ child ann : Annotation + child name : {NameComponent}+ child typ : TypeName + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ParamDefTp:+ child ann : Annotation + child typ : TypeName + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data ParamDef = ParamDef (Annotation) (NameComponent) (TypeName)+ | ParamDefTp (Annotation) (TypeName)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_ParamDef :: ParamDef ->+ T_ParamDef+_sem_ParamDef (ParamDef _ann _name _typ) =+ (_sem_ParamDef_ParamDef (_sem_Annotation _ann) _name (_sem_TypeName _typ))+_sem_ParamDef (ParamDefTp _ann _typ) =+ (_sem_ParamDef_ParamDefTp (_sem_Annotation _ann) (_sem_TypeName _typ))+-- semantic domain+type T_ParamDef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ParamDef,ParamDef)+data Inh_ParamDef = Inh_ParamDef {_cat_Inh_ParamDef :: Catalog,_flags_Inh_ParamDef :: TypeCheckFlags,_imCast_Inh_ParamDef :: (Maybe TypeExtra)}+data Syn_ParamDef = Syn_ParamDef {_annotatedTree_Syn_ParamDef :: ParamDef,_originalTree_Syn_ParamDef :: ParamDef}+_wrap_ParamDef :: T_ParamDef ->+ Inh_ParamDef ->+ Syn_ParamDef+_wrap_ParamDef sem (Inh_ParamDef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ParamDef _lhsOannotatedTree _lhsOoriginalTree))+_sem_ParamDef_ParamDef :: T_Annotation ->+ NameComponent ->+ T_TypeName ->+ T_ParamDef+_sem_ParamDef_ParamDef ann_ name_ typ_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: ParamDef+ _lhsOoriginalTree :: ParamDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 69, column 25)+ _annOtpe =+ ({-# LINE 69 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 7437 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ParamDef _annIannotatedTree name_ _typIannotatedTree+ {-# LINE 7443 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ParamDef _annIoriginalTree name_ _typIoriginalTree+ {-# LINE 7449 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7455 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7461 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7467 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7473 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7479 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7485 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7491 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7497 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_ParamDef_ParamDefTp :: T_Annotation ->+ T_TypeName ->+ T_ParamDef+_sem_ParamDef_ParamDefTp ann_ typ_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: ParamDef+ _lhsOoriginalTree :: ParamDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 70, column 27)+ _annOtpe =+ ({-# LINE 70 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 7529 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ParamDefTp _annIannotatedTree _typIannotatedTree+ {-# LINE 7535 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ParamDefTp _annIoriginalTree _typIoriginalTree+ {-# LINE 7541 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7547 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7553 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7559 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7565 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7571 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7577 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7583 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7589 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ParamDefList ------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ParamDefList + originalTree : ParamDefList + alternatives:+ alternative Cons:+ child hd : ParamDef + child tl : ParamDefList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ParamDefList = [ParamDef]+-- cata+_sem_ParamDefList :: ParamDefList ->+ T_ParamDefList+_sem_ParamDefList list =+ (Prelude.foldr _sem_ParamDefList_Cons _sem_ParamDefList_Nil (Prelude.map _sem_ParamDef list))+-- semantic domain+type T_ParamDefList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ParamDefList,ParamDefList)+data Inh_ParamDefList = Inh_ParamDefList {_cat_Inh_ParamDefList :: Catalog,_flags_Inh_ParamDefList :: TypeCheckFlags,_imCast_Inh_ParamDefList :: (Maybe TypeExtra)}+data Syn_ParamDefList = Syn_ParamDefList {_annotatedTree_Syn_ParamDefList :: ParamDefList,_originalTree_Syn_ParamDefList :: ParamDefList}+_wrap_ParamDefList :: T_ParamDefList ->+ Inh_ParamDefList ->+ Syn_ParamDefList+_wrap_ParamDefList sem (Inh_ParamDefList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ParamDefList _lhsOannotatedTree _lhsOoriginalTree))+_sem_ParamDefList_Cons :: T_ParamDef ->+ T_ParamDefList ->+ T_ParamDefList+_sem_ParamDefList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ParamDefList+ _lhsOoriginalTree :: ParamDefList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ParamDef+ _hdIoriginalTree :: ParamDef+ _tlIannotatedTree :: ParamDefList+ _tlIoriginalTree :: ParamDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 7660 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 7666 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7672 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7678 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7684 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7690 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7696 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 7702 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 7708 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 7714 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_ParamDefList_Nil :: T_ParamDefList+_sem_ParamDefList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ParamDefList+ _lhsOoriginalTree :: ParamDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 7732 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 7738 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 7744 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 7750 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- QueryExpr ---------------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ expectedType : Maybe [TypeExtra]+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ outerDownEnv : Maybe Environment+ synthesized attributes:+ annotatedTree : QueryExpr + originalTree : QueryExpr + upType : Maybe [(Text,TypeExtra)]+ alternatives:+ alternative Select:+ child ann : Annotation + child selDistinct : {Distinct}+ child selSelectList : SelectList + child selTref : TableRefList + child selWhere : MaybeBoolExpr + child selGroupBy : ScalarExprList + child selHaving : MaybeBoolExpr + child selOrderBy : ScalarExprDirectionPairList + child selLimit : MaybeScalarExpr + child selOffset : MaybeScalarExpr + child selOption : {[QueryHint]}+ visit 0:+ local tpee : {Either [TypeError] [(Text,TypeExtra)]}+ local tpe : {Either [TypeError] TypeExtra}+ local selGroupBy : _+ local annotatedTree : _+ local originalTree : _+ alternative CombineQueryExpr:+ child ann : Annotation + child cqType : {CombineType}+ child cqQe0 : QueryExpr + child cqQe1 : QueryExpr + visit 0:+ local tpe : {Either [TypeError] TypeExtra}+ local tpee : {Either [TypeError] [(Text,TypeExtra)]}+ local annotatedTree : _+ local originalTree : _+ alternative Values:+ child ann : Annotation + child qeValues : ScalarExprListList + visit 0:+ local tpe : {Either [TypeError] TypeExtra}+ local tpee : {Either [TypeError] [(Text,TypeExtra)]}+ local annotatedTree : _+ local originalTree : _+ alternative WithQueryExpr:+ child ann : Annotation + child withs : WithQueryList + child withQe : QueryExpr + visit 0:+ local tpe : {Either [TypeError] TypeExtra}+ local tpee : {Either [TypeError] [(Text,TypeExtra)]}+ local annotatedTree : _+ local originalTree : _+-}++data QueryExpr+ = Select { ann:: (Annotation)+ ,selDistinct :: ( Distinct)+ ,selSelectList :: ( SelectList)+ ,selTref :: ( TableRefList)+ ,selWhere :: ( MaybeBoolExpr)+ ,selGroupBy :: ( ScalarExprList)+ ,selHaving :: ( MaybeBoolExpr)+ ,selOrderBy :: ( ScalarExprDirectionPairList)+ ,selLimit :: ( MaybeScalarExpr)+ ,selOffset :: ( MaybeScalarExpr)+ ,selOption :: ( [QueryHint])+ }+ | CombineQueryExpr { ann:: (Annotation)+ ,cqType :: ( CombineType)+ ,cqQe0 :: ( QueryExpr)+ ,cqQe1 :: ( QueryExpr)+ }+ | Values { ann:: (Annotation)+ ,qeValues:: (ScalarExprListList)+ }+ | WithQueryExpr { ann :: ( Annotation)+ ,withs :: ( WithQueryList)+ ,withQe :: ( QueryExpr)++-- todo: represent parens explicitly in queryexpr+-- | QueryExprParens ex:: QueryExpr+++ } deriving (Eq,Show,Data,Typeable)++-- cata+_sem_QueryExpr :: QueryExpr ->+ T_QueryExpr+_sem_QueryExpr (Select _ann _selDistinct _selSelectList _selTref _selWhere _selGroupBy _selHaving _selOrderBy _selLimit _selOffset _selOption) =+ (_sem_QueryExpr_Select (_sem_Annotation _ann) _selDistinct (_sem_SelectList _selSelectList) (_sem_TableRefList _selTref) (_sem_MaybeBoolExpr _selWhere) (_sem_ScalarExprList _selGroupBy) (_sem_MaybeBoolExpr _selHaving) (_sem_ScalarExprDirectionPairList _selOrderBy) (_sem_MaybeScalarExpr _selLimit) (_sem_MaybeScalarExpr _selOffset) _selOption)+_sem_QueryExpr (CombineQueryExpr _ann _cqType _cqQe0 _cqQe1) =+ (_sem_QueryExpr_CombineQueryExpr (_sem_Annotation _ann) _cqType (_sem_QueryExpr _cqQe0) (_sem_QueryExpr _cqQe1))+_sem_QueryExpr (Values _ann _qeValues) =+ (_sem_QueryExpr_Values (_sem_Annotation _ann) (_sem_ScalarExprListList _qeValues))+_sem_QueryExpr (WithQueryExpr _ann _withs _withQe) =+ (_sem_QueryExpr_WithQueryExpr (_sem_Annotation _ann) (_sem_WithQueryList _withs) (_sem_QueryExpr _withQe))+-- semantic domain+type T_QueryExpr = Bool ->+ Catalog ->+ (Maybe [TypeExtra]) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ (Maybe Environment) ->+ ( QueryExpr,QueryExpr,(Maybe [(Text,TypeExtra)]))+data Inh_QueryExpr = Inh_QueryExpr {_assignmentCastContext_Inh_QueryExpr :: Bool,_cat_Inh_QueryExpr :: Catalog,_expectedType_Inh_QueryExpr :: (Maybe [TypeExtra]),_flags_Inh_QueryExpr :: TypeCheckFlags,_imCast_Inh_QueryExpr :: (Maybe TypeExtra),_outerDownEnv_Inh_QueryExpr :: (Maybe Environment)}+data Syn_QueryExpr = Syn_QueryExpr {_annotatedTree_Syn_QueryExpr :: QueryExpr,_originalTree_Syn_QueryExpr :: QueryExpr,_upType_Syn_QueryExpr :: (Maybe [(Text,TypeExtra)])}+_wrap_QueryExpr :: T_QueryExpr ->+ Inh_QueryExpr ->+ Syn_QueryExpr+_wrap_QueryExpr sem (Inh_QueryExpr _lhsIassignmentCastContext _lhsIcat _lhsIexpectedType _lhsIflags _lhsIimCast _lhsIouterDownEnv) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType) = sem _lhsIassignmentCastContext _lhsIcat _lhsIexpectedType _lhsIflags _lhsIimCast _lhsIouterDownEnv+ in (Syn_QueryExpr _lhsOannotatedTree _lhsOoriginalTree _lhsOupType))+_sem_QueryExpr_Select :: T_Annotation ->+ Distinct ->+ T_SelectList ->+ T_TableRefList ->+ T_MaybeBoolExpr ->+ T_ScalarExprList ->+ T_MaybeBoolExpr ->+ T_ScalarExprDirectionPairList ->+ T_MaybeScalarExpr ->+ T_MaybeScalarExpr ->+ ([QueryHint]) ->+ T_QueryExpr+_sem_QueryExpr_Select ann_ selDistinct_ selSelectList_ selTref_ selWhere_ selGroupBy_ selHaving_ selOrderBy_ selLimit_ selOffset_ selOption_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIouterDownEnv ->+ (let _selGroupByOexpectedCast :: Bool+ _selLimitOdownEnv :: Environment+ _selLimitOexpectedCast :: Bool+ _selOffsetOdownEnv :: Environment+ _selOffsetOexpectedCast :: Bool+ _selSelectListOexpectedCast :: Bool+ _selSelectListOdownEnv :: Environment+ _selGroupByOdownEnv :: Environment+ _selHavingOdownEnv :: Environment+ _selOrderByOdownEnv :: Environment+ _tpee :: (Either [TypeError] [(Text,TypeExtra)])+ _selWhereOdownEnv :: Environment+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _lhsOannotatedTree :: QueryExpr+ _selGroupByOexpectedTypes :: ([TypeExtra])+ _selLimitOexpectedType :: (Maybe TypeExtra)+ _selOffsetOexpectedType :: (Maybe TypeExtra)+ _lhsOoriginalTree :: QueryExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _selSelectListOassignmentCastContext :: Bool+ _selSelectListOcat :: Catalog+ _selSelectListOexpectedType :: (Maybe [TypeExtra])+ _selSelectListOflags :: TypeCheckFlags+ _selSelectListOimCast :: (Maybe TypeExtra)+ _selTrefOcat :: Catalog+ _selTrefOflags :: TypeCheckFlags+ _selTrefOimCast :: (Maybe TypeExtra)+ _selWhereOcat :: Catalog+ _selWhereOflags :: TypeCheckFlags+ _selWhereOimCast :: (Maybe TypeExtra)+ _selGroupByOassignmentCastContext :: Bool+ _selGroupByOcat :: Catalog+ _selGroupByOflags :: TypeCheckFlags+ _selGroupByOimCast :: (Maybe TypeExtra)+ _selHavingOcat :: Catalog+ _selHavingOflags :: TypeCheckFlags+ _selHavingOimCast :: (Maybe TypeExtra)+ _selOrderByOcat :: Catalog+ _selOrderByOflags :: TypeCheckFlags+ _selOrderByOimCast :: (Maybe TypeExtra)+ _selLimitOassignmentCastContext :: Bool+ _selLimitOcat :: Catalog+ _selLimitOflags :: TypeCheckFlags+ _selLimitOimCast :: (Maybe TypeExtra)+ _selOffsetOassignmentCastContext :: Bool+ _selOffsetOcat :: Catalog+ _selOffsetOflags :: TypeCheckFlags+ _selOffsetOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selSelectListIannotatedTree :: SelectList+ _selSelectListIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _selSelectListIoriginalTree :: SelectList+ _selSelectListIupEnv :: Environment+ _selSelectListIupType :: (Maybe [(Text,TypeExtra)])+ _selTrefIannotatedTree :: TableRefList+ _selTrefIoriginalTree :: TableRefList+ _selTrefIupEnv :: Environment+ _selWhereIannotatedTree :: MaybeBoolExpr+ _selWhereIoriginalTree :: MaybeBoolExpr+ _selGroupByIannotatedTree :: ScalarExprList+ _selGroupByIoriginalTree :: ScalarExprList+ _selGroupByIupTypes :: ([Maybe TypeExtra])+ _selHavingIannotatedTree :: MaybeBoolExpr+ _selHavingIoriginalTree :: MaybeBoolExpr+ _selOrderByIannotatedTree :: ScalarExprDirectionPairList+ _selOrderByIoriginalTree :: ScalarExprDirectionPairList+ _selLimitIannotatedTree :: MaybeScalarExpr+ _selLimitIoriginalTree :: MaybeScalarExpr+ _selLimitIupType :: (Maybe TypeExtra)+ _selOffsetIannotatedTree :: MaybeScalarExpr+ _selOffsetIoriginalTree :: MaybeScalarExpr+ _selOffsetIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 71, column 24)+ _selGroupByOexpectedCast =+ ({-# LINE 71 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 7946 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 72, column 24)+ _selLimitOdownEnv =+ ({-# LINE 72 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 7952 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 73, column 24)+ _selLimitOexpectedCast =+ ({-# LINE 73 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 7958 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 74, column 24)+ _selOffsetOdownEnv =+ ({-# LINE 74 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 7964 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 75, column 24)+ _selOffsetOexpectedCast =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 7970 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 76, column 24)+ _selSelectListOexpectedCast =+ ({-# LINE 76 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 7976 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 106, column 9)+ _selSelectListOdownEnv =+ ({-# LINE 106 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _selTrefIupEnv+ {-# LINE 7982 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 107, column 9)+ _selGroupByOdownEnv =+ ({-# LINE 107 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _selTrefIupEnv+ {-# LINE 7988 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 108, column 9)+ _selHavingOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _selTrefIupEnv+ {-# LINE 7994 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 128, column 9)+ _selOrderByOdownEnv =+ ({-# LINE 128 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ E.orderByEnvironment _selSelectListIupEnv _selTrefIupEnv+ {-# LINE 8000 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 129, column 9)+ _tpee =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ maybe (Left []) Right _selSelectListIupType+ {-# LINE 8006 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 132, column 9)+ _selWhereOdownEnv =+ ({-# LINE 132 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ maybe _selTrefIupEnv+ (\e -> E.createCorrelatedSubqueryEnvironment e _selTrefIupEnv)+ _lhsIouterDownEnv+ {-# LINE 8014 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 142, column 9)+ _tpe =+ ({-# LINE 142 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM (mkTypeExtra . CompositeType) _tpee+ {-# LINE 8020 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 145, column 9)+ _lhsOupType =+ ({-# LINE 145 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ either (const Nothing) Just _tpee+ {-# LINE 8026 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 239, column 9)+ _selGroupBy =+ ({-# LINE 239 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ case _selGroupByIannotatedTree of+ [App e nm@(Name _ [Nmc "cube"]) es] ->+ [App e{anType = (Just (mkTypeExtra $ ScalarType "int4"))+ ,anErrs = []+ } nm es]+ x -> x+ {-# LINE 8037 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 248, column 9)+ _lhsOannotatedTree =+ ({-# LINE 248 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Select _annIannotatedTree+ selDistinct_+ _selSelectListIannotatedTree+ _selTrefIannotatedTree+ _selWhereIannotatedTree+ _selGroupBy+ _selHavingIannotatedTree+ _selOrderByIannotatedTree+ _selLimitIannotatedTree+ _selOffsetIannotatedTree+ selOption_+ {-# LINE 8053 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 767, column 7)+ _selGroupByOexpectedTypes =+ ({-# LINE 767 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 8059 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 768, column 7)+ _selLimitOexpectedType =+ ({-# LINE 768 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 8065 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 769, column 7)+ _selOffsetOexpectedType =+ ({-# LINE 769 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 8071 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Select _annIannotatedTree selDistinct_ _selSelectListIannotatedTree _selTrefIannotatedTree _selWhereIannotatedTree _selGroupByIannotatedTree _selHavingIannotatedTree _selOrderByIannotatedTree _selLimitIannotatedTree _selOffsetIannotatedTree selOption_+ {-# LINE 8077 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Select _annIoriginalTree selDistinct_ _selSelectListIoriginalTree _selTrefIoriginalTree _selWhereIoriginalTree _selGroupByIoriginalTree _selHavingIoriginalTree _selOrderByIoriginalTree _selLimitIoriginalTree _selOffsetIoriginalTree selOption_+ {-# LINE 8083 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 8089 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8095 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8101 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8107 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 8113 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selSelectListOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8119 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selSelectListOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8125 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selSelectListOexpectedType =+ ({-# LINE 159 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedType+ {-# LINE 8131 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selSelectListOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8137 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selSelectListOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8143 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selTrefOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8149 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selTrefOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8155 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selTrefOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8161 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selWhereOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8167 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selWhereOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8173 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selWhereOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8179 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selGroupByOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8185 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selGroupByOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8191 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selGroupByOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8197 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selGroupByOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8203 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selHavingOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8209 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selHavingOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8215 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selHavingOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8221 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOrderByOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8227 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOrderByOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8233 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOrderByOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8239 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selLimitOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selLimitOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selLimitOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selLimitOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOffsetOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOffsetOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOffsetOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOffsetOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selSelectListIannotatedTree,_selSelectListIcolExprs,_selSelectListIoriginalTree,_selSelectListIupEnv,_selSelectListIupType) =+ selSelectList_ _selSelectListOassignmentCastContext _selSelectListOcat _selSelectListOdownEnv _selSelectListOexpectedCast _selSelectListOexpectedType _selSelectListOflags _selSelectListOimCast+ ( _selTrefIannotatedTree,_selTrefIoriginalTree,_selTrefIupEnv) =+ selTref_ _selTrefOcat _selTrefOflags _selTrefOimCast+ ( _selWhereIannotatedTree,_selWhereIoriginalTree) =+ selWhere_ _selWhereOcat _selWhereOdownEnv _selWhereOflags _selWhereOimCast+ ( _selGroupByIannotatedTree,_selGroupByIoriginalTree,_selGroupByIupTypes) =+ selGroupBy_ _selGroupByOassignmentCastContext _selGroupByOcat _selGroupByOdownEnv _selGroupByOexpectedCast _selGroupByOexpectedTypes _selGroupByOflags _selGroupByOimCast+ ( _selHavingIannotatedTree,_selHavingIoriginalTree) =+ selHaving_ _selHavingOcat _selHavingOdownEnv _selHavingOflags _selHavingOimCast+ ( _selOrderByIannotatedTree,_selOrderByIoriginalTree) =+ selOrderBy_ _selOrderByOcat _selOrderByOdownEnv _selOrderByOflags _selOrderByOimCast+ ( _selLimitIannotatedTree,_selLimitIoriginalTree,_selLimitIupType) =+ selLimit_ _selLimitOassignmentCastContext _selLimitOcat _selLimitOdownEnv _selLimitOexpectedCast _selLimitOexpectedType _selLimitOflags _selLimitOimCast+ ( _selOffsetIannotatedTree,_selOffsetIoriginalTree,_selOffsetIupType) =+ selOffset_ _selOffsetOassignmentCastContext _selOffsetOcat _selOffsetOdownEnv _selOffsetOexpectedCast _selOffsetOexpectedType _selOffsetOflags _selOffsetOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+_sem_QueryExpr_CombineQueryExpr :: T_Annotation ->+ CombineType ->+ T_QueryExpr ->+ T_QueryExpr ->+ T_QueryExpr+_sem_QueryExpr_CombineQueryExpr ann_ cqType_ cqQe0_ cqQe1_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIouterDownEnv ->+ (let _tpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _tpee :: (Either [TypeError] [(Text,TypeExtra)])+ _lhsOannotatedTree :: QueryExpr+ _lhsOoriginalTree :: QueryExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _cqQe0OassignmentCastContext :: Bool+ _cqQe0Ocat :: Catalog+ _cqQe0OexpectedType :: (Maybe [TypeExtra])+ _cqQe0Oflags :: TypeCheckFlags+ _cqQe0OimCast :: (Maybe TypeExtra)+ _cqQe0OouterDownEnv :: (Maybe Environment)+ _cqQe1OassignmentCastContext :: Bool+ _cqQe1Ocat :: Catalog+ _cqQe1OexpectedType :: (Maybe [TypeExtra])+ _cqQe1Oflags :: TypeCheckFlags+ _cqQe1OimCast :: (Maybe TypeExtra)+ _cqQe1OouterDownEnv :: (Maybe Environment)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _cqQe0IannotatedTree :: QueryExpr+ _cqQe0IoriginalTree :: QueryExpr+ _cqQe0IupType :: (Maybe [(Text,TypeExtra)])+ _cqQe1IannotatedTree :: QueryExpr+ _cqQe1IoriginalTree :: QueryExpr+ _cqQe1IupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 142, column 9)+ _tpe =+ ({-# LINE 142 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM (mkTypeExtra . CompositeType) _tpee+ {-# LINE 8353 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 145, column 9)+ _lhsOupType =+ ({-# LINE 145 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ either (const Nothing) Just _tpee+ {-# LINE 8359 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 156, column 9)+ _tpee =+ ({-# LINE 156 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ do+ a <- maybe (Left []) Right _cqQe0IupType+ b <- maybe (Left []) Right _cqQe1IupType+ unless (length a == length b) $ Left [IncompatibleUnionTypes (CompositeType a) (CompositeType b)]+ let uts = zipWithM (\(_,te1) (_,te2) -> resolveResultSetTypeExtra _lhsIcat [te1,te2])+ a b+ case uts of+ Left{} -> Left [IncompatibleUnionTypes (CompositeType a) (CompositeType b)]+ Right uts' -> return $ zipWith (\(n,_) te -> (n,te)) a uts'+ {-# LINE 8373 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CombineQueryExpr _annIannotatedTree cqType_ _cqQe0IannotatedTree _cqQe1IannotatedTree+ {-# LINE 8379 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CombineQueryExpr _annIoriginalTree cqType_ _cqQe0IoriginalTree _cqQe1IoriginalTree+ {-# LINE 8385 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 8391 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 8397 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8403 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8409 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8415 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 8421 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe0OassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8427 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe0Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8433 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe0OexpectedType =+ ({-# LINE 18 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 8439 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe0Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8445 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe0OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8451 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe0OouterDownEnv =+ ({-# LINE 89 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIouterDownEnv+ {-# LINE 8457 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe1OassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8463 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8469 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe1OexpectedType =+ ({-# LINE 18 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 8475 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8481 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8487 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _cqQe1OouterDownEnv =+ ({-# LINE 89 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIouterDownEnv+ {-# LINE 8493 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _cqQe0IannotatedTree,_cqQe0IoriginalTree,_cqQe0IupType) =+ cqQe0_ _cqQe0OassignmentCastContext _cqQe0Ocat _cqQe0OexpectedType _cqQe0Oflags _cqQe0OimCast _cqQe0OouterDownEnv+ ( _cqQe1IannotatedTree,_cqQe1IoriginalTree,_cqQe1IupType) =+ cqQe1_ _cqQe1OassignmentCastContext _cqQe1Ocat _cqQe1OexpectedType _cqQe1Oflags _cqQe1OimCast _cqQe1OouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+_sem_QueryExpr_Values :: T_Annotation ->+ T_ScalarExprListList ->+ T_QueryExpr+_sem_QueryExpr_Values ann_ qeValues_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIouterDownEnv ->+ (let _qeValuesOdownEnv :: Environment+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _tpee :: (Either [TypeError] [(Text,TypeExtra)])+ _qeValuesOexpectedCast :: Bool+ _lhsOannotatedTree :: QueryExpr+ _lhsOoriginalTree :: QueryExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _qeValuesOassignmentCastContext :: Bool+ _qeValuesOcat :: Catalog+ _qeValuesOexpectedType :: (Maybe [TypeExtra])+ _qeValuesOflags :: TypeCheckFlags+ _qeValuesOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _qeValuesIannotatedTree :: ScalarExprListList+ _qeValuesIoriginalTree :: ScalarExprListList+ _qeValuesIupType :: (Either [TypeError] [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 77, column 24)+ _qeValuesOdownEnv =+ ({-# LINE 77 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 8537 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 142, column 9)+ _tpe =+ ({-# LINE 142 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM (mkTypeExtra . CompositeType) _tpee+ {-# LINE 8543 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 145, column 9)+ _lhsOupType =+ ({-# LINE 145 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ either (const Nothing) Just _tpee+ {-# LINE 8549 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 153, column 9)+ _tpee =+ ({-# LINE 153 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _qeValuesIupType+ {-# LINE 8555 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 154, column 9)+ _qeValuesOexpectedCast =+ ({-# LINE 154 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ True+ {-# LINE 8561 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Values _annIannotatedTree _qeValuesIannotatedTree+ {-# LINE 8567 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Values _annIoriginalTree _qeValuesIoriginalTree+ {-# LINE 8573 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 8579 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 8585 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8591 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8597 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8603 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 8609 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _qeValuesOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8615 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _qeValuesOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8621 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _qeValuesOexpectedType =+ ({-# LINE 186 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 8627 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _qeValuesOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8633 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _qeValuesOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _qeValuesIannotatedTree,_qeValuesIoriginalTree,_qeValuesIupType) =+ qeValues_ _qeValuesOassignmentCastContext _qeValuesOcat _qeValuesOdownEnv _qeValuesOexpectedCast _qeValuesOexpectedType _qeValuesOflags _qeValuesOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+_sem_QueryExpr_WithQueryExpr :: T_Annotation ->+ T_WithQueryList ->+ T_QueryExpr ->+ T_QueryExpr+_sem_QueryExpr_WithQueryExpr ann_ withs_ withQe_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIouterDownEnv ->+ (let _withQeOcat :: Catalog+ _withsOcatExtIncomp :: (Either [TypeError] Catalog)+ _lhsOannotatedTree :: QueryExpr+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _tpee :: (Either [TypeError] [(Text,TypeExtra)])+ _lhsOoriginalTree :: QueryExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _withsOcat :: Catalog+ _withsOflags :: TypeCheckFlags+ _withsOimCast :: (Maybe TypeExtra)+ _withQeOassignmentCastContext :: Bool+ _withQeOexpectedType :: (Maybe [TypeExtra])+ _withQeOflags :: TypeCheckFlags+ _withQeOimCast :: (Maybe TypeExtra)+ _withQeOouterDownEnv :: (Maybe Environment)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _withsIannotatedTree :: WithQueryList+ _withsIcatExtComp :: (Either [TypeError] Catalog)+ _withsIoriginalTree :: WithQueryList+ _withQeIannotatedTree :: QueryExpr+ _withQeIoriginalTree :: QueryExpr+ _withQeIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 70, column 8)+ _withQeOcat =+ ({-# LINE 70 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ case _withsIcatExtComp of+ Right catExtComp -> catExtComp+ Left _ -> _lhsIcat+ {-# LINE 8690 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 74, column 8)+ _withsOcatExtIncomp =+ ({-# LINE 74 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ return _lhsIcat+ {-# LINE 8696 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 76, column 8)+ _lhsOannotatedTree =+ ({-# LINE 76 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ case _withsIcatExtComp of+ Right _ -> WithQueryExpr (_annIannotatedTree) (_withsIannotatedTree) (_withQeIannotatedTree)+ Left tyErrs -> WithQueryExpr (emptyAnnotation { anType = Nothing, anErrs = tyErrs })+ (_withsIannotatedTree) (_withQeIannotatedTree)+ {-# LINE 8705 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 142, column 9)+ _tpe =+ ({-# LINE 142 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM (mkTypeExtra . CompositeType) _tpee+ {-# LINE 8711 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 145, column 9)+ _lhsOupType =+ ({-# LINE 145 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ either (const Nothing) Just _tpee+ {-# LINE 8717 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 151, column 9)+ _tpee =+ ({-# LINE 151 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ maybe (Left []) Right _withQeIupType+ {-# LINE 8723 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WithQueryExpr _annIannotatedTree _withsIannotatedTree _withQeIannotatedTree+ {-# LINE 8729 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WithQueryExpr _annIoriginalTree _withsIoriginalTree _withQeIoriginalTree+ {-# LINE 8735 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 8741 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8747 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8753 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8759 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _annOtpe =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _tpe+ {-# LINE 8765 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8771 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8777 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8783 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withQeOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 8789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withQeOexpectedType =+ ({-# LINE 18 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 8795 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withQeOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withQeOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 8807 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _withQeOouterDownEnv =+ ({-# LINE 89 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIouterDownEnv+ {-# LINE 8813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _withsIannotatedTree,_withsIcatExtComp,_withsIoriginalTree) =+ withs_ _withsOcat _withsOcatExtIncomp _withsOflags _withsOimCast+ ( _withQeIannotatedTree,_withQeIoriginalTree,_withQeIupType) =+ withQe_ _withQeOassignmentCastContext _withQeOcat _withQeOexpectedType _withQeOflags _withQeOimCast _withQeOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+-- Root --------------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ synthesized attributes:+ annotatedTree : Root + originalTree : Root + alternatives:+ alternative Root:+ child statements : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data Root = Root (StatementList)+ deriving ( Show)+-- cata+_sem_Root :: Root ->+ T_Root+_sem_Root (Root _statements) =+ (_sem_Root_Root (_sem_StatementList _statements))+-- semantic domain+type T_Root = Catalog ->+ TypeCheckFlags ->+ ( Root,Root)+data Inh_Root = Inh_Root {_cat_Inh_Root :: Catalog,_flags_Inh_Root :: TypeCheckFlags}+data Syn_Root = Syn_Root {_annotatedTree_Syn_Root :: Root,_originalTree_Syn_Root :: Root}+_wrap_Root :: T_Root ->+ Inh_Root ->+ Syn_Root+_wrap_Root sem (Inh_Root _lhsIcat _lhsIflags) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags+ in (Syn_Root _lhsOannotatedTree _lhsOoriginalTree))+_sem_Root_Root :: T_StatementList ->+ T_Root+_sem_Root_Root statements_ =+ (\ _lhsIcat+ _lhsIflags ->+ (let _statementsOimCast :: (Maybe TypeExtra)+ _lhsOannotatedTree :: Root+ _lhsOoriginalTree :: Root+ _statementsOcat :: Catalog+ _statementsOflags :: TypeCheckFlags+ _statementsIannotatedTree :: StatementList+ _statementsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag"(line 133, column 8)+ _statementsOimCast =+ ({-# LINE 133 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 8873 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Root _statementsIannotatedTree+ {-# LINE 8879 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Root _statementsIoriginalTree+ {-# LINE 8885 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 8891 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 8897 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _statementsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 8903 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _statementsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 8909 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _statementsIannotatedTree,_statementsIoriginalTree) =+ statements_ _statementsOcat _statementsOflags _statementsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- RowConstraint -----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : RowConstraint + originalTree : RowConstraint + alternatives:+ alternative DefaultConstraint:+ child ann : Annotation + child name : {String}+ child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative NullConstraint:+ child ann : Annotation + child name : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative NotNullConstraint:+ child ann : Annotation + child name : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative IdentityConstraint:+ child ann : Annotation + child name : {String}+ child seedAndInc : {(Maybe (Integer,Integer))}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative RowCheckConstraint:+ child ann : Annotation + child name : {String}+ child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative RowUniqueConstraint:+ child ann : Annotation + child name : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative RowPrimaryKeyConstraint:+ child ann : Annotation + child name : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative RowReferenceConstraint:+ child ann : Annotation + child name : {String}+ child table : Name + child att : {Maybe NameComponent}+ child onUpdate : {Cascade}+ child onDelete : {Cascade}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data RowConstraint = DefaultConstraint (Annotation) (String) (ScalarExpr)+ | NullConstraint (Annotation) (String)+ | NotNullConstraint (Annotation) (String)+ | IdentityConstraint (Annotation) (String) (((Maybe (Integer,Integer))))+ | RowCheckConstraint (Annotation) (String) (ScalarExpr)+ | RowUniqueConstraint (Annotation) (String)+ | RowPrimaryKeyConstraint (Annotation) (String)+ | RowReferenceConstraint (Annotation) (String) (Name) ((Maybe NameComponent)) (Cascade) (Cascade)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_RowConstraint :: RowConstraint ->+ T_RowConstraint+_sem_RowConstraint (DefaultConstraint _ann _name _expr) =+ (_sem_RowConstraint_DefaultConstraint (_sem_Annotation _ann) _name (_sem_ScalarExpr _expr))+_sem_RowConstraint (NullConstraint _ann _name) =+ (_sem_RowConstraint_NullConstraint (_sem_Annotation _ann) _name)+_sem_RowConstraint (NotNullConstraint _ann _name) =+ (_sem_RowConstraint_NotNullConstraint (_sem_Annotation _ann) _name)+_sem_RowConstraint (IdentityConstraint _ann _name _seedAndInc) =+ (_sem_RowConstraint_IdentityConstraint (_sem_Annotation _ann) _name _seedAndInc)+_sem_RowConstraint (RowCheckConstraint _ann _name _expr) =+ (_sem_RowConstraint_RowCheckConstraint (_sem_Annotation _ann) _name (_sem_ScalarExpr _expr))+_sem_RowConstraint (RowUniqueConstraint _ann _name) =+ (_sem_RowConstraint_RowUniqueConstraint (_sem_Annotation _ann) _name)+_sem_RowConstraint (RowPrimaryKeyConstraint _ann _name) =+ (_sem_RowConstraint_RowPrimaryKeyConstraint (_sem_Annotation _ann) _name)+_sem_RowConstraint (RowReferenceConstraint _ann _name _table _att _onUpdate _onDelete) =+ (_sem_RowConstraint_RowReferenceConstraint (_sem_Annotation _ann) _name (_sem_Name _table) _att _onUpdate _onDelete)+-- semantic domain+type T_RowConstraint = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( RowConstraint,RowConstraint)+data Inh_RowConstraint = Inh_RowConstraint {_cat_Inh_RowConstraint :: Catalog,_flags_Inh_RowConstraint :: TypeCheckFlags,_imCast_Inh_RowConstraint :: (Maybe TypeExtra)}+data Syn_RowConstraint = Syn_RowConstraint {_annotatedTree_Syn_RowConstraint :: RowConstraint,_originalTree_Syn_RowConstraint :: RowConstraint}+_wrap_RowConstraint :: T_RowConstraint ->+ Inh_RowConstraint ->+ Syn_RowConstraint+_wrap_RowConstraint sem (Inh_RowConstraint _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_RowConstraint _lhsOannotatedTree _lhsOoriginalTree))+_sem_RowConstraint_DefaultConstraint :: T_Annotation ->+ String ->+ T_ScalarExpr ->+ T_RowConstraint+_sem_RowConstraint_DefaultConstraint ann_ name_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 81, column 39)+ _annOtpe =+ ({-# LINE 81 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9054 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 82, column 39)+ _exprOdownEnv =+ ({-# LINE 82 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 9060 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 83, column 39)+ _exprOexpectedCast =+ ({-# LINE 83 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 9066 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 84, column 39)+ _exprOexpectedType =+ ({-# LINE 84 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 9072 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 149, column 25)+ _exprOodbcFunction =+ ({-# LINE 149 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 9078 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 816, column 39)+ _exprOassignmentCastContext =+ ({-# LINE 816 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 9084 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DefaultConstraint _annIannotatedTree name_ _exprIannotatedTree+ {-# LINE 9090 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DefaultConstraint _annIoriginalTree name_ _exprIoriginalTree+ {-# LINE 9096 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9102 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9108 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9114 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9120 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9126 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_NullConstraint :: T_Annotation ->+ String ->+ T_RowConstraint+_sem_RowConstraint_NullConstraint ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 80, column 36)+ _annOtpe =+ ({-# LINE 80 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9170 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NullConstraint _annIannotatedTree name_+ {-# LINE 9176 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NullConstraint _annIoriginalTree name_+ {-# LINE 9182 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9188 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9194 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9200 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9206 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9212 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_NotNullConstraint :: T_Annotation ->+ String ->+ T_RowConstraint+_sem_RowConstraint_NotNullConstraint ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 79, column 39)+ _annOtpe =+ ({-# LINE 79 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9236 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NotNullConstraint _annIannotatedTree name_+ {-# LINE 9242 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NotNullConstraint _annIoriginalTree name_+ {-# LINE 9248 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9254 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9260 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9266 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9272 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9278 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_IdentityConstraint :: T_Annotation ->+ String ->+ ((Maybe (Integer,Integer))) ->+ T_RowConstraint+_sem_RowConstraint_IdentityConstraint ann_ name_ seedAndInc_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 78, column 40)+ _annOtpe =+ ({-# LINE 78 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9303 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ IdentityConstraint _annIannotatedTree name_ seedAndInc_+ {-# LINE 9309 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ IdentityConstraint _annIoriginalTree name_ seedAndInc_+ {-# LINE 9315 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9321 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9327 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9333 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9339 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9345 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_RowCheckConstraint :: T_Annotation ->+ String ->+ T_ScalarExpr ->+ T_RowConstraint+_sem_RowConstraint_RowCheckConstraint ann_ name_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 85, column 40)+ _annOtpe =+ ({-# LINE 85 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9382 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 86, column 40)+ _exprOdownEnv =+ ({-# LINE 86 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 9388 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 87, column 40)+ _exprOexpectedCast =+ ({-# LINE 87 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 9394 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 88, column 40)+ _exprOexpectedType =+ ({-# LINE 88 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 9400 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 150, column 26)+ _exprOodbcFunction =+ ({-# LINE 150 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 9406 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 817, column 40)+ _exprOassignmentCastContext =+ ({-# LINE 817 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 9412 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowCheckConstraint _annIannotatedTree name_ _exprIannotatedTree+ {-# LINE 9418 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowCheckConstraint _annIoriginalTree name_ _exprIoriginalTree+ {-# LINE 9424 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9430 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9436 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9442 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9448 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9454 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9460 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9466 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9472 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_RowUniqueConstraint :: T_Annotation ->+ String ->+ T_RowConstraint+_sem_RowConstraint_RowUniqueConstraint ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 92, column 41)+ _annOtpe =+ ({-# LINE 92 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9498 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowUniqueConstraint _annIannotatedTree name_+ {-# LINE 9504 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowUniqueConstraint _annIoriginalTree name_+ {-# LINE 9510 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9516 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9522 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9528 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9534 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9540 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_RowPrimaryKeyConstraint :: T_Annotation ->+ String ->+ T_RowConstraint+_sem_RowConstraint_RowPrimaryKeyConstraint ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 89, column 45)+ _annOtpe =+ ({-# LINE 89 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9564 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowPrimaryKeyConstraint _annIannotatedTree name_+ {-# LINE 9570 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowPrimaryKeyConstraint _annIoriginalTree name_+ {-# LINE 9576 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9582 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9588 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9594 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9600 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9606 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraint_RowReferenceConstraint :: T_Annotation ->+ String ->+ T_Name ->+ (Maybe NameComponent) ->+ Cascade ->+ Cascade ->+ T_RowConstraint+_sem_RowConstraint_RowReferenceConstraint ann_ name_ table_ att_ onUpdate_ onDelete_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _tableOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: RowConstraint+ _lhsOoriginalTree :: RowConstraint+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tableOcat :: Catalog+ _tableOflags :: TypeCheckFlags+ _tableOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tableIannotatedTree :: Name+ _tableIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 90, column 44)+ _annOtpe =+ ({-# LINE 90 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9640 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 91, column 44)+ _tableOtpe =+ ({-# LINE 91 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 9646 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowReferenceConstraint _annIannotatedTree name_ _tableIannotatedTree att_ onUpdate_ onDelete_+ {-# LINE 9652 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ RowReferenceConstraint _annIoriginalTree name_ _tableIoriginalTree att_ onUpdate_ onDelete_+ {-# LINE 9658 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9664 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9670 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9676 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9682 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9688 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9694 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9700 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9706 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tableIannotatedTree,_tableIoriginalTree) =+ table_ _tableOcat _tableOflags _tableOimCast _tableOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- RowConstraintList -------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : RowConstraintList + originalTree : RowConstraintList + alternatives:+ alternative Cons:+ child hd : RowConstraint + child tl : RowConstraintList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type RowConstraintList = [RowConstraint]+-- cata+_sem_RowConstraintList :: RowConstraintList ->+ T_RowConstraintList+_sem_RowConstraintList list =+ (Prelude.foldr _sem_RowConstraintList_Cons _sem_RowConstraintList_Nil (Prelude.map _sem_RowConstraint list))+-- semantic domain+type T_RowConstraintList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( RowConstraintList,RowConstraintList)+data Inh_RowConstraintList = Inh_RowConstraintList {_cat_Inh_RowConstraintList :: Catalog,_flags_Inh_RowConstraintList :: TypeCheckFlags,_imCast_Inh_RowConstraintList :: (Maybe TypeExtra)}+data Syn_RowConstraintList = Syn_RowConstraintList {_annotatedTree_Syn_RowConstraintList :: RowConstraintList,_originalTree_Syn_RowConstraintList :: RowConstraintList}+_wrap_RowConstraintList :: T_RowConstraintList ->+ Inh_RowConstraintList ->+ Syn_RowConstraintList+_wrap_RowConstraintList sem (Inh_RowConstraintList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_RowConstraintList _lhsOannotatedTree _lhsOoriginalTree))+_sem_RowConstraintList_Cons :: T_RowConstraint ->+ T_RowConstraintList ->+ T_RowConstraintList+_sem_RowConstraintList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: RowConstraintList+ _lhsOoriginalTree :: RowConstraintList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: RowConstraint+ _hdIoriginalTree :: RowConstraint+ _tlIannotatedTree :: RowConstraintList+ _tlIoriginalTree :: RowConstraintList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 9777 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 9783 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9795 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9807 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 9819 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 9825 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 9831 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_RowConstraintList_Nil :: T_RowConstraintList+_sem_RowConstraintList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: RowConstraintList+ _lhsOoriginalTree :: RowConstraintList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 9849 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 9855 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 9861 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 9867 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExpr --------------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe TypeExtra+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ odbcFunction : Bool+ synthesized attributes:+ annotatedTree : ScalarExpr + colExprs : [(NameComponent,Maybe TypeExtra,ScalarExpr)]+ originalTree : ScalarExpr + upType : Maybe TypeExtra+ alternatives:+ alternative NumberLit:+ child ann : Annotation + child d : {String}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local digChars : _+ local annotatedTree : _+ local originalTree : _+ alternative StringLit:+ child ann : Annotation + child value : {String}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative NullLit:+ child ann : Annotation + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative BooleanLit:+ child ann : Annotation + child b : {Bool}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative TypedStringLit:+ child ann : Annotation + child tn : TypeName + child value : {String}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Interval:+ child ann : Annotation + child value : {String}+ child field : {IntervalField}+ child prec : {Maybe Int}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Identifier:+ child ann : Annotation + child i : Name + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local elkp : _+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Star:+ child ann : Annotation + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local starCS : _+ local annotatedTree : _+ local originalTree : _+ alternative QStar:+ child ann : Annotation + child q : {NameComponent}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local starCS : _+ local annotatedTree : _+ local originalTree : _+ alternative PositionalArg:+ child ann : Annotation + child p : {Integer}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Placeholder:+ child ann : Annotation + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative PrefixOp:+ child ann : Annotation + child opName : Name + child arg : ScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local ttpe : {Either [TypeError] ([TypeExtra],TypeExtra)}+ local annotatedTree : _+ local originalTree : _+ alternative PostfixOp:+ child ann : Annotation + child opName : Name + child arg : ScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local ttpe : {Either [TypeError] ([TypeExtra],TypeExtra)}+ local annotatedTree : _+ local originalTree : _+ alternative BinaryOp:+ child ann : Annotation + child opName : Name + child arg0 : ScalarExpr + child arg1 : ScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local ttpe : {Either [TypeError] ([TypeExtra],TypeExtra)}+ local annotatedTree : _+ local originalTree : _+ alternative SpecialOp:+ child ann : Annotation + child opName : Name + child args : ScalarExprList + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local ttpe : {Either [TypeError] ([TypeExtra],TypeExtra)}+ local annotatedTree : _+ local originalTree : _+ alternative Extract:+ child ann : Annotation + child field : {ExtractField}+ child e : ScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative App:+ child ann : Annotation + child funName : Name + child args : ScalarExprList + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : {Either [TypeError] TypeExtra}+ local funName : _+ local ttpe : {Either [TypeError] ([TypeExtra],TypeExtra)}+ local annotatedTree : _+ local originalTree : _+ alternative AggregateApp:+ child ann : Annotation + child aggDistinct : {Distinct}+ child fn : ScalarExpr + child orderBy : ScalarExprDirectionPairList + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative WindowApp:+ child ann : Annotation + child fn : ScalarExpr + child partitionBy : ScalarExprList + child orderBy : ScalarExprDirectionPairList + child frm : {Maybe FrameClause}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Cast:+ child ann : Annotation + child expr : ScalarExpr + child tn : TypeName + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative ImplicitCast:+ child ann : Annotation + child expr : ScalarExpr + child te : {TypeExtra}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Case:+ child ann : Annotation + child cases : CaseScalarExprListScalarExprPairList + child els : MaybeScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local whenTypes : _+ local thenTypes : _+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative CaseSimple:+ child ann : Annotation + child value : ScalarExpr + child cases : CaseScalarExprListScalarExprPairList + child els : MaybeScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local whenTypes : _+ local thenTypes : _+ local whent : _+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Parens:+ child ann : Annotation + child ex : ScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative InPredicate:+ child ann : Annotation + child expr : ScalarExpr + child i : {Bool}+ child list : InList + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local rt : {Either [TypeError] TypeExtra}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative Exists:+ child ann : Annotation + child sel : QueryExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative ScalarSubQuery:+ child ann : Annotation + child sel : QueryExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative LiftApp:+ child ann : Annotation + child oper : Name + child flav : {LiftFlavour}+ child args : ScalarExprList + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative OdbcLiteral:+ child ann : Annotation + child olt : {OdbcLiteralType}+ child val : {String}+ visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative OdbcFunc:+ child ann : Annotation + child ex : ScalarExpr + visit 0:+ local upType : _+ local dialectTypeName : {Text -> Either [TypeError] Text}+ local tpe : _+ local annotatedTree : _+ local originalTree : _+ alternative AntiScalarExpr:+ child string : {String}+ visit 0:+ local tpe : _+ local annotatedTree : _+ local originalTree : _+-}+data ScalarExpr = NumberLit (Annotation) (String)+ | StringLit (Annotation) (String)+ | NullLit (Annotation)+ | BooleanLit (Annotation) (Bool)+ | TypedStringLit (Annotation) (TypeName) (String)+ | Interval (Annotation) (String) (IntervalField) ((Maybe Int))+ | Identifier (Annotation) (Name)+ | Star (Annotation)+ | QStar (Annotation) (NameComponent)+ | PositionalArg (Annotation) (Integer)+ | Placeholder (Annotation)+ | PrefixOp (Annotation) (Name) (ScalarExpr)+ | PostfixOp (Annotation) (Name) (ScalarExpr)+ | BinaryOp (Annotation) (Name) (ScalarExpr) (ScalarExpr)+ | SpecialOp (Annotation) (Name) (ScalarExprList)+ | Extract (Annotation) (ExtractField) (ScalarExpr)+ | App (Annotation) (Name) (ScalarExprList)+ | AggregateApp (Annotation) (Distinct) (ScalarExpr) (ScalarExprDirectionPairList)+ | WindowApp (Annotation) (ScalarExpr) (ScalarExprList) (ScalarExprDirectionPairList) ((Maybe FrameClause))+ | Cast (Annotation) (ScalarExpr) (TypeName)+ | ImplicitCast (Annotation) (ScalarExpr) (TypeExtra)+ | Case (Annotation) (CaseScalarExprListScalarExprPairList) (MaybeScalarExpr)+ | CaseSimple (Annotation) (ScalarExpr) (CaseScalarExprListScalarExprPairList) (MaybeScalarExpr)+ | Parens (Annotation) (ScalarExpr)+ | InPredicate (Annotation) (ScalarExpr) (Bool) (InList)+ | Exists (Annotation) (QueryExpr)+ | ScalarSubQuery (Annotation) (QueryExpr)+ | LiftApp (Annotation) (Name) (LiftFlavour) (ScalarExprList)+ | OdbcLiteral (Annotation) (OdbcLiteralType) (String)+ | OdbcFunc (Annotation) (ScalarExpr)+ | AntiScalarExpr (String)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_ScalarExpr :: ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr (NumberLit _ann _d) =+ (_sem_ScalarExpr_NumberLit (_sem_Annotation _ann) _d)+_sem_ScalarExpr (StringLit _ann _value) =+ (_sem_ScalarExpr_StringLit (_sem_Annotation _ann) _value)+_sem_ScalarExpr (NullLit _ann) =+ (_sem_ScalarExpr_NullLit (_sem_Annotation _ann))+_sem_ScalarExpr (BooleanLit _ann _b) =+ (_sem_ScalarExpr_BooleanLit (_sem_Annotation _ann) _b)+_sem_ScalarExpr (TypedStringLit _ann _tn _value) =+ (_sem_ScalarExpr_TypedStringLit (_sem_Annotation _ann) (_sem_TypeName _tn) _value)+_sem_ScalarExpr (Interval _ann _value _field _prec) =+ (_sem_ScalarExpr_Interval (_sem_Annotation _ann) _value _field _prec)+_sem_ScalarExpr (Identifier _ann _i) =+ (_sem_ScalarExpr_Identifier (_sem_Annotation _ann) (_sem_Name _i))+_sem_ScalarExpr (Star _ann) =+ (_sem_ScalarExpr_Star (_sem_Annotation _ann))+_sem_ScalarExpr (QStar _ann _q) =+ (_sem_ScalarExpr_QStar (_sem_Annotation _ann) _q)+_sem_ScalarExpr (PositionalArg _ann _p) =+ (_sem_ScalarExpr_PositionalArg (_sem_Annotation _ann) _p)+_sem_ScalarExpr (Placeholder _ann) =+ (_sem_ScalarExpr_Placeholder (_sem_Annotation _ann))+_sem_ScalarExpr (PrefixOp _ann _opName _arg) =+ (_sem_ScalarExpr_PrefixOp (_sem_Annotation _ann) (_sem_Name _opName) (_sem_ScalarExpr _arg))+_sem_ScalarExpr (PostfixOp _ann _opName _arg) =+ (_sem_ScalarExpr_PostfixOp (_sem_Annotation _ann) (_sem_Name _opName) (_sem_ScalarExpr _arg))+_sem_ScalarExpr (BinaryOp _ann _opName _arg0 _arg1) =+ (_sem_ScalarExpr_BinaryOp (_sem_Annotation _ann) (_sem_Name _opName) (_sem_ScalarExpr _arg0) (_sem_ScalarExpr _arg1))+_sem_ScalarExpr (SpecialOp _ann _opName _args) =+ (_sem_ScalarExpr_SpecialOp (_sem_Annotation _ann) (_sem_Name _opName) (_sem_ScalarExprList _args))+_sem_ScalarExpr (Extract _ann _field _e) =+ (_sem_ScalarExpr_Extract (_sem_Annotation _ann) _field (_sem_ScalarExpr _e))+_sem_ScalarExpr (App _ann _funName _args) =+ (_sem_ScalarExpr_App (_sem_Annotation _ann) (_sem_Name _funName) (_sem_ScalarExprList _args))+_sem_ScalarExpr (AggregateApp _ann _aggDistinct _fn _orderBy) =+ (_sem_ScalarExpr_AggregateApp (_sem_Annotation _ann) _aggDistinct (_sem_ScalarExpr _fn) (_sem_ScalarExprDirectionPairList _orderBy))+_sem_ScalarExpr (WindowApp _ann _fn _partitionBy _orderBy _frm) =+ (_sem_ScalarExpr_WindowApp (_sem_Annotation _ann) (_sem_ScalarExpr _fn) (_sem_ScalarExprList _partitionBy) (_sem_ScalarExprDirectionPairList _orderBy) _frm)+_sem_ScalarExpr (Cast _ann _expr _tn) =+ (_sem_ScalarExpr_Cast (_sem_Annotation _ann) (_sem_ScalarExpr _expr) (_sem_TypeName _tn))+_sem_ScalarExpr (ImplicitCast _ann _expr _te) =+ (_sem_ScalarExpr_ImplicitCast (_sem_Annotation _ann) (_sem_ScalarExpr _expr) _te)+_sem_ScalarExpr (Case _ann _cases _els) =+ (_sem_ScalarExpr_Case (_sem_Annotation _ann) (_sem_CaseScalarExprListScalarExprPairList _cases) (_sem_MaybeScalarExpr _els))+_sem_ScalarExpr (CaseSimple _ann _value _cases _els) =+ (_sem_ScalarExpr_CaseSimple (_sem_Annotation _ann) (_sem_ScalarExpr _value) (_sem_CaseScalarExprListScalarExprPairList _cases) (_sem_MaybeScalarExpr _els))+_sem_ScalarExpr (Parens _ann _ex) =+ (_sem_ScalarExpr_Parens (_sem_Annotation _ann) (_sem_ScalarExpr _ex))+_sem_ScalarExpr (InPredicate _ann _expr _i _list) =+ (_sem_ScalarExpr_InPredicate (_sem_Annotation _ann) (_sem_ScalarExpr _expr) _i (_sem_InList _list))+_sem_ScalarExpr (Exists _ann _sel) =+ (_sem_ScalarExpr_Exists (_sem_Annotation _ann) (_sem_QueryExpr _sel))+_sem_ScalarExpr (ScalarSubQuery _ann _sel) =+ (_sem_ScalarExpr_ScalarSubQuery (_sem_Annotation _ann) (_sem_QueryExpr _sel))+_sem_ScalarExpr (LiftApp _ann _oper _flav _args) =+ (_sem_ScalarExpr_LiftApp (_sem_Annotation _ann) (_sem_Name _oper) _flav (_sem_ScalarExprList _args))+_sem_ScalarExpr (OdbcLiteral _ann _olt _val) =+ (_sem_ScalarExpr_OdbcLiteral (_sem_Annotation _ann) _olt _val)+_sem_ScalarExpr (OdbcFunc _ann _ex) =+ (_sem_ScalarExpr_OdbcFunc (_sem_Annotation _ann) (_sem_ScalarExpr _ex))+_sem_ScalarExpr (AntiScalarExpr _string) =+ (_sem_ScalarExpr_AntiScalarExpr _string)+-- semantic domain+type T_ScalarExpr = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ (Maybe TypeExtra) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ Bool ->+ ( ScalarExpr,([(NameComponent,Maybe TypeExtra,ScalarExpr)]),ScalarExpr,(Maybe TypeExtra))+data Inh_ScalarExpr = Inh_ScalarExpr {_assignmentCastContext_Inh_ScalarExpr :: Bool,_cat_Inh_ScalarExpr :: Catalog,_downEnv_Inh_ScalarExpr :: Environment,_expectedCast_Inh_ScalarExpr :: Bool,_expectedType_Inh_ScalarExpr :: (Maybe TypeExtra),_flags_Inh_ScalarExpr :: TypeCheckFlags,_imCast_Inh_ScalarExpr :: (Maybe TypeExtra),_odbcFunction_Inh_ScalarExpr :: Bool}+data Syn_ScalarExpr = Syn_ScalarExpr {_annotatedTree_Syn_ScalarExpr :: ScalarExpr,_colExprs_Syn_ScalarExpr :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)]),_originalTree_Syn_ScalarExpr :: ScalarExpr,_upType_Syn_ScalarExpr :: (Maybe TypeExtra)}+_wrap_ScalarExpr :: T_ScalarExpr ->+ Inh_ScalarExpr ->+ Syn_ScalarExpr+_wrap_ScalarExpr sem (Inh_ScalarExpr _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast _lhsIodbcFunction) =+ (let ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast _lhsIodbcFunction+ in (Syn_ScalarExpr _lhsOannotatedTree _lhsOcolExprs _lhsOoriginalTree _lhsOupType))+_sem_ScalarExpr_NumberLit :: T_Annotation ->+ String ->+ T_ScalarExpr+_sem_ScalarExpr_NumberLit ann_ d_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 10360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 10366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 10372 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 10378 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 10389 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 10395 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 250, column 9)+ _tpe =+ ({-# LINE 250 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ if all (`elem` _digChars ) d_+ then (mkTypeExtraNN . ScalarType) <$> classifyInteger (tcfDialect _lhsIflags) d_+ else (mkTypeExtraNN . ScalarType) <$> (_dialectTypeName "numeric")+ {-# LINE 10403 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 254, column 9)+ _digChars =+ ({-# LINE 254 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ concatMap show [(0::Int)..9]+ {-# LINE 10409 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NumberLit _annIannotatedTree d_+ {-# LINE 10415 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NumberLit _annIoriginalTree d_+ {-# LINE 10421 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 10427 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 10433 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 10439 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 10445 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_StringLit :: T_Annotation ->+ String ->+ T_ScalarExpr+_sem_ScalarExpr_StringLit ann_ value_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 10492 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 10498 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 10504 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 10510 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 10521 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 10527 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 258, column 9)+ _tpe =+ ({-# LINE 258 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right $ (mkTypeExtraNN UnknownType) {tePrecision = Just $ length value_}+ {-# LINE 10533 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ StringLit _annIannotatedTree value_+ {-# LINE 10539 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ StringLit _annIoriginalTree value_+ {-# LINE 10545 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 10551 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 10557 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 10563 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 10569 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_NullLit :: T_Annotation ->+ T_ScalarExpr+_sem_ScalarExpr_NullLit ann_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 10615 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 10621 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 10627 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 10633 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 10644 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 10650 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 261, column 10)+ _tpe =+ ({-# LINE 261 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right $ mkTypeExtra UnknownType+ {-# LINE 10656 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NullLit _annIannotatedTree+ {-# LINE 10662 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NullLit _annIoriginalTree+ {-# LINE 10668 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 10674 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 10680 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 10686 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 10692 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_BooleanLit :: T_Annotation ->+ Bool ->+ T_ScalarExpr+_sem_ScalarExpr_BooleanLit ann_ b_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 10739 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 10745 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 10751 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 10757 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 10768 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 10774 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 241, column 9)+ _tpe =+ ({-# LINE 241 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap (mkTypeExtraNN . ScalarType) $ _dialectTypeName "boolean"+ {-# LINE 10780 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ BooleanLit _annIannotatedTree b_+ {-# LINE 10786 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ BooleanLit _annIoriginalTree b_+ {-# LINE 10792 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 10798 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 10804 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 10810 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 10816 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_TypedStringLit :: T_Annotation ->+ T_TypeName ->+ String ->+ T_ScalarExpr+_sem_ScalarExpr_TypedStringLit ann_ tn_ value_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _tnOcat :: Catalog+ _tnOflags :: TypeCheckFlags+ _tnOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tnIannotatedTree :: TypeName+ _tnInamedType :: (Maybe TypeExtra)+ _tnIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 10870 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 10876 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 10882 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 10888 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 10899 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 10905 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 271, column 10)+ _tpe =+ ({-# LINE 271 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right _tnInamedType+ {-# LINE 10911 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TypedStringLit _annIannotatedTree _tnIannotatedTree value_+ {-# LINE 10917 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TypedStringLit _annIoriginalTree _tnIoriginalTree value_+ {-# LINE 10923 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 10929 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 10935 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 10941 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 10947 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 10953 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 10959 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 10965 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tnIannotatedTree,_tnInamedType,_tnIoriginalTree) =+ tn_ _tnOcat _tnOflags _tnOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Interval :: T_Annotation ->+ String ->+ IntervalField ->+ (Maybe Int) ->+ T_ScalarExpr+_sem_ScalarExpr_Interval ann_ value_ field_ prec_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11045 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11051 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 283, column 9)+ _tpe =+ ({-# LINE 283 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right $ mkTypeExtraNN $ ScalarType "interval"+ {-# LINE 11057 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Interval _annIannotatedTree value_ field_ prec_+ {-# LINE 11063 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Interval _annIoriginalTree value_ field_ prec_+ {-# LINE 11069 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 11075 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11081 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11087 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11093 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Identifier :: T_Annotation ->+ T_Name ->+ T_ScalarExpr+_sem_ScalarExpr_Identifier ann_ i_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _iOtpe :: (Either [TypeError] TypeExtra)+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _iOcat :: Catalog+ _iOflags :: TypeCheckFlags+ _iOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _iIannotatedTree :: Name+ _iIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11146 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11152 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11158 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11164 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11175 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11181 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 326, column 10)+ _elkp =+ ({-# LINE 326 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ E.envLookupIdentifier (nameComponents _iIoriginalTree) _lhsIdownEnv+ {-# LINE 11187 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 327, column 10)+ _tpe =+ ({-# LINE 327 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap snd _elkp+ {-# LINE 11193 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 329, column 10)+ _lhsOannotatedTree =+ ({-# LINE 329 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _annotatedTree+ {-# LINE 11199 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 330, column 10)+ _annotatedTree =+ ({-# LINE 330 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ let t = Identifier _annIannotatedTree _iIannotatedTree+ in fromMaybe t $ do+ case tcfAddQualifiers _lhsIflags of+ False -> Nothing+ True -> do+ ((q,i),_) <- either (const Nothing) Just _elkp+ if q /= ""+ then+ return $ Identifier _annIannotatedTree+ (Name emptyAnnotation [Nmc $ T.unpack q, Nmc $ T.unpack i])+ else return t+ {-# LINE 11215 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 350, column 10)+ _iOtpe =+ ({-# LINE 350 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 11221 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Identifier _annIoriginalTree _iIoriginalTree+ {-# LINE 11227 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11233 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11239 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _iOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _iOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _iOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 11263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _iIannotatedTree,_iIoriginalTree) =+ i_ _iOcat _iOflags _iOimCast _iOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Star :: T_Annotation ->+ T_ScalarExpr+_sem_ScalarExpr_Star ann_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11312 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11318 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11324 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11330 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11341 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11347 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 714, column 9)+ _tpe =+ ({-# LINE 714 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _originalTree of+ Star _ ->+ E.envExpandStar Nothing _lhsIdownEnv+ >>= _starCS+ QStar _ q -> do+ E.envExpandStar (Just q) _lhsIdownEnv+ >>= _starCS+ _ -> Left [InternalError "wrong ctor in sem rule for star, qstar in scalarexprs.ag"]+ {-# LINE 11360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 723, column 9)+ _starCS =+ ({-# LINE 723 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right . mkTypeExtraNN . CompositeType . map (\((_q,n),t) -> (n,t))+ {-# LINE 11366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Star _annIannotatedTree+ {-# LINE 11372 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Star _annIoriginalTree+ {-# LINE 11378 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 11384 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11390 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11396 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11402 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_QStar :: T_Annotation ->+ NameComponent ->+ T_ScalarExpr+_sem_ScalarExpr_QStar ann_ q_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11450 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11456 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11462 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11468 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11479 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11485 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 714, column 9)+ _tpe =+ ({-# LINE 714 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _originalTree of+ Star _ ->+ E.envExpandStar Nothing _lhsIdownEnv+ >>= _starCS+ QStar _ q -> do+ E.envExpandStar (Just q) _lhsIdownEnv+ >>= _starCS+ _ -> Left [InternalError "wrong ctor in sem rule for star, qstar in scalarexprs.ag"]+ {-# LINE 11498 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 723, column 9)+ _starCS =+ ({-# LINE 723 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right . mkTypeExtraNN . CompositeType . map (\((_q,n),t) -> (n,t))+ {-# LINE 11504 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ QStar _annIannotatedTree q_+ {-# LINE 11510 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ QStar _annIoriginalTree q_+ {-# LINE 11516 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 11522 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11528 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11534 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11540 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_PositionalArg :: T_Annotation ->+ Integer ->+ T_ScalarExpr+_sem_ScalarExpr_PositionalArg ann_ p_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11587 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11593 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11599 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11605 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11616 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11622 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 735, column 9)+ _tpe =+ ({-# LINE 735 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 11628 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PositionalArg _annIannotatedTree p_+ {-# LINE 11634 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PositionalArg _annIoriginalTree p_+ {-# LINE 11640 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 11646 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11652 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11658 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11664 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Placeholder :: T_Annotation ->+ T_ScalarExpr+_sem_ScalarExpr_Placeholder ann_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11710 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11716 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11722 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11728 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11739 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11745 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 301, column 10)+ _tpe =+ ({-# LINE 301 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right $ mkTypeExtraNN UnknownType+ {-# LINE 11751 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Placeholder _annIannotatedTree+ {-# LINE 11757 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Placeholder _annIoriginalTree+ {-# LINE 11763 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 11769 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11775 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11781 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11787 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_PrefixOp :: T_Annotation ->+ T_Name ->+ T_ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_PrefixOp ann_ opName_ arg_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _argOodbcFunction :: Bool+ _opNameOtpe :: (Either [TypeError] TypeExtra)+ _tpe :: (Either [TypeError] TypeExtra)+ _ttpe :: (Either [TypeError] ([TypeExtra],TypeExtra))+ _argOexpectedType :: (Maybe TypeExtra)+ _argOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _opNameOcat :: Catalog+ _opNameOflags :: TypeCheckFlags+ _opNameOimCast :: (Maybe TypeExtra)+ _argOassignmentCastContext :: Bool+ _argOcat :: Catalog+ _argOdownEnv :: Environment+ _argOflags :: TypeCheckFlags+ _argOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _opNameIannotatedTree :: Name+ _opNameIoriginalTree :: Name+ _argIannotatedTree :: ScalarExpr+ _argIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _argIoriginalTree :: ScalarExpr+ _argIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 11855 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 11861 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 11867 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 11873 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 11884 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 11890 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 176, column 26)+ _argOodbcFunction =+ ({-# LINE 176 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 11896 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 211, column 9)+ _opNameOtpe =+ ({-# LINE 211 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 11902 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 365, column 10)+ _tpe =+ ({-# LINE 365 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap snd _ttpe+ {-# LINE 11908 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 434, column 10)+ _ttpe =+ ({-# LINE 434 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ tcAppLike (tcfDialect _lhsIflags) _lhsIcat (nameComponents _opNameIoriginalTree) (getMaybeIntsFromLiterals [_argIoriginalTree]) [_argIupType]+ {-# LINE 11914 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 435, column 10)+ _argOexpectedType =+ ({-# LINE 435 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _ttpe of+ Right ([t],_) -> Just t+ _ -> Nothing+ {-# LINE 11922 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 457, column 9)+ _argOexpectedCast =+ ({-# LINE 457 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 11928 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PrefixOp _annIannotatedTree _opNameIannotatedTree _argIannotatedTree+ {-# LINE 11934 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PrefixOp _annIoriginalTree _opNameIoriginalTree _argIoriginalTree+ {-# LINE 11940 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 11946 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 11952 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11958 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11964 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11970 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 11976 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 11982 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 11988 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 11994 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 12000 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12006 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12012 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _opNameIannotatedTree,_opNameIoriginalTree) =+ opName_ _opNameOcat _opNameOflags _opNameOimCast _opNameOtpe+ ( _argIannotatedTree,_argIcolExprs,_argIoriginalTree,_argIupType) =+ arg_ _argOassignmentCastContext _argOcat _argOdownEnv _argOexpectedCast _argOexpectedType _argOflags _argOimCast _argOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_PostfixOp :: T_Annotation ->+ T_Name ->+ T_ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_PostfixOp ann_ opName_ arg_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _argOodbcFunction :: Bool+ _opNameOtpe :: (Either [TypeError] TypeExtra)+ _tpe :: (Either [TypeError] TypeExtra)+ _ttpe :: (Either [TypeError] ([TypeExtra],TypeExtra))+ _argOexpectedType :: (Maybe TypeExtra)+ _argOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _opNameOcat :: Catalog+ _opNameOflags :: TypeCheckFlags+ _opNameOimCast :: (Maybe TypeExtra)+ _argOassignmentCastContext :: Bool+ _argOcat :: Catalog+ _argOdownEnv :: Environment+ _argOflags :: TypeCheckFlags+ _argOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _opNameIannotatedTree :: Name+ _opNameIoriginalTree :: Name+ _argIannotatedTree :: ScalarExpr+ _argIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _argIoriginalTree :: ScalarExpr+ _argIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 12084 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 12090 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 12096 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 12102 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 12113 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 12119 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 176, column 26)+ _argOodbcFunction =+ ({-# LINE 176 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12125 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 211, column 9)+ _opNameOtpe =+ ({-# LINE 211 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 12131 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 365, column 10)+ _tpe =+ ({-# LINE 365 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap snd _ttpe+ {-# LINE 12137 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 434, column 10)+ _ttpe =+ ({-# LINE 434 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ tcAppLike (tcfDialect _lhsIflags) _lhsIcat (nameComponents _opNameIoriginalTree) (getMaybeIntsFromLiterals [_argIoriginalTree]) [_argIupType]+ {-# LINE 12143 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 435, column 10)+ _argOexpectedType =+ ({-# LINE 435 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _ttpe of+ Right ([t],_) -> Just t+ _ -> Nothing+ {-# LINE 12151 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 457, column 9)+ _argOexpectedCast =+ ({-# LINE 457 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12157 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PostfixOp _annIannotatedTree _opNameIannotatedTree _argIannotatedTree+ {-# LINE 12163 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PostfixOp _annIoriginalTree _opNameIoriginalTree _argIoriginalTree+ {-# LINE 12169 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 12175 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 12181 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12187 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12193 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12199 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12205 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12211 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 12217 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12223 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 12229 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12235 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12241 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _opNameIannotatedTree,_opNameIoriginalTree) =+ opName_ _opNameOcat _opNameOflags _opNameOimCast _opNameOtpe+ ( _argIannotatedTree,_argIcolExprs,_argIoriginalTree,_argIupType) =+ arg_ _argOassignmentCastContext _argOcat _argOdownEnv _argOexpectedCast _argOexpectedType _argOflags _argOimCast _argOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_BinaryOp :: T_Annotation ->+ T_Name ->+ T_ScalarExpr ->+ T_ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_BinaryOp ann_ opName_ arg0_ arg1_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _arg0OodbcFunction :: Bool+ _arg1OodbcFunction :: Bool+ _opNameOtpe :: (Either [TypeError] TypeExtra)+ _tpe :: (Either [TypeError] TypeExtra)+ _ttpe :: (Either [TypeError] ([TypeExtra],TypeExtra))+ _arg0OexpectedType :: (Maybe TypeExtra)+ _arg1OexpectedType :: (Maybe TypeExtra)+ _arg0OexpectedCast :: Bool+ _arg1OexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _opNameOcat :: Catalog+ _opNameOflags :: TypeCheckFlags+ _opNameOimCast :: (Maybe TypeExtra)+ _arg0OassignmentCastContext :: Bool+ _arg0Ocat :: Catalog+ _arg0OdownEnv :: Environment+ _arg0Oflags :: TypeCheckFlags+ _arg0OimCast :: (Maybe TypeExtra)+ _arg1OassignmentCastContext :: Bool+ _arg1Ocat :: Catalog+ _arg1OdownEnv :: Environment+ _arg1Oflags :: TypeCheckFlags+ _arg1OimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _opNameIannotatedTree :: Name+ _opNameIoriginalTree :: Name+ _arg0IannotatedTree :: ScalarExpr+ _arg0IcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _arg0IoriginalTree :: ScalarExpr+ _arg0IupType :: (Maybe TypeExtra)+ _arg1IannotatedTree :: ScalarExpr+ _arg1IcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _arg1IoriginalTree :: ScalarExpr+ _arg1IupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 12326 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 12332 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 12338 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 12344 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 12355 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 12361 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 177, column 16)+ _arg0OodbcFunction =+ ({-# LINE 177 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12367 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 178, column 16)+ _arg1OodbcFunction =+ ({-# LINE 178 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12373 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 211, column 9)+ _opNameOtpe =+ ({-# LINE 211 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 12379 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 365, column 10)+ _tpe =+ ({-# LINE 365 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap snd _ttpe+ {-# LINE 12385 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 426, column 10)+ _ttpe =+ ({-# LINE 426 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ tcAppLike (tcfDialect _lhsIflags)+ _lhsIcat (nameComponents _opNameIoriginalTree) (getMaybeIntsFromLiterals [_arg0IoriginalTree,_arg1IoriginalTree])+ [_arg0IupType,_arg1IupType]+ {-# LINE 12393 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 429, column 10)+ (_arg0OexpectedType,_arg1OexpectedType) =+ ({-# LINE 429 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _ttpe of+ Right ([t0,t1],_) -> (Just t0,Just t1)+ _ -> (Nothing,Nothing)+ {-# LINE 12401 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 459, column 9)+ _arg0OexpectedCast =+ ({-# LINE 459 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12407 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 460, column 9)+ _arg1OexpectedCast =+ ({-# LINE 460 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12413 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ BinaryOp _annIannotatedTree _opNameIannotatedTree _arg0IannotatedTree _arg1IannotatedTree+ {-# LINE 12419 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ BinaryOp _annIoriginalTree _opNameIoriginalTree _arg0IoriginalTree _arg1IoriginalTree+ {-# LINE 12425 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 12431 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 12437 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12443 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12449 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12455 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12461 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12467 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg0OassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 12473 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg0Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12479 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg0OdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 12485 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg0Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12491 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg0OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12497 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg1OassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 12503 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12509 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg1OdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 12515 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12521 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _arg1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12527 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _opNameIannotatedTree,_opNameIoriginalTree) =+ opName_ _opNameOcat _opNameOflags _opNameOimCast _opNameOtpe+ ( _arg0IannotatedTree,_arg0IcolExprs,_arg0IoriginalTree,_arg0IupType) =+ arg0_ _arg0OassignmentCastContext _arg0Ocat _arg0OdownEnv _arg0OexpectedCast _arg0OexpectedType _arg0Oflags _arg0OimCast _arg0OodbcFunction+ ( _arg1IannotatedTree,_arg1IcolExprs,_arg1IoriginalTree,_arg1IupType) =+ arg1_ _arg1OassignmentCastContext _arg1Ocat _arg1OdownEnv _arg1OexpectedCast _arg1OexpectedType _arg1Oflags _arg1OimCast _arg1OodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_SpecialOp :: T_Annotation ->+ T_Name ->+ T_ScalarExprList ->+ T_ScalarExpr+_sem_ScalarExpr_SpecialOp ann_ opName_ args_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _opNameOtpe :: (Either [TypeError] TypeExtra)+ _tpe :: (Either [TypeError] TypeExtra)+ _ttpe :: (Either [TypeError] ([TypeExtra],TypeExtra))+ _argsOexpectedTypes :: ([TypeExtra])+ _argsOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _opNameOcat :: Catalog+ _opNameOflags :: TypeCheckFlags+ _opNameOimCast :: (Maybe TypeExtra)+ _argsOassignmentCastContext :: Bool+ _argsOcat :: Catalog+ _argsOdownEnv :: Environment+ _argsOflags :: TypeCheckFlags+ _argsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _opNameIannotatedTree :: Name+ _opNameIoriginalTree :: Name+ _argsIannotatedTree :: ScalarExprList+ _argsIoriginalTree :: ScalarExprList+ _argsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 12599 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 12605 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 12611 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 12617 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 12628 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 12634 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 211, column 9)+ _opNameOtpe =+ ({-# LINE 211 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 12640 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 365, column 10)+ _tpe =+ ({-# LINE 365 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap snd _ttpe+ {-# LINE 12646 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 440, column 10)+ _ttpe =+ ({-# LINE 440 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ tcAppLike (tcfDialect _lhsIflags) _lhsIcat (nameComponents _opNameIoriginalTree) (getMaybeIntsFromLiterals _argsIoriginalTree) _argsIupTypes+ {-# LINE 12652 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 441, column 10)+ _argsOexpectedTypes =+ ({-# LINE 441 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const []) id $ fmap fst _ttpe+ {-# LINE 12658 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 455, column 9)+ _argsOexpectedCast =+ ({-# LINE 455 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12664 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SpecialOp _annIannotatedTree _opNameIannotatedTree _argsIannotatedTree+ {-# LINE 12670 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SpecialOp _annIoriginalTree _opNameIoriginalTree _argsIoriginalTree+ {-# LINE 12676 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 12682 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 12688 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12694 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12700 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12706 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12712 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _opNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12718 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 12724 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12730 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 12736 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12742 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12748 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _opNameIannotatedTree,_opNameIoriginalTree) =+ opName_ _opNameOcat _opNameOflags _opNameOimCast _opNameOtpe+ ( _argsIannotatedTree,_argsIoriginalTree,_argsIupTypes) =+ args_ _argsOassignmentCastContext _argsOcat _argsOdownEnv _argsOexpectedCast _argsOexpectedTypes _argsOflags _argsOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Extract :: T_Annotation ->+ ExtractField ->+ T_ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_Extract ann_ field_ e_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _eOodbcFunction :: Bool+ _eOexpectedType :: (Maybe TypeExtra)+ _eOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _eOassignmentCastContext :: Bool+ _eOcat :: Catalog+ _eOdownEnv :: Environment+ _eOflags :: TypeCheckFlags+ _eOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _eIannotatedTree :: ScalarExpr+ _eIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _eIoriginalTree :: ScalarExpr+ _eIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 12812 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 12818 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 12824 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 12830 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 12841 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 12847 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 172, column 15)+ _eOodbcFunction =+ ({-# LINE 172 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12853 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 285, column 9)+ _tpe =+ ({-# LINE 285 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ x <- maybe (Left []) Right _eIupType+ if (teType x) `elem` (map ScalarType $ diDatetimeTypes $ tcfDialect _lhsIflags)+ then do+ i <- ScalarType <$> _dialectTypeName "int"+ return $ TypeExtra i Nothing Nothing $ teNullable x+ else Left [NoMatchingOperator "extract" [teType x]]+ {-# LINE 12865 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 293, column 9)+ _eOexpectedType =+ ({-# LINE 293 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ x <- _eIupType+ either (const Nothing)+ (Just . TypeExtra (teType x) Nothing Nothing . teNullable)+ _tpe+ {-# LINE 12875 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 299, column 9)+ _eOexpectedCast =+ ({-# LINE 299 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 12881 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Extract _annIannotatedTree field_ _eIannotatedTree+ {-# LINE 12887 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Extract _annIoriginalTree field_ _eIoriginalTree+ {-# LINE 12893 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 12899 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 12905 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12911 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12917 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _eOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 12923 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _eOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 12929 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _eOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 12935 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _eOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 12941 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _eOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 12947 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _eIannotatedTree,_eIcolExprs,_eIoriginalTree,_eIupType) =+ e_ _eOassignmentCastContext _eOcat _eOdownEnv _eOexpectedCast _eOexpectedType _eOflags _eOimCast _eOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_App :: T_Annotation ->+ T_Name ->+ T_ScalarExprList ->+ T_ScalarExpr+_sem_ScalarExpr_App ann_ funName_ args_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _funNameOtpe :: (Either [TypeError] TypeExtra)+ _tpe :: (Either [TypeError] TypeExtra)+ _argsOexpectedTypes :: ([TypeExtra])+ _ttpe :: (Either [TypeError] ([TypeExtra],TypeExtra))+ _argsOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _funNameOcat :: Catalog+ _funNameOflags :: TypeCheckFlags+ _funNameOimCast :: (Maybe TypeExtra)+ _argsOassignmentCastContext :: Bool+ _argsOcat :: Catalog+ _argsOdownEnv :: Environment+ _argsOflags :: TypeCheckFlags+ _argsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _funNameIannotatedTree :: Name+ _funNameIoriginalTree :: Name+ _argsIannotatedTree :: ScalarExprList+ _argsIoriginalTree :: ScalarExprList+ _argsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 13015 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 13021 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 13027 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 13033 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 13044 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 13050 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 209, column 9)+ _funNameOtpe =+ ({-# LINE 209 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 13056 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 365, column 10)+ _tpe =+ ({-# LINE 365 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ fmap snd _ttpe+ {-# LINE 13062 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 367, column 10)+ _argsOexpectedTypes =+ ({-# LINE 367 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const []) id $ fmap fst _ttpe+ {-# LINE 13068 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 381, column 10)+ _funName =+ ({-# LINE 381 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ let y = if _lhsIodbcFunction+ then let f [] = []+ f [Nmc x] = [Nmc $ "!odbc-" ++ x]+ f [QNmc x] = [QNmc $ "!odbc-" ++ x]+ f [x] = [x]+ f (x:xs) = x:f xs+ in (\(Name a nms) -> Name a (f nms)) _funNameIoriginalTree+ else _funNameIoriginalTree+ in y+ {-# LINE 13082 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 404, column 10)+ _ttpe =+ ({-# LINE 404 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _originalTree of+ (App _ (Name _ [Nmc "count"]) [Star _]) ->+ tcAppLike (tcfDialect _lhsIflags)+ _lhsIcat (nameComponents _funName )+ (getMaybeIntsFromLiterals _argsIoriginalTree)+ [Just $ mkTypeExtraNN UnknownType]+ (App _ (Name _ [Nmc n]) [_,Identifier _ (Name _ [Nmc tyi])])+ | _lhsIodbcFunction && map toLower n == "convert" -> do+ (ts,_r) <- do+ t <- _dialectTypeName "int"+ tcAppLike (tcfDialect _lhsIflags)+ _lhsIcat (nameComponents _funName ) (getMaybeIntsFromLiterals _argsIoriginalTree)+ [Just $ mkTypeExtraNN UnknownType, Just $ mkTypeExtraNN $ ScalarType t]+ r' <- maybe (Left [UnrecognisedIdentifier $ T.pack tyi]) (Right . mkTypeExtra)+ $ lookup (map toLower tyi) odbcConvertTypes+ Right (ts, r')+ _ -> tcAppLike (tcfDialect _lhsIflags)+ _lhsIcat (nameComponents _funName ) (getMaybeIntsFromLiterals _argsIoriginalTree) _argsIupTypes+ {-# LINE 13105 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 455, column 9)+ _argsOexpectedCast =+ ({-# LINE 455 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13111 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ App _annIannotatedTree _funNameIannotatedTree _argsIannotatedTree+ {-# LINE 13117 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ App _annIoriginalTree _funNameIoriginalTree _argsIoriginalTree+ {-# LINE 13123 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 13129 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 13135 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13141 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13147 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _funNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13153 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _funNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13159 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _funNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13165 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 13171 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13177 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13183 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13189 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13195 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _funNameIannotatedTree,_funNameIoriginalTree) =+ funName_ _funNameOcat _funNameOflags _funNameOimCast _funNameOtpe+ ( _argsIannotatedTree,_argsIoriginalTree,_argsIupTypes) =+ args_ _argsOassignmentCastContext _argsOcat _argsOdownEnv _argsOexpectedCast _argsOexpectedTypes _argsOflags _argsOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_AggregateApp :: T_Annotation ->+ Distinct ->+ T_ScalarExpr ->+ T_ScalarExprDirectionPairList ->+ T_ScalarExpr+_sem_ScalarExpr_AggregateApp ann_ aggDistinct_ fn_ orderBy_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _fnOodbcFunction :: Bool+ _fnOexpectedCast :: Bool+ _fnOexpectedType :: (Maybe TypeExtra)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _fnOassignmentCastContext :: Bool+ _fnOcat :: Catalog+ _fnOdownEnv :: Environment+ _fnOflags :: TypeCheckFlags+ _fnOimCast :: (Maybe TypeExtra)+ _orderByOcat :: Catalog+ _orderByOdownEnv :: Environment+ _orderByOflags :: TypeCheckFlags+ _orderByOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _fnIannotatedTree :: ScalarExpr+ _fnIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _fnIoriginalTree :: ScalarExpr+ _fnIupType :: (Maybe TypeExtra)+ _orderByIannotatedTree :: ScalarExprDirectionPairList+ _orderByIoriginalTree :: ScalarExprDirectionPairList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 13266 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 13272 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 13278 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 13284 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 13295 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 13301 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 179, column 20)+ _fnOodbcFunction =+ ({-# LINE 179 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13307 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 443, column 10)+ _tpe =+ ({-# LINE 443 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _fnIoriginalTree of+ (App _ fnm@(Name _ [Nmc "count"]) [Star _]) ->+ fmap snd $ tcAppLike (tcfDialect _lhsIflags) _lhsIcat (nameComponents fnm) [] [Just $ mkTypeExtraNN UnknownType]+ _ -> maybe (Left []) Right _fnIupType+ {-# LINE 13316 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 462, column 9)+ _fnOexpectedCast =+ ({-# LINE 462 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13322 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 753, column 28)+ _fnOexpectedType =+ ({-# LINE 753 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 13328 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AggregateApp _annIannotatedTree aggDistinct_ _fnIannotatedTree _orderByIannotatedTree+ {-# LINE 13334 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AggregateApp _annIoriginalTree aggDistinct_ _fnIoriginalTree _orderByIoriginalTree+ {-# LINE 13340 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 13346 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 13352 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13358 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13364 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 13370 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13376 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13382 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13388 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13394 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13400 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOdownEnv =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13406 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13412 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13418 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _fnIannotatedTree,_fnIcolExprs,_fnIoriginalTree,_fnIupType) =+ fn_ _fnOassignmentCastContext _fnOcat _fnOdownEnv _fnOexpectedCast _fnOexpectedType _fnOflags _fnOimCast _fnOodbcFunction+ ( _orderByIannotatedTree,_orderByIoriginalTree) =+ orderBy_ _orderByOcat _orderByOdownEnv _orderByOflags _orderByOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_WindowApp :: T_Annotation ->+ T_ScalarExpr ->+ T_ScalarExprList ->+ T_ScalarExprDirectionPairList ->+ (Maybe FrameClause) ->+ T_ScalarExpr+_sem_ScalarExpr_WindowApp ann_ fn_ partitionBy_ orderBy_ frm_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _fnOodbcFunction :: Bool+ _fnOexpectedCast :: Bool+ _partitionByOexpectedCast :: Bool+ _fnOexpectedType :: (Maybe TypeExtra)+ _partitionByOexpectedTypes :: ([TypeExtra])+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _fnOassignmentCastContext :: Bool+ _fnOcat :: Catalog+ _fnOdownEnv :: Environment+ _fnOflags :: TypeCheckFlags+ _fnOimCast :: (Maybe TypeExtra)+ _partitionByOassignmentCastContext :: Bool+ _partitionByOcat :: Catalog+ _partitionByOdownEnv :: Environment+ _partitionByOflags :: TypeCheckFlags+ _partitionByOimCast :: (Maybe TypeExtra)+ _orderByOcat :: Catalog+ _orderByOdownEnv :: Environment+ _orderByOflags :: TypeCheckFlags+ _orderByOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _fnIannotatedTree :: ScalarExpr+ _fnIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _fnIoriginalTree :: ScalarExpr+ _fnIupType :: (Maybe TypeExtra)+ _partitionByIannotatedTree :: ScalarExprList+ _partitionByIoriginalTree :: ScalarExprList+ _partitionByIupTypes :: ([Maybe TypeExtra])+ _orderByIannotatedTree :: ScalarExprDirectionPairList+ _orderByIoriginalTree :: ScalarExprDirectionPairList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 13500 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 13506 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 13512 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 13518 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 13529 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 13535 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 180, column 17)+ _fnOodbcFunction =+ ({-# LINE 180 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13541 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 449, column 10)+ _tpe =+ ({-# LINE 449 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right _fnIupType+ {-# LINE 13547 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 462, column 9)+ _fnOexpectedCast =+ ({-# LINE 462 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13553 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 465, column 9)+ _partitionByOexpectedCast =+ ({-# LINE 465 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13559 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 753, column 28)+ _fnOexpectedType =+ ({-# LINE 753 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 13565 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 775, column 15)+ _partitionByOexpectedTypes =+ ({-# LINE 775 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 13571 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WindowApp _annIannotatedTree _fnIannotatedTree _partitionByIannotatedTree _orderByIannotatedTree frm_+ {-# LINE 13577 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WindowApp _annIoriginalTree _fnIoriginalTree _partitionByIoriginalTree _orderByIoriginalTree frm_+ {-# LINE 13583 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 13589 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 13595 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13601 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13607 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 13613 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13619 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13625 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13631 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13637 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionByOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 13643 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionByOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13649 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionByOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13655 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionByOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13661 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionByOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13667 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13673 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOdownEnv =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13679 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13685 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _orderByOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13691 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _fnIannotatedTree,_fnIcolExprs,_fnIoriginalTree,_fnIupType) =+ fn_ _fnOassignmentCastContext _fnOcat _fnOdownEnv _fnOexpectedCast _fnOexpectedType _fnOflags _fnOimCast _fnOodbcFunction+ ( _partitionByIannotatedTree,_partitionByIoriginalTree,_partitionByIupTypes) =+ partitionBy_ _partitionByOassignmentCastContext _partitionByOcat _partitionByOdownEnv _partitionByOexpectedCast _partitionByOexpectedTypes _partitionByOflags _partitionByOimCast+ ( _orderByIannotatedTree,_orderByIoriginalTree) =+ orderBy_ _orderByOcat _orderByOdownEnv _orderByOflags _orderByOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Cast :: T_Annotation ->+ T_ScalarExpr ->+ T_TypeName ->+ T_ScalarExpr+_sem_ScalarExpr_Cast ann_ expr_ tn_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _exprOodbcFunction :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _exprOassignmentCastContext :: Bool+ _exprOcat :: Catalog+ _exprOdownEnv :: Environment+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _tnOcat :: Catalog+ _tnOflags :: TypeCheckFlags+ _tnOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ _tnIannotatedTree :: TypeName+ _tnInamedType :: (Maybe TypeExtra)+ _tnIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 13763 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 13769 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 13775 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 13781 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 13792 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 13798 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 173, column 12)+ _exprOodbcFunction =+ ({-# LINE 173 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13804 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 273, column 10)+ _tpe =+ ({-# LINE 273 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ let nullability = fromMaybe False $ teNullable <$> _exprIupType+ setNullability te = te{teNullable = nullability}+ in maybe (Left []) (Right . setNullability) _tnInamedType+ {-# LINE 13812 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 277, column 10)+ _exprOexpectedType =+ ({-# LINE 277 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 13818 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 278, column 10)+ _exprOexpectedCast =+ ({-# LINE 278 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 13824 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Cast _annIannotatedTree _exprIannotatedTree _tnIannotatedTree+ {-# LINE 13830 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Cast _annIoriginalTree _exprIoriginalTree _tnIoriginalTree+ {-# LINE 13836 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 13842 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 13848 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13854 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13860 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 13866 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13872 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 13878 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13884 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13890 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 13896 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 13902 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 13908 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ ( _tnIannotatedTree,_tnInamedType,_tnIoriginalTree) =+ tn_ _tnOcat _tnOflags _tnOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_ImplicitCast :: T_Annotation ->+ T_ScalarExpr ->+ TypeExtra ->+ T_ScalarExpr+_sem_ScalarExpr_ImplicitCast ann_ expr_ te_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _exprOodbcFunction :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _exprOassignmentCastContext :: Bool+ _exprOcat :: Catalog+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 13972 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 13978 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 13984 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 13990 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 14001 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 14007 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 174, column 20)+ _exprOodbcFunction =+ ({-# LINE 174 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 14013 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 280, column 9)+ _tpe =+ ({-# LINE 280 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Right te_+ {-# LINE 14019 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 281, column 9)+ _exprOexpectedType =+ ({-# LINE 281 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 14025 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ImplicitCast _annIannotatedTree _exprIannotatedTree te_+ {-# LINE 14031 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ImplicitCast _annIoriginalTree _exprIoriginalTree te_+ {-# LINE 14037 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 14043 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 14049 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14055 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14061 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 14067 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14073 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14079 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOexpectedCast =+ ({-# LINE 111 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 14085 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14091 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14097 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Case :: T_Annotation ->+ T_CaseScalarExprListScalarExprPairList ->+ T_MaybeScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_Case ann_ cases_ els_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _casesOwhenExpectedType :: (Maybe TypeExtra)+ _casesOthenExpectedType :: (Maybe TypeExtra)+ _elsOexpectedType :: (Maybe TypeExtra)+ _elsOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _casesOcat :: Catalog+ _casesOdownEnv :: Environment+ _casesOflags :: TypeCheckFlags+ _casesOimCast :: (Maybe TypeExtra)+ _elsOassignmentCastContext :: Bool+ _elsOcat :: Catalog+ _elsOdownEnv :: Environment+ _elsOflags :: TypeCheckFlags+ _elsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _casesIannotatedTree :: CaseScalarExprListScalarExprPairList+ _casesIoriginalTree :: CaseScalarExprListScalarExprPairList+ _casesIthenTypes :: ([Maybe TypeExtra])+ _casesIupTypes :: ([Maybe TypeExtra])+ _casesIwhenTypes :: ([[Maybe TypeExtra]])+ _elsIannotatedTree :: MaybeScalarExpr+ _elsIoriginalTree :: MaybeScalarExpr+ _elsIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 14168 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 14174 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14180 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 14186 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 14197 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 14203 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 559, column 9)+ _whenTypes =+ ({-# LINE 559 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _casesIwhenTypes+ {-# LINE 14209 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 560, column 9)+ _thenTypes =+ ({-# LINE 560 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _casesIthenTypes ++ maybe [] ((:[]) . Just) _elsIupType+ {-# LINE 14215 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 562, column 9)+ _tpe =+ ({-# LINE 562 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ wt <- mapM (maybe (Left []) Right) $ concat _whenTypes+ bt <- ScalarType <$> _dialectTypeName "boolean"+ when (any ((/= bt) . teType) wt)+ $ Left [WrongTypes bt $ map teType wt]+ tt <- mapM (maybe (Left []) Right) _thenTypes+ tse <- resolveResultSetTypeExtra _lhsIcat tt+ return $ if isNothing _elsIoriginalTree+ then tse{teNullable=True}+ else tse+ {-# LINE 14230 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 574, column 9)+ _casesOwhenExpectedType =+ ({-# LINE 574 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ ws <- sequence $ concat _whenTypes+ w <- either (const Nothing) Just $ resolveResultSetTypeExtra _lhsIcat ws+ bt <- ScalarType <$> either (const Nothing) Just (_dialectTypeName "boolean")+ Just $ TypeExtra bt Nothing Nothing $ teNullable w+ {-# LINE 14240 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 580, column 9)+ _casesOthenExpectedType =+ ({-# LINE 580 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14246 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 581, column 9)+ _elsOexpectedType =+ ({-# LINE 581 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14252 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 582, column 9)+ _elsOexpectedCast =+ ({-# LINE 582 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ True+ {-# LINE 14258 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Case _annIannotatedTree _casesIannotatedTree _elsIannotatedTree+ {-# LINE 14264 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Case _annIoriginalTree _casesIoriginalTree _elsIoriginalTree+ {-# LINE 14270 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 14276 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 14282 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14288 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14294 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14300 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOdownEnv =+ ({-# LINE 554 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14306 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14312 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14318 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 14324 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14330 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14336 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14342 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14348 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _casesIannotatedTree,_casesIoriginalTree,_casesIthenTypes,_casesIupTypes,_casesIwhenTypes) =+ cases_ _casesOcat _casesOdownEnv _casesOflags _casesOimCast _casesOthenExpectedType _casesOwhenExpectedType+ ( _elsIannotatedTree,_elsIoriginalTree,_elsIupType) =+ els_ _elsOassignmentCastContext _elsOcat _elsOdownEnv _elsOexpectedCast _elsOexpectedType _elsOflags _elsOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_CaseSimple :: T_Annotation ->+ T_ScalarExpr ->+ T_CaseScalarExprListScalarExprPairList ->+ T_MaybeScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_CaseSimple ann_ value_ cases_ els_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _valueOodbcFunction :: Bool+ _casesOwhenExpectedType :: (Maybe TypeExtra)+ _valueOexpectedType :: (Maybe TypeExtra)+ _valueOexpectedCast :: Bool+ _casesOthenExpectedType :: (Maybe TypeExtra)+ _elsOexpectedType :: (Maybe TypeExtra)+ _elsOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _valueOassignmentCastContext :: Bool+ _valueOcat :: Catalog+ _valueOdownEnv :: Environment+ _valueOflags :: TypeCheckFlags+ _valueOimCast :: (Maybe TypeExtra)+ _casesOcat :: Catalog+ _casesOdownEnv :: Environment+ _casesOflags :: TypeCheckFlags+ _casesOimCast :: (Maybe TypeExtra)+ _elsOassignmentCastContext :: Bool+ _elsOcat :: Catalog+ _elsOdownEnv :: Environment+ _elsOflags :: TypeCheckFlags+ _elsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _valueIannotatedTree :: ScalarExpr+ _valueIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _valueIoriginalTree :: ScalarExpr+ _valueIupType :: (Maybe TypeExtra)+ _casesIannotatedTree :: CaseScalarExprListScalarExprPairList+ _casesIoriginalTree :: CaseScalarExprListScalarExprPairList+ _casesIthenTypes :: ([Maybe TypeExtra])+ _casesIupTypes :: ([Maybe TypeExtra])+ _casesIwhenTypes :: ([[Maybe TypeExtra]])+ _elsIannotatedTree :: MaybeScalarExpr+ _elsIoriginalTree :: MaybeScalarExpr+ _elsIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 14434 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 14440 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14446 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 14452 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 14463 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 14469 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 175, column 18)+ _valueOodbcFunction =+ ({-# LINE 175 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 14475 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 559, column 9)+ _whenTypes =+ ({-# LINE 559 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _casesIwhenTypes+ {-# LINE 14481 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 560, column 9)+ _thenTypes =+ ({-# LINE 560 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _casesIthenTypes ++ maybe [] ((:[]) . Just) _elsIupType+ {-# LINE 14487 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 584, column 9)+ _whent =+ ({-# LINE 584 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ wt <- mapM (maybe (Left []) Right) $ concat _whenTypes+ vt <- maybe (Left []) Right _valueIupType+ resolveResultSetTypeExtra _lhsIcat (vt : wt)+ {-# LINE 14496 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 589, column 9)+ _tpe =+ ({-# LINE 589 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ _ <- _whent+ tt <- mapM (maybe (Left []) Right) _thenTypes+ resolveResultSetTypeExtra _lhsIcat tt+ {-# LINE 14505 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 594, column 9)+ _casesOwhenExpectedType =+ ({-# LINE 594 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _whent+ {-# LINE 14511 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 595, column 9)+ _valueOexpectedType =+ ({-# LINE 595 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _whent+ {-# LINE 14517 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 596, column 9)+ _valueOexpectedCast =+ ({-# LINE 596 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 14523 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 597, column 9)+ _casesOthenExpectedType =+ ({-# LINE 597 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14529 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 598, column 9)+ _elsOexpectedType =+ ({-# LINE 598 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14535 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 599, column 9)+ _elsOexpectedCast =+ ({-# LINE 599 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ True+ {-# LINE 14541 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CaseSimple _annIannotatedTree _valueIannotatedTree _casesIannotatedTree _elsIannotatedTree+ {-# LINE 14547 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CaseSimple _annIoriginalTree _valueIoriginalTree _casesIoriginalTree _elsIoriginalTree+ {-# LINE 14553 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 14559 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 14565 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14571 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14577 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 14583 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14589 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14595 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14601 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14607 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14613 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOdownEnv =+ ({-# LINE 554 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14619 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14625 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14631 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 14637 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14643 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14649 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14655 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14661 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _valueIannotatedTree,_valueIcolExprs,_valueIoriginalTree,_valueIupType) =+ value_ _valueOassignmentCastContext _valueOcat _valueOdownEnv _valueOexpectedCast _valueOexpectedType _valueOflags _valueOimCast _valueOodbcFunction+ ( _casesIannotatedTree,_casesIoriginalTree,_casesIthenTypes,_casesIupTypes,_casesIwhenTypes) =+ cases_ _casesOcat _casesOdownEnv _casesOflags _casesOimCast _casesOthenExpectedType _casesOwhenExpectedType+ ( _elsIannotatedTree,_elsIoriginalTree,_elsIupType) =+ els_ _elsOassignmentCastContext _elsOcat _elsOdownEnv _elsOexpectedCast _elsOexpectedType _elsOflags _elsOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Parens :: T_Annotation ->+ T_ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_Parens ann_ ex_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _exOodbcFunction :: Bool+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _exOassignmentCastContext :: Bool+ _exOcat :: Catalog+ _exOdownEnv :: Environment+ _exOexpectedCast :: Bool+ _exOexpectedType :: (Maybe TypeExtra)+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: ScalarExpr+ _exIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exIoriginalTree :: ScalarExpr+ _exIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 14726 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 14732 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14738 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 14744 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 14755 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 14761 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 182, column 14)+ _exOodbcFunction =+ ({-# LINE 182 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 14767 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 615, column 5)+ _tpe =+ ({-# LINE 615 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right _exIupType+ {-# LINE 14773 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Parens _annIannotatedTree _exIannotatedTree+ {-# LINE 14779 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Parens _annIoriginalTree _exIoriginalTree+ {-# LINE 14785 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 14791 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 14797 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14803 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14809 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 14815 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 14821 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 14827 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOexpectedCast =+ ({-# LINE 111 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 14833 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOexpectedType =+ ({-# LINE 110 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 14839 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 14845 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 14851 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIcolExprs,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOdownEnv _exOexpectedCast _exOexpectedType _exOflags _exOimCast _exOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_InPredicate :: T_Annotation ->+ T_ScalarExpr ->+ Bool ->+ T_InList ->+ T_ScalarExpr+_sem_ScalarExpr_InPredicate ann_ expr_ i_ list_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _exprOodbcFunction :: Bool+ _rt :: (Either [TypeError] TypeExtra)+ _listOexpectedType :: (Maybe TypeExtra)+ _exprOexpectedType :: (Maybe TypeExtra)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _exprOassignmentCastContext :: Bool+ _exprOcat :: Catalog+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _listOcat :: Catalog+ _listOdownEnv :: Environment+ _listOexpectedCast :: Bool+ _listOflags :: TypeCheckFlags+ _listOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ _listIannotatedTree :: InList+ _listIlistType :: (Either [TypeError] TypeExtra)+ _listIoriginalTree :: InList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 14924 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 14930 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 14936 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 14942 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 14953 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 14959 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 181, column 19)+ _exprOodbcFunction =+ ({-# LINE 181 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 14965 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 669, column 9)+ _rt =+ ({-# LINE 669 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ lt <- _listIlistType+ expt <- maybe (Left []) Right _exprIupType+ resolveResultSetTypeExtra _lhsIcat [expt, lt]+ {-# LINE 14974 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 673, column 9)+ _tpe =+ ({-# LINE 673 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ r <- _rt+ bt <- ScalarType <$> _dialectTypeName "boolean"+ return $ TypeExtra bt Nothing Nothing $ teNullable r+ {-# LINE 14983 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 677, column 9)+ _listOexpectedType =+ ({-# LINE 677 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _rt+ {-# LINE 14989 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 678, column 9)+ _exprOexpectedType =+ ({-# LINE 678 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _rt+ {-# LINE 14995 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ InPredicate _annIannotatedTree _exprIannotatedTree i_ _listIannotatedTree+ {-# LINE 15001 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ InPredicate _annIoriginalTree _exprIoriginalTree i_ _listIoriginalTree+ {-# LINE 15007 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 15013 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 15019 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15025 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15031 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 15037 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15043 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 15049 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOexpectedCast =+ ({-# LINE 111 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 15055 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15061 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15067 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _listOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15073 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _listOdownEnv =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 15079 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _listOexpectedCast =+ ({-# LINE 662 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 15085 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _listOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15091 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _listOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15097 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ ( _listIannotatedTree,_listIlistType,_listIoriginalTree) =+ list_ _listOcat _listOdownEnv _listOexpectedCast _listOexpectedType _listOflags _listOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_Exists :: T_Annotation ->+ T_QueryExpr ->+ T_ScalarExpr+_sem_ScalarExpr_Exists ann_ sel_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _selOouterDownEnv :: (Maybe Environment)+ _selOexpectedType :: (Maybe [TypeExtra])+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _selOassignmentCastContext :: Bool+ _selOcat :: Catalog+ _selOflags :: TypeCheckFlags+ _selOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selIannotatedTree :: QueryExpr+ _selIoriginalTree :: QueryExpr+ _selIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 15157 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 15163 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 15169 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 15175 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 15186 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 15192 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 628, column 9)+ _tpe =+ ({-# LINE 628 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ (mkTypeExtraNN . ScalarType) <$> (_dialectTypeName "boolean")+ {-# LINE 15198 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 650, column 9)+ _selOouterDownEnv =+ ({-# LINE 650 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Just _lhsIdownEnv+ {-# LINE 15204 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 652, column 9)+ _selOexpectedType =+ ({-# LINE 652 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ liftM (map snd) _selIupType+ {-# LINE 15210 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Exists _annIannotatedTree _selIannotatedTree+ {-# LINE 15216 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Exists _annIoriginalTree _selIoriginalTree+ {-# LINE 15222 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 15228 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 15234 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15240 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15246 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 15252 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15258 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15264 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15270 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selIannotatedTree,_selIoriginalTree,_selIupType) =+ sel_ _selOassignmentCastContext _selOcat _selOexpectedType _selOflags _selOimCast _selOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_ScalarSubQuery :: T_Annotation ->+ T_QueryExpr ->+ T_ScalarExpr+_sem_ScalarExpr_ScalarSubQuery ann_ sel_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _selOouterDownEnv :: (Maybe Environment)+ _selOexpectedType :: (Maybe [TypeExtra])+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _selOassignmentCastContext :: Bool+ _selOcat :: Catalog+ _selOflags :: TypeCheckFlags+ _selOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selIannotatedTree :: QueryExpr+ _selIoriginalTree :: QueryExpr+ _selIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 15328 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 15334 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 15340 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 15346 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 15357 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 15363 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 638, column 9)+ _tpe =+ ({-# LINE 638 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ do+ selType <- maybe (Left []) Right _selIupType+ case length selType of+ 0 -> Left [InternalError "no columns in scalar subquery?"]+ 1 -> Right $ snd $ head selType+ _ -> Right $ mkTypeExtra $ AnonymousCompositeType+ $ map (teType . snd) selType+ {-# LINE 15375 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 648, column 9)+ _selOouterDownEnv =+ ({-# LINE 648 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Just _lhsIdownEnv+ {-# LINE 15381 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 652, column 9)+ _selOexpectedType =+ ({-# LINE 652 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ liftM (map snd) _selIupType+ {-# LINE 15387 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ScalarSubQuery _annIannotatedTree _selIannotatedTree+ {-# LINE 15393 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ScalarSubQuery _annIoriginalTree _selIoriginalTree+ {-# LINE 15399 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 15405 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 15411 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 15429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15447 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selIannotatedTree,_selIoriginalTree,_selIupType) =+ sel_ _selOassignmentCastContext _selOcat _selOexpectedType _selOflags _selOimCast _selOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_LiftApp :: T_Annotation ->+ T_Name ->+ LiftFlavour ->+ T_ScalarExprList ->+ T_ScalarExpr+_sem_ScalarExpr_LiftApp ann_ oper_ flav_ args_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _argsOexpectedCast :: Bool+ _argsOexpectedTypes :: ([TypeExtra])+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _operOcat :: Catalog+ _operOflags :: TypeCheckFlags+ _operOimCast :: (Maybe TypeExtra)+ _operOtpe :: (Either [TypeError] TypeExtra)+ _argsOassignmentCastContext :: Bool+ _argsOcat :: Catalog+ _argsOdownEnv :: Environment+ _argsOflags :: TypeCheckFlags+ _argsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _operIannotatedTree :: Name+ _operIoriginalTree :: Name+ _argsIannotatedTree :: ScalarExprList+ _argsIoriginalTree :: ScalarExprList+ _argsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 15514 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 15520 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 15526 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 15532 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 15543 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 15549 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 455, column 9)+ _argsOexpectedCast =+ ({-# LINE 455 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 15555 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 735, column 9)+ _tpe =+ ({-# LINE 735 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 15561 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 772, column 13)+ _argsOexpectedTypes =+ ({-# LINE 772 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 15567 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ LiftApp _annIannotatedTree _operIannotatedTree flav_ _argsIannotatedTree+ {-# LINE 15573 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ LiftApp _annIoriginalTree _operIoriginalTree flav_ _argsIoriginalTree+ {-# LINE 15579 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 15585 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 15591 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15597 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15603 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15609 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15615 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15621 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (from local)+ _operOtpe =+ ({-# LINE 46 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ _tpe+ {-# LINE 15627 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 15633 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 15645 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15651 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15657 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _operIannotatedTree,_operIoriginalTree) =+ oper_ _operOcat _operOflags _operOimCast _operOtpe+ ( _argsIannotatedTree,_argsIoriginalTree,_argsIupTypes) =+ args_ _argsOassignmentCastContext _argsOcat _argsOdownEnv _argsOexpectedCast _argsOexpectedTypes _argsOflags _argsOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_OdbcLiteral :: T_Annotation ->+ OdbcLiteralType ->+ String ->+ T_ScalarExpr+_sem_ScalarExpr_OdbcLiteral ann_ olt_ val_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 15709 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 15715 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 15721 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 15727 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 15738 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 15744 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 307, column 10)+ _tpe =+ ({-# LINE 307 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case olt_ of+ OLDate -> (mkTypeExtra . ScalarType) <$> _dialectTypeName "date"+ OLTime -> (mkTypeExtra . ScalarType) <$> _dialectTypeName "time"+ OLTimestamp -> (mkTypeExtra . ScalarType) <$> _dialectTypeName "timestamp"+ {-# LINE 15753 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ OdbcLiteral _annIannotatedTree olt_ val_+ {-# LINE 15759 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ OdbcLiteral _annIoriginalTree olt_ val_+ {-# LINE 15765 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 15771 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 15777 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15783 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_OdbcFunc :: T_Annotation ->+ T_ScalarExpr ->+ T_ScalarExpr+_sem_ScalarExpr_OdbcFunc ann_ ex_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe TypeExtra)+ _annOimCast :: (Maybe TypeExtra)+ _dialectTypeName :: (Text -> Either [TypeError] Text)+ _exOodbcFunction :: Bool+ _exOcat :: Catalog+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _exOassignmentCastContext :: Bool+ _exOdownEnv :: Environment+ _exOexpectedCast :: Bool+ _exOexpectedType :: (Maybe TypeExtra)+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: ScalarExpr+ _exIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exIoriginalTree :: ScalarExpr+ _exIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 42, column 7)+ _lhsOcolExprs =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ let a = _annIoriginalTree+ doStar is =+ map (\((q,n),t) ->+ let a' = a {anType = Just t}+ in (Nmc $ T.unpack n, Just t,+ Identifier a' $ Name a'+ $ [Nmc q' | let q' = T.unpack q, not $ null q']+ ++ [Nmc $ T.unpack n])+ ) is+ in case _originalTree of+ Star _ | Right is <- E.envExpandStar Nothing _lhsIdownEnv ->+ doStar is+ QStar _ q | Right is <- E.envExpandStar (Just q) _lhsIdownEnv ->+ doStar is+ _ ->+ [(columnName _originalTree,_upType,_annotatedTree)]+ {-# LINE 15848 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 35, column 9)+ _annOtpe =+ ({-# LINE 35 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _tpe+ {-# LINE 15854 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 36, column 9)+ _upType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 15860 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 37, column 9)+ _lhsOupType =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _upType+ {-# LINE 15866 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 38, column 9)+ _annOimCast =+ ({-# LINE 38 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _upType of+ Nothing -> _lhsIexpectedType+ Just upType -> do+ expType <- _lhsIexpectedType+ guard $ needsImplicitCast _lhsIexpectedCast upType expType+ return $ implicitCastType _lhsIexpectedCast upType expType+ {-# LINE 15877 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 45, column 9)+ _dialectTypeName =+ ({-# LINE 45 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ maybe (Left []) Right . ansiTypeNameToDialect (tcfDialect _lhsIflags)+ {-# LINE 15883 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 183, column 16)+ _exOodbcFunction =+ ({-# LINE 183 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ True+ {-# LINE 15889 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 313, column 10)+ _exOcat =+ ({-# LINE 313 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ id _lhsIcat+ {-# LINE 15895 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 314, column 10)+ _tpe =+ ({-# LINE 314 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _exIoriginalTree of+ Extract {} -> maybe (Left []) Right _exIupType+ App {} -> maybe (Left []) Right _exIupType+ _ -> Left [OdbcFuncBadContent]+ {-# LINE 15904 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ OdbcFunc _annIannotatedTree _exIannotatedTree+ {-# LINE 15910 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ OdbcFunc _annIoriginalTree _exIoriginalTree+ {-# LINE 15916 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 15922 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 15928 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 15934 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15940 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 15946 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 15952 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOexpectedCast =+ ({-# LINE 111 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 15958 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOexpectedType =+ ({-# LINE 110 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 15964 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 15970 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 15976 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIcolExprs,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOdownEnv _exOexpectedCast _exOexpectedType _exOflags _exOimCast _exOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExpr_AntiScalarExpr :: String ->+ T_ScalarExpr+_sem_ScalarExpr_AntiScalarExpr string_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast+ _lhsIodbcFunction ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _lhsOupType :: (Maybe TypeExtra)+ _lhsOannotatedTree :: ScalarExpr+ _lhsOoriginalTree :: ScalarExpr+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 232, column 21)+ _lhsOcolExprs =+ ({-# LINE 232 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ [(Nmc "?anti?",Nothing,_originalTree)]+ {-# LINE 16002 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 102, column 9)+ _lhsOupType =+ ({-# LINE 102 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 16008 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 735, column 9)+ _tpe =+ ({-# LINE 735 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Left []+ {-# LINE 16014 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AntiScalarExpr string_+ {-# LINE 16020 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AntiScalarExpr string_+ {-# LINE 16026 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16032 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16038 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupType)))+-- ScalarExprDirectionPair -------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprDirectionPair + originalTree : ScalarExprDirectionPair + alternatives:+ alternative Tuple:+ child x1 : ScalarExpr + child x2 : {Direction}+ child x3 : {NullsOrder}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprDirectionPair = ( ScalarExpr,(Direction),(NullsOrder))+-- cata+_sem_ScalarExprDirectionPair :: ScalarExprDirectionPair ->+ T_ScalarExprDirectionPair+_sem_ScalarExprDirectionPair ( x1,x2,x3) =+ (_sem_ScalarExprDirectionPair_Tuple (_sem_ScalarExpr x1) x2 x3)+-- semantic domain+type T_ScalarExprDirectionPair = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprDirectionPair,ScalarExprDirectionPair)+data Inh_ScalarExprDirectionPair = Inh_ScalarExprDirectionPair {_cat_Inh_ScalarExprDirectionPair :: Catalog,_downEnv_Inh_ScalarExprDirectionPair :: Environment,_flags_Inh_ScalarExprDirectionPair :: TypeCheckFlags,_imCast_Inh_ScalarExprDirectionPair :: (Maybe TypeExtra)}+data Syn_ScalarExprDirectionPair = Syn_ScalarExprDirectionPair {_annotatedTree_Syn_ScalarExprDirectionPair :: ScalarExprDirectionPair,_originalTree_Syn_ScalarExprDirectionPair :: ScalarExprDirectionPair}+_wrap_ScalarExprDirectionPair :: T_ScalarExprDirectionPair ->+ Inh_ScalarExprDirectionPair ->+ Syn_ScalarExprDirectionPair+_wrap_ScalarExprDirectionPair sem (Inh_ScalarExprDirectionPair _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast+ in (Syn_ScalarExprDirectionPair _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprDirectionPair_Tuple :: T_ScalarExpr ->+ Direction ->+ NullsOrder ->+ T_ScalarExprDirectionPair+_sem_ScalarExprDirectionPair_Tuple x1_ x2_ x3_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _x1OexpectedCast :: Bool+ _x1OodbcFunction :: Bool+ _x1OexpectedType :: (Maybe TypeExtra)+ _x1OassignmentCastContext :: Bool+ _lhsOannotatedTree :: ScalarExprDirectionPair+ _lhsOoriginalTree :: ScalarExprDirectionPair+ _x1Ocat :: Catalog+ _x1OdownEnv :: Environment+ _x1Oflags :: TypeCheckFlags+ _x1OimCast :: (Maybe TypeExtra)+ _x1IannotatedTree :: ScalarExpr+ _x1IcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _x1IoriginalTree :: ScalarExpr+ _x1IupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 93, column 37)+ _x1OexpectedCast =+ ({-# LINE 93 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 16108 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 153, column 13)+ _x1OodbcFunction =+ ({-# LINE 153 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 16114 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 758, column 11)+ _x1OexpectedType =+ ({-# LINE 758 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 16120 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 818, column 37)+ _x1OassignmentCastContext =+ ({-# LINE 818 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 16126 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IannotatedTree,x2_,x3_)+ {-# LINE 16132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IoriginalTree,x2_,x3_)+ {-# LINE 16138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16150 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16156 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 16162 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16168 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16174 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _x1IannotatedTree,_x1IcolExprs,_x1IoriginalTree,_x1IupType) =+ x1_ _x1OassignmentCastContext _x1Ocat _x1OdownEnv _x1OexpectedCast _x1OexpectedType _x1Oflags _x1OimCast _x1OodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprDirectionPairList ---------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprDirectionPairList + originalTree : ScalarExprDirectionPairList + alternatives:+ alternative Cons:+ child hd : ScalarExprDirectionPair + child tl : ScalarExprDirectionPairList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprDirectionPairList = [ScalarExprDirectionPair]+-- cata+_sem_ScalarExprDirectionPairList :: ScalarExprDirectionPairList ->+ T_ScalarExprDirectionPairList+_sem_ScalarExprDirectionPairList list =+ (Prelude.foldr _sem_ScalarExprDirectionPairList_Cons _sem_ScalarExprDirectionPairList_Nil (Prelude.map _sem_ScalarExprDirectionPair list))+-- semantic domain+type T_ScalarExprDirectionPairList = Catalog ->+ Environment ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprDirectionPairList,ScalarExprDirectionPairList)+data Inh_ScalarExprDirectionPairList = Inh_ScalarExprDirectionPairList {_cat_Inh_ScalarExprDirectionPairList :: Catalog,_downEnv_Inh_ScalarExprDirectionPairList :: Environment,_flags_Inh_ScalarExprDirectionPairList :: TypeCheckFlags,_imCast_Inh_ScalarExprDirectionPairList :: (Maybe TypeExtra)}+data Syn_ScalarExprDirectionPairList = Syn_ScalarExprDirectionPairList {_annotatedTree_Syn_ScalarExprDirectionPairList :: ScalarExprDirectionPairList,_originalTree_Syn_ScalarExprDirectionPairList :: ScalarExprDirectionPairList}+_wrap_ScalarExprDirectionPairList :: T_ScalarExprDirectionPairList ->+ Inh_ScalarExprDirectionPairList ->+ Syn_ScalarExprDirectionPairList+_wrap_ScalarExprDirectionPairList sem (Inh_ScalarExprDirectionPairList _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIflags _lhsIimCast+ in (Syn_ScalarExprDirectionPairList _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprDirectionPairList_Cons :: T_ScalarExprDirectionPair ->+ T_ScalarExprDirectionPairList ->+ T_ScalarExprDirectionPairList+_sem_ScalarExprDirectionPairList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ScalarExprDirectionPairList+ _lhsOoriginalTree :: ScalarExprDirectionPairList+ _hdOcat :: Catalog+ _hdOdownEnv :: Environment+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOdownEnv :: Environment+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ScalarExprDirectionPair+ _hdIoriginalTree :: ScalarExprDirectionPair+ _tlIannotatedTree :: ScalarExprDirectionPairList+ _tlIoriginalTree :: ScalarExprDirectionPairList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 16248 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 16254 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16260 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16266 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16272 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOdownEnv =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 16278 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16284 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16290 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16296 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOdownEnv =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 16302 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16308 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16314 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOdownEnv _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOdownEnv _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_ScalarExprDirectionPairList_Nil :: T_ScalarExprDirectionPairList+_sem_ScalarExprDirectionPairList_Nil =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ScalarExprDirectionPairList+ _lhsOoriginalTree :: ScalarExprDirectionPairList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 16333 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 16339 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16345 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16351 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprList ----------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedTypes : [TypeExtra]+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprList + originalTree : ScalarExprList + upTypes : [Maybe TypeExtra]+ alternatives:+ alternative Cons:+ child hd : ScalarExpr + child tl : ScalarExprList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprList = [ScalarExpr]+-- cata+_sem_ScalarExprList :: ScalarExprList ->+ T_ScalarExprList+_sem_ScalarExprList list =+ (Prelude.foldr _sem_ScalarExprList_Cons _sem_ScalarExprList_Nil (Prelude.map _sem_ScalarExpr list))+-- semantic domain+type T_ScalarExprList = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ ([TypeExtra]) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprList,ScalarExprList,([Maybe TypeExtra]))+data Inh_ScalarExprList = Inh_ScalarExprList {_assignmentCastContext_Inh_ScalarExprList :: Bool,_cat_Inh_ScalarExprList :: Catalog,_downEnv_Inh_ScalarExprList :: Environment,_expectedCast_Inh_ScalarExprList :: Bool,_expectedTypes_Inh_ScalarExprList :: ([TypeExtra]),_flags_Inh_ScalarExprList :: TypeCheckFlags,_imCast_Inh_ScalarExprList :: (Maybe TypeExtra)}+data Syn_ScalarExprList = Syn_ScalarExprList {_annotatedTree_Syn_ScalarExprList :: ScalarExprList,_originalTree_Syn_ScalarExprList :: ScalarExprList,_upTypes_Syn_ScalarExprList :: ([Maybe TypeExtra])}+_wrap_ScalarExprList :: T_ScalarExprList ->+ Inh_ScalarExprList ->+ Syn_ScalarExprList+_wrap_ScalarExprList sem (Inh_ScalarExprList _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedTypes _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupTypes) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedTypes _lhsIflags _lhsIimCast+ in (Syn_ScalarExprList _lhsOannotatedTree _lhsOoriginalTree _lhsOupTypes))+_sem_ScalarExprList_Cons :: T_ScalarExpr ->+ T_ScalarExprList ->+ T_ScalarExprList+_sem_ScalarExprList_Cons hd_ tl_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedTypes+ _lhsIflags+ _lhsIimCast ->+ (let _hdOodbcFunction :: Bool+ _lhsOupTypes :: ([Maybe TypeExtra])+ _hdOexpectedType :: (Maybe TypeExtra)+ _tlOexpectedTypes :: ([TypeExtra])+ _hdOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExprList+ _lhsOoriginalTree :: ScalarExprList+ _hdOassignmentCastContext :: Bool+ _hdOcat :: Catalog+ _hdOdownEnv :: Environment+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOassignmentCastContext :: Bool+ _tlOcat :: Catalog+ _tlOdownEnv :: Environment+ _tlOexpectedCast :: Bool+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ScalarExpr+ _hdIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _hdIoriginalTree :: ScalarExpr+ _hdIupType :: (Maybe TypeExtra)+ _tlIannotatedTree :: ScalarExprList+ _tlIoriginalTree :: ScalarExprList+ _tlIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 156, column 12)+ _hdOodbcFunction =+ ({-# LINE 156 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 16444 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 197, column 9)+ _lhsOupTypes =+ ({-# LINE 197 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _hdIupType : _tlIupTypes+ {-# LINE 16450 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 198, column 9)+ (_hdOexpectedType,_tlOexpectedTypes) =+ ({-# LINE 198 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ case _lhsIexpectedTypes of+ (x:xs) -> (Just x,xs)+ [] -> (Nothing,[])+ {-# LINE 16458 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 202, column 9)+ _hdOexpectedCast =+ ({-# LINE 202 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 16464 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 16470 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 16476 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16482 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16488 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 16494 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16500 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 16506 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16512 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16518 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 16524 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16530 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 16536 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOexpectedCast =+ ({-# LINE 193 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 16542 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16548 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16554 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIcolExprs,_hdIoriginalTree,_hdIupType) =+ hd_ _hdOassignmentCastContext _hdOcat _hdOdownEnv _hdOexpectedCast _hdOexpectedType _hdOflags _hdOimCast _hdOodbcFunction+ ( _tlIannotatedTree,_tlIoriginalTree,_tlIupTypes) =+ tl_ _tlOassignmentCastContext _tlOcat _tlOdownEnv _tlOexpectedCast _tlOexpectedTypes _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupTypes)))+_sem_ScalarExprList_Nil :: T_ScalarExprList+_sem_ScalarExprList_Nil =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedTypes+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupTypes :: ([Maybe TypeExtra])+ _lhsOannotatedTree :: ScalarExprList+ _lhsOoriginalTree :: ScalarExprList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 203, column 11)+ _lhsOupTypes =+ ({-# LINE 203 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ []+ {-# LINE 16577 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 16583 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 16589 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16595 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16601 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupTypes)))+-- ScalarExprListList ------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe [TypeExtra]+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprListList + originalTree : ScalarExprListList + upType : Either [TypeError] [(Text,TypeExtra)]+ alternatives:+ alternative Cons:+ child hd : ScalarExprTransposedList + child tl : ScalarExprListList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprListList = [ScalarExprTransposedList]+-- cata+_sem_ScalarExprListList :: ScalarExprListList ->+ T_ScalarExprListList+_sem_ScalarExprListList list =+ (Prelude.foldr _sem_ScalarExprListList_Cons _sem_ScalarExprListList_Nil (Prelude.map _sem_ScalarExprTransposedList list))+-- semantic domain+type T_ScalarExprListList = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ (Maybe [TypeExtra]) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprListList,ScalarExprListList,(Either [TypeError] [(Text,TypeExtra)]))+data Inh_ScalarExprListList = Inh_ScalarExprListList {_assignmentCastContext_Inh_ScalarExprListList :: Bool,_cat_Inh_ScalarExprListList :: Catalog,_downEnv_Inh_ScalarExprListList :: Environment,_expectedCast_Inh_ScalarExprListList :: Bool,_expectedType_Inh_ScalarExprListList :: (Maybe [TypeExtra]),_flags_Inh_ScalarExprListList :: TypeCheckFlags,_imCast_Inh_ScalarExprListList :: (Maybe TypeExtra)}+data Syn_ScalarExprListList = Syn_ScalarExprListList {_annotatedTree_Syn_ScalarExprListList :: ScalarExprListList,_originalTree_Syn_ScalarExprListList :: ScalarExprListList,_upType_Syn_ScalarExprListList :: (Either [TypeError] [(Text,TypeExtra)])}+_wrap_ScalarExprListList :: T_ScalarExprListList ->+ Inh_ScalarExprListList ->+ Syn_ScalarExprListList+_wrap_ScalarExprListList sem (Inh_ScalarExprListList _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_ScalarExprListList _lhsOannotatedTree _lhsOoriginalTree _lhsOupType))+_sem_ScalarExprListList_Cons :: T_ScalarExprTransposedList ->+ T_ScalarExprListList ->+ T_ScalarExprListList+_sem_ScalarExprListList_Cons hd_ tl_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupType :: (Either [TypeError] [(Text,TypeExtra)])+ _hdOexpectedCast :: Bool+ _tlOexpectedCast :: Bool+ _lhsOannotatedTree :: ScalarExprListList+ _lhsOoriginalTree :: ScalarExprListList+ _hdOcat :: Catalog+ _hdOexpectedType :: (Maybe [TypeExtra])+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOassignmentCastContext :: Bool+ _tlOcat :: Catalog+ _tlOdownEnv :: Environment+ _tlOexpectedType :: (Maybe [TypeExtra])+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ScalarExprTransposedList+ _hdIoriginalTree :: ScalarExprTransposedList+ _hdIupType :: (Maybe [TypeExtra])+ _tlIannotatedTree :: ScalarExprListList+ _tlIoriginalTree :: ScalarExprListList+ _tlIupType :: (Either [TypeError] [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 191, column 9)+ _lhsOupType =+ ({-# LINE 191 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ do+ a <- maybe (Left [InternalError "type error in VALUES clause"]) Right _hdIupType+ b <- _tlIupType+ unless (not $ null a) $ Left [InternalError "empty row in VALUES clause"]+ let a' = map ("",) a+ itError = Left [IncompatibleUnionTypes (CompositeType a') (CompositeType b)]+ unless (null b || length a == length b) itError+ if null b+ then return $ zip [T.pack ("values%" ++ show k) | k <- [(0::Int)..]] a+ else+ do+ let uts = zipWithM (\te1 (_,te2) -> resolveResultSetTypeExtra _lhsIcat [te1,te2])+ a b+ case uts of+ Left{} -> itError+ Right uts' -> return $ zipWith (\(n,_) te -> (n,te)) b uts'+ {-# LINE 16705 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 209, column 9)+ _hdOexpectedCast =+ ({-# LINE 209 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 16711 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 210, column 9)+ _tlOexpectedCast =+ ({-# LINE 210 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 16717 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 16723 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 16729 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16735 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16741 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16747 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOexpectedType =+ ({-# LINE 169 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 16753 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16759 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16765 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 16771 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16777 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOdownEnv =+ ({-# LINE 183 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 16783 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOexpectedType =+ ({-# LINE 186 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedType+ {-# LINE 16789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16795 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree,_hdIupType) =+ hd_ _hdOcat _hdOexpectedCast _hdOexpectedType _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree,_tlIupType) =+ tl_ _tlOassignmentCastContext _tlOcat _tlOdownEnv _tlOexpectedCast _tlOexpectedType _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExprListList_Nil :: T_ScalarExprListList+_sem_ScalarExprListList_Nil =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupType :: (Either [TypeError] [(Text,TypeExtra)])+ _lhsOannotatedTree :: ScalarExprListList+ _lhsOoriginalTree :: ScalarExprListList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 211, column 11)+ _lhsOupType =+ ({-# LINE 211 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Right []+ {-# LINE 16824 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 16830 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 16836 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16842 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16848 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+-- ScalarExprListStatementListTriple ---------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprListStatementListTriple + originalTree : ScalarExprListStatementListTriple + alternatives:+ alternative Tuple:+ child x1 : ScalarExprList + child x2 : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprListStatementListTriple = ( ScalarExprList,StatementList)+-- cata+_sem_ScalarExprListStatementListTriple :: ScalarExprListStatementListTriple ->+ T_ScalarExprListStatementListTriple+_sem_ScalarExprListStatementListTriple ( x1,x2) =+ (_sem_ScalarExprListStatementListTriple_Tuple (_sem_ScalarExprList x1) (_sem_StatementList x2))+-- semantic domain+type T_ScalarExprListStatementListTriple = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprListStatementListTriple,ScalarExprListStatementListTriple)+data Inh_ScalarExprListStatementListTriple = Inh_ScalarExprListStatementListTriple {_cat_Inh_ScalarExprListStatementListTriple :: Catalog,_flags_Inh_ScalarExprListStatementListTriple :: TypeCheckFlags,_imCast_Inh_ScalarExprListStatementListTriple :: (Maybe TypeExtra)}+data Syn_ScalarExprListStatementListTriple = Syn_ScalarExprListStatementListTriple {_annotatedTree_Syn_ScalarExprListStatementListTriple :: ScalarExprListStatementListTriple,_originalTree_Syn_ScalarExprListStatementListTriple :: ScalarExprListStatementListTriple}+_wrap_ScalarExprListStatementListTriple :: T_ScalarExprListStatementListTriple ->+ Inh_ScalarExprListStatementListTriple ->+ Syn_ScalarExprListStatementListTriple+_wrap_ScalarExprListStatementListTriple sem (Inh_ScalarExprListStatementListTriple _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ScalarExprListStatementListTriple _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprListStatementListTriple_Tuple :: T_ScalarExprList ->+ T_StatementList ->+ T_ScalarExprListStatementListTriple+_sem_ScalarExprListStatementListTriple_Tuple x1_ x2_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _x1OdownEnv :: Environment+ _x1OexpectedCast :: Bool+ _x1OexpectedTypes :: ([TypeExtra])+ _x1OassignmentCastContext :: Bool+ _lhsOannotatedTree :: ScalarExprListStatementListTriple+ _lhsOoriginalTree :: ScalarExprListStatementListTriple+ _x1Ocat :: Catalog+ _x1Oflags :: TypeCheckFlags+ _x1OimCast :: (Maybe TypeExtra)+ _x2Ocat :: Catalog+ _x2Oflags :: TypeCheckFlags+ _x2OimCast :: (Maybe TypeExtra)+ _x1IannotatedTree :: ScalarExprList+ _x1IoriginalTree :: ScalarExprList+ _x1IupTypes :: ([Maybe TypeExtra])+ _x2IannotatedTree :: StatementList+ _x2IoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 94, column 47)+ _x1OdownEnv =+ ({-# LINE 94 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 16916 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 95, column 47)+ _x1OexpectedCast =+ ({-# LINE 95 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 16922 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 96, column 47)+ _x1OexpectedTypes =+ ({-# LINE 96 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ []+ {-# LINE 16928 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 819, column 47)+ _x1OassignmentCastContext =+ ({-# LINE 819 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 16934 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IannotatedTree,_x2IannotatedTree)+ {-# LINE 16940 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IoriginalTree,_x2IoriginalTree)+ {-# LINE 16946 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 16952 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 16958 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16964 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16970 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16976 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 16982 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 16988 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 16994 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _x1IannotatedTree,_x1IoriginalTree,_x1IupTypes) =+ x1_ _x1OassignmentCastContext _x1Ocat _x1OdownEnv _x1OexpectedCast _x1OexpectedTypes _x1Oflags _x1OimCast+ ( _x2IannotatedTree,_x2IoriginalTree) =+ x2_ _x2Ocat _x2Oflags _x2OimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprListStatementListTripleList -----------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprListStatementListTripleList + originalTree : ScalarExprListStatementListTripleList + alternatives:+ alternative Cons:+ child hd : ScalarExprListStatementListTriple + child tl : ScalarExprListStatementListTripleList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprListStatementListTripleList = [ScalarExprListStatementListTriple]+-- cata+_sem_ScalarExprListStatementListTripleList :: ScalarExprListStatementListTripleList ->+ T_ScalarExprListStatementListTripleList+_sem_ScalarExprListStatementListTripleList list =+ (Prelude.foldr _sem_ScalarExprListStatementListTripleList_Cons _sem_ScalarExprListStatementListTripleList_Nil (Prelude.map _sem_ScalarExprListStatementListTriple list))+-- semantic domain+type T_ScalarExprListStatementListTripleList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprListStatementListTripleList,ScalarExprListStatementListTripleList)+data Inh_ScalarExprListStatementListTripleList = Inh_ScalarExprListStatementListTripleList {_cat_Inh_ScalarExprListStatementListTripleList :: Catalog,_flags_Inh_ScalarExprListStatementListTripleList :: TypeCheckFlags,_imCast_Inh_ScalarExprListStatementListTripleList :: (Maybe TypeExtra)}+data Syn_ScalarExprListStatementListTripleList = Syn_ScalarExprListStatementListTripleList {_annotatedTree_Syn_ScalarExprListStatementListTripleList :: ScalarExprListStatementListTripleList,_originalTree_Syn_ScalarExprListStatementListTripleList :: ScalarExprListStatementListTripleList}+_wrap_ScalarExprListStatementListTripleList :: T_ScalarExprListStatementListTripleList ->+ Inh_ScalarExprListStatementListTripleList ->+ Syn_ScalarExprListStatementListTripleList+_wrap_ScalarExprListStatementListTripleList sem (Inh_ScalarExprListStatementListTripleList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ScalarExprListStatementListTripleList _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprListStatementListTripleList_Cons :: T_ScalarExprListStatementListTriple ->+ T_ScalarExprListStatementListTripleList ->+ T_ScalarExprListStatementListTripleList+_sem_ScalarExprListStatementListTripleList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ScalarExprListStatementListTripleList+ _lhsOoriginalTree :: ScalarExprListStatementListTripleList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ScalarExprListStatementListTriple+ _hdIoriginalTree :: ScalarExprListStatementListTriple+ _tlIannotatedTree :: ScalarExprListStatementListTripleList+ _tlIoriginalTree :: ScalarExprListStatementListTripleList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 17065 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 17071 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17077 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17083 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17089 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17095 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17101 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17107 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17113 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17119 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_ScalarExprListStatementListTripleList_Nil :: T_ScalarExprListStatementListTripleList+_sem_ScalarExprListStatementListTripleList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ScalarExprListStatementListTripleList+ _lhsOoriginalTree :: ScalarExprListStatementListTripleList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 17137 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 17143 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17149 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17155 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprRoot ----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ downEnv : Environment+ flags : TypeCheckFlags+ synthesized attributes:+ annotatedTree : ScalarExprRoot + originalTree : ScalarExprRoot + alternatives:+ alternative ScalarExprRoot:+ child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data ScalarExprRoot = ScalarExprRoot (ScalarExpr)+ deriving ( Show)+-- cata+_sem_ScalarExprRoot :: ScalarExprRoot ->+ T_ScalarExprRoot+_sem_ScalarExprRoot (ScalarExprRoot _expr) =+ (_sem_ScalarExprRoot_ScalarExprRoot (_sem_ScalarExpr _expr))+-- semantic domain+type T_ScalarExprRoot = Catalog ->+ Environment ->+ TypeCheckFlags ->+ ( ScalarExprRoot,ScalarExprRoot)+data Inh_ScalarExprRoot = Inh_ScalarExprRoot {_cat_Inh_ScalarExprRoot :: Catalog,_downEnv_Inh_ScalarExprRoot :: Environment,_flags_Inh_ScalarExprRoot :: TypeCheckFlags}+data Syn_ScalarExprRoot = Syn_ScalarExprRoot {_annotatedTree_Syn_ScalarExprRoot :: ScalarExprRoot,_originalTree_Syn_ScalarExprRoot :: ScalarExprRoot}+_wrap_ScalarExprRoot :: T_ScalarExprRoot ->+ Inh_ScalarExprRoot ->+ Syn_ScalarExprRoot+_wrap_ScalarExprRoot sem (Inh_ScalarExprRoot _lhsIcat _lhsIdownEnv _lhsIflags) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIdownEnv _lhsIflags+ in (Syn_ScalarExprRoot _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprRoot_ScalarExprRoot :: T_ScalarExpr ->+ T_ScalarExprRoot+_sem_ScalarExprRoot_ScalarExprRoot expr_ =+ (\ _lhsIcat+ _lhsIdownEnv+ _lhsIflags ->+ (let _exprOexpectedCast :: Bool+ _exprOodbcFunction :: Bool+ _exprOdownEnv :: Environment+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOassignmentCastContext :: Bool+ _exprOimCast :: (Maybe TypeExtra)+ _lhsOannotatedTree :: ScalarExprRoot+ _lhsOoriginalTree :: ScalarExprRoot+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 97, column 37)+ _exprOexpectedCast =+ ({-# LINE 97 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 17219 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 159, column 22)+ _exprOodbcFunction =+ ({-# LINE 159 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 17225 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 237, column 9)+ _exprOdownEnv =+ ({-# LINE 237 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 17231 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 741, column 20)+ _exprOexpectedType =+ ({-# LINE 741 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ Nothing+ {-# LINE 17237 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 820, column 37)+ _exprOassignmentCastContext =+ ({-# LINE 820 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 17243 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag"(line 136, column 8)+ _exprOimCast =+ ({-# LINE 136 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Nothing+ {-# LINE 17249 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ScalarExprRoot _exprIannotatedTree+ {-# LINE 17255 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ScalarExprRoot _exprIoriginalTree+ {-# LINE 17261 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17267 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17273 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17279 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17285 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprStatementListPair ---------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprStatementListPair + originalTree : ScalarExprStatementListPair + alternatives:+ alternative Tuple:+ child x1 : ScalarExpr + child x2 : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprStatementListPair = ( ScalarExpr,StatementList)+-- cata+_sem_ScalarExprStatementListPair :: ScalarExprStatementListPair ->+ T_ScalarExprStatementListPair+_sem_ScalarExprStatementListPair ( x1,x2) =+ (_sem_ScalarExprStatementListPair_Tuple (_sem_ScalarExpr x1) (_sem_StatementList x2))+-- semantic domain+type T_ScalarExprStatementListPair = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprStatementListPair,ScalarExprStatementListPair)+data Inh_ScalarExprStatementListPair = Inh_ScalarExprStatementListPair {_cat_Inh_ScalarExprStatementListPair :: Catalog,_flags_Inh_ScalarExprStatementListPair :: TypeCheckFlags,_imCast_Inh_ScalarExprStatementListPair :: (Maybe TypeExtra)}+data Syn_ScalarExprStatementListPair = Syn_ScalarExprStatementListPair {_annotatedTree_Syn_ScalarExprStatementListPair :: ScalarExprStatementListPair,_originalTree_Syn_ScalarExprStatementListPair :: ScalarExprStatementListPair}+_wrap_ScalarExprStatementListPair :: T_ScalarExprStatementListPair ->+ Inh_ScalarExprStatementListPair ->+ Syn_ScalarExprStatementListPair+_wrap_ScalarExprStatementListPair sem (Inh_ScalarExprStatementListPair _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ScalarExprStatementListPair _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprStatementListPair_Tuple :: T_ScalarExpr ->+ T_StatementList ->+ T_ScalarExprStatementListPair+_sem_ScalarExprStatementListPair_Tuple x1_ x2_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _x1OdownEnv :: Environment+ _x1OexpectedCast :: Bool+ _x1OexpectedType :: (Maybe TypeExtra)+ _x1OodbcFunction :: Bool+ _x1OassignmentCastContext :: Bool+ _lhsOannotatedTree :: ScalarExprStatementListPair+ _lhsOoriginalTree :: ScalarExprStatementListPair+ _x1Ocat :: Catalog+ _x1Oflags :: TypeCheckFlags+ _x1OimCast :: (Maybe TypeExtra)+ _x2Ocat :: Catalog+ _x2Oflags :: TypeCheckFlags+ _x2OimCast :: (Maybe TypeExtra)+ _x1IannotatedTree :: ScalarExpr+ _x1IcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _x1IoriginalTree :: ScalarExpr+ _x1IupType :: (Maybe TypeExtra)+ _x2IannotatedTree :: StatementList+ _x2IoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 98, column 41)+ _x1OdownEnv =+ ({-# LINE 98 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 17357 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 99, column 41)+ _x1OexpectedCast =+ ({-# LINE 99 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 17363 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 100, column 41)+ _x1OexpectedType =+ ({-# LINE 100 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 17369 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 101, column 41)+ _x1OodbcFunction =+ ({-# LINE 101 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 17375 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 821, column 41)+ _x1OassignmentCastContext =+ ({-# LINE 821 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 17381 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IannotatedTree,_x2IannotatedTree)+ {-# LINE 17387 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (_x1IoriginalTree,_x2IoriginalTree)+ {-# LINE 17393 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17399 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17405 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17411 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _x2OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _x1IannotatedTree,_x1IcolExprs,_x1IoriginalTree,_x1IupType) =+ x1_ _x1OassignmentCastContext _x1Ocat _x1OdownEnv _x1OexpectedCast _x1OexpectedType _x1Oflags _x1OimCast _x1OodbcFunction+ ( _x2IannotatedTree,_x2IoriginalTree) =+ x2_ _x2Ocat _x2Oflags _x2OimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprStatementListPairList -----------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprStatementListPairList + originalTree : ScalarExprStatementListPairList + alternatives:+ alternative Cons:+ child hd : ScalarExprStatementListPair + child tl : ScalarExprStatementListPairList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprStatementListPairList = [ScalarExprStatementListPair]+-- cata+_sem_ScalarExprStatementListPairList :: ScalarExprStatementListPairList ->+ T_ScalarExprStatementListPairList+_sem_ScalarExprStatementListPairList list =+ (Prelude.foldr _sem_ScalarExprStatementListPairList_Cons _sem_ScalarExprStatementListPairList_Nil (Prelude.map _sem_ScalarExprStatementListPair list))+-- semantic domain+type T_ScalarExprStatementListPairList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprStatementListPairList,ScalarExprStatementListPairList)+data Inh_ScalarExprStatementListPairList = Inh_ScalarExprStatementListPairList {_cat_Inh_ScalarExprStatementListPairList :: Catalog,_flags_Inh_ScalarExprStatementListPairList :: TypeCheckFlags,_imCast_Inh_ScalarExprStatementListPairList :: (Maybe TypeExtra)}+data Syn_ScalarExprStatementListPairList = Syn_ScalarExprStatementListPairList {_annotatedTree_Syn_ScalarExprStatementListPairList :: ScalarExprStatementListPairList,_originalTree_Syn_ScalarExprStatementListPairList :: ScalarExprStatementListPairList}+_wrap_ScalarExprStatementListPairList :: T_ScalarExprStatementListPairList ->+ Inh_ScalarExprStatementListPairList ->+ Syn_ScalarExprStatementListPairList+_wrap_ScalarExprStatementListPairList sem (Inh_ScalarExprStatementListPairList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_ScalarExprStatementListPairList _lhsOannotatedTree _lhsOoriginalTree))+_sem_ScalarExprStatementListPairList_Cons :: T_ScalarExprStatementListPair ->+ T_ScalarExprStatementListPairList ->+ T_ScalarExprStatementListPairList+_sem_ScalarExprStatementListPairList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ScalarExprStatementListPairList+ _lhsOoriginalTree :: ScalarExprStatementListPairList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ScalarExprStatementListPair+ _hdIoriginalTree :: ScalarExprStatementListPair+ _tlIannotatedTree :: ScalarExprStatementListPairList+ _tlIoriginalTree :: ScalarExprStatementListPairList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 17512 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 17518 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17524 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17530 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17536 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17542 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17548 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17554 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17560 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17566 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_ScalarExprStatementListPairList_Nil :: T_ScalarExprStatementListPairList+_sem_ScalarExprStatementListPairList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: ScalarExprStatementListPairList+ _lhsOoriginalTree :: ScalarExprStatementListPairList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 17584 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 17590 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17596 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17602 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- ScalarExprTransposedList ------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ expectedCast : Bool+ expectedType : Maybe [TypeExtra]+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : ScalarExprTransposedList + originalTree : ScalarExprTransposedList + upType : Maybe [TypeExtra]+ alternatives:+ alternative Cons:+ child hd : ScalarExpr + child tl : ScalarExprTransposedList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type ScalarExprTransposedList = [ScalarExpr]+-- cata+_sem_ScalarExprTransposedList :: ScalarExprTransposedList ->+ T_ScalarExprTransposedList+_sem_ScalarExprTransposedList list =+ (Prelude.foldr _sem_ScalarExprTransposedList_Cons _sem_ScalarExprTransposedList_Nil (Prelude.map _sem_ScalarExpr list))+-- semantic domain+type T_ScalarExprTransposedList = Catalog ->+ Bool ->+ (Maybe [TypeExtra]) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( ScalarExprTransposedList,ScalarExprTransposedList,(Maybe [TypeExtra]))+data Inh_ScalarExprTransposedList = Inh_ScalarExprTransposedList {_cat_Inh_ScalarExprTransposedList :: Catalog,_expectedCast_Inh_ScalarExprTransposedList :: Bool,_expectedType_Inh_ScalarExprTransposedList :: (Maybe [TypeExtra]),_flags_Inh_ScalarExprTransposedList :: TypeCheckFlags,_imCast_Inh_ScalarExprTransposedList :: (Maybe TypeExtra)}+data Syn_ScalarExprTransposedList = Syn_ScalarExprTransposedList {_annotatedTree_Syn_ScalarExprTransposedList :: ScalarExprTransposedList,_originalTree_Syn_ScalarExprTransposedList :: ScalarExprTransposedList,_upType_Syn_ScalarExprTransposedList :: (Maybe [TypeExtra])}+_wrap_ScalarExprTransposedList :: T_ScalarExprTransposedList ->+ Inh_ScalarExprTransposedList ->+ Syn_ScalarExprTransposedList+_wrap_ScalarExprTransposedList sem (Inh_ScalarExprTransposedList _lhsIcat _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType) = sem _lhsIcat _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_ScalarExprTransposedList _lhsOannotatedTree _lhsOoriginalTree _lhsOupType))+_sem_ScalarExprTransposedList_Cons :: T_ScalarExpr ->+ T_ScalarExprTransposedList ->+ T_ScalarExprTransposedList+_sem_ScalarExprTransposedList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _hdOdownEnv :: Environment+ _lhsOupType :: (Maybe [TypeExtra])+ _hdOexpectedType :: (Maybe TypeExtra)+ _tlOexpectedType :: (Maybe [TypeExtra])+ _hdOexpectedCast :: Bool+ _tlOexpectedCast :: Bool+ _hdOodbcFunction :: Bool+ _hdOassignmentCastContext :: Bool+ _lhsOannotatedTree :: ScalarExprTransposedList+ _lhsOoriginalTree :: ScalarExprTransposedList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: ScalarExpr+ _hdIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _hdIoriginalTree :: ScalarExpr+ _hdIupType :: (Maybe TypeExtra)+ _tlIannotatedTree :: ScalarExprTransposedList+ _tlIoriginalTree :: ScalarExprTransposedList+ _tlIupType :: (Maybe [TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 102, column 37)+ _hdOdownEnv =+ ({-# LINE 102 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 17687 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 174, column 9)+ _lhsOupType =+ ({-# LINE 174 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM2 (:) _hdIupType _tlIupType+ {-# LINE 17693 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 175, column 9)+ _hdOexpectedType =+ ({-# LINE 175 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM fst $ splitTypeExtraList _lhsIexpectedType+ {-# LINE 17699 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 176, column 9)+ _tlOexpectedType =+ ({-# LINE 176 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM snd $ splitTypeExtraList _lhsIexpectedType+ {-# LINE 17705 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 177, column 9)+ _hdOexpectedCast =+ ({-# LINE 177 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 17711 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 178, column 9)+ _tlOexpectedCast =+ ({-# LINE 178 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIexpectedCast+ {-# LINE 17717 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 163, column 12)+ _hdOodbcFunction =+ ({-# LINE 163 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 17723 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 822, column 37)+ _hdOassignmentCastContext =+ ({-# LINE 822 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 17729 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 17735 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 17741 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17747 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17753 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17759 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17765 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17771 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17777 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17783 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 17789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIcolExprs,_hdIoriginalTree,_hdIupType) =+ hd_ _hdOassignmentCastContext _hdOcat _hdOdownEnv _hdOexpectedCast _hdOexpectedType _hdOflags _hdOimCast _hdOodbcFunction+ ( _tlIannotatedTree,_tlIoriginalTree,_tlIupType) =+ tl_ _tlOcat _tlOexpectedCast _tlOexpectedType _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+_sem_ScalarExprTransposedList_Nil :: T_ScalarExprTransposedList+_sem_ScalarExprTransposedList_Nil =+ (\ _lhsIcat+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupType :: (Maybe [TypeExtra])+ _lhsOannotatedTree :: ScalarExprTransposedList+ _lhsOoriginalTree :: ScalarExprTransposedList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 180, column 9)+ _lhsOupType =+ ({-# LINE 180 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Just []+ {-# LINE 17810 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 17816 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 17822 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 17828 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17834 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupType)))+-- SelectItem --------------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe TypeExtra+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : SelectItem + colExprs : [(NameComponent,Maybe TypeExtra,ScalarExpr)]+ originalTree : SelectItem + alternatives:+ alternative SelExp:+ child ann : Annotation + child ex : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative SelectItem:+ child ann : Annotation + child ex : ScalarExpr + child name : {NameComponent}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data SelectItem = SelExp (Annotation) (ScalarExpr)+ | SelectItem (Annotation) (ScalarExpr) (NameComponent)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_SelectItem :: SelectItem ->+ T_SelectItem+_sem_SelectItem (SelExp _ann _ex) =+ (_sem_SelectItem_SelExp (_sem_Annotation _ann) (_sem_ScalarExpr _ex))+_sem_SelectItem (SelectItem _ann _ex _name) =+ (_sem_SelectItem_SelectItem (_sem_Annotation _ann) (_sem_ScalarExpr _ex) _name)+-- semantic domain+type T_SelectItem = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ (Maybe TypeExtra) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( SelectItem,([(NameComponent,Maybe TypeExtra,ScalarExpr)]),SelectItem)+data Inh_SelectItem = Inh_SelectItem {_assignmentCastContext_Inh_SelectItem :: Bool,_cat_Inh_SelectItem :: Catalog,_downEnv_Inh_SelectItem :: Environment,_expectedCast_Inh_SelectItem :: Bool,_expectedType_Inh_SelectItem :: (Maybe TypeExtra),_flags_Inh_SelectItem :: TypeCheckFlags,_imCast_Inh_SelectItem :: (Maybe TypeExtra)}+data Syn_SelectItem = Syn_SelectItem {_annotatedTree_Syn_SelectItem :: SelectItem,_colExprs_Syn_SelectItem :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)]),_originalTree_Syn_SelectItem :: SelectItem}+_wrap_SelectItem :: T_SelectItem ->+ Inh_SelectItem ->+ Syn_SelectItem+_wrap_SelectItem sem (Inh_SelectItem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_SelectItem _lhsOannotatedTree _lhsOcolExprs _lhsOoriginalTree))+_sem_SelectItem_SelExp :: T_Annotation ->+ T_ScalarExpr ->+ T_SelectItem+_sem_SelectItem_SelExp ann_ ex_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: SelectItem+ _annOtpe :: (Either [TypeError] TypeExtra)+ _exOexpectedType :: (Maybe TypeExtra)+ _exOexpectedCast :: Bool+ _exOodbcFunction :: Bool+ _lhsOoriginalTree :: SelectItem+ _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exOassignmentCastContext :: Bool+ _exOcat :: Catalog+ _exOdownEnv :: Environment+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: ScalarExpr+ _exIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exIoriginalTree :: ScalarExpr+ _exIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 117, column 7)+ _lhsOannotatedTree =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ if tcfAddSelectItemAliases _lhsIflags+ then case _exIcolExprs of+ [(n,_,_)] -> SelectItem _annIannotatedTree _exIannotatedTree n+ _ ->+ _annotatedTree+ else _annotatedTree+ {-# LINE 17935 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 208, column 7)+ _annOtpe =+ ({-# LINE 208 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ Left []+ {-# LINE 17941 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 209, column 7)+ _exOexpectedType =+ ({-# LINE 209 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedType+ {-# LINE 17947 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 210, column 7)+ _exOexpectedCast =+ ({-# LINE 210 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedCast+ {-# LINE 17953 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 166, column 25)+ _exOodbcFunction =+ ({-# LINE 166 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 17959 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SelExp _annIannotatedTree _exIannotatedTree+ {-# LINE 17965 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SelExp _annIoriginalTree _exIoriginalTree+ {-# LINE 17971 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 17977 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOcolExprs =+ ({-# LINE 150 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _exIcolExprs+ {-# LINE 17983 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 17989 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 17995 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18001 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 18007 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18013 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 18019 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18025 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18031 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIcolExprs,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOdownEnv _exOexpectedCast _exOexpectedType _exOflags _exOimCast _exOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree)))+_sem_SelectItem_SelectItem :: T_Annotation ->+ T_ScalarExpr ->+ NameComponent ->+ T_SelectItem+_sem_SelectItem_SelectItem ann_ ex_ name_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _annOtpe :: (Either [TypeError] TypeExtra)+ _exOexpectedType :: (Maybe TypeExtra)+ _exOexpectedCast :: Bool+ _exOodbcFunction :: Bool+ _lhsOannotatedTree :: SelectItem+ _lhsOoriginalTree :: SelectItem+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exOassignmentCastContext :: Bool+ _exOcat :: Catalog+ _exOdownEnv :: Environment+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: ScalarExpr+ _exIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exIoriginalTree :: ScalarExpr+ _exIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 112, column 7)+ _lhsOcolExprs =+ ({-# LINE 112 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ case _exIcolExprs of+ [(_,t,e)] -> [(name_, t,e)]+ x -> x+ {-# LINE 18077 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 208, column 7)+ _annOtpe =+ ({-# LINE 208 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ Left []+ {-# LINE 18083 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 209, column 7)+ _exOexpectedType =+ ({-# LINE 209 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedType+ {-# LINE 18089 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 210, column 7)+ _exOexpectedCast =+ ({-# LINE 210 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedCast+ {-# LINE 18095 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 166, column 25)+ _exOodbcFunction =+ ({-# LINE 166 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 18101 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SelectItem _annIannotatedTree _exIannotatedTree name_+ {-# LINE 18107 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SelectItem _annIoriginalTree _exIoriginalTree name_+ {-# LINE 18113 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 18119 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 18125 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18131 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18137 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18143 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 18149 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18155 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIdownEnv+ {-# LINE 18161 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18167 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18173 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIcolExprs,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOdownEnv _exOexpectedCast _exOexpectedType _exOflags _exOimCast _exOodbcFunction+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree)))+-- SelectItemList ----------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe [TypeExtra]+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : SelectItemList + colExprs : [(NameComponent,Maybe TypeExtra,ScalarExpr)]+ originalTree : SelectItemList + upEnv : Environment+ upType : Maybe [(Text,TypeExtra)]+ alternatives:+ alternative Cons:+ child hd : SelectItem + child tl : SelectItemList + visit 0:+ local colExprs : _+ local upType : _+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local upType : _+ local annotatedTree : _+ local originalTree : _+-}+type SelectItemList = [SelectItem]+-- cata+_sem_SelectItemList :: SelectItemList ->+ T_SelectItemList+_sem_SelectItemList list =+ (Prelude.foldr _sem_SelectItemList_Cons _sem_SelectItemList_Nil (Prelude.map _sem_SelectItem list))+-- semantic domain+type T_SelectItemList = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ (Maybe [TypeExtra]) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( SelectItemList,([(NameComponent,Maybe TypeExtra,ScalarExpr)]),SelectItemList,Environment,(Maybe [(Text,TypeExtra)]))+data Inh_SelectItemList = Inh_SelectItemList {_assignmentCastContext_Inh_SelectItemList :: Bool,_cat_Inh_SelectItemList :: Catalog,_downEnv_Inh_SelectItemList :: Environment,_expectedCast_Inh_SelectItemList :: Bool,_expectedType_Inh_SelectItemList :: (Maybe [TypeExtra]),_flags_Inh_SelectItemList :: TypeCheckFlags,_imCast_Inh_SelectItemList :: (Maybe TypeExtra)}+data Syn_SelectItemList = Syn_SelectItemList {_annotatedTree_Syn_SelectItemList :: SelectItemList,_colExprs_Syn_SelectItemList :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)]),_originalTree_Syn_SelectItemList :: SelectItemList,_upEnv_Syn_SelectItemList :: Environment,_upType_Syn_SelectItemList :: (Maybe [(Text,TypeExtra)])}+_wrap_SelectItemList :: T_SelectItemList ->+ Inh_SelectItemList ->+ Syn_SelectItemList+_wrap_SelectItemList sem (Inh_SelectItemList _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupEnv,_lhsOupType) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_SelectItemList _lhsOannotatedTree _lhsOcolExprs _lhsOoriginalTree _lhsOupEnv _lhsOupType))+_sem_SelectItemList_Cons :: T_SelectItem ->+ T_SelectItemList ->+ T_SelectItemList+_sem_SelectItemList_Cons hd_ tl_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: SelectItemList+ _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _hdOexpectedType :: (Maybe TypeExtra)+ _tlOexpectedType :: (Maybe [TypeExtra])+ _hdOexpectedCast :: Bool+ _tlOexpectedCast :: Bool+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _lhsOupEnv :: Environment+ _lhsOoriginalTree :: SelectItemList+ _hdOassignmentCastContext :: Bool+ _hdOcat :: Catalog+ _hdOdownEnv :: Environment+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOassignmentCastContext :: Bool+ _tlOcat :: Catalog+ _tlOdownEnv :: Environment+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: SelectItem+ _hdIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _hdIoriginalTree :: SelectItem+ _tlIannotatedTree :: SelectItemList+ _tlIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _tlIoriginalTree :: SelectItemList+ _tlIupEnv :: Environment+ _tlIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 132, column 10)+ _lhsOannotatedTree =+ ({-# LINE 132 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ if tcfExpandStars _lhsIflags+ then flip map _colExprs $ \(n,_t,e) ->+ if ncStr n == ncStr (columnName e) && not (tcfAddSelectItemAliases _lhsIflags)+ then SelExp emptyAnnotation e+ else SelectItem emptyAnnotation e n+ else _annotatedTree+ {-# LINE 18282 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 177, column 9)+ _colExprs =+ ({-# LINE 177 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _hdIcolExprs ++ _tlIcolExprs+ {-# LINE 18288 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 178, column 9)+ _lhsOcolExprs =+ ({-# LINE 178 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _colExprs+ {-# LINE 18294 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 179, column 9)+ _upType =+ ({-# LINE 179 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ sequence $ flip map _colExprs+ $ \(n,t,_) -> fmap (ncStrT n,) t+ {-# LINE 18301 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 181, column 9)+ _hdOexpectedType =+ ({-# LINE 181 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ liftM fst $ splitTypeExtraList _lhsIexpectedType+ {-# LINE 18307 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 182, column 9)+ _tlOexpectedType =+ ({-# LINE 182 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ liftM snd $ splitTypeExtraList _lhsIexpectedType+ {-# LINE 18313 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 183, column 9)+ _hdOexpectedCast =+ ({-# LINE 183 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedCast+ {-# LINE 18319 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 184, column 9)+ _tlOexpectedCast =+ ({-# LINE 184 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedCast+ {-# LINE 18325 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 186, column 7)+ _lhsOupType =+ ({-# LINE 186 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _upType+ {-# LINE 18331 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 187, column 7)+ _lhsOupEnv =+ ({-# LINE 187 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ case fmap E.envSelectListEnvironment _upType of+ (Just (Right e)) -> e+ _ -> E.brokeEnvironment+ {-# LINE 18339 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 18345 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 18351 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 18357 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 18363 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18369 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOdownEnv =+ ({-# LINE 151 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIdownEnv+ {-# LINE 18375 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18381 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18387 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 18393 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18399 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOdownEnv =+ ({-# LINE 156 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIdownEnv+ {-# LINE 18405 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18411 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIcolExprs,_hdIoriginalTree) =+ hd_ _hdOassignmentCastContext _hdOcat _hdOdownEnv _hdOexpectedCast _hdOexpectedType _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIcolExprs,_tlIoriginalTree,_tlIupEnv,_tlIupType) =+ tl_ _tlOassignmentCastContext _tlOcat _tlOdownEnv _tlOexpectedCast _tlOexpectedType _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupEnv,_lhsOupType)))+_sem_SelectItemList_Nil :: T_SelectItemList+_sem_SelectItemList_Nil =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: SelectItemList+ _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _lhsOupEnv :: Environment+ _lhsOoriginalTree :: SelectItemList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 131, column 9)+ _lhsOannotatedTree =+ ({-# LINE 131 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ []+ {-# LINE 18442 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 174, column 9)+ _lhsOcolExprs =+ ({-# LINE 174 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ []+ {-# LINE 18448 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 175, column 9)+ _upType =+ ({-# LINE 175 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ Nothing+ {-# LINE 18454 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 186, column 7)+ _lhsOupType =+ ({-# LINE 186 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _upType+ {-# LINE 18460 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 187, column 7)+ _lhsOupEnv =+ ({-# LINE 187 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ case fmap E.envSelectListEnvironment _upType of+ (Just (Right e)) -> e+ _ -> E.brokeEnvironment+ {-# LINE 18468 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 18474 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 18480 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 18486 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupEnv,_lhsOupType)))+-- SelectList --------------------------------------------------+{-+ visit 0:+ inherited attributes:+ assignmentCastContext : Bool+ cat : Catalog+ downEnv : Environment+ expectedCast : Bool+ expectedType : Maybe [TypeExtra]+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : SelectList + colExprs : [(NameComponent,Maybe TypeExtra,ScalarExpr)]+ originalTree : SelectList + upEnv : Environment+ upType : Maybe [(Text,TypeExtra)]+ alternatives:+ alternative SelectList:+ child ann : Annotation + child items : SelectItemList + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data SelectList = SelectList (Annotation) (SelectItemList)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_SelectList :: SelectList ->+ T_SelectList+_sem_SelectList (SelectList _ann _items) =+ (_sem_SelectList_SelectList (_sem_Annotation _ann) (_sem_SelectItemList _items))+-- semantic domain+type T_SelectList = Bool ->+ Catalog ->+ Environment ->+ Bool ->+ (Maybe [TypeExtra]) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( SelectList,([(NameComponent,Maybe TypeExtra,ScalarExpr)]),SelectList,Environment,(Maybe [(Text,TypeExtra)]))+data Inh_SelectList = Inh_SelectList {_assignmentCastContext_Inh_SelectList :: Bool,_cat_Inh_SelectList :: Catalog,_downEnv_Inh_SelectList :: Environment,_expectedCast_Inh_SelectList :: Bool,_expectedType_Inh_SelectList :: (Maybe [TypeExtra]),_flags_Inh_SelectList :: TypeCheckFlags,_imCast_Inh_SelectList :: (Maybe TypeExtra)}+data Syn_SelectList = Syn_SelectList {_annotatedTree_Syn_SelectList :: SelectList,_colExprs_Syn_SelectList :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)]),_originalTree_Syn_SelectList :: SelectList,_upEnv_Syn_SelectList :: Environment,_upType_Syn_SelectList :: (Maybe [(Text,TypeExtra)])}+_wrap_SelectList :: T_SelectList ->+ Inh_SelectList ->+ Syn_SelectList+_wrap_SelectList sem (Inh_SelectList _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupEnv,_lhsOupType) = sem _lhsIassignmentCastContext _lhsIcat _lhsIdownEnv _lhsIexpectedCast _lhsIexpectedType _lhsIflags _lhsIimCast+ in (Syn_SelectList _lhsOannotatedTree _lhsOcolExprs _lhsOoriginalTree _lhsOupEnv _lhsOupType))+_sem_SelectList_SelectList :: T_Annotation ->+ T_SelectItemList ->+ T_SelectList+_sem_SelectList_SelectList ann_ items_ =+ (\ _lhsIassignmentCastContext+ _lhsIcat+ _lhsIdownEnv+ _lhsIexpectedCast+ _lhsIexpectedType+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _itemsOexpectedCast :: Bool+ _lhsOannotatedTree :: SelectList+ _lhsOoriginalTree :: SelectList+ _lhsOcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _lhsOupEnv :: Environment+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _itemsOassignmentCastContext :: Bool+ _itemsOcat :: Catalog+ _itemsOdownEnv :: Environment+ _itemsOexpectedType :: (Maybe [TypeExtra])+ _itemsOflags :: TypeCheckFlags+ _itemsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _itemsIannotatedTree :: SelectItemList+ _itemsIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _itemsIoriginalTree :: SelectItemList+ _itemsIupEnv :: Environment+ _itemsIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 204, column 7)+ _annOtpe =+ ({-# LINE 204 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ Left []+ {-# LINE 18576 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag"(line 205, column 7)+ _itemsOexpectedCast =+ ({-# LINE 205 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ True+ {-# LINE 18582 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SelectList _annIannotatedTree _itemsIannotatedTree+ {-# LINE 18588 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SelectList _annIoriginalTree _itemsIoriginalTree+ {-# LINE 18594 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 18600 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 18606 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOcolExprs =+ ({-# LINE 157 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _itemsIcolExprs+ {-# LINE 18612 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOupEnv =+ ({-# LINE 161 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _itemsIupEnv+ {-# LINE 18618 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOupType =+ ({-# LINE 158 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _itemsIupType+ {-# LINE 18624 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18630 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18636 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18642 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _itemsOassignmentCastContext =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ _lhsIassignmentCastContext+ {-# LINE 18648 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _itemsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18654 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _itemsOdownEnv =+ ({-# LINE 156 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIdownEnv+ {-# LINE 18660 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _itemsOexpectedType =+ ({-# LINE 159 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/SelectLists.ag" #-}+ _lhsIexpectedType+ {-# LINE 18666 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _itemsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18672 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _itemsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18678 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _itemsIannotatedTree,_itemsIcolExprs,_itemsIoriginalTree,_itemsIupEnv,_itemsIupType) =+ items_ _itemsOassignmentCastContext _itemsOcat _itemsOdownEnv _itemsOexpectedCast _itemsOexpectedType _itemsOflags _itemsOimCast+ in ( _lhsOannotatedTree,_lhsOcolExprs,_lhsOoriginalTree,_lhsOupEnv,_lhsOupType)))+-- SetClause ---------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : SetClause + originalTree : SetClause + alternatives:+ alternative SetClause:+ child ann : Annotation + child setTarget : {NameComponent}+ child ex : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative MultiSetClause:+ child ann : Annotation + child setTargets : {[NameComponent]}+ child ex : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data SetClause = SetClause (Annotation) (NameComponent) (ScalarExpr)+ | MultiSetClause (Annotation) (([NameComponent])) (ScalarExpr)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_SetClause :: SetClause ->+ T_SetClause+_sem_SetClause (SetClause _ann _setTarget _ex) =+ (_sem_SetClause_SetClause (_sem_Annotation _ann) _setTarget (_sem_ScalarExpr _ex))+_sem_SetClause (MultiSetClause _ann _setTargets _ex) =+ (_sem_SetClause_MultiSetClause (_sem_Annotation _ann) _setTargets (_sem_ScalarExpr _ex))+-- semantic domain+type T_SetClause = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( SetClause,SetClause)+data Inh_SetClause = Inh_SetClause {_cat_Inh_SetClause :: Catalog,_flags_Inh_SetClause :: TypeCheckFlags,_imCast_Inh_SetClause :: (Maybe TypeExtra)}+data Syn_SetClause = Syn_SetClause {_annotatedTree_Syn_SetClause :: SetClause,_originalTree_Syn_SetClause :: SetClause}+_wrap_SetClause :: T_SetClause ->+ Inh_SetClause ->+ Syn_SetClause+_wrap_SetClause sem (Inh_SetClause _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_SetClause _lhsOannotatedTree _lhsOoriginalTree))+_sem_SetClause_SetClause :: T_Annotation ->+ NameComponent ->+ T_ScalarExpr ->+ T_SetClause+_sem_SetClause_SetClause ann_ setTarget_ ex_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exOdownEnv :: Environment+ _exOexpectedCast :: Bool+ _exOexpectedType :: (Maybe TypeExtra)+ _exOodbcFunction :: Bool+ _exOassignmentCastContext :: Bool+ _lhsOannotatedTree :: SetClause+ _lhsOoriginalTree :: SetClause+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exOcat :: Catalog+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: ScalarExpr+ _exIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exIoriginalTree :: ScalarExpr+ _exIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 107, column 27)+ _annOtpe =+ ({-# LINE 107 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 18766 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 108, column 27)+ _exOdownEnv =+ ({-# LINE 108 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 18772 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 109, column 27)+ _exOexpectedCast =+ ({-# LINE 109 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 18778 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 110, column 27)+ _exOexpectedType =+ ({-# LINE 110 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 18784 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 169, column 32)+ _exOodbcFunction =+ ({-# LINE 169 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 18790 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 824, column 27)+ _exOassignmentCastContext =+ ({-# LINE 824 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 18796 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetClause _annIannotatedTree setTarget_ _exIannotatedTree+ {-# LINE 18802 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetClause _annIoriginalTree setTarget_ _exIoriginalTree+ {-# LINE 18808 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 18814 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 18820 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18826 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18832 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18838 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18844 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18850 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18856 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIcolExprs,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOdownEnv _exOexpectedCast _exOexpectedType _exOflags _exOimCast _exOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_SetClause_MultiSetClause :: T_Annotation ->+ ([NameComponent]) ->+ T_ScalarExpr ->+ T_SetClause+_sem_SetClause_MultiSetClause ann_ setTargets_ ex_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exOdownEnv :: Environment+ _exOexpectedCast :: Bool+ _exOexpectedType :: (Maybe TypeExtra)+ _exOodbcFunction :: Bool+ _exOassignmentCastContext :: Bool+ _lhsOannotatedTree :: SetClause+ _lhsOoriginalTree :: SetClause+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exOcat :: Catalog+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: ScalarExpr+ _exIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exIoriginalTree :: ScalarExpr+ _exIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 103, column 32)+ _annOtpe =+ ({-# LINE 103 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 18895 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 104, column 32)+ _exOdownEnv =+ ({-# LINE 104 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 18901 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 105, column 32)+ _exOexpectedCast =+ ({-# LINE 105 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 18907 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 106, column 32)+ _exOexpectedType =+ ({-# LINE 106 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 18913 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 169, column 32)+ _exOodbcFunction =+ ({-# LINE 169 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 18919 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 823, column 32)+ _exOassignmentCastContext =+ ({-# LINE 823 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 18925 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ MultiSetClause _annIannotatedTree setTargets_ _exIannotatedTree+ {-# LINE 18931 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ MultiSetClause _annIoriginalTree setTargets_ _exIoriginalTree+ {-# LINE 18937 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 18943 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 18949 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18955 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18961 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18967 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 18973 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 18979 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 18985 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIcolExprs,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOdownEnv _exOexpectedCast _exOexpectedType _exOflags _exOimCast _exOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- SetClauseList -----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : SetClauseList + originalTree : SetClauseList + alternatives:+ alternative Cons:+ child hd : SetClause + child tl : SetClauseList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type SetClauseList = [SetClause]+-- cata+_sem_SetClauseList :: SetClauseList ->+ T_SetClauseList+_sem_SetClauseList list =+ (Prelude.foldr _sem_SetClauseList_Cons _sem_SetClauseList_Nil (Prelude.map _sem_SetClause list))+-- semantic domain+type T_SetClauseList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( SetClauseList,SetClauseList)+data Inh_SetClauseList = Inh_SetClauseList {_cat_Inh_SetClauseList :: Catalog,_flags_Inh_SetClauseList :: TypeCheckFlags,_imCast_Inh_SetClauseList :: (Maybe TypeExtra)}+data Syn_SetClauseList = Syn_SetClauseList {_annotatedTree_Syn_SetClauseList :: SetClauseList,_originalTree_Syn_SetClauseList :: SetClauseList}+_wrap_SetClauseList :: T_SetClauseList ->+ Inh_SetClauseList ->+ Syn_SetClauseList+_wrap_SetClauseList sem (Inh_SetClauseList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_SetClauseList _lhsOannotatedTree _lhsOoriginalTree))+_sem_SetClauseList_Cons :: T_SetClause ->+ T_SetClauseList ->+ T_SetClauseList+_sem_SetClauseList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: SetClauseList+ _lhsOoriginalTree :: SetClauseList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: SetClause+ _hdIoriginalTree :: SetClause+ _tlIannotatedTree :: SetClauseList+ _tlIoriginalTree :: SetClauseList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 19056 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 19062 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 19068 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 19074 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 19080 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 19086 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 19092 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 19098 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 19104 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 19110 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_SetClauseList_Nil :: T_SetClauseList+_sem_SetClauseList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: SetClauseList+ _lhsOoriginalTree :: SetClauseList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 19128 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 19134 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 19140 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 19146 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- Statement ---------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : Statement + originalTree : Statement + alternatives:+ alternative QueryStatement:+ child ann : Annotation + child ex : QueryExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Insert:+ child ann : Annotation + child table : Name + child targetCols : {[NameComponent]}+ child insData : QueryExpr + child returning : MaybeSelectList + visit 0:+ local tpe : {Either [TypeError] [TypeExtra]}+ local tooManyCols : {Maybe [TypeError]}+ local annotatedTree : _+ local originalTree : _+ alternative Update:+ child ann : Annotation + child table : Name + child assigns : SetClauseList + child fromList : TableRefList + child whr : MaybeBoolExpr + child returning : MaybeSelectList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Delete:+ child ann : Annotation + child table : Name + child using : TableRefList + child whr : MaybeBoolExpr + child returning : MaybeSelectList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CopyFrom:+ child ann : Annotation + child table : Name + child targetCols : {[NameComponent]}+ child source : {CopyFromSource}+ child opts : {[CopyFromOption]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CopyData:+ child ann : Annotation + child insData : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CopyTo:+ child ann : Annotation + child cp : {CopyToSource}+ child fn : {String}+ child opts : {[CopyToOption]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Truncate:+ child ann : Annotation + child tables : {[Name]}+ child restartIdentity : {RestartIdentity}+ child cascade : {Cascade}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateTable:+ child ann : Annotation + child name : Name + child atts : AttributeDefList + child cons : ConstraintList + child partition : MaybeTablePartitionDef + child rep : {Replace}+ child options : {[TableOption]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterTable:+ child ann : Annotation + child name : Name + child operation : AlterTableOperation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterDatabase:+ child ann : Annotation + child name : Name + child operation : AlterDatabaseOperation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateSequence:+ child ann : Annotation + child name : Name + child incr : {Integer}+ child min : {Maybe Integer}+ child max : {Maybe Integer}+ child start : {Integer}+ child cache : {Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSequence:+ child ann : Annotation + child name : Name + child operation : AlterSequenceOperation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateTableAs:+ child ann : Annotation + child name : Name + child rep : {Replace}+ child expr : QueryExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateView:+ child ann : Annotation + child name : Name + child colNames : {MaybeNameComponentList}+ child expr : QueryExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterView:+ child ann : Annotation + child name : Name + child colNames : {MaybeNameComponentList}+ child expr : QueryExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateType:+ child ann : Annotation + child name : Name + child atts : TypeAttributeDefList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateUser:+ child ann : Annotation + child name : Name + child password : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateLogin:+ child ann : Annotation + child name : Name + child password : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterUser:+ child ann : Annotation + child name : Name + child password : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterLogin:+ child ann : Annotation + child name : Name + child password : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateSchema:+ child ann : Annotation + child name : Name + child owner : {Maybe Name}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AlterSchema:+ child ann : Annotation + child name : Name + child operation : AlterSchemaOperation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateFunction:+ child ann : Annotation + child name : Name + child params : ParamDefList + child rettype : TypeName + child rep : {Replace}+ child lang : {Language}+ child body : FnBody + child vol : {Volatility}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateDomain:+ child ann : Annotation + child name : Name + child typ : TypeName + child constraintName : {String}+ child check : MaybeBoolExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateLanguage:+ child ann : Annotation + child name : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateTrigger:+ child ann : Annotation + child name : {NameComponent}+ child wh : {TriggerWhen}+ child events : {[TriggerEvent]}+ child tbl : Name + child firing : {TriggerFire}+ child fnName : Name + child fnArgs : ScalarExprList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DropFunction:+ child ann : Annotation + child ifE : {IfExists}+ child sigs : NameTypeNameListPairList + child cascade : {Cascade}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DropSomething:+ child ann : Annotation + child dropType : {DropType}+ child ifE : {IfExists}+ child names : {[Name]}+ child cascade : {Cascade}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DropTrigger:+ child ann : Annotation + child ifE : {IfExists}+ child name : {NameComponent}+ child tbl : Name + child cascade : {Cascade}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateDatabase:+ child ann : Annotation + child nm : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Set:+ child ann : Annotation + child name : {String}+ child values : {[SetValue]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Notify:+ child ann : Annotation + child name : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Into:+ child ann : Annotation + child strict : {Bool}+ child into : {[Name]}+ child stmt : Statement + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Assignment:+ child ann : Annotation + child target : Name + child value : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Return:+ child ann : Annotation + child value : MaybeScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ReturnNext:+ child ann : Annotation + child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ReturnQuery:+ child ann : Annotation + child sel : QueryExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Raise:+ child ann : Annotation + child level : {RaiseType}+ child message : {String}+ child args : ScalarExprList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative NullStatement:+ child ann : Annotation + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Perform:+ child ann : Annotation + child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Execute:+ child ann : Annotation + child expr : ScalarExpr + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ForQueryStatement:+ child ann : Annotation + child lb : {Maybe String}+ child var : {NameComponent}+ child sel : QueryExpr + child sts : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ForIntegerStatement:+ child ann : Annotation + child lb : {Maybe String}+ child var : {NameComponent}+ child from : ScalarExpr + child to : ScalarExpr + child sts : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative LoopStatement:+ child ann : Annotation + child lb : {Maybe String}+ child sts : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative WhileStatement:+ child ann : Annotation + child lb : {Maybe String}+ child expr : ScalarExpr + child sts : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ContinueStatement:+ child ann : Annotation + child lb : {Maybe String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ExitStatement:+ child ann : Annotation + child lb : {Maybe String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CaseStatementSimple:+ child ann : Annotation + child val : ScalarExpr + child cases : ScalarExprListStatementListTripleList + child els : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CaseStatement:+ child ann : Annotation + child cases : ScalarExprListStatementListTripleList + child els : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative If:+ child ann : Annotation + child cases : ScalarExprStatementListPairList + child els : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Block:+ child ann : Annotation + child lb : {Maybe String}+ child vars : VarDefList + child sts : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative AntiStatement:+ child string : {String}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative DeclareStatement:+ child ann : Annotation + child ds : {[(String,TypeName,Maybe ScalarExpr)]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ExecStatement:+ child ann : Annotation + child spName : Name + child args : ScalarExprList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative CreateIndexTSQL:+ child ann : Annotation + child nm : {NameComponent}+ child obj : Name + child cols : {[NameComponent]}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data Statement = QueryStatement (Annotation) (QueryExpr)+ | Insert (Annotation) (Name) (([NameComponent])) (QueryExpr) (MaybeSelectList)+ | Update (Annotation) (Name) (SetClauseList) (TableRefList) (MaybeBoolExpr) (MaybeSelectList)+ | Delete (Annotation) (Name) (TableRefList) (MaybeBoolExpr) (MaybeSelectList)+ | CopyFrom (Annotation) (Name) (([NameComponent])) (CopyFromSource) (([CopyFromOption]))+ | CopyData (Annotation) (String)+ | CopyTo (Annotation) (CopyToSource) (String) (([CopyToOption]))+ | Truncate (Annotation) (([Name])) (RestartIdentity) (Cascade)+ | CreateTable (Annotation) (Name) (AttributeDefList) (ConstraintList) (MaybeTablePartitionDef) (Replace) (([TableOption]))+ | AlterTable (Annotation) (Name) (AlterTableOperation)+ | AlterDatabase (Annotation) (Name) (AlterDatabaseOperation)+ | CreateSequence (Annotation) (Name) (Integer) ((Maybe Integer)) ((Maybe Integer)) (Integer) (Integer)+ | AlterSequence (Annotation) (Name) (AlterSequenceOperation)+ | CreateTableAs (Annotation) (Name) (Replace) (QueryExpr)+ | CreateView (Annotation) (Name) (MaybeNameComponentList) (QueryExpr)+ | AlterView (Annotation) (Name) (MaybeNameComponentList) (QueryExpr)+ | CreateType (Annotation) (Name) (TypeAttributeDefList)+ | CreateUser (Annotation) (Name) (String)+ | CreateLogin (Annotation) (Name) (String)+ | AlterUser (Annotation) (Name) (String)+ | AlterLogin (Annotation) (Name) (String)+ | CreateSchema (Annotation) (Name) ((Maybe Name))+ | AlterSchema (Annotation) (Name) (AlterSchemaOperation)+ | CreateFunction (Annotation) (Name) (ParamDefList) (TypeName) (Replace) (Language) (FnBody) (Volatility)+ | CreateDomain (Annotation) (Name) (TypeName) (String) (MaybeBoolExpr)+ | CreateLanguage (Annotation) (String)+ | CreateTrigger (Annotation) (NameComponent) (TriggerWhen) (([TriggerEvent])) (Name) (TriggerFire) (Name) (ScalarExprList)+ | DropFunction (Annotation) (IfExists) (NameTypeNameListPairList) (Cascade)+ | DropSomething (Annotation) (DropType) (IfExists) (([Name])) (Cascade)+ | DropTrigger (Annotation) (IfExists) (NameComponent) (Name) (Cascade)+ | CreateDatabase (Annotation) (Name)+ | Set (Annotation) (String) (([SetValue]))+ | Notify (Annotation) (String)+ | Into (Annotation) (Bool) (([Name])) (Statement)+ | Assignment (Annotation) (Name) (ScalarExpr)+ | Return (Annotation) (MaybeScalarExpr)+ | ReturnNext (Annotation) (ScalarExpr)+ | ReturnQuery (Annotation) (QueryExpr)+ | Raise (Annotation) (RaiseType) (String) (ScalarExprList)+ | NullStatement (Annotation)+ | Perform (Annotation) (ScalarExpr)+ | Execute (Annotation) (ScalarExpr)+ | ForQueryStatement (Annotation) ((Maybe String)) (NameComponent) (QueryExpr) (StatementList)+ | ForIntegerStatement (Annotation) ((Maybe String)) (NameComponent) (ScalarExpr) (ScalarExpr) (StatementList)+ | LoopStatement (Annotation) ((Maybe String)) (StatementList)+ | WhileStatement (Annotation) ((Maybe String)) (ScalarExpr) (StatementList)+ | ContinueStatement (Annotation) ((Maybe String))+ | ExitStatement (Annotation) ((Maybe String))+ | CaseStatementSimple (Annotation) (ScalarExpr) (ScalarExprListStatementListTripleList) (StatementList)+ | CaseStatement (Annotation) (ScalarExprListStatementListTripleList) (StatementList)+ | If (Annotation) (ScalarExprStatementListPairList) (StatementList)+ | Block (Annotation) ((Maybe String)) (VarDefList) (StatementList)+ | AntiStatement (String)+ | DeclareStatement (Annotation) (([(String,TypeName,Maybe ScalarExpr)]))+ | ExecStatement (Annotation) (Name) (ScalarExprList)+ | CreateIndexTSQL (Annotation) (NameComponent) (Name) (([NameComponent]))+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_Statement :: Statement ->+ T_Statement+_sem_Statement (QueryStatement _ann _ex) =+ (_sem_Statement_QueryStatement (_sem_Annotation _ann) (_sem_QueryExpr _ex))+_sem_Statement (Insert _ann _table _targetCols _insData _returning) =+ (_sem_Statement_Insert (_sem_Annotation _ann) (_sem_Name _table) _targetCols (_sem_QueryExpr _insData) (_sem_MaybeSelectList _returning))+_sem_Statement (Update _ann _table _assigns _fromList _whr _returning) =+ (_sem_Statement_Update (_sem_Annotation _ann) (_sem_Name _table) (_sem_SetClauseList _assigns) (_sem_TableRefList _fromList) (_sem_MaybeBoolExpr _whr) (_sem_MaybeSelectList _returning))+_sem_Statement (Delete _ann _table _using _whr _returning) =+ (_sem_Statement_Delete (_sem_Annotation _ann) (_sem_Name _table) (_sem_TableRefList _using) (_sem_MaybeBoolExpr _whr) (_sem_MaybeSelectList _returning))+_sem_Statement (CopyFrom _ann _table _targetCols _source _opts) =+ (_sem_Statement_CopyFrom (_sem_Annotation _ann) (_sem_Name _table) _targetCols _source _opts)+_sem_Statement (CopyData _ann _insData) =+ (_sem_Statement_CopyData (_sem_Annotation _ann) _insData)+_sem_Statement (CopyTo _ann _cp _fn _opts) =+ (_sem_Statement_CopyTo (_sem_Annotation _ann) _cp _fn _opts)+_sem_Statement (Truncate _ann _tables _restartIdentity _cascade) =+ (_sem_Statement_Truncate (_sem_Annotation _ann) _tables _restartIdentity _cascade)+_sem_Statement (CreateTable _ann _name _atts _cons _partition _rep _options) =+ (_sem_Statement_CreateTable (_sem_Annotation _ann) (_sem_Name _name) (_sem_AttributeDefList _atts) (_sem_ConstraintList _cons) (_sem_MaybeTablePartitionDef _partition) _rep _options)+_sem_Statement (AlterTable _ann _name _operation) =+ (_sem_Statement_AlterTable (_sem_Annotation _ann) (_sem_Name _name) (_sem_AlterTableOperation _operation))+_sem_Statement (AlterDatabase _ann _name _operation) =+ (_sem_Statement_AlterDatabase (_sem_Annotation _ann) (_sem_Name _name) (_sem_AlterDatabaseOperation _operation))+_sem_Statement (CreateSequence _ann _name _incr _min _max _start _cache) =+ (_sem_Statement_CreateSequence (_sem_Annotation _ann) (_sem_Name _name) _incr _min _max _start _cache)+_sem_Statement (AlterSequence _ann _name _operation) =+ (_sem_Statement_AlterSequence (_sem_Annotation _ann) (_sem_Name _name) (_sem_AlterSequenceOperation _operation))+_sem_Statement (CreateTableAs _ann _name _rep _expr) =+ (_sem_Statement_CreateTableAs (_sem_Annotation _ann) (_sem_Name _name) _rep (_sem_QueryExpr _expr))+_sem_Statement (CreateView _ann _name _colNames _expr) =+ (_sem_Statement_CreateView (_sem_Annotation _ann) (_sem_Name _name) _colNames (_sem_QueryExpr _expr))+_sem_Statement (AlterView _ann _name _colNames _expr) =+ (_sem_Statement_AlterView (_sem_Annotation _ann) (_sem_Name _name) _colNames (_sem_QueryExpr _expr))+_sem_Statement (CreateType _ann _name _atts) =+ (_sem_Statement_CreateType (_sem_Annotation _ann) (_sem_Name _name) (_sem_TypeAttributeDefList _atts))+_sem_Statement (CreateUser _ann _name _password) =+ (_sem_Statement_CreateUser (_sem_Annotation _ann) (_sem_Name _name) _password)+_sem_Statement (CreateLogin _ann _name _password) =+ (_sem_Statement_CreateLogin (_sem_Annotation _ann) (_sem_Name _name) _password)+_sem_Statement (AlterUser _ann _name _password) =+ (_sem_Statement_AlterUser (_sem_Annotation _ann) (_sem_Name _name) _password)+_sem_Statement (AlterLogin _ann _name _password) =+ (_sem_Statement_AlterLogin (_sem_Annotation _ann) (_sem_Name _name) _password)+_sem_Statement (CreateSchema _ann _name _owner) =+ (_sem_Statement_CreateSchema (_sem_Annotation _ann) (_sem_Name _name) _owner)+_sem_Statement (AlterSchema _ann _name _operation) =+ (_sem_Statement_AlterSchema (_sem_Annotation _ann) (_sem_Name _name) (_sem_AlterSchemaOperation _operation))+_sem_Statement (CreateFunction _ann _name _params _rettype _rep _lang _body _vol) =+ (_sem_Statement_CreateFunction (_sem_Annotation _ann) (_sem_Name _name) (_sem_ParamDefList _params) (_sem_TypeName _rettype) _rep _lang (_sem_FnBody _body) _vol)+_sem_Statement (CreateDomain _ann _name _typ _constraintName _check) =+ (_sem_Statement_CreateDomain (_sem_Annotation _ann) (_sem_Name _name) (_sem_TypeName _typ) _constraintName (_sem_MaybeBoolExpr _check))+_sem_Statement (CreateLanguage _ann _name) =+ (_sem_Statement_CreateLanguage (_sem_Annotation _ann) _name)+_sem_Statement (CreateTrigger _ann _name _wh _events _tbl _firing _fnName _fnArgs) =+ (_sem_Statement_CreateTrigger (_sem_Annotation _ann) _name _wh _events (_sem_Name _tbl) _firing (_sem_Name _fnName) (_sem_ScalarExprList _fnArgs))+_sem_Statement (DropFunction _ann _ifE _sigs _cascade) =+ (_sem_Statement_DropFunction (_sem_Annotation _ann) _ifE (_sem_NameTypeNameListPairList _sigs) _cascade)+_sem_Statement (DropSomething _ann _dropType _ifE _names _cascade) =+ (_sem_Statement_DropSomething (_sem_Annotation _ann) _dropType _ifE _names _cascade)+_sem_Statement (DropTrigger _ann _ifE _name _tbl _cascade) =+ (_sem_Statement_DropTrigger (_sem_Annotation _ann) _ifE _name (_sem_Name _tbl) _cascade)+_sem_Statement (CreateDatabase _ann _nm) =+ (_sem_Statement_CreateDatabase (_sem_Annotation _ann) (_sem_Name _nm))+_sem_Statement (Set _ann _name _values) =+ (_sem_Statement_Set (_sem_Annotation _ann) _name _values)+_sem_Statement (Notify _ann _name) =+ (_sem_Statement_Notify (_sem_Annotation _ann) _name)+_sem_Statement (Into _ann _strict _into _stmt) =+ (_sem_Statement_Into (_sem_Annotation _ann) _strict _into (_sem_Statement _stmt))+_sem_Statement (Assignment _ann _target _value) =+ (_sem_Statement_Assignment (_sem_Annotation _ann) (_sem_Name _target) (_sem_ScalarExpr _value))+_sem_Statement (Return _ann _value) =+ (_sem_Statement_Return (_sem_Annotation _ann) (_sem_MaybeScalarExpr _value))+_sem_Statement (ReturnNext _ann _expr) =+ (_sem_Statement_ReturnNext (_sem_Annotation _ann) (_sem_ScalarExpr _expr))+_sem_Statement (ReturnQuery _ann _sel) =+ (_sem_Statement_ReturnQuery (_sem_Annotation _ann) (_sem_QueryExpr _sel))+_sem_Statement (Raise _ann _level _message _args) =+ (_sem_Statement_Raise (_sem_Annotation _ann) _level _message (_sem_ScalarExprList _args))+_sem_Statement (NullStatement _ann) =+ (_sem_Statement_NullStatement (_sem_Annotation _ann))+_sem_Statement (Perform _ann _expr) =+ (_sem_Statement_Perform (_sem_Annotation _ann) (_sem_ScalarExpr _expr))+_sem_Statement (Execute _ann _expr) =+ (_sem_Statement_Execute (_sem_Annotation _ann) (_sem_ScalarExpr _expr))+_sem_Statement (ForQueryStatement _ann _lb _var _sel _sts) =+ (_sem_Statement_ForQueryStatement (_sem_Annotation _ann) _lb _var (_sem_QueryExpr _sel) (_sem_StatementList _sts))+_sem_Statement (ForIntegerStatement _ann _lb _var _from _to _sts) =+ (_sem_Statement_ForIntegerStatement (_sem_Annotation _ann) _lb _var (_sem_ScalarExpr _from) (_sem_ScalarExpr _to) (_sem_StatementList _sts))+_sem_Statement (LoopStatement _ann _lb _sts) =+ (_sem_Statement_LoopStatement (_sem_Annotation _ann) _lb (_sem_StatementList _sts))+_sem_Statement (WhileStatement _ann _lb _expr _sts) =+ (_sem_Statement_WhileStatement (_sem_Annotation _ann) _lb (_sem_ScalarExpr _expr) (_sem_StatementList _sts))+_sem_Statement (ContinueStatement _ann _lb) =+ (_sem_Statement_ContinueStatement (_sem_Annotation _ann) _lb)+_sem_Statement (ExitStatement _ann _lb) =+ (_sem_Statement_ExitStatement (_sem_Annotation _ann) _lb)+_sem_Statement (CaseStatementSimple _ann _val _cases _els) =+ (_sem_Statement_CaseStatementSimple (_sem_Annotation _ann) (_sem_ScalarExpr _val) (_sem_ScalarExprListStatementListTripleList _cases) (_sem_StatementList _els))+_sem_Statement (CaseStatement _ann _cases _els) =+ (_sem_Statement_CaseStatement (_sem_Annotation _ann) (_sem_ScalarExprListStatementListTripleList _cases) (_sem_StatementList _els))+_sem_Statement (If _ann _cases _els) =+ (_sem_Statement_If (_sem_Annotation _ann) (_sem_ScalarExprStatementListPairList _cases) (_sem_StatementList _els))+_sem_Statement (Block _ann _lb _vars _sts) =+ (_sem_Statement_Block (_sem_Annotation _ann) _lb (_sem_VarDefList _vars) (_sem_StatementList _sts))+_sem_Statement (AntiStatement _string) =+ (_sem_Statement_AntiStatement _string)+_sem_Statement (DeclareStatement _ann _ds) =+ (_sem_Statement_DeclareStatement (_sem_Annotation _ann) _ds)+_sem_Statement (ExecStatement _ann _spName _args) =+ (_sem_Statement_ExecStatement (_sem_Annotation _ann) (_sem_Name _spName) (_sem_ScalarExprList _args))+_sem_Statement (CreateIndexTSQL _ann _nm _obj _cols) =+ (_sem_Statement_CreateIndexTSQL (_sem_Annotation _ann) _nm (_sem_Name _obj) _cols)+-- semantic domain+type T_Statement = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( Statement,Statement)+data Inh_Statement = Inh_Statement {_cat_Inh_Statement :: Catalog,_flags_Inh_Statement :: TypeCheckFlags,_imCast_Inh_Statement :: (Maybe TypeExtra)}+data Syn_Statement = Syn_Statement {_annotatedTree_Syn_Statement :: Statement,_originalTree_Syn_Statement :: Statement}+_wrap_Statement :: T_Statement ->+ Inh_Statement ->+ Syn_Statement+_wrap_Statement sem (Inh_Statement _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_Statement _lhsOannotatedTree _lhsOoriginalTree))+_sem_Statement_QueryStatement :: T_Annotation ->+ T_QueryExpr ->+ T_Statement+_sem_Statement_QueryStatement ann_ ex_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exOexpectedType :: (Maybe [TypeExtra])+ _exOouterDownEnv :: (Maybe Environment)+ _exOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exOcat :: Catalog+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: QueryExpr+ _exIoriginalTree :: QueryExpr+ _exIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 19801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 16, column 5)+ _exOexpectedType =+ ({-# LINE 16 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ liftM (map snd) _exIupType+ {-# LINE 19807 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 91, column 20)+ _exOouterDownEnv =+ ({-# LINE 91 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Nothing+ {-# LINE 19813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 838, column 32)+ _exOassignmentCastContext =+ ({-# LINE 838 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 19819 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ QueryStatement _annIannotatedTree _exIannotatedTree+ {-# LINE 19825 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ QueryStatement _annIoriginalTree _exIoriginalTree+ {-# LINE 19831 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 19837 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 19843 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 19849 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 19855 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 19861 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 19867 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 19873 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 19879 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOexpectedType _exOflags _exOimCast _exOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Insert :: T_Annotation ->+ T_Name ->+ ([NameComponent]) ->+ T_QueryExpr ->+ T_MaybeSelectList ->+ T_Statement+_sem_Statement_Insert ann_ table_ targetCols_ insData_ returning_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _tpe :: (Either [TypeError] [TypeExtra])+ _tableOtpe :: (Either [TypeError] TypeExtra)+ _insDataOexpectedType :: (Maybe [TypeExtra])+ _insDataOouterDownEnv :: (Maybe Environment)+ _tooManyCols :: (Maybe [TypeError])+ _insDataOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tableOcat :: Catalog+ _tableOflags :: TypeCheckFlags+ _tableOimCast :: (Maybe TypeExtra)+ _insDataOcat :: Catalog+ _insDataOflags :: TypeCheckFlags+ _insDataOimCast :: (Maybe TypeExtra)+ _returningOcat :: Catalog+ _returningOflags :: TypeCheckFlags+ _returningOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tableIannotatedTree :: Name+ _tableIoriginalTree :: Name+ _insDataIannotatedTree :: QueryExpr+ _insDataIoriginalTree :: QueryExpr+ _insDataIupType :: (Maybe [(Text,TypeExtra)])+ _returningIannotatedTree :: MaybeSelectList+ _returningIoriginalTree :: MaybeSelectList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 19, column 5)+ _annOtpe =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left []+ {-# LINE 19930 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 25, column 5)+ _tpe =+ ({-# LINE 25 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ do+ let tnm = nameComponents _tableIoriginalTree+ (_,pub,_) <- catLookupTableAndAttrs _lhsIcat tnm+ case targetCols_ of+ [] -> return $ map snd pub+ tcs -> do+ tcs' <- mapM xnmcString tcs+ let utcs' = nub tcs'+ when (length utcs' /= length tcs') $+ Left $ map DuplicateColumnName+ $ nub (tcs' \\ utcs')+ forM tcs' $ \x ->+ maybe (Left [UnrecognisedIdentifier x])+ Right $ lookup x pub+ {-# LINE 19949 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 44, column 5)+ _tableOtpe =+ ({-# LINE 44 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left (either id (const []) _tpe+ ++ maybe [] id _tooManyCols )+ {-# LINE 19956 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 47, column 5)+ _insDataOexpectedType =+ ({-# LINE 47 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 19962 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 49, column 5)+ _insDataOouterDownEnv =+ ({-# LINE 49 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Nothing+ {-# LINE 19968 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 54, column 5)+ _tooManyCols =+ ({-# LINE 54 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ do+ x <- _insDataIupType+ y <- either (const Nothing) Just _tpe+ if (length x > length y)+ then Just [TooManyColumnsInInsert]+ else Nothing+ {-# LINE 19979 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 836, column 24)+ _insDataOassignmentCastContext =+ ({-# LINE 836 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 19985 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Insert _annIannotatedTree _tableIannotatedTree targetCols_ _insDataIannotatedTree _returningIannotatedTree+ {-# LINE 19991 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Insert _annIoriginalTree _tableIoriginalTree targetCols_ _insDataIoriginalTree _returningIoriginalTree+ {-# LINE 19997 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20003 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20009 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20015 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20021 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20027 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20033 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20039 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20045 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _insDataOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20051 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _insDataOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20057 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _insDataOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20063 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20069 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20075 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20081 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tableIannotatedTree,_tableIoriginalTree) =+ table_ _tableOcat _tableOflags _tableOimCast _tableOtpe+ ( _insDataIannotatedTree,_insDataIoriginalTree,_insDataIupType) =+ insData_ _insDataOassignmentCastContext _insDataOcat _insDataOexpectedType _insDataOflags _insDataOimCast _insDataOouterDownEnv+ ( _returningIannotatedTree,_returningIoriginalTree) =+ returning_ _returningOcat _returningOflags _returningOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Update :: T_Annotation ->+ T_Name ->+ T_SetClauseList ->+ T_TableRefList ->+ T_MaybeBoolExpr ->+ T_MaybeSelectList ->+ T_Statement+_sem_Statement_Update ann_ table_ assigns_ fromList_ whr_ returning_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _tableOtpe :: (Either [TypeError] TypeExtra)+ _whrOdownEnv :: Environment+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tableOcat :: Catalog+ _tableOflags :: TypeCheckFlags+ _tableOimCast :: (Maybe TypeExtra)+ _assignsOcat :: Catalog+ _assignsOflags :: TypeCheckFlags+ _assignsOimCast :: (Maybe TypeExtra)+ _fromListOcat :: Catalog+ _fromListOflags :: TypeCheckFlags+ _fromListOimCast :: (Maybe TypeExtra)+ _whrOcat :: Catalog+ _whrOflags :: TypeCheckFlags+ _whrOimCast :: (Maybe TypeExtra)+ _returningOcat :: Catalog+ _returningOflags :: TypeCheckFlags+ _returningOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tableIannotatedTree :: Name+ _tableIoriginalTree :: Name+ _assignsIannotatedTree :: SetClauseList+ _assignsIoriginalTree :: SetClauseList+ _fromListIannotatedTree :: TableRefList+ _fromListIoriginalTree :: TableRefList+ _fromListIupEnv :: Environment+ _whrIannotatedTree :: MaybeBoolExpr+ _whrIoriginalTree :: MaybeBoolExpr+ _returningIannotatedTree :: MaybeSelectList+ _returningIoriginalTree :: MaybeSelectList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 220, column 24)+ _tableOtpe =+ ({-# LINE 220 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20143 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 221, column 24)+ _whrOdownEnv =+ ({-# LINE 221 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 20149 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 19, column 5)+ _annOtpe =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left []+ {-# LINE 20155 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Update _annIannotatedTree _tableIannotatedTree _assignsIannotatedTree _fromListIannotatedTree _whrIannotatedTree _returningIannotatedTree+ {-# LINE 20161 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Update _annIoriginalTree _tableIoriginalTree _assignsIoriginalTree _fromListIoriginalTree _whrIoriginalTree _returningIoriginalTree+ {-# LINE 20167 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20173 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20179 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20185 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20191 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20197 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20203 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20209 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20215 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _assignsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20221 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _assignsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20227 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _assignsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20233 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fromListOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20239 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fromListOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fromListOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _whrOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _whrOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _whrOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tableIannotatedTree,_tableIoriginalTree) =+ table_ _tableOcat _tableOflags _tableOimCast _tableOtpe+ ( _assignsIannotatedTree,_assignsIoriginalTree) =+ assigns_ _assignsOcat _assignsOflags _assignsOimCast+ ( _fromListIannotatedTree,_fromListIoriginalTree,_fromListIupEnv) =+ fromList_ _fromListOcat _fromListOflags _fromListOimCast+ ( _whrIannotatedTree,_whrIoriginalTree) =+ whr_ _whrOcat _whrOdownEnv _whrOflags _whrOimCast+ ( _returningIannotatedTree,_returningIoriginalTree) =+ returning_ _returningOcat _returningOflags _returningOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Delete :: T_Annotation ->+ T_Name ->+ T_TableRefList ->+ T_MaybeBoolExpr ->+ T_MaybeSelectList ->+ T_Statement+_sem_Statement_Delete ann_ table_ using_ whr_ returning_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _tableOtpe :: (Either [TypeError] TypeExtra)+ _whrOdownEnv :: Environment+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tableOcat :: Catalog+ _tableOflags :: TypeCheckFlags+ _tableOimCast :: (Maybe TypeExtra)+ _usingOcat :: Catalog+ _usingOflags :: TypeCheckFlags+ _usingOimCast :: (Maybe TypeExtra)+ _whrOcat :: Catalog+ _whrOflags :: TypeCheckFlags+ _whrOimCast :: (Maybe TypeExtra)+ _returningOcat :: Catalog+ _returningOflags :: TypeCheckFlags+ _returningOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tableIannotatedTree :: Name+ _tableIoriginalTree :: Name+ _usingIannotatedTree :: TableRefList+ _usingIoriginalTree :: TableRefList+ _usingIupEnv :: Environment+ _whrIannotatedTree :: MaybeBoolExpr+ _whrIoriginalTree :: MaybeBoolExpr+ _returningIannotatedTree :: MaybeSelectList+ _returningIoriginalTree :: MaybeSelectList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 171, column 24)+ _tableOtpe =+ ({-# LINE 171 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20347 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 172, column 24)+ _whrOdownEnv =+ ({-# LINE 172 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 20353 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 19, column 5)+ _annOtpe =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left []+ {-# LINE 20359 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Delete _annIannotatedTree _tableIannotatedTree _usingIannotatedTree _whrIannotatedTree _returningIannotatedTree+ {-# LINE 20365 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Delete _annIoriginalTree _tableIoriginalTree _usingIoriginalTree _whrIoriginalTree _returningIoriginalTree+ {-# LINE 20371 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20377 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20383 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20389 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20395 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20401 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20407 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20413 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20419 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _usingOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20425 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _usingOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20431 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _usingOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20437 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _whrOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20443 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _whrOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20449 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _whrOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20455 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20461 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20467 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _returningOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20473 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tableIannotatedTree,_tableIoriginalTree) =+ table_ _tableOcat _tableOflags _tableOimCast _tableOtpe+ ( _usingIannotatedTree,_usingIoriginalTree,_usingIupEnv) =+ using_ _usingOcat _usingOflags _usingOimCast+ ( _whrIannotatedTree,_whrIoriginalTree) =+ whr_ _whrOcat _whrOdownEnv _whrOflags _whrOimCast+ ( _returningIannotatedTree,_returningIoriginalTree) =+ returning_ _returningOcat _returningOflags _returningOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CopyFrom :: T_Annotation ->+ T_Name ->+ ([NameComponent]) ->+ CopyFromSource ->+ ([CopyFromOption]) ->+ T_Statement+_sem_Statement_CopyFrom ann_ table_ targetCols_ source_ opts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _tableOtpe :: (Either [TypeError] TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tableOcat :: Catalog+ _tableOflags :: TypeCheckFlags+ _tableOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tableIannotatedTree :: Name+ _tableIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 138, column 26)+ _tableOtpe =+ ({-# LINE 138 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20514 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 19, column 5)+ _annOtpe =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left []+ {-# LINE 20520 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CopyFrom _annIannotatedTree _tableIannotatedTree targetCols_ source_ opts_+ {-# LINE 20526 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CopyFrom _annIoriginalTree _tableIoriginalTree targetCols_ source_ opts_+ {-# LINE 20532 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20538 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20544 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20550 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20556 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20562 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20568 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20574 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tableOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20580 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tableIannotatedTree,_tableIoriginalTree) =+ table_ _tableOcat _tableOflags _tableOimCast _tableOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CopyData :: T_Annotation ->+ String ->+ T_Statement+_sem_Statement_CopyData ann_ insData_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 137, column 26)+ _annOtpe =+ ({-# LINE 137 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20606 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CopyData _annIannotatedTree insData_+ {-# LINE 20612 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CopyData _annIoriginalTree insData_+ {-# LINE 20618 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20624 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20630 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20636 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20642 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20648 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CopyTo :: T_Annotation ->+ CopyToSource ->+ String ->+ ([CopyToOption]) ->+ T_Statement+_sem_Statement_CopyTo ann_ cp_ fn_ opts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 19, column 5)+ _annOtpe =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left []+ {-# LINE 20674 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CopyTo _annIannotatedTree cp_ fn_ opts_+ {-# LINE 20680 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CopyTo _annIoriginalTree cp_ fn_ opts_+ {-# LINE 20686 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20692 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20698 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20704 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20710 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20716 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Truncate :: T_Annotation ->+ ([Name]) ->+ RestartIdentity ->+ Cascade ->+ T_Statement+_sem_Statement_Truncate ann_ tables_ restartIdentity_ cascade_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag"(line 19, column 5)+ _annOtpe =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Updates.ag" #-}+ Left []+ {-# LINE 20742 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Truncate _annIannotatedTree tables_ restartIdentity_ cascade_+ {-# LINE 20748 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Truncate _annIoriginalTree tables_ restartIdentity_ cascade_+ {-# LINE 20754 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20760 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20766 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20772 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20778 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20784 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateTable :: T_Annotation ->+ T_Name ->+ T_AttributeDefList ->+ T_ConstraintList ->+ T_MaybeTablePartitionDef ->+ Replace ->+ ([TableOption]) ->+ T_Statement+_sem_Statement_CreateTable ann_ name_ atts_ cons_ partition_ rep_ options_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _attsOcat :: Catalog+ _attsOflags :: TypeCheckFlags+ _attsOimCast :: (Maybe TypeExtra)+ _consOcat :: Catalog+ _consOflags :: TypeCheckFlags+ _consOimCast :: (Maybe TypeExtra)+ _partitionOcat :: Catalog+ _partitionOflags :: TypeCheckFlags+ _partitionOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _attsIannotatedTree :: AttributeDefList+ _attsIoriginalTree :: AttributeDefList+ _consIannotatedTree :: ConstraintList+ _consIoriginalTree :: ConstraintList+ _partitionIannotatedTree :: MaybeTablePartitionDef+ _partitionIoriginalTree :: MaybeTablePartitionDef+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 153, column 29)+ _annOtpe =+ ({-# LINE 153 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20834 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 154, column 29)+ _nameOtpe =+ ({-# LINE 154 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20840 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateTable _annIannotatedTree _nameIannotatedTree _attsIannotatedTree _consIannotatedTree _partitionIannotatedTree rep_ options_+ {-# LINE 20846 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateTable _annIoriginalTree _nameIoriginalTree _attsIoriginalTree _consIoriginalTree _partitionIoriginalTree rep_ options_+ {-# LINE 20852 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 20858 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 20864 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20870 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20876 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20882 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20888 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20894 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20900 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20906 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20912 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20918 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _consOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20924 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _consOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20930 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _consOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20936 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 20942 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 20948 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _partitionOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 20954 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _attsIannotatedTree,_attsIoriginalTree) =+ atts_ _attsOcat _attsOflags _attsOimCast+ ( _consIannotatedTree,_consIoriginalTree) =+ cons_ _consOcat _consOflags _consOimCast+ ( _partitionIannotatedTree,_partitionIoriginalTree) =+ partition_ _partitionOcat _partitionOflags _partitionOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterTable :: T_Annotation ->+ T_Name ->+ T_AlterTableOperation ->+ T_Statement+_sem_Statement_AlterTable ann_ name_ operation_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _operationOcat :: Catalog+ _operationOflags :: TypeCheckFlags+ _operationOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _operationIannotatedTree :: AlterTableOperation+ _operationIoriginalTree :: AlterTableOperation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 118, column 28)+ _annOtpe =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 20998 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 119, column 28)+ _nameOtpe =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21004 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterTable _annIannotatedTree _nameIannotatedTree _operationIannotatedTree+ {-# LINE 21010 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterTable _annIoriginalTree _nameIoriginalTree _operationIoriginalTree+ {-# LINE 21016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21040 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21046 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21052 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21058 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21064 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21070 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21076 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21082 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _operationIannotatedTree,_operationIoriginalTree) =+ operation_ _operationOcat _operationOflags _operationOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterDatabase :: T_Annotation ->+ T_Name ->+ T_AlterDatabaseOperation ->+ T_Statement+_sem_Statement_AlterDatabase ann_ name_ operation_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _operationOcat :: Catalog+ _operationOflags :: TypeCheckFlags+ _operationOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _operationIannotatedTree :: AlterDatabaseOperation+ _operationIoriginalTree :: AlterDatabaseOperation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 111, column 31)+ _annOtpe =+ ({-# LINE 111 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21122 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 112, column 31)+ _nameOtpe =+ ({-# LINE 112 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21128 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterDatabase _annIannotatedTree _nameIannotatedTree _operationIannotatedTree+ {-# LINE 21134 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterDatabase _annIoriginalTree _nameIoriginalTree _operationIoriginalTree+ {-# LINE 21140 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21146 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21152 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21158 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21164 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21170 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21176 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21182 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21188 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21194 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21200 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21206 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _operationIannotatedTree,_operationIoriginalTree) =+ operation_ _operationOcat _operationOflags _operationOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateSequence :: T_Annotation ->+ T_Name ->+ Integer ->+ (Maybe Integer) ->+ (Maybe Integer) ->+ Integer ->+ Integer ->+ T_Statement+_sem_Statement_CreateSequence ann_ name_ incr_ min_ max_ start_ cache_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 151, column 32)+ _annOtpe =+ ({-# LINE 151 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 152, column 32)+ _nameOtpe =+ ({-# LINE 152 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateSequence _annIannotatedTree _nameIannotatedTree incr_ min_ max_ start_ cache_+ {-# LINE 21257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateSequence _annIoriginalTree _nameIoriginalTree incr_ min_ max_ start_ cache_+ {-# LINE 21263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21293 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21299 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21305 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21311 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterSequence :: T_Annotation ->+ T_Name ->+ T_AlterSequenceOperation ->+ T_Statement+_sem_Statement_AlterSequence ann_ name_ operation_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _operationOcat :: Catalog+ _operationOflags :: TypeCheckFlags+ _operationOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _operationIannotatedTree :: AlterSequenceOperation+ _operationIoriginalTree :: AlterSequenceOperation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 116, column 31)+ _annOtpe =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21349 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 117, column 31)+ _nameOtpe =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21355 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequence _annIannotatedTree _nameIannotatedTree _operationIannotatedTree+ {-# LINE 21361 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSequence _annIoriginalTree _nameIoriginalTree _operationIoriginalTree+ {-# LINE 21367 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21373 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21379 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21385 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21391 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21397 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21403 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21409 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21415 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21421 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21427 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21433 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _operationIannotatedTree,_operationIoriginalTree) =+ operation_ _operationOcat _operationOflags _operationOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateTableAs :: T_Annotation ->+ T_Name ->+ Replace ->+ T_QueryExpr ->+ T_Statement+_sem_Statement_CreateTableAs ann_ name_ rep_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOouterDownEnv :: (Maybe Environment)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _exprOexpectedType :: (Maybe [TypeExtra])+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _exprIannotatedTree :: QueryExpr+ _exprIoriginalTree :: QueryExpr+ _exprIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 155, column 31)+ _annOtpe =+ ({-# LINE 155 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21478 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 156, column 31)+ _exprOouterDownEnv =+ ({-# LINE 156 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 21484 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 157, column 31)+ _nameOtpe =+ ({-# LINE 157 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21490 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 19, column 5)+ _exprOexpectedType =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ liftM (map snd) _exprIupType+ {-# LINE 21496 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 828, column 31)+ _exprOassignmentCastContext =+ ({-# LINE 828 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 21502 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateTableAs _annIannotatedTree _nameIannotatedTree rep_ _exprIannotatedTree+ {-# LINE 21508 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateTableAs _annIoriginalTree _nameIoriginalTree rep_ _exprIoriginalTree+ {-# LINE 21514 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21520 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21526 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21532 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21538 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21544 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21550 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21556 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21562 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21568 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21574 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21580 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _exprIannotatedTree,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOexpectedType _exprOflags _exprOimCast _exprOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateView :: T_Annotation ->+ T_Name ->+ MaybeNameComponentList ->+ T_QueryExpr ->+ T_Statement+_sem_Statement_CreateView ann_ name_ colNames_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOouterDownEnv :: (Maybe Environment)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _exprOexpectedType :: (Maybe [TypeExtra])+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _exprIannotatedTree :: QueryExpr+ _exprIoriginalTree :: QueryExpr+ _exprIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 168, column 28)+ _annOtpe =+ ({-# LINE 168 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21625 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 169, column 28)+ _exprOouterDownEnv =+ ({-# LINE 169 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 21631 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 170, column 28)+ _nameOtpe =+ ({-# LINE 170 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21637 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 19, column 5)+ _exprOexpectedType =+ ({-# LINE 19 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ liftM (map snd) _exprIupType+ {-# LINE 21643 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 830, column 28)+ _exprOassignmentCastContext =+ ({-# LINE 830 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 21649 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateView _annIannotatedTree _nameIannotatedTree colNames_ _exprIannotatedTree+ {-# LINE 21655 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateView _annIoriginalTree _nameIoriginalTree colNames_ _exprIoriginalTree+ {-# LINE 21661 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21667 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21673 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21679 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21685 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21691 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21697 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21703 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21709 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21715 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21721 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21727 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _exprIannotatedTree,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOexpectedType _exprOflags _exprOimCast _exprOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterView :: T_Annotation ->+ T_Name ->+ MaybeNameComponentList ->+ T_QueryExpr ->+ T_Statement+_sem_Statement_AlterView ann_ name_ colNames_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOexpectedType :: (Maybe [TypeExtra])+ _exprOouterDownEnv :: (Maybe Environment)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _exprIannotatedTree :: QueryExpr+ _exprIoriginalTree :: QueryExpr+ _exprIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 122, column 27)+ _annOtpe =+ ({-# LINE 122 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21772 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 123, column 27)+ _exprOexpectedType =+ ({-# LINE 123 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 21778 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 124, column 27)+ _exprOouterDownEnv =+ ({-# LINE 124 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 21784 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 125, column 27)+ _nameOtpe =+ ({-# LINE 125 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21790 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 825, column 27)+ _exprOassignmentCastContext =+ ({-# LINE 825 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 21796 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterView _annIannotatedTree _nameIannotatedTree colNames_ _exprIannotatedTree+ {-# LINE 21802 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterView _annIoriginalTree _nameIoriginalTree colNames_ _exprIoriginalTree+ {-# LINE 21808 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21814 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21820 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21826 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21832 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21838 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21844 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21850 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21856 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21862 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21868 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21874 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _exprIannotatedTree,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOexpectedType _exprOflags _exprOimCast _exprOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateType :: T_Annotation ->+ T_Name ->+ T_TypeAttributeDefList ->+ T_Statement+_sem_Statement_CreateType ann_ name_ atts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _attsOcat :: Catalog+ _attsOflags :: TypeCheckFlags+ _attsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _attsIannotatedTree :: TypeAttributeDefList+ _attsIoriginalTree :: TypeAttributeDefList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 164, column 28)+ _annOtpe =+ ({-# LINE 164 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21914 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 165, column 28)+ _nameOtpe =+ ({-# LINE 165 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 21920 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateType _annIannotatedTree _nameIannotatedTree _attsIannotatedTree+ {-# LINE 21926 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateType _annIoriginalTree _nameIoriginalTree _attsIoriginalTree+ {-# LINE 21932 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 21938 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 21944 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21950 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21956 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21962 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21968 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21974 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21980 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 21986 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 21992 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _attsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 21998 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _attsIannotatedTree,_attsIoriginalTree) =+ atts_ _attsOcat _attsOflags _attsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateUser :: T_Annotation ->+ T_Name ->+ String ->+ T_Statement+_sem_Statement_CreateUser ann_ name_ password_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 166, column 28)+ _annOtpe =+ ({-# LINE 166 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22033 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 167, column 28)+ _nameOtpe =+ ({-# LINE 167 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22039 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateUser _annIannotatedTree _nameIannotatedTree password_+ {-# LINE 22045 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateUser _annIoriginalTree _nameIoriginalTree password_+ {-# LINE 22051 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22057 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22063 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22069 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22075 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22081 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22087 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22093 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22099 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateLogin :: T_Annotation ->+ T_Name ->+ String ->+ T_Statement+_sem_Statement_CreateLogin ann_ name_ password_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 148, column 29)+ _annOtpe =+ ({-# LINE 148 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 149, column 29)+ _nameOtpe =+ ({-# LINE 149 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateLogin _annIannotatedTree _nameIannotatedTree password_+ {-# LINE 22144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateLogin _annIoriginalTree _nameIoriginalTree password_+ {-# LINE 22150 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22156 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22162 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22168 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22174 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22180 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22186 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22192 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22198 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterUser :: T_Annotation ->+ T_Name ->+ String ->+ T_Statement+_sem_Statement_AlterUser ann_ name_ password_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 120, column 27)+ _annOtpe =+ ({-# LINE 120 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22231 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 121, column 27)+ _nameOtpe =+ ({-# LINE 121 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22237 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterUser _annIannotatedTree _nameIannotatedTree password_+ {-# LINE 22243 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterUser _annIoriginalTree _nameIoriginalTree password_+ {-# LINE 22249 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22255 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22261 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22267 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22273 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22279 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22285 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22291 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22297 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterLogin :: T_Annotation ->+ T_Name ->+ String ->+ T_Statement+_sem_Statement_AlterLogin ann_ name_ password_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 113, column 28)+ _annOtpe =+ ({-# LINE 113 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22330 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 114, column 28)+ _nameOtpe =+ ({-# LINE 114 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22336 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterLogin _annIannotatedTree _nameIannotatedTree password_+ {-# LINE 22342 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterLogin _annIoriginalTree _nameIoriginalTree password_+ {-# LINE 22348 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22354 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22372 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22378 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22384 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22390 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22396 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateSchema :: T_Annotation ->+ T_Name ->+ (Maybe Name) ->+ T_Statement+_sem_Statement_CreateSchema ann_ name_ owner_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 150, column 30)+ _annOtpe =+ ({-# LINE 150 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateSchema _annIannotatedTree _nameIannotatedTree owner_+ {-# LINE 22435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateSchema _annIoriginalTree _nameIoriginalTree owner_+ {-# LINE 22441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22447 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22453 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22459 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22465 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22471 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22477 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22483 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22489 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (chain)+ _nameOtpe =+ ({-# LINE 46 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ error "missing rule: Statement.CreateSchema.name.tpe"+ {-# LINE 22495 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AlterSchema :: T_Annotation ->+ T_Name ->+ T_AlterSchemaOperation ->+ T_Statement+_sem_Statement_AlterSchema ann_ name_ operation_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _operationOcat :: Catalog+ _operationOflags :: TypeCheckFlags+ _operationOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _operationIannotatedTree :: AlterSchemaOperation+ _operationIoriginalTree :: AlterSchemaOperation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 115, column 29)+ _annOtpe =+ ({-# LINE 115 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22533 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSchema _annIannotatedTree _nameIannotatedTree _operationIannotatedTree+ {-# LINE 22539 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AlterSchema _annIoriginalTree _nameIoriginalTree _operationIoriginalTree+ {-# LINE 22545 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22551 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22557 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22563 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22569 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22575 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22581 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22587 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22593 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (chain)+ _nameOtpe =+ ({-# LINE 46 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ error "missing rule: Statement.AlterSchema.name.tpe"+ {-# LINE 22599 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22605 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22611 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _operationOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22617 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _operationIannotatedTree,_operationIoriginalTree) =+ operation_ _operationOcat _operationOflags _operationOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateFunction :: T_Annotation ->+ T_Name ->+ T_ParamDefList ->+ T_TypeName ->+ Replace ->+ Language ->+ T_FnBody ->+ Volatility ->+ T_Statement+_sem_Statement_CreateFunction ann_ name_ params_ rettype_ rep_ lang_ body_ vol_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _paramsOcat :: Catalog+ _paramsOflags :: TypeCheckFlags+ _paramsOimCast :: (Maybe TypeExtra)+ _rettypeOcat :: Catalog+ _rettypeOflags :: TypeCheckFlags+ _rettypeOimCast :: (Maybe TypeExtra)+ _bodyOcat :: Catalog+ _bodyOflags :: TypeCheckFlags+ _bodyOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _paramsIannotatedTree :: ParamDefList+ _paramsIoriginalTree :: ParamDefList+ _rettypeIannotatedTree :: TypeName+ _rettypeInamedType :: (Maybe TypeExtra)+ _rettypeIoriginalTree :: TypeName+ _bodyIannotatedTree :: FnBody+ _bodyIoriginalTree :: FnBody+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 144, column 32)+ _annOtpe =+ ({-# LINE 144 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22673 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 145, column 32)+ _nameOtpe =+ ({-# LINE 145 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22679 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateFunction _annIannotatedTree _nameIannotatedTree _paramsIannotatedTree _rettypeIannotatedTree rep_ lang_ _bodyIannotatedTree vol_+ {-# LINE 22685 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateFunction _annIoriginalTree _nameIoriginalTree _paramsIoriginalTree _rettypeIoriginalTree rep_ lang_ _bodyIoriginalTree vol_+ {-# LINE 22691 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22697 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22703 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22709 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22715 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22721 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22727 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22733 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22739 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _paramsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22745 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _paramsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22751 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _paramsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22757 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _rettypeOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22763 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _rettypeOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22769 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _rettypeOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22775 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _bodyOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22781 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _bodyOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22787 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _bodyOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22793 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _paramsIannotatedTree,_paramsIoriginalTree) =+ params_ _paramsOcat _paramsOflags _paramsOimCast+ ( _rettypeIannotatedTree,_rettypeInamedType,_rettypeIoriginalTree) =+ rettype_ _rettypeOcat _rettypeOflags _rettypeOimCast+ ( _bodyIannotatedTree,_bodyIoriginalTree) =+ body_ _bodyOcat _bodyOflags _bodyOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateDomain :: T_Annotation ->+ T_Name ->+ T_TypeName ->+ String ->+ T_MaybeBoolExpr ->+ T_Statement+_sem_Statement_CreateDomain ann_ name_ typ_ constraintName_ check_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _checkOdownEnv :: Environment+ _nameOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nameOcat :: Catalog+ _nameOflags :: TypeCheckFlags+ _nameOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _checkOcat :: Catalog+ _checkOflags :: TypeCheckFlags+ _checkOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nameIannotatedTree :: Name+ _nameIoriginalTree :: Name+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ _checkIannotatedTree :: MaybeBoolExpr+ _checkIoriginalTree :: MaybeBoolExpr+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 141, column 30)+ _annOtpe =+ ({-# LINE 141 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22846 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 142, column 30)+ _checkOdownEnv =+ ({-# LINE 142 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 22852 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 143, column 30)+ _nameOtpe =+ ({-# LINE 143 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22858 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateDomain _annIannotatedTree _nameIannotatedTree _typIannotatedTree constraintName_ _checkIannotatedTree+ {-# LINE 22864 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateDomain _annIoriginalTree _nameIoriginalTree _typIoriginalTree constraintName_ _checkIoriginalTree+ {-# LINE 22870 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 22876 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 22882 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22888 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22894 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22900 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22906 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22912 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22918 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22924 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22930 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22936 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _checkOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 22942 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _checkOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 22948 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _checkOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 22954 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nameIannotatedTree,_nameIoriginalTree) =+ name_ _nameOcat _nameOflags _nameOimCast _nameOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ ( _checkIannotatedTree,_checkIoriginalTree) =+ check_ _checkOcat _checkOdownEnv _checkOflags _checkOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateLanguage :: T_Annotation ->+ String ->+ T_Statement+_sem_Statement_CreateLanguage ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 147, column 32)+ _annOtpe =+ ({-# LINE 147 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 22984 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateLanguage _annIannotatedTree name_+ {-# LINE 22990 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateLanguage _annIoriginalTree name_+ {-# LINE 22996 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23002 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23008 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23014 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23020 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23026 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateTrigger :: T_Annotation ->+ NameComponent ->+ TriggerWhen ->+ ([TriggerEvent]) ->+ T_Name ->+ TriggerFire ->+ T_Name ->+ T_ScalarExprList ->+ T_Statement+_sem_Statement_CreateTrigger ann_ name_ wh_ events_ tbl_ firing_ fnName_ fnArgs_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _fnArgsOdownEnv :: Environment+ _fnArgsOexpectedCast :: Bool+ _fnArgsOexpectedTypes :: ([TypeExtra])+ _fnNameOtpe :: (Either [TypeError] TypeExtra)+ _tblOtpe :: (Either [TypeError] TypeExtra)+ _fnArgsOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tblOcat :: Catalog+ _tblOflags :: TypeCheckFlags+ _tblOimCast :: (Maybe TypeExtra)+ _fnNameOcat :: Catalog+ _fnNameOflags :: TypeCheckFlags+ _fnNameOimCast :: (Maybe TypeExtra)+ _fnArgsOcat :: Catalog+ _fnArgsOflags :: TypeCheckFlags+ _fnArgsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tblIannotatedTree :: Name+ _tblIoriginalTree :: Name+ _fnNameIannotatedTree :: Name+ _fnNameIoriginalTree :: Name+ _fnArgsIannotatedTree :: ScalarExprList+ _fnArgsIoriginalTree :: ScalarExprList+ _fnArgsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 158, column 31)+ _annOtpe =+ ({-# LINE 158 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23078 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 159, column 31)+ _fnArgsOdownEnv =+ ({-# LINE 159 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 23084 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 160, column 31)+ _fnArgsOexpectedCast =+ ({-# LINE 160 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 23090 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 161, column 31)+ _fnArgsOexpectedTypes =+ ({-# LINE 161 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ []+ {-# LINE 23096 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 162, column 31)+ _fnNameOtpe =+ ({-# LINE 162 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23102 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 163, column 31)+ _tblOtpe =+ ({-# LINE 163 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23108 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 829, column 31)+ _fnArgsOassignmentCastContext =+ ({-# LINE 829 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 23114 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateTrigger _annIannotatedTree name_ wh_ events_ _tblIannotatedTree firing_ _fnNameIannotatedTree _fnArgsIannotatedTree+ {-# LINE 23120 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateTrigger _annIoriginalTree name_ wh_ events_ _tblIoriginalTree firing_ _fnNameIoriginalTree _fnArgsIoriginalTree+ {-# LINE 23126 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23150 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23156 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23162 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23168 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23174 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23180 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23186 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23192 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnArgsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23198 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnArgsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23204 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnArgsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23210 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tblIannotatedTree,_tblIoriginalTree) =+ tbl_ _tblOcat _tblOflags _tblOimCast _tblOtpe+ ( _fnNameIannotatedTree,_fnNameIoriginalTree) =+ fnName_ _fnNameOcat _fnNameOflags _fnNameOimCast _fnNameOtpe+ ( _fnArgsIannotatedTree,_fnArgsIoriginalTree,_fnArgsIupTypes) =+ fnArgs_ _fnArgsOassignmentCastContext _fnArgsOcat _fnArgsOdownEnv _fnArgsOexpectedCast _fnArgsOexpectedTypes _fnArgsOflags _fnArgsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_DropFunction :: T_Annotation ->+ IfExists ->+ T_NameTypeNameListPairList ->+ Cascade ->+ T_Statement+_sem_Statement_DropFunction ann_ ifE_ sigs_ cascade_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _sigsOcat :: Catalog+ _sigsOflags :: TypeCheckFlags+ _sigsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _sigsIannotatedTree :: NameTypeNameListPairList+ _sigsIoriginalTree :: NameTypeNameListPairList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 173, column 30)+ _annOtpe =+ ({-# LINE 173 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23247 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropFunction _annIannotatedTree ifE_ _sigsIannotatedTree cascade_+ {-# LINE 23253 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropFunction _annIoriginalTree ifE_ _sigsIoriginalTree cascade_+ {-# LINE 23259 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23265 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23271 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23277 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23283 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23289 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _sigsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23295 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _sigsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23301 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _sigsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23307 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _sigsIannotatedTree,_sigsIoriginalTree) =+ sigs_ _sigsOcat _sigsOflags _sigsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_DropSomething :: T_Annotation ->+ DropType ->+ IfExists ->+ ([Name]) ->+ Cascade ->+ T_Statement+_sem_Statement_DropSomething ann_ dropType_ ifE_ names_ cascade_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 23336 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropSomething _annIannotatedTree dropType_ ifE_ names_ cascade_+ {-# LINE 23342 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropSomething _annIoriginalTree dropType_ ifE_ names_ cascade_+ {-# LINE 23348 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23354 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23372 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23378 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_DropTrigger :: T_Annotation ->+ IfExists ->+ NameComponent ->+ T_Name ->+ Cascade ->+ T_Statement+_sem_Statement_DropTrigger ann_ ifE_ name_ tbl_ cascade_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _tblOtpe :: (Either [TypeError] TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tblOcat :: Catalog+ _tblOflags :: TypeCheckFlags+ _tblOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tblIannotatedTree :: Name+ _tblIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 174, column 29)+ _tblOtpe =+ ({-# LINE 174 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23411 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 23417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropTrigger _annIannotatedTree ifE_ name_ _tblIannotatedTree cascade_+ {-# LINE 23423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DropTrigger _annIoriginalTree ifE_ name_ _tblIoriginalTree cascade_+ {-# LINE 23429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23447 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23453 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23459 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23465 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23471 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23477 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tblIannotatedTree,_tblIoriginalTree) =+ tbl_ _tblOcat _tblOflags _tblOimCast _tblOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateDatabase :: T_Annotation ->+ T_Name ->+ T_Statement+_sem_Statement_CreateDatabase ann_ nm_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _nmOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _nmOcat :: Catalog+ _nmOflags :: TypeCheckFlags+ _nmOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _nmIannotatedTree :: Name+ _nmIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 139, column 32)+ _annOtpe =+ ({-# LINE 139 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23509 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 140, column 32)+ _nmOtpe =+ ({-# LINE 140 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23515 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateDatabase _annIannotatedTree _nmIannotatedTree+ {-# LINE 23521 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateDatabase _annIoriginalTree _nmIoriginalTree+ {-# LINE 23527 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23533 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23539 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23545 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23551 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23557 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nmOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23563 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nmOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23569 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _nmOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23575 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _nmIannotatedTree,_nmIoriginalTree) =+ nm_ _nmOcat _nmOflags _nmOimCast _nmOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Set :: T_Annotation ->+ String ->+ ([SetValue]) ->+ T_Statement+_sem_Statement_Set ann_ name_ values_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 219, column 21)+ _annOtpe =+ ({-# LINE 219 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23602 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Set _annIannotatedTree name_ values_+ {-# LINE 23608 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Set _annIoriginalTree name_ values_+ {-# LINE 23614 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23620 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23626 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23632 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23638 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23644 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Notify :: T_Annotation ->+ String ->+ T_Statement+_sem_Statement_Notify ann_ name_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 197, column 24)+ _annOtpe =+ ({-# LINE 197 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23668 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Notify _annIannotatedTree name_+ {-# LINE 23674 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Notify _annIoriginalTree name_+ {-# LINE 23680 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23686 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23692 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23698 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23704 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23710 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Into :: T_Annotation ->+ Bool ->+ ([Name]) ->+ T_Statement ->+ T_Statement+_sem_Statement_Into ann_ strict_ into_ stmt_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _stmtOcat :: Catalog+ _stmtOflags :: TypeCheckFlags+ _stmtOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _stmtIannotatedTree :: Statement+ _stmtIoriginalTree :: Statement+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 23741 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Into _annIannotatedTree strict_ into_ _stmtIannotatedTree+ {-# LINE 23747 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Into _annIoriginalTree strict_ into_ _stmtIoriginalTree+ {-# LINE 23753 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23759 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23765 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23771 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23777 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23783 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stmtOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stmtOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23795 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stmtOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _stmtIannotatedTree,_stmtIoriginalTree) =+ stmt_ _stmtOcat _stmtOflags _stmtOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Assignment :: T_Annotation ->+ T_Name ->+ T_ScalarExpr ->+ T_Statement+_sem_Statement_Assignment ann_ target_ value_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _valueOexpectedCast :: Bool+ _valueOexpectedType :: (Maybe TypeExtra)+ _valueOodbcFunction :: Bool+ _annOtpe :: (Either [TypeError] TypeExtra)+ _targetOtpe :: (Either [TypeError] TypeExtra)+ _valueOdownEnv :: Environment+ _valueOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _targetOcat :: Catalog+ _targetOflags :: TypeCheckFlags+ _targetOimCast :: (Maybe TypeExtra)+ _valueOcat :: Catalog+ _valueOflags :: TypeCheckFlags+ _valueOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _targetIannotatedTree :: Name+ _targetIoriginalTree :: Name+ _valueIannotatedTree :: ScalarExpr+ _valueIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _valueIoriginalTree :: ScalarExpr+ _valueIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 126, column 28)+ _valueOexpectedCast =+ ({-# LINE 126 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 23846 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 127, column 28)+ _valueOexpectedType =+ ({-# LINE 127 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 23852 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 128, column 28)+ _valueOodbcFunction =+ ({-# LINE 128 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 23858 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 23864 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 26, column 5)+ _targetOtpe =+ ({-# LINE 26 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 23870 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 27, column 5)+ _valueOdownEnv =+ ({-# LINE 27 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ E.emptyEnvironment+ {-# LINE 23876 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 826, column 28)+ _valueOassignmentCastContext =+ ({-# LINE 826 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 23882 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Assignment _annIannotatedTree _targetIannotatedTree _valueIannotatedTree+ {-# LINE 23888 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Assignment _annIoriginalTree _targetIoriginalTree _valueIoriginalTree+ {-# LINE 23894 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 23900 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 23906 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23912 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23918 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23924 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _targetOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23930 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _targetOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23936 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _targetOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23942 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 23948 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 23954 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 23960 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _targetIannotatedTree,_targetIoriginalTree) =+ target_ _targetOcat _targetOflags _targetOimCast _targetOtpe+ ( _valueIannotatedTree,_valueIcolExprs,_valueIoriginalTree,_valueIupType) =+ value_ _valueOassignmentCastContext _valueOcat _valueOdownEnv _valueOexpectedCast _valueOexpectedType _valueOflags _valueOimCast _valueOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Return :: T_Annotation ->+ T_MaybeScalarExpr ->+ T_Statement+_sem_Statement_Return ann_ value_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _valueOdownEnv :: Environment+ _valueOexpectedCast :: Bool+ _valueOexpectedType :: (Maybe TypeExtra)+ _valueOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _valueOcat :: Catalog+ _valueOflags :: TypeCheckFlags+ _valueOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _valueIannotatedTree :: MaybeScalarExpr+ _valueIoriginalTree :: MaybeScalarExpr+ _valueIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 208, column 24)+ _annOtpe =+ ({-# LINE 208 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 23998 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 209, column 24)+ _valueOdownEnv =+ ({-# LINE 209 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24004 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 210, column 24)+ _valueOexpectedCast =+ ({-# LINE 210 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24010 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 211, column 24)+ _valueOexpectedType =+ ({-# LINE 211 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 840, column 24)+ _valueOassignmentCastContext =+ ({-# LINE 840 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Return _annIannotatedTree _valueIannotatedTree+ {-# LINE 24028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Return _annIoriginalTree _valueIoriginalTree+ {-# LINE 24034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24040 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24046 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24052 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24058 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24064 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24070 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24076 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valueOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24082 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _valueIannotatedTree,_valueIoriginalTree,_valueIupType) =+ value_ _valueOassignmentCastContext _valueOcat _valueOdownEnv _valueOexpectedCast _valueOexpectedType _valueOflags _valueOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ReturnNext :: T_Annotation ->+ T_ScalarExpr ->+ T_Statement+_sem_Statement_ReturnNext ann_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 212, column 28)+ _annOtpe =+ ({-# LINE 212 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24120 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 213, column 28)+ _exprOdownEnv =+ ({-# LINE 213 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24126 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 214, column 28)+ _exprOexpectedCast =+ ({-# LINE 214 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 215, column 28)+ _exprOexpectedType =+ ({-# LINE 215 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 216, column 28)+ _exprOodbcFunction =+ ({-# LINE 216 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24144 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 841, column 28)+ _exprOassignmentCastContext =+ ({-# LINE 841 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24150 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ReturnNext _annIannotatedTree _exprIannotatedTree+ {-# LINE 24156 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ReturnNext _annIoriginalTree _exprIoriginalTree+ {-# LINE 24162 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24168 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24174 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24180 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24186 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24192 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24198 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24204 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24210 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ReturnQuery :: T_Annotation ->+ T_QueryExpr ->+ T_Statement+_sem_Statement_ReturnQuery ann_ sel_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _selOouterDownEnv :: (Maybe Environment)+ _selOexpectedType :: (Maybe [TypeExtra])+ _selOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _selOcat :: Catalog+ _selOflags :: TypeCheckFlags+ _selOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selIannotatedTree :: QueryExpr+ _selIoriginalTree :: QueryExpr+ _selIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 217, column 29)+ _annOtpe =+ ({-# LINE 217 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 218, column 29)+ _selOouterDownEnv =+ ({-# LINE 218 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 22, column 5)+ _selOexpectedType =+ ({-# LINE 22 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ liftM (map snd) _selIupType+ {-# LINE 24257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 842, column 29)+ _selOassignmentCastContext =+ ({-# LINE 842 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ReturnQuery _annIannotatedTree _selIannotatedTree+ {-# LINE 24269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ReturnQuery _annIoriginalTree _selIoriginalTree+ {-# LINE 24275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24293 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24299 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24305 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24311 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24317 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24323 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selIannotatedTree,_selIoriginalTree,_selIupType) =+ sel_ _selOassignmentCastContext _selOcat _selOexpectedType _selOflags _selOimCast _selOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Raise :: T_Annotation ->+ RaiseType ->+ String ->+ T_ScalarExprList ->+ T_Statement+_sem_Statement_Raise ann_ level_ message_ args_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _argsOdownEnv :: Environment+ _argsOexpectedCast :: Bool+ _argsOexpectedTypes :: ([TypeExtra])+ _argsOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _argsOcat :: Catalog+ _argsOflags :: TypeCheckFlags+ _argsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _argsIannotatedTree :: ScalarExprList+ _argsIoriginalTree :: ScalarExprList+ _argsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 204, column 23)+ _annOtpe =+ ({-# LINE 204 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24361 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 205, column 23)+ _argsOdownEnv =+ ({-# LINE 205 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24367 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 206, column 23)+ _argsOexpectedCast =+ ({-# LINE 206 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24373 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 207, column 23)+ _argsOexpectedTypes =+ ({-# LINE 207 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ []+ {-# LINE 24379 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 839, column 23)+ _argsOassignmentCastContext =+ ({-# LINE 839 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24385 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Raise _annIannotatedTree level_ message_ _argsIannotatedTree+ {-# LINE 24391 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Raise _annIoriginalTree level_ message_ _argsIoriginalTree+ {-# LINE 24397 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24403 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24409 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24415 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24421 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24427 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24433 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24439 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24445 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _argsIannotatedTree,_argsIoriginalTree,_argsIupTypes) =+ args_ _argsOassignmentCastContext _argsOcat _argsOdownEnv _argsOexpectedCast _argsOexpectedTypes _argsOflags _argsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_NullStatement :: T_Annotation ->+ T_Statement+_sem_Statement_NullStatement ann_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 198, column 31)+ _annOtpe =+ ({-# LINE 198 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24470 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NullStatement _annIannotatedTree+ {-# LINE 24476 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ NullStatement _annIoriginalTree+ {-# LINE 24482 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24488 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24494 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24500 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24506 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24512 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Perform :: T_Annotation ->+ T_ScalarExpr ->+ T_Statement+_sem_Statement_Perform ann_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 199, column 25)+ _annOtpe =+ ({-# LINE 199 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24548 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 200, column 25)+ _exprOdownEnv =+ ({-# LINE 200 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24554 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 201, column 25)+ _exprOexpectedCast =+ ({-# LINE 201 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24560 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 202, column 25)+ _exprOexpectedType =+ ({-# LINE 202 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24566 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 203, column 25)+ _exprOodbcFunction =+ ({-# LINE 203 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24572 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 837, column 25)+ _exprOassignmentCastContext =+ ({-# LINE 837 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24578 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Perform _annIannotatedTree _exprIannotatedTree+ {-# LINE 24584 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Perform _annIoriginalTree _exprIoriginalTree+ {-# LINE 24590 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24596 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24602 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24608 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24614 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24620 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24626 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24632 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24638 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Execute :: T_Annotation ->+ T_ScalarExpr ->+ T_Statement+_sem_Statement_Execute ann_ expr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 179, column 25)+ _annOtpe =+ ({-# LINE 179 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24676 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 180, column 25)+ _exprOdownEnv =+ ({-# LINE 180 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24682 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 181, column 25)+ _exprOexpectedCast =+ ({-# LINE 181 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24688 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 182, column 25)+ _exprOexpectedType =+ ({-# LINE 182 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24694 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 183, column 25)+ _exprOodbcFunction =+ ({-# LINE 183 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24700 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 832, column 25)+ _exprOassignmentCastContext =+ ({-# LINE 832 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24706 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Execute _annIannotatedTree _exprIannotatedTree+ {-# LINE 24712 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Execute _annIoriginalTree _exprIoriginalTree+ {-# LINE 24718 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24724 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24730 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24736 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24742 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24748 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24754 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24760 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24766 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ForQueryStatement :: T_Annotation ->+ (Maybe String) ->+ NameComponent ->+ T_QueryExpr ->+ T_StatementList ->+ T_Statement+_sem_Statement_ForQueryStatement ann_ lb_ var_ sel_ sts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _selOouterDownEnv :: (Maybe Environment)+ _selOexpectedType :: (Maybe [TypeExtra])+ _selOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _selOcat :: Catalog+ _selOflags :: TypeCheckFlags+ _selOimCast :: (Maybe TypeExtra)+ _stsOcat :: Catalog+ _stsOflags :: TypeCheckFlags+ _stsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selIannotatedTree :: QueryExpr+ _selIoriginalTree :: QueryExpr+ _selIupType :: (Maybe [(Text,TypeExtra)])+ _stsIannotatedTree :: StatementList+ _stsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 194, column 35)+ _annOtpe =+ ({-# LINE 194 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24809 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 195, column 35)+ _selOouterDownEnv =+ ({-# LINE 195 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24815 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 22, column 5)+ _selOexpectedType =+ ({-# LINE 22 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ liftM (map snd) _selIupType+ {-# LINE 24821 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 835, column 35)+ _selOassignmentCastContext =+ ({-# LINE 835 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 24827 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ForQueryStatement _annIannotatedTree lb_ var_ _selIannotatedTree _stsIannotatedTree+ {-# LINE 24833 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ForQueryStatement _annIoriginalTree lb_ var_ _selIoriginalTree _stsIoriginalTree+ {-# LINE 24839 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 24845 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 24851 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24857 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24863 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24869 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24875 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24881 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24887 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 24893 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 24899 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 24905 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selIannotatedTree,_selIoriginalTree,_selIupType) =+ sel_ _selOassignmentCastContext _selOcat _selOexpectedType _selOflags _selOimCast _selOouterDownEnv+ ( _stsIannotatedTree,_stsIoriginalTree) =+ sts_ _stsOcat _stsOflags _stsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ForIntegerStatement :: T_Annotation ->+ (Maybe String) ->+ NameComponent ->+ T_ScalarExpr ->+ T_ScalarExpr ->+ T_StatementList ->+ T_Statement+_sem_Statement_ForIntegerStatement ann_ lb_ var_ from_ to_ sts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _fromOdownEnv :: Environment+ _fromOexpectedCast :: Bool+ _fromOexpectedType :: (Maybe TypeExtra)+ _fromOodbcFunction :: Bool+ _toOdownEnv :: Environment+ _toOexpectedCast :: Bool+ _toOexpectedType :: (Maybe TypeExtra)+ _toOodbcFunction :: Bool+ _fromOassignmentCastContext :: Bool+ _toOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _fromOcat :: Catalog+ _fromOflags :: TypeCheckFlags+ _fromOimCast :: (Maybe TypeExtra)+ _toOcat :: Catalog+ _toOflags :: TypeCheckFlags+ _toOimCast :: (Maybe TypeExtra)+ _stsOcat :: Catalog+ _stsOflags :: TypeCheckFlags+ _stsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _fromIannotatedTree :: ScalarExpr+ _fromIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _fromIoriginalTree :: ScalarExpr+ _fromIupType :: (Maybe TypeExtra)+ _toIannotatedTree :: ScalarExpr+ _toIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _toIoriginalTree :: ScalarExpr+ _toIupType :: (Maybe TypeExtra)+ _stsIannotatedTree :: StatementList+ _stsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 185, column 37)+ _annOtpe =+ ({-# LINE 185 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 24966 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 186, column 37)+ _fromOdownEnv =+ ({-# LINE 186 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24972 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 187, column 37)+ _fromOexpectedCast =+ ({-# LINE 187 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24978 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 188, column 37)+ _fromOexpectedType =+ ({-# LINE 188 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 24984 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 189, column 37)+ _fromOodbcFunction =+ ({-# LINE 189 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 24990 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 190, column 37)+ _toOdownEnv =+ ({-# LINE 190 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 24996 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 191, column 37)+ _toOexpectedCast =+ ({-# LINE 191 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 25002 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 192, column 37)+ _toOexpectedType =+ ({-# LINE 192 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 25008 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 193, column 37)+ _toOodbcFunction =+ ({-# LINE 193 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 25014 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 833, column 37)+ _fromOassignmentCastContext =+ ({-# LINE 833 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 25020 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 834, column 37)+ _toOassignmentCastContext =+ ({-# LINE 834 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 25026 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ForIntegerStatement _annIannotatedTree lb_ var_ _fromIannotatedTree _toIannotatedTree _stsIannotatedTree+ {-# LINE 25032 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ForIntegerStatement _annIoriginalTree lb_ var_ _fromIoriginalTree _toIoriginalTree _stsIoriginalTree+ {-# LINE 25038 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25044 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25050 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25056 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25062 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25068 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fromOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25074 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fromOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25080 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fromOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25086 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _toOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25092 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _toOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25098 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _toOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25104 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25110 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25116 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25122 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _fromIannotatedTree,_fromIcolExprs,_fromIoriginalTree,_fromIupType) =+ from_ _fromOassignmentCastContext _fromOcat _fromOdownEnv _fromOexpectedCast _fromOexpectedType _fromOflags _fromOimCast _fromOodbcFunction+ ( _toIannotatedTree,_toIcolExprs,_toIoriginalTree,_toIupType) =+ to_ _toOassignmentCastContext _toOcat _toOdownEnv _toOexpectedCast _toOexpectedType _toOflags _toOimCast _toOodbcFunction+ ( _stsIannotatedTree,_stsIoriginalTree) =+ sts_ _stsOcat _stsOflags _stsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_LoopStatement :: T_Annotation ->+ (Maybe String) ->+ T_StatementList ->+ T_Statement+_sem_Statement_LoopStatement ann_ lb_ sts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _stsOcat :: Catalog+ _stsOflags :: TypeCheckFlags+ _stsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _stsIannotatedTree :: StatementList+ _stsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 196, column 31)+ _annOtpe =+ ({-# LINE 196 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25158 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ LoopStatement _annIannotatedTree lb_ _stsIannotatedTree+ {-# LINE 25164 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ LoopStatement _annIoriginalTree lb_ _stsIoriginalTree+ {-# LINE 25170 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25176 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25182 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25188 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25194 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25200 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25206 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25212 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25218 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _stsIannotatedTree,_stsIoriginalTree) =+ sts_ _stsOcat _stsOflags _stsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_WhileStatement :: T_Annotation ->+ (Maybe String) ->+ T_ScalarExpr ->+ T_StatementList ->+ T_Statement+_sem_Statement_WhileStatement ann_ lb_ expr_ sts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _exprOdownEnv :: Environment+ _exprOexpectedCast :: Bool+ _exprOexpectedType :: (Maybe TypeExtra)+ _exprOodbcFunction :: Bool+ _exprOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exprOcat :: Catalog+ _exprOflags :: TypeCheckFlags+ _exprOimCast :: (Maybe TypeExtra)+ _stsOcat :: Catalog+ _stsOflags :: TypeCheckFlags+ _stsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exprIannotatedTree :: ScalarExpr+ _exprIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _exprIoriginalTree :: ScalarExpr+ _exprIupType :: (Maybe TypeExtra)+ _stsIannotatedTree :: StatementList+ _stsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 222, column 32)+ _annOtpe =+ ({-# LINE 222 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 223, column 32)+ _exprOdownEnv =+ ({-# LINE 223 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 25269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 224, column 32)+ _exprOexpectedCast =+ ({-# LINE 224 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 25275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 225, column 32)+ _exprOexpectedType =+ ({-# LINE 225 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 25281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 226, column 32)+ _exprOodbcFunction =+ ({-# LINE 226 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 25287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 843, column 32)+ _exprOassignmentCastContext =+ ({-# LINE 843 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 25293 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WhileStatement _annIannotatedTree lb_ _exprIannotatedTree _stsIannotatedTree+ {-# LINE 25299 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WhileStatement _annIoriginalTree lb_ _exprIoriginalTree _stsIoriginalTree+ {-# LINE 25305 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25311 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25317 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25323 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25329 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25335 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25341 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25347 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25353 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25359 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25365 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25371 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exprIannotatedTree,_exprIcolExprs,_exprIoriginalTree,_exprIupType) =+ expr_ _exprOassignmentCastContext _exprOcat _exprOdownEnv _exprOexpectedCast _exprOexpectedType _exprOflags _exprOimCast _exprOodbcFunction+ ( _stsIannotatedTree,_stsIoriginalTree) =+ sts_ _stsOcat _stsOflags _stsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ContinueStatement :: T_Annotation ->+ (Maybe String) ->+ T_Statement+_sem_Statement_ContinueStatement ann_ lb_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 136, column 35)+ _annOtpe =+ ({-# LINE 136 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25399 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ContinueStatement _annIannotatedTree lb_+ {-# LINE 25405 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ContinueStatement _annIoriginalTree lb_+ {-# LINE 25411 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25417 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25423 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25429 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25435 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25441 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ExitStatement :: T_Annotation ->+ (Maybe String) ->+ T_Statement+_sem_Statement_ExitStatement ann_ lb_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 184, column 31)+ _annOtpe =+ ({-# LINE 184 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25465 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ExitStatement _annIannotatedTree lb_+ {-# LINE 25471 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ExitStatement _annIoriginalTree lb_+ {-# LINE 25477 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25483 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25489 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25495 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25501 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25507 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CaseStatementSimple :: T_Annotation ->+ T_ScalarExpr ->+ T_ScalarExprListStatementListTripleList ->+ T_StatementList ->+ T_Statement+_sem_Statement_CaseStatementSimple ann_ val_ cases_ els_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _valOdownEnv :: Environment+ _valOexpectedCast :: Bool+ _valOexpectedType :: (Maybe TypeExtra)+ _valOodbcFunction :: Bool+ _valOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _valOcat :: Catalog+ _valOflags :: TypeCheckFlags+ _valOimCast :: (Maybe TypeExtra)+ _casesOcat :: Catalog+ _casesOflags :: TypeCheckFlags+ _casesOimCast :: (Maybe TypeExtra)+ _elsOcat :: Catalog+ _elsOflags :: TypeCheckFlags+ _elsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _valIannotatedTree :: ScalarExpr+ _valIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _valIoriginalTree :: ScalarExpr+ _valIupType :: (Maybe TypeExtra)+ _casesIannotatedTree :: ScalarExprListStatementListTripleList+ _casesIoriginalTree :: ScalarExprListStatementListTripleList+ _elsIannotatedTree :: StatementList+ _elsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 131, column 37)+ _annOtpe =+ ({-# LINE 131 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25555 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 132, column 37)+ _valOdownEnv =+ ({-# LINE 132 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 25561 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 133, column 37)+ _valOexpectedCast =+ ({-# LINE 133 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 25567 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 134, column 37)+ _valOexpectedType =+ ({-# LINE 134 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 25573 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 135, column 37)+ _valOodbcFunction =+ ({-# LINE 135 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 25579 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 827, column 37)+ _valOassignmentCastContext =+ ({-# LINE 827 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 25585 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CaseStatementSimple _annIannotatedTree _valIannotatedTree _casesIannotatedTree _elsIannotatedTree+ {-# LINE 25591 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CaseStatementSimple _annIoriginalTree _valIoriginalTree _casesIoriginalTree _elsIoriginalTree+ {-# LINE 25597 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25603 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25609 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25615 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25621 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25627 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25633 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _valOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25645 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25651 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25657 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25663 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25669 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25675 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25681 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _valIannotatedTree,_valIcolExprs,_valIoriginalTree,_valIupType) =+ val_ _valOassignmentCastContext _valOcat _valOdownEnv _valOexpectedCast _valOexpectedType _valOflags _valOimCast _valOodbcFunction+ ( _casesIannotatedTree,_casesIoriginalTree) =+ cases_ _casesOcat _casesOflags _casesOimCast+ ( _elsIannotatedTree,_elsIoriginalTree) =+ els_ _elsOcat _elsOflags _elsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CaseStatement :: T_Annotation ->+ T_ScalarExprListStatementListTripleList ->+ T_StatementList ->+ T_Statement+_sem_Statement_CaseStatement ann_ cases_ els_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _casesOcat :: Catalog+ _casesOflags :: TypeCheckFlags+ _casesOimCast :: (Maybe TypeExtra)+ _elsOcat :: Catalog+ _elsOflags :: TypeCheckFlags+ _elsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _casesIannotatedTree :: ScalarExprListStatementListTripleList+ _casesIoriginalTree :: ScalarExprListStatementListTripleList+ _elsIannotatedTree :: StatementList+ _elsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 130, column 31)+ _annOtpe =+ ({-# LINE 130 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25722 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CaseStatement _annIannotatedTree _casesIannotatedTree _elsIannotatedTree+ {-# LINE 25728 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CaseStatement _annIoriginalTree _casesIoriginalTree _elsIoriginalTree+ {-# LINE 25734 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25740 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25746 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25752 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25758 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25764 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25770 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25776 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25782 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25788 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25794 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25800 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _casesIannotatedTree,_casesIoriginalTree) =+ cases_ _casesOcat _casesOflags _casesOimCast+ ( _elsIannotatedTree,_elsIoriginalTree) =+ els_ _elsOcat _elsOflags _elsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_If :: T_Annotation ->+ T_ScalarExprStatementListPairList ->+ T_StatementList ->+ T_Statement+_sem_Statement_If ann_ cases_ els_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _casesOcat :: Catalog+ _casesOflags :: TypeCheckFlags+ _casesOimCast :: (Maybe TypeExtra)+ _elsOcat :: Catalog+ _elsOflags :: TypeCheckFlags+ _elsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _casesIannotatedTree :: ScalarExprStatementListPairList+ _casesIoriginalTree :: ScalarExprStatementListPairList+ _elsIannotatedTree :: StatementList+ _elsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 25839 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ If _annIannotatedTree _casesIannotatedTree _elsIannotatedTree+ {-# LINE 25845 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ If _annIoriginalTree _casesIoriginalTree _elsIoriginalTree+ {-# LINE 25851 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25857 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25863 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25869 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25875 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25881 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25887 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25893 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _casesOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25899 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25905 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25911 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _elsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25917 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _casesIannotatedTree,_casesIoriginalTree) =+ cases_ _casesOcat _casesOflags _casesOimCast+ ( _elsIannotatedTree,_elsIoriginalTree) =+ els_ _elsOcat _elsOflags _elsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_Block :: T_Annotation ->+ (Maybe String) ->+ T_VarDefList ->+ T_StatementList ->+ T_Statement+_sem_Statement_Block ann_ lb_ vars_ sts_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _varsOcat :: Catalog+ _varsOflags :: TypeCheckFlags+ _varsOimCast :: (Maybe TypeExtra)+ _stsOcat :: Catalog+ _stsOflags :: TypeCheckFlags+ _stsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _varsIannotatedTree :: VarDefList+ _varsIoriginalTree :: VarDefList+ _stsIannotatedTree :: StatementList+ _stsIoriginalTree :: StatementList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 129, column 23)+ _annOtpe =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 25957 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Block _annIannotatedTree lb_ _varsIannotatedTree _stsIannotatedTree+ {-# LINE 25963 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Block _annIoriginalTree lb_ _varsIoriginalTree _stsIoriginalTree+ {-# LINE 25969 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 25975 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 25981 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 25987 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 25993 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 25999 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _varsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26005 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _varsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26011 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _varsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26017 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26023 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26029 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _stsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26035 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _varsIannotatedTree,_varsIoriginalTree) =+ vars_ _varsOcat _varsOflags _varsOimCast+ ( _stsIannotatedTree,_stsIoriginalTree) =+ sts_ _stsOcat _stsOflags _stsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_AntiStatement :: String ->+ T_Statement+_sem_Statement_AntiStatement string_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AntiStatement string_+ {-# LINE 26056 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ AntiStatement string_+ {-# LINE 26062 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26068 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26074 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_DeclareStatement :: T_Annotation ->+ ([(String,TypeName,Maybe ScalarExpr)]) ->+ T_Statement+_sem_Statement_DeclareStatement ann_ ds_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 26096 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DeclareStatement _annIannotatedTree ds_+ {-# LINE 26102 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ DeclareStatement _annIoriginalTree ds_+ {-# LINE 26108 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26114 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26120 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26126 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26138 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_ExecStatement :: T_Annotation ->+ T_Name ->+ T_ScalarExprList ->+ T_Statement+_sem_Statement_ExecStatement ann_ spName_ args_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _argsOdownEnv :: Environment+ _argsOexpectedCast :: Bool+ _argsOexpectedTypes :: ([TypeExtra])+ _spNameOtpe :: (Either [TypeError] TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _argsOassignmentCastContext :: Bool+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _spNameOcat :: Catalog+ _spNameOflags :: TypeCheckFlags+ _spNameOimCast :: (Maybe TypeExtra)+ _argsOcat :: Catalog+ _argsOflags :: TypeCheckFlags+ _argsOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _spNameIannotatedTree :: Name+ _spNameIoriginalTree :: Name+ _argsIannotatedTree :: ScalarExprList+ _argsIoriginalTree :: ScalarExprList+ _argsIupTypes :: ([Maybe TypeExtra])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 175, column 31)+ _argsOdownEnv =+ ({-# LINE 175 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 26179 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 176, column 31)+ _argsOexpectedCast =+ ({-# LINE 176 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 26185 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 177, column 31)+ _argsOexpectedTypes =+ ({-# LINE 177 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ []+ {-# LINE 26191 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 178, column 31)+ _spNameOtpe =+ ({-# LINE 178 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 26197 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 26203 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 831, column 31)+ _argsOassignmentCastContext =+ ({-# LINE 831 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 26209 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ExecStatement _annIannotatedTree _spNameIannotatedTree _argsIannotatedTree+ {-# LINE 26215 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ExecStatement _annIoriginalTree _spNameIoriginalTree _argsIoriginalTree+ {-# LINE 26221 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26227 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26233 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26239 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26245 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26251 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _spNameOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26257 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _spNameOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26263 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _spNameOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26269 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26275 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26281 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _argsOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26287 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _spNameIannotatedTree,_spNameIoriginalTree) =+ spName_ _spNameOcat _spNameOflags _spNameOimCast _spNameOtpe+ ( _argsIannotatedTree,_argsIoriginalTree,_argsIupTypes) =+ args_ _argsOassignmentCastContext _argsOcat _argsOdownEnv _argsOexpectedCast _argsOexpectedTypes _argsOflags _argsOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_Statement_CreateIndexTSQL :: T_Annotation ->+ NameComponent ->+ T_Name ->+ ([NameComponent]) ->+ T_Statement+_sem_Statement_CreateIndexTSQL ann_ nm_ obj_ cols_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _objOtpe :: (Either [TypeError] TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: Statement+ _lhsOoriginalTree :: Statement+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _objOcat :: Catalog+ _objOflags :: TypeCheckFlags+ _objOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _objIannotatedTree :: Name+ _objIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 146, column 33)+ _objOtpe =+ ({-# LINE 146 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 26323 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag"(line 13, column 5)+ _annOtpe =+ ({-# LINE 13 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Statements.ag" #-}+ Left []+ {-# LINE 26329 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateIndexTSQL _annIannotatedTree nm_ _objIannotatedTree cols_+ {-# LINE 26335 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ CreateIndexTSQL _annIoriginalTree nm_ _objIoriginalTree cols_+ {-# LINE 26341 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26347 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26353 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26359 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26365 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26371 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _objOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26377 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _objOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26383 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _objOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26389 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _objIannotatedTree,_objIoriginalTree) =+ obj_ _objOcat _objOflags _objOimCast _objOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- StatementList -----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : StatementList + originalTree : StatementList + alternatives:+ alternative Cons:+ child hd : Statement + child tl : StatementList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type StatementList = [Statement]+-- cata+_sem_StatementList :: StatementList ->+ T_StatementList+_sem_StatementList list =+ (Prelude.foldr _sem_StatementList_Cons _sem_StatementList_Nil (Prelude.map _sem_Statement list))+-- semantic domain+type T_StatementList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( StatementList,StatementList)+data Inh_StatementList = Inh_StatementList {_cat_Inh_StatementList :: Catalog,_flags_Inh_StatementList :: TypeCheckFlags,_imCast_Inh_StatementList :: (Maybe TypeExtra)}+data Syn_StatementList = Syn_StatementList {_annotatedTree_Syn_StatementList :: StatementList,_originalTree_Syn_StatementList :: StatementList}+_wrap_StatementList :: T_StatementList ->+ Inh_StatementList ->+ Syn_StatementList+_wrap_StatementList sem (Inh_StatementList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_StatementList _lhsOannotatedTree _lhsOoriginalTree))+_sem_StatementList_Cons :: T_Statement ->+ T_StatementList ->+ T_StatementList+_sem_StatementList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: StatementList+ _lhsOoriginalTree :: StatementList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: Statement+ _hdIoriginalTree :: Statement+ _tlIannotatedTree :: StatementList+ _tlIoriginalTree :: StatementList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 26460 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 26466 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26472 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26478 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26484 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26490 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26496 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26502 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26508 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26514 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_StatementList_Nil :: T_StatementList+_sem_StatementList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: StatementList+ _lhsOoriginalTree :: StatementList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 26532 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 26538 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26544 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26550 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- TablePartitionDef -------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TablePartitionDef + originalTree : TablePartitionDef + alternatives:+ alternative TablePartitionDef:+ child ann : Annotation + child colname : {NameComponent}+ child interval : {Integer}+ child timeframe : {TablePartitionDateTimeInterval}+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data TablePartitionDef = TablePartitionDef (Annotation) (NameComponent) (Integer) (TablePartitionDateTimeInterval)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_TablePartitionDef :: TablePartitionDef ->+ T_TablePartitionDef+_sem_TablePartitionDef (TablePartitionDef _ann _colname _interval _timeframe) =+ (_sem_TablePartitionDef_TablePartitionDef (_sem_Annotation _ann) _colname _interval _timeframe)+-- semantic domain+type T_TablePartitionDef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TablePartitionDef,TablePartitionDef)+data Inh_TablePartitionDef = Inh_TablePartitionDef {_cat_Inh_TablePartitionDef :: Catalog,_flags_Inh_TablePartitionDef :: TypeCheckFlags,_imCast_Inh_TablePartitionDef :: (Maybe TypeExtra)}+data Syn_TablePartitionDef = Syn_TablePartitionDef {_annotatedTree_Syn_TablePartitionDef :: TablePartitionDef,_originalTree_Syn_TablePartitionDef :: TablePartitionDef}+_wrap_TablePartitionDef :: T_TablePartitionDef ->+ Inh_TablePartitionDef ->+ Syn_TablePartitionDef+_wrap_TablePartitionDef sem (Inh_TablePartitionDef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TablePartitionDef _lhsOannotatedTree _lhsOoriginalTree))+_sem_TablePartitionDef_TablePartitionDef :: T_Annotation ->+ NameComponent ->+ Integer ->+ TablePartitionDateTimeInterval ->+ T_TablePartitionDef+_sem_TablePartitionDef_TablePartitionDef ann_ colname_ interval_ timeframe_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TablePartitionDef+ _lhsOoriginalTree :: TablePartitionDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 227, column 43)+ _annOtpe =+ ({-# LINE 227 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 26614 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TablePartitionDef _annIannotatedTree colname_ interval_ timeframe_+ {-# LINE 26620 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TablePartitionDef _annIoriginalTree colname_ interval_ timeframe_+ {-# LINE 26626 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 26632 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26638 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26644 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26650 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26656 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- TableRef ----------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TableRef + originalTree : TableRef + upEnv : Environment+ alternatives:+ alternative Tref:+ child ann : Annotation + child tbl : Name + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local newAlias : _+ local annotatedTree : _+ local originalTree : _+ alternative FunTref:+ child ann : Annotation + child fn : ScalarExpr + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local newAlias : _+ local annotatedTree : _+ local originalTree : _+ alternative SubTref:+ child ann : Annotation + child sel : QueryExpr + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local newAlias : _+ local annotatedTree : _+ local originalTree : _+ alternative JoinTref:+ child ann : Annotation + child tref0 : TableRef + child nat : {Natural}+ child joinType : {JoinType}+ child joinHint : {Maybe JoinHint}+ child tref1 : TableRef + child onExpr : OnExpr + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local newAlias : _+ local annotatedTree : _+ local originalTree : _+ alternative TableAlias:+ child ann : Annotation + child tb : {NameComponent}+ child tref : TableRef + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local annotatedTree : _+ local originalTree : _+ alternative FullAlias:+ child ann : Annotation + child tb : {NameComponent}+ child cols : {[NameComponent]}+ child tref : TableRef + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local annotatedTree : _+ local originalTree : _+ alternative TableRefParens:+ child ann : Annotation + child tref : TableRef + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local newAlias : _+ local annotatedTree : _+ local originalTree : _+ alternative OdbcTableRef:+ child ann : Annotation + child tref : TableRef + visit 0:+ local eEnv : {Either [TypeError] Environment}+ local newAlias : _+ local annotatedTree : _+ local originalTree : _+-}+data TableRef = Tref (Annotation) (Name)+ | FunTref (Annotation) (ScalarExpr)+ | SubTref (Annotation) (QueryExpr)+ | JoinTref (Annotation) (TableRef) (Natural) (JoinType) ((Maybe JoinHint)) (TableRef) (OnExpr)+ | TableAlias (Annotation) (NameComponent) (TableRef)+ | FullAlias (Annotation) (NameComponent) (([NameComponent])) (TableRef)+ | TableRefParens (Annotation) (TableRef)+ | OdbcTableRef (Annotation) (TableRef)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_TableRef :: TableRef ->+ T_TableRef+_sem_TableRef (Tref _ann _tbl) =+ (_sem_TableRef_Tref (_sem_Annotation _ann) (_sem_Name _tbl))+_sem_TableRef (FunTref _ann _fn) =+ (_sem_TableRef_FunTref (_sem_Annotation _ann) (_sem_ScalarExpr _fn))+_sem_TableRef (SubTref _ann _sel) =+ (_sem_TableRef_SubTref (_sem_Annotation _ann) (_sem_QueryExpr _sel))+_sem_TableRef (JoinTref _ann _tref0 _nat _joinType _joinHint _tref1 _onExpr) =+ (_sem_TableRef_JoinTref (_sem_Annotation _ann) (_sem_TableRef _tref0) _nat _joinType _joinHint (_sem_TableRef _tref1) (_sem_OnExpr _onExpr))+_sem_TableRef (TableAlias _ann _tb _tref) =+ (_sem_TableRef_TableAlias (_sem_Annotation _ann) _tb (_sem_TableRef _tref))+_sem_TableRef (FullAlias _ann _tb _cols _tref) =+ (_sem_TableRef_FullAlias (_sem_Annotation _ann) _tb _cols (_sem_TableRef _tref))+_sem_TableRef (TableRefParens _ann _tref) =+ (_sem_TableRef_TableRefParens (_sem_Annotation _ann) (_sem_TableRef _tref))+_sem_TableRef (OdbcTableRef _ann _tref) =+ (_sem_TableRef_OdbcTableRef (_sem_Annotation _ann) (_sem_TableRef _tref))+-- semantic domain+type T_TableRef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TableRef,TableRef,Environment)+data Inh_TableRef = Inh_TableRef {_cat_Inh_TableRef :: Catalog,_flags_Inh_TableRef :: TypeCheckFlags,_imCast_Inh_TableRef :: (Maybe TypeExtra)}+data Syn_TableRef = Syn_TableRef {_annotatedTree_Syn_TableRef :: TableRef,_originalTree_Syn_TableRef :: TableRef,_upEnv_Syn_TableRef :: Environment}+_wrap_TableRef :: T_TableRef ->+ Inh_TableRef ->+ Syn_TableRef+_wrap_TableRef sem (Inh_TableRef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TableRef _lhsOannotatedTree _lhsOoriginalTree _lhsOupEnv))+_sem_TableRef_Tref :: T_Annotation ->+ T_Name ->+ T_TableRef+_sem_TableRef_Tref ann_ tbl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _tblOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TableRef+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tblOcat :: Catalog+ _tblOflags :: TypeCheckFlags+ _tblOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tblIannotatedTree :: Name+ _tblIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 26813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 26819 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 42, column 7)+ _eEnv =+ ({-# LINE 42 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ E.envCreateTrefEnvironment _lhsIcat (nameComponents _tblIoriginalTree)+ {-# LINE 26825 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 43, column 7)+ _tblOtpe =+ ({-# LINE 43 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ Left []+ {-# LINE 26831 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 75, column 7)+ _lhsOannotatedTree =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ let mk (q,is) = FullAlias emptyAnnotation+ (Nmc q)+ (map Nmc is)+ $ wrapIfJoin _annotatedTree+ wrapIfJoin tr = case tr of+ JoinTref {} -> TableRefParens emptyAnnotation tr+ _ -> tr+ in maybe _annotatedTree mk _newAlias+ {-# LINE 26844 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 150, column 7)+ _newAlias =+ ({-# LINE 150 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if tcfAddFullTablerefAliases _lhsIflags+ then do+ ((_,n),cs,_) <- either (const Nothing) Just+ $ catLookupTableAndAttrs _lhsIcat+ (nameComponents _tblIoriginalTree)+ return (T.unpack n, (map (T.unpack . fst) cs))+ else Nothing+ {-# LINE 26856 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Tref _annIannotatedTree _tblIannotatedTree+ {-# LINE 26862 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Tref _annIoriginalTree _tblIoriginalTree+ {-# LINE 26868 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 26874 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26880 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26886 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26892 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 26898 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 26904 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tblOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 26910 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tblIannotatedTree,_tblIoriginalTree) =+ tbl_ _tblOcat _tblOflags _tblOimCast _tblOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_FunTref :: T_Annotation ->+ T_ScalarExpr ->+ T_TableRef+_sem_TableRef_FunTref ann_ fn_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _fnOdownEnv :: Environment+ _fnOexpectedCast :: Bool+ _fnOexpectedType :: (Maybe TypeExtra)+ _fnOodbcFunction :: Bool+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _lhsOannotatedTree :: TableRef+ _fnOassignmentCastContext :: Bool+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _fnOcat :: Catalog+ _fnOflags :: TypeCheckFlags+ _fnOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _fnIannotatedTree :: ScalarExpr+ _fnIcolExprs :: ([(NameComponent,Maybe TypeExtra,ScalarExpr)])+ _fnIoriginalTree :: ScalarExpr+ _fnIupType :: (Maybe TypeExtra)+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 228, column 24)+ _fnOdownEnv =+ ({-# LINE 228 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ E.emptyEnvironment+ {-# LINE 26950 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 229, column 24)+ _fnOexpectedCast =+ ({-# LINE 229 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 26956 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 230, column 24)+ _fnOexpectedType =+ ({-# LINE 230 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Nothing+ {-# LINE 26962 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 231, column 24)+ _fnOodbcFunction =+ ({-# LINE 231 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ False+ {-# LINE 26968 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 26975 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 26981 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 71, column 7)+ _eEnv =+ ({-# LINE 71 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ Left []+ {-# LINE 26987 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 75, column 7)+ _lhsOannotatedTree =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ let mk (q,is) = FullAlias emptyAnnotation+ (Nmc q)+ (map Nmc is)+ $ wrapIfJoin _annotatedTree+ wrapIfJoin tr = case tr of+ JoinTref {} -> TableRefParens emptyAnnotation tr+ _ -> tr+ in maybe _annotatedTree mk _newAlias+ {-# LINE 27000 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 135, column 7)+ _newAlias =+ ({-# LINE 135 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if tcfAddFullTablerefAliases _lhsIflags+ then do+ env <- either (const Nothing) Just _eEnv+ cs <- either (const Nothing) Just $ E.envExpandStar Nothing env+ let qs = map (fst . fst) cs+ if all (== head qs) qs+ then return (T.unpack $ head qs, map (T.unpack . snd . fst) cs)+ else+ Nothing+ else Nothing+ {-# LINE 27015 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 844, column 24)+ _fnOassignmentCastContext =+ ({-# LINE 844 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 27021 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ FunTref _annIannotatedTree _fnIannotatedTree+ {-# LINE 27027 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ FunTref _annIoriginalTree _fnIoriginalTree+ {-# LINE 27033 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27039 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27045 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27051 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27057 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27063 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27069 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _fnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27075 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _fnIannotatedTree,_fnIcolExprs,_fnIoriginalTree,_fnIupType) =+ fn_ _fnOassignmentCastContext _fnOcat _fnOdownEnv _fnOexpectedCast _fnOexpectedType _fnOflags _fnOimCast _fnOodbcFunction+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_SubTref :: T_Annotation ->+ T_QueryExpr ->+ T_TableRef+_sem_TableRef_SubTref ann_ sel_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _selOexpectedType :: (Maybe [TypeExtra])+ _lhsOannotatedTree :: TableRef+ _selOouterDownEnv :: (Maybe Environment)+ _selOassignmentCastContext :: Bool+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _selOcat :: Catalog+ _selOflags :: TypeCheckFlags+ _selOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _selIannotatedTree :: QueryExpr+ _selIoriginalTree :: QueryExpr+ _selIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 27113 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27119 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 58, column 7)+ _eEnv =+ ({-# LINE 58 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ maybe (Left []) id+ $ fmap E.envSelectListEnvironment _selIupType+ {-# LINE 27126 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 60, column 7)+ _selOexpectedType =+ ({-# LINE 60 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ liftM (map snd) _selIupType+ {-# LINE 27132 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 75, column 7)+ _lhsOannotatedTree =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ let mk (q,is) = FullAlias emptyAnnotation+ (Nmc q)+ (map Nmc is)+ $ wrapIfJoin _annotatedTree+ wrapIfJoin tr = case tr of+ JoinTref {} -> TableRefParens emptyAnnotation tr+ _ -> tr+ in maybe _annotatedTree mk _newAlias+ {-# LINE 27145 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 135, column 7)+ _newAlias =+ ({-# LINE 135 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if tcfAddFullTablerefAliases _lhsIflags+ then do+ env <- either (const Nothing) Just _eEnv+ cs <- either (const Nothing) Just $ E.envExpandStar Nothing env+ let qs = map (fst . fst) cs+ if all (== head qs) qs+ then return (T.unpack $ head qs, map (T.unpack . snd . fst) cs)+ else+ Nothing+ else Nothing+ {-# LINE 27160 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 93, column 13)+ _selOouterDownEnv =+ ({-# LINE 93 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Nothing+ {-# LINE 27166 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 845, column 24)+ _selOassignmentCastContext =+ ({-# LINE 845 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 27172 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SubTref _annIannotatedTree _selIannotatedTree+ {-# LINE 27178 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SubTref _annIoriginalTree _selIoriginalTree+ {-# LINE 27184 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27190 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27196 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27202 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27208 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27214 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27220 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _selOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27226 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _selIannotatedTree,_selIoriginalTree,_selIupType) =+ sel_ _selOassignmentCastContext _selOcat _selOexpectedType _selOflags _selOimCast _selOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_JoinTref :: T_Annotation ->+ T_TableRef ->+ Natural ->+ JoinType ->+ (Maybe JoinHint) ->+ T_TableRef ->+ T_OnExpr ->+ T_TableRef+_sem_TableRef_JoinTref ann_ tref0_ nat_ joinType_ joinHint_ tref1_ onExpr_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _onExprOdownEnv :: Environment+ _lhsOannotatedTree :: TableRef+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tref0Ocat :: Catalog+ _tref0Oflags :: TypeCheckFlags+ _tref0OimCast :: (Maybe TypeExtra)+ _tref1Ocat :: Catalog+ _tref1Oflags :: TypeCheckFlags+ _tref1OimCast :: (Maybe TypeExtra)+ _onExprOcat :: Catalog+ _onExprOflags :: TypeCheckFlags+ _onExprOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tref0IannotatedTree :: TableRef+ _tref0IoriginalTree :: TableRef+ _tref0IupEnv :: Environment+ _tref1IannotatedTree :: TableRef+ _tref1IoriginalTree :: TableRef+ _tref1IupEnv :: Environment+ _onExprIannotatedTree :: OnExpr+ _onExprIoriginalTree :: OnExpr+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 27278 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27284 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 46, column 7)+ _eEnv =+ ({-# LINE 46 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ E.createJoinTrefEnvironment _lhsIcat+ _tref0IupEnv _tref1IupEnv (convertJoinType joinType_)+ $ case (joinType_,_onExprIoriginalTree) of+ (x,Nothing) | x /= Cross -> Nothing+ (_,Just (JoinUsing _ nms)) -> Just nms+ _ -> Just []+ {-# LINE 27295 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 56, column 7)+ _onExprOdownEnv =+ ({-# LINE 56 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27301 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 75, column 7)+ _lhsOannotatedTree =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ let mk (q,is) = FullAlias emptyAnnotation+ (Nmc q)+ (map Nmc is)+ $ wrapIfJoin _annotatedTree+ wrapIfJoin tr = case tr of+ JoinTref {} -> TableRefParens emptyAnnotation tr+ _ -> tr+ in maybe _annotatedTree mk _newAlias+ {-# LINE 27314 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 135, column 7)+ _newAlias =+ ({-# LINE 135 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if tcfAddFullTablerefAliases _lhsIflags+ then do+ env <- either (const Nothing) Just _eEnv+ cs <- either (const Nothing) Just $ E.envExpandStar Nothing env+ let qs = map (fst . fst) cs+ if all (== head qs) qs+ then return (T.unpack $ head qs, map (T.unpack . snd . fst) cs)+ else+ Nothing+ else Nothing+ {-# LINE 27329 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ JoinTref _annIannotatedTree _tref0IannotatedTree nat_ joinType_ joinHint_ _tref1IannotatedTree _onExprIannotatedTree+ {-# LINE 27335 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ JoinTref _annIoriginalTree _tref0IoriginalTree nat_ joinType_ joinHint_ _tref1IoriginalTree _onExprIoriginalTree+ {-# LINE 27341 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27347 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27353 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27359 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27365 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tref0Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27371 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tref0Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27377 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tref0OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27383 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tref1Ocat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27389 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tref1Oflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27395 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tref1OimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27401 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _onExprOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27407 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _onExprOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27413 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _onExprOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27419 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tref0IannotatedTree,_tref0IoriginalTree,_tref0IupEnv) =+ tref0_ _tref0Ocat _tref0Oflags _tref0OimCast+ ( _tref1IannotatedTree,_tref1IoriginalTree,_tref1IupEnv) =+ tref1_ _tref1Ocat _tref1Oflags _tref1OimCast+ ( _onExprIannotatedTree,_onExprIoriginalTree) =+ onExpr_ _onExprOcat _onExprOdownEnv _onExprOflags _onExprOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_TableAlias :: T_Annotation ->+ NameComponent ->+ T_TableRef ->+ T_TableRef+_sem_TableRef_TableAlias ann_ tb_ tref_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _lhsOannotatedTree :: TableRef+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _trefOcat :: Catalog+ _trefOflags :: TypeCheckFlags+ _trefOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _trefIannotatedTree :: TableRef+ _trefIoriginalTree :: TableRef+ _trefIupEnv :: Environment+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 27459 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27465 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 68, column 7)+ _eEnv =+ ({-# LINE 68 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ Right $ E.createTrefAliasedEnvironment+ (ncStrT tb_) Nothing _trefIupEnv+ {-# LINE 27472 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 124, column 7)+ _lhsOannotatedTree =+ ({-# LINE 124 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ case _trefIannotatedTree of+ FullAlias _ _ c tr -> FullAlias emptyAnnotation tb_ c tr+ TableAlias _ _ tr -> TableAlias emptyAnnotation tb_ tr+ _ -> _annotatedTree+ {-# LINE 27481 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TableAlias _annIannotatedTree tb_ _trefIannotatedTree+ {-# LINE 27487 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TableAlias _annIoriginalTree tb_ _trefIoriginalTree+ {-# LINE 27493 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27499 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27505 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27511 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27517 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27523 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27529 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27535 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _trefIannotatedTree,_trefIoriginalTree,_trefIupEnv) =+ tref_ _trefOcat _trefOflags _trefOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_FullAlias :: T_Annotation ->+ NameComponent ->+ ([NameComponent]) ->+ T_TableRef ->+ T_TableRef+_sem_TableRef_FullAlias ann_ tb_ cols_ tref_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _lhsOannotatedTree :: TableRef+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _trefOcat :: Catalog+ _trefOflags :: TypeCheckFlags+ _trefOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _trefIannotatedTree :: TableRef+ _trefIoriginalTree :: TableRef+ _trefIupEnv :: Environment+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 27572 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27578 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 65, column 7)+ _eEnv =+ ({-# LINE 65 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ Right $ E.createTrefAliasedEnvironment+ (ncStrT tb_) (Just $ map ncStrT cols_) _trefIupEnv+ {-# LINE 27585 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 103, column 7)+ _lhsOannotatedTree =+ ({-# LINE 103 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ case _trefIannotatedTree of+ FullAlias _ t _ tr -> FullAlias emptyAnnotation+ (if tb_ == Nmc "" then t else tb_) cols_ tr+ TableAlias _ _ tr -> FullAlias emptyAnnotation tb_ cols_ tr+ _ -> _annotatedTree+ {-# LINE 27595 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ FullAlias _annIannotatedTree tb_ cols_ _trefIannotatedTree+ {-# LINE 27601 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ FullAlias _annIoriginalTree tb_ cols_ _trefIoriginalTree+ {-# LINE 27607 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27613 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27619 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27625 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27631 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27637 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27643 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27649 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _trefIannotatedTree,_trefIoriginalTree,_trefIupEnv) =+ tref_ _trefOcat _trefOflags _trefOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_TableRefParens :: T_Annotation ->+ T_TableRef ->+ T_TableRef+_sem_TableRef_TableRefParens ann_ tref_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _lhsOannotatedTree :: TableRef+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _trefOcat :: Catalog+ _trefOflags :: TypeCheckFlags+ _trefOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _trefIannotatedTree :: TableRef+ _trefIoriginalTree :: TableRef+ _trefIupEnv :: Environment+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 27684 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27690 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 63, column 7)+ _eEnv =+ ({-# LINE 63 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ Right $ _trefIupEnv+ {-# LINE 27696 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 75, column 7)+ _lhsOannotatedTree =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ let mk (q,is) = FullAlias emptyAnnotation+ (Nmc q)+ (map Nmc is)+ $ wrapIfJoin _annotatedTree+ wrapIfJoin tr = case tr of+ JoinTref {} -> TableRefParens emptyAnnotation tr+ _ -> tr+ in maybe _annotatedTree mk _newAlias+ {-# LINE 27709 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 135, column 7)+ _newAlias =+ ({-# LINE 135 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if tcfAddFullTablerefAliases _lhsIflags+ then do+ env <- either (const Nothing) Just _eEnv+ cs <- either (const Nothing) Just $ E.envExpandStar Nothing env+ let qs = map (fst . fst) cs+ if all (== head qs) qs+ then return (T.unpack $ head qs, map (T.unpack . snd . fst) cs)+ else+ Nothing+ else Nothing+ {-# LINE 27724 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TableRefParens _annIannotatedTree _trefIannotatedTree+ {-# LINE 27730 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TableRefParens _annIoriginalTree _trefIoriginalTree+ {-# LINE 27736 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27742 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27748 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27754 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27760 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27766 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27772 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27778 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _trefIannotatedTree,_trefIoriginalTree,_trefIupEnv) =+ tref_ _trefOcat _trefOflags _trefOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRef_OdbcTableRef :: T_Annotation ->+ T_TableRef ->+ T_TableRef+_sem_TableRef_OdbcTableRef ann_ tref_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOupEnv :: Environment+ _eEnv :: (Either [TypeError] Environment)+ _lhsOannotatedTree :: TableRef+ _lhsOoriginalTree :: TableRef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _trefOcat :: Catalog+ _trefOflags :: TypeCheckFlags+ _trefOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _trefIannotatedTree :: TableRef+ _trefIoriginalTree :: TableRef+ _trefIupEnv :: Environment+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 33, column 7)+ _annOtpe =+ ({-# LINE 33 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either Left (Right . mkTypeExtraNN . TrefType)+ (_eEnv >>= E.envExpandStar Nothing)+ {-# LINE 27813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 36, column 7)+ _lhsOupEnv =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ either (const E.brokeEnvironment) id _eEnv+ {-# LINE 27819 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 63, column 7)+ _eEnv =+ ({-# LINE 63 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ Right $ _trefIupEnv+ {-# LINE 27825 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 75, column 7)+ _lhsOannotatedTree =+ ({-# LINE 75 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ let mk (q,is) = FullAlias emptyAnnotation+ (Nmc q)+ (map Nmc is)+ $ wrapIfJoin _annotatedTree+ wrapIfJoin tr = case tr of+ JoinTref {} -> TableRefParens emptyAnnotation tr+ _ -> tr+ in maybe _annotatedTree mk _newAlias+ {-# LINE 27838 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 135, column 7)+ _newAlias =+ ({-# LINE 135 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if tcfAddFullTablerefAliases _lhsIflags+ then do+ env <- either (const Nothing) Just _eEnv+ cs <- either (const Nothing) Just $ E.envExpandStar Nothing env+ let qs = map (fst . fst) cs+ if all (== head qs) qs+ then return (T.unpack $ head qs, map (T.unpack . snd . fst) cs)+ else+ Nothing+ else Nothing+ {-# LINE 27853 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ OdbcTableRef _annIannotatedTree _trefIannotatedTree+ {-# LINE 27859 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ OdbcTableRef _annIoriginalTree _trefIoriginalTree+ {-# LINE 27865 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 27871 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27877 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27883 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27889 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 27895 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 27901 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _trefOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 27907 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _trefIannotatedTree,_trefIoriginalTree,_trefIupEnv) =+ tref_ _trefOcat _trefOflags _trefOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+-- TableRefList ------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TableRefList + originalTree : TableRefList + upEnv : Environment+ alternatives:+ alternative Cons:+ child hd : TableRef + child tl : TableRefList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type TableRefList = [TableRef]+-- cata+_sem_TableRefList :: TableRefList ->+ T_TableRefList+_sem_TableRefList list =+ (Prelude.foldr _sem_TableRefList_Cons _sem_TableRefList_Nil (Prelude.map _sem_TableRef list))+-- semantic domain+type T_TableRefList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TableRefList,TableRefList,Environment)+data Inh_TableRefList = Inh_TableRefList {_cat_Inh_TableRefList :: Catalog,_flags_Inh_TableRefList :: TypeCheckFlags,_imCast_Inh_TableRefList :: (Maybe TypeExtra)}+data Syn_TableRefList = Syn_TableRefList {_annotatedTree_Syn_TableRefList :: TableRefList,_originalTree_Syn_TableRefList :: TableRefList,_upEnv_Syn_TableRefList :: Environment}+_wrap_TableRefList :: T_TableRefList ->+ Inh_TableRefList ->+ Syn_TableRefList+_wrap_TableRefList sem (Inh_TableRefList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TableRefList _lhsOannotatedTree _lhsOoriginalTree _lhsOupEnv))+_sem_TableRefList_Cons :: T_TableRef ->+ T_TableRefList ->+ T_TableRefList+_sem_TableRefList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupEnv :: Environment+ _lhsOannotatedTree :: TableRefList+ _lhsOoriginalTree :: TableRefList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: TableRef+ _hdIoriginalTree :: TableRef+ _hdIupEnv :: Environment+ _tlIannotatedTree :: TableRefList+ _tlIoriginalTree :: TableRefList+ _tlIupEnv :: Environment+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 20, column 7)+ _lhsOupEnv =+ ({-# LINE 20 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ if E.isEmptyEnv _tlIupEnv+ then _hdIupEnv+ else+ either (error . show) id $+ E.createJoinTrefEnvironment _lhsIcat _hdIupEnv _tlIupEnv E.Inner $ Just []+ {-# LINE 27986 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 27992 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 27998 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28004 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28010 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28040 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28046 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree,_hdIupEnv) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree,_tlIupEnv) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+_sem_TableRefList_Nil :: T_TableRefList+_sem_TableRefList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOupEnv :: Environment+ _lhsOannotatedTree :: TableRefList+ _lhsOoriginalTree :: TableRefList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag"(line 18, column 9)+ _lhsOupEnv =+ ({-# LINE 18 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/TableRefs.ag" #-}+ E.emptyEnvironment+ {-# LINE 28065 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 28071 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 28077 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28083 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28089 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree,_lhsOupEnv)))+-- TypeAttributeDef --------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TypeAttributeDef + originalTree : TypeAttributeDef + alternatives:+ alternative TypeAttDef:+ child ann : Annotation + child name : {NameComponent}+ child typ : TypeName + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data TypeAttributeDef = TypeAttDef (Annotation) (NameComponent) (TypeName)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_TypeAttributeDef :: TypeAttributeDef ->+ T_TypeAttributeDef+_sem_TypeAttributeDef (TypeAttDef _ann _name _typ) =+ (_sem_TypeAttributeDef_TypeAttDef (_sem_Annotation _ann) _name (_sem_TypeName _typ))+-- semantic domain+type T_TypeAttributeDef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TypeAttributeDef,TypeAttributeDef)+data Inh_TypeAttributeDef = Inh_TypeAttributeDef {_cat_Inh_TypeAttributeDef :: Catalog,_flags_Inh_TypeAttributeDef :: TypeCheckFlags,_imCast_Inh_TypeAttributeDef :: (Maybe TypeExtra)}+data Syn_TypeAttributeDef = Syn_TypeAttributeDef {_annotatedTree_Syn_TypeAttributeDef :: TypeAttributeDef,_originalTree_Syn_TypeAttributeDef :: TypeAttributeDef}+_wrap_TypeAttributeDef :: T_TypeAttributeDef ->+ Inh_TypeAttributeDef ->+ Syn_TypeAttributeDef+_wrap_TypeAttributeDef sem (Inh_TypeAttributeDef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TypeAttributeDef _lhsOannotatedTree _lhsOoriginalTree))+_sem_TypeAttributeDef_TypeAttDef :: T_Annotation ->+ NameComponent ->+ T_TypeName ->+ T_TypeAttributeDef+_sem_TypeAttributeDef_TypeAttDef ann_ name_ typ_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TypeAttributeDef+ _lhsOoriginalTree :: TypeAttributeDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 232, column 35)+ _annOtpe =+ ({-# LINE 232 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 28157 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TypeAttDef _annIannotatedTree name_ _typIannotatedTree+ {-# LINE 28163 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ TypeAttDef _annIoriginalTree name_ _typIoriginalTree+ {-# LINE 28169 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28175 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28181 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28187 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28193 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28199 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28205 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28211 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28217 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- TypeAttributeDefList ----------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TypeAttributeDefList + originalTree : TypeAttributeDefList + alternatives:+ alternative Cons:+ child hd : TypeAttributeDef + child tl : TypeAttributeDefList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type TypeAttributeDefList = [TypeAttributeDef]+-- cata+_sem_TypeAttributeDefList :: TypeAttributeDefList ->+ T_TypeAttributeDefList+_sem_TypeAttributeDefList list =+ (Prelude.foldr _sem_TypeAttributeDefList_Cons _sem_TypeAttributeDefList_Nil (Prelude.map _sem_TypeAttributeDef list))+-- semantic domain+type T_TypeAttributeDefList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TypeAttributeDefList,TypeAttributeDefList)+data Inh_TypeAttributeDefList = Inh_TypeAttributeDefList {_cat_Inh_TypeAttributeDefList :: Catalog,_flags_Inh_TypeAttributeDefList :: TypeCheckFlags,_imCast_Inh_TypeAttributeDefList :: (Maybe TypeExtra)}+data Syn_TypeAttributeDefList = Syn_TypeAttributeDefList {_annotatedTree_Syn_TypeAttributeDefList :: TypeAttributeDefList,_originalTree_Syn_TypeAttributeDefList :: TypeAttributeDefList}+_wrap_TypeAttributeDefList :: T_TypeAttributeDefList ->+ Inh_TypeAttributeDefList ->+ Syn_TypeAttributeDefList+_wrap_TypeAttributeDefList sem (Inh_TypeAttributeDefList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TypeAttributeDefList _lhsOannotatedTree _lhsOoriginalTree))+_sem_TypeAttributeDefList_Cons :: T_TypeAttributeDef ->+ T_TypeAttributeDefList ->+ T_TypeAttributeDefList+_sem_TypeAttributeDefList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: TypeAttributeDefList+ _lhsOoriginalTree :: TypeAttributeDefList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: TypeAttributeDef+ _hdIoriginalTree :: TypeAttributeDef+ _tlIannotatedTree :: TypeAttributeDefList+ _tlIoriginalTree :: TypeAttributeDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 28288 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 28294 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28300 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28306 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28312 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28318 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28324 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28330 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28336 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28342 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_TypeAttributeDefList_Nil :: T_TypeAttributeDefList+_sem_TypeAttributeDefList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: TypeAttributeDefList+ _lhsOoriginalTree :: TypeAttributeDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 28360 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 28366 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28372 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28378 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- TypeName ----------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TypeName + namedType : Maybe TypeExtra+ originalTree : TypeName + alternatives:+ alternative SimpleTypeName:+ child ann : Annotation + child tn : Name + visit 0:+ local canType : {[NameComponent] -> [NameComponent]}+ local tpe : {Either [TypeError] TypeExtra}+ local annotatedTree : _+ local originalTree : _+ alternative PrecTypeName:+ child ann : Annotation + child tn : Name + child prec : {Integer}+ visit 0:+ local canType : {[NameComponent] -> [NameComponent]}+ local tpe : {Either [TypeError] TypeExtra}+ local annotatedTree : _+ local originalTree : _+ alternative Prec2TypeName:+ child ann : Annotation + child tn : Name + child prec : {Integer}+ child prec1 : {Integer}+ visit 0:+ local canType : {[NameComponent] -> [NameComponent]}+ local tpe : {Either [TypeError] TypeExtra}+ local annotatedTree : _+ local originalTree : _+ alternative ArrayTypeName:+ child ann : Annotation + child typ : TypeName + visit 0:+ local canType : {[NameComponent] -> [NameComponent]}+ local tpe : {Either [TypeError] TypeExtra}+ local annotatedTree : _+ local originalTree : _+ alternative SetOfTypeName:+ child ann : Annotation + child typ : TypeName + visit 0:+ local canType : {[NameComponent] -> [NameComponent]}+ local tpe : {Either [TypeError] TypeExtra}+ local annotatedTree : _+ local originalTree : _+-}+data TypeName = SimpleTypeName (Annotation) (Name)+ | PrecTypeName (Annotation) (Name) (Integer)+ | Prec2TypeName (Annotation) (Name) (Integer) (Integer)+ | ArrayTypeName (Annotation) (TypeName)+ | SetOfTypeName (Annotation) (TypeName)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_TypeName :: TypeName ->+ T_TypeName+_sem_TypeName (SimpleTypeName _ann _tn) =+ (_sem_TypeName_SimpleTypeName (_sem_Annotation _ann) (_sem_Name _tn))+_sem_TypeName (PrecTypeName _ann _tn _prec) =+ (_sem_TypeName_PrecTypeName (_sem_Annotation _ann) (_sem_Name _tn) _prec)+_sem_TypeName (Prec2TypeName _ann _tn _prec _prec1) =+ (_sem_TypeName_Prec2TypeName (_sem_Annotation _ann) (_sem_Name _tn) _prec _prec1)+_sem_TypeName (ArrayTypeName _ann _typ) =+ (_sem_TypeName_ArrayTypeName (_sem_Annotation _ann) (_sem_TypeName _typ))+_sem_TypeName (SetOfTypeName _ann _typ) =+ (_sem_TypeName_SetOfTypeName (_sem_Annotation _ann) (_sem_TypeName _typ))+-- semantic domain+type T_TypeName = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TypeName,(Maybe TypeExtra),TypeName)+data Inh_TypeName = Inh_TypeName {_cat_Inh_TypeName :: Catalog,_flags_Inh_TypeName :: TypeCheckFlags,_imCast_Inh_TypeName :: (Maybe TypeExtra)}+data Syn_TypeName = Syn_TypeName {_annotatedTree_Syn_TypeName :: TypeName,_namedType_Syn_TypeName :: (Maybe TypeExtra),_originalTree_Syn_TypeName :: TypeName}+_wrap_TypeName :: T_TypeName ->+ Inh_TypeName ->+ Syn_TypeName+_wrap_TypeName sem (Inh_TypeName _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TypeName _lhsOannotatedTree _lhsOnamedType _lhsOoriginalTree))+_sem_TypeName_SimpleTypeName :: T_Annotation ->+ T_Name ->+ T_TypeName+_sem_TypeName_SimpleTypeName ann_ tn_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOnamedType :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _tnOtpe :: (Either [TypeError] TypeExtra)+ _canType :: ([NameComponent] -> [NameComponent])+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TypeName+ _lhsOoriginalTree :: TypeName+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tnOcat :: Catalog+ _tnOflags :: TypeCheckFlags+ _tnOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tnIannotatedTree :: Name+ _tnIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 36, column 10)+ _lhsOnamedType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 28497 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 37, column 10)+ _annOtpe =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either Left (const $ Left []) _tpe+ {-# LINE 28503 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 39, column 10)+ _tnOtpe =+ ({-# LINE 39 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ Left []+ {-# LINE 28509 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 51, column 10)+ _canType =+ ({-# LINE 51 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ \x -> case x of+ [Nmc nc] -> [Nmc $ T.unpack $ canonicalizeTypeName (tcfDialect _lhsIflags) $ T.pack nc]+ _ -> x+ {-# LINE 28517 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 63, column 10)+ _tpe =+ ({-# LINE 63 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ mkTypeExtraNN `liftM` catLookupType _lhsIcat (_canType $ nameComponents _tnIoriginalTree)+ {-# LINE 28523 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SimpleTypeName _annIannotatedTree _tnIannotatedTree+ {-# LINE 28529 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SimpleTypeName _annIoriginalTree _tnIoriginalTree+ {-# LINE 28535 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28541 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28547 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28553 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28559 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28565 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28571 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28577 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28583 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tnIannotatedTree,_tnIoriginalTree) =+ tn_ _tnOcat _tnOflags _tnOimCast _tnOtpe+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))+_sem_TypeName_PrecTypeName :: T_Annotation ->+ T_Name ->+ Integer ->+ T_TypeName+_sem_TypeName_PrecTypeName ann_ tn_ prec_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOnamedType :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _tnOtpe :: (Either [TypeError] TypeExtra)+ _canType :: ([NameComponent] -> [NameComponent])+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TypeName+ _lhsOoriginalTree :: TypeName+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tnOcat :: Catalog+ _tnOflags :: TypeCheckFlags+ _tnOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tnIannotatedTree :: Name+ _tnIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 36, column 10)+ _lhsOnamedType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 28619 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 37, column 10)+ _annOtpe =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either Left (const $ Left []) _tpe+ {-# LINE 28625 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 39, column 10)+ _tnOtpe =+ ({-# LINE 39 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ Left []+ {-# LINE 28631 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 51, column 10)+ _canType =+ ({-# LINE 51 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ \x -> case x of+ [Nmc nc] -> [Nmc $ T.unpack $ canonicalizeTypeName (tcfDialect _lhsIflags) $ T.pack nc]+ _ -> x+ {-# LINE 28639 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 77, column 9)+ _tpe =+ ({-# LINE 77 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ ((\t -> t{tePrecision = Just $ fromIntegral prec_}) . mkTypeExtraNN)+ `liftM` catLookupType _lhsIcat (nameComponents _tnIoriginalTree)+ {-# LINE 28646 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PrecTypeName _annIannotatedTree _tnIannotatedTree prec_+ {-# LINE 28652 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ PrecTypeName _annIoriginalTree _tnIoriginalTree prec_+ {-# LINE 28658 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28664 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28670 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28676 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28682 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28688 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28694 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28700 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28706 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tnIannotatedTree,_tnIoriginalTree) =+ tn_ _tnOcat _tnOflags _tnOimCast _tnOtpe+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))+_sem_TypeName_Prec2TypeName :: T_Annotation ->+ T_Name ->+ Integer ->+ Integer ->+ T_TypeName+_sem_TypeName_Prec2TypeName ann_ tn_ prec_ prec1_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOnamedType :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _tnOtpe :: (Either [TypeError] TypeExtra)+ _canType :: ([NameComponent] -> [NameComponent])+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TypeName+ _lhsOoriginalTree :: TypeName+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _tnOcat :: Catalog+ _tnOflags :: TypeCheckFlags+ _tnOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _tnIannotatedTree :: Name+ _tnIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 36, column 10)+ _lhsOnamedType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 28743 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 37, column 10)+ _annOtpe =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either Left (const $ Left []) _tpe+ {-# LINE 28749 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 39, column 10)+ _tnOtpe =+ ({-# LINE 39 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ Left []+ {-# LINE 28755 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 51, column 10)+ _canType =+ ({-# LINE 51 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ \x -> case x of+ [Nmc nc] -> [Nmc $ T.unpack $ canonicalizeTypeName (tcfDialect _lhsIflags) $ T.pack nc]+ _ -> x+ {-# LINE 28763 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 80, column 9)+ _tpe =+ ({-# LINE 80 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ ((\t -> t{tePrecision = Just $ fromIntegral prec_,+ teScale = Just $ fromIntegral prec1_})+ . mkTypeExtraNN)+ `liftM` catLookupType _lhsIcat (nameComponents _tnIoriginalTree)+ {-# LINE 28772 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Prec2TypeName _annIannotatedTree _tnIannotatedTree prec_ prec1_+ {-# LINE 28778 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ Prec2TypeName _annIoriginalTree _tnIoriginalTree prec_ prec1_+ {-# LINE 28784 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28790 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28796 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28802 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28808 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28814 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28820 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28826 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tnOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28832 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _tnIannotatedTree,_tnIoriginalTree) =+ tn_ _tnOcat _tnOflags _tnOimCast _tnOtpe+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))+_sem_TypeName_ArrayTypeName :: T_Annotation ->+ T_TypeName ->+ T_TypeName+_sem_TypeName_ArrayTypeName ann_ typ_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOnamedType :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _canType :: ([NameComponent] -> [NameComponent])+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TypeName+ _lhsOoriginalTree :: TypeName+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 36, column 10)+ _lhsOnamedType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 28867 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 37, column 10)+ _annOtpe =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either Left (const $ Left []) _tpe+ {-# LINE 28873 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 51, column 10)+ _canType =+ ({-# LINE 51 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ \x -> case x of+ [Nmc nc] -> [Nmc $ T.unpack $ canonicalizeTypeName (tcfDialect _lhsIflags) $ T.pack nc]+ _ -> x+ {-# LINE 28881 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 71, column 9)+ _tpe =+ ({-# LINE 71 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ maybe (Left []) Right _typInamedType+ >>= Right . (\t -> t{teType = ArrayType $ teType t})+ {-# LINE 28888 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ArrayTypeName _annIannotatedTree _typIannotatedTree+ {-# LINE 28894 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ArrayTypeName _annIoriginalTree _typIoriginalTree+ {-# LINE 28900 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 28906 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 28912 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28918 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28924 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28930 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 28936 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 28942 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 28948 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))+_sem_TypeName_SetOfTypeName :: T_Annotation ->+ T_TypeName ->+ T_TypeName+_sem_TypeName_SetOfTypeName ann_ typ_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOnamedType :: (Maybe TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _canType :: ([NameComponent] -> [NameComponent])+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: TypeName+ _lhsOoriginalTree :: TypeName+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 36, column 10)+ _lhsOnamedType =+ ({-# LINE 36 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either (const Nothing) Just _tpe+ {-# LINE 28983 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 37, column 10)+ _annOtpe =+ ({-# LINE 37 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ either Left (const $ Left []) _tpe+ {-# LINE 28989 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 51, column 10)+ _canType =+ ({-# LINE 51 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ \x -> case x of+ [Nmc nc] -> [Nmc $ T.unpack $ canonicalizeTypeName (tcfDialect _lhsIflags) $ T.pack nc]+ _ -> x+ {-# LINE 28997 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag"(line 74, column 9)+ _tpe =+ ({-# LINE 74 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Misc.ag" #-}+ maybe (Left []) Right _typInamedType+ >>= Right . (\t -> t{teType = Pseudo $ SetOfType $ teType t})+ {-# LINE 29004 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetOfTypeName _annIannotatedTree _typIannotatedTree+ {-# LINE 29010 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ SetOfTypeName _annIoriginalTree _typIoriginalTree+ {-# LINE 29016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29040 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29046 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29052 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29058 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29064 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOoriginalTree)))+-- TypeNameList ------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : TypeNameList + originalTree : TypeNameList + alternatives:+ alternative Cons:+ child hd : TypeName + child tl : TypeNameList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type TypeNameList = [TypeName]+-- cata+_sem_TypeNameList :: TypeNameList ->+ T_TypeNameList+_sem_TypeNameList list =+ (Prelude.foldr _sem_TypeNameList_Cons _sem_TypeNameList_Nil (Prelude.map _sem_TypeName list))+-- semantic domain+type T_TypeNameList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( TypeNameList,TypeNameList)+data Inh_TypeNameList = Inh_TypeNameList {_cat_Inh_TypeNameList :: Catalog,_flags_Inh_TypeNameList :: TypeCheckFlags,_imCast_Inh_TypeNameList :: (Maybe TypeExtra)}+data Syn_TypeNameList = Syn_TypeNameList {_annotatedTree_Syn_TypeNameList :: TypeNameList,_originalTree_Syn_TypeNameList :: TypeNameList}+_wrap_TypeNameList :: T_TypeNameList ->+ Inh_TypeNameList ->+ Syn_TypeNameList+_wrap_TypeNameList sem (Inh_TypeNameList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_TypeNameList _lhsOannotatedTree _lhsOoriginalTree))+_sem_TypeNameList_Cons :: T_TypeName ->+ T_TypeNameList ->+ T_TypeNameList+_sem_TypeNameList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: TypeNameList+ _lhsOoriginalTree :: TypeNameList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: TypeName+ _hdInamedType :: (Maybe TypeExtra)+ _hdIoriginalTree :: TypeName+ _tlIannotatedTree :: TypeNameList+ _tlIoriginalTree :: TypeNameList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 29136 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 29142 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29148 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29154 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29160 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29166 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29172 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29178 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29184 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29190 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdInamedType,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_TypeNameList_Nil :: T_TypeNameList+_sem_TypeNameList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: TypeNameList+ _lhsOoriginalTree :: TypeNameList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 29208 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 29214 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29220 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29226 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- VarDef ------------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : VarDef + originalTree : VarDef + alternatives:+ alternative VarDef:+ child ann : Annotation + child name : {NameComponent}+ child typ : TypeName + child value : {Maybe ScalarExpr}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative ParamAlias:+ child ann : Annotation + child name : {NameComponent}+ child i : {Integer}+ visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative VarAlias:+ child ann : Annotation + child name : {NameComponent}+ child aliased : Name + visit 0:+ local annotatedTree : _+ local originalTree : _+-}+data VarDef = VarDef (Annotation) (NameComponent) (TypeName) ((Maybe ScalarExpr))+ | ParamAlias (Annotation) (NameComponent) (Integer)+ | VarAlias (Annotation) (NameComponent) (Name)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_VarDef :: VarDef ->+ T_VarDef+_sem_VarDef (VarDef _ann _name _typ _value) =+ (_sem_VarDef_VarDef (_sem_Annotation _ann) _name (_sem_TypeName _typ) _value)+_sem_VarDef (ParamAlias _ann _name _i) =+ (_sem_VarDef_ParamAlias (_sem_Annotation _ann) _name _i)+_sem_VarDef (VarAlias _ann _name _aliased) =+ (_sem_VarDef_VarAlias (_sem_Annotation _ann) _name (_sem_Name _aliased))+-- semantic domain+type T_VarDef = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( VarDef,VarDef)+data Inh_VarDef = Inh_VarDef {_cat_Inh_VarDef :: Catalog,_flags_Inh_VarDef :: TypeCheckFlags,_imCast_Inh_VarDef :: (Maybe TypeExtra)}+data Syn_VarDef = Syn_VarDef {_annotatedTree_Syn_VarDef :: VarDef,_originalTree_Syn_VarDef :: VarDef}+_wrap_VarDef :: T_VarDef ->+ Inh_VarDef ->+ Syn_VarDef+_wrap_VarDef sem (Inh_VarDef _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_VarDef _lhsOannotatedTree _lhsOoriginalTree))+_sem_VarDef_VarDef :: T_Annotation ->+ NameComponent ->+ T_TypeName ->+ (Maybe ScalarExpr) ->+ T_VarDef+_sem_VarDef_VarDef ann_ name_ typ_ value_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: VarDef+ _lhsOoriginalTree :: VarDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _typOcat :: Catalog+ _typOflags :: TypeCheckFlags+ _typOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _typIannotatedTree :: TypeName+ _typInamedType :: (Maybe TypeExtra)+ _typIoriginalTree :: TypeName+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 236, column 21)+ _annOtpe =+ ({-# LINE 236 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 29316 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ VarDef _annIannotatedTree name_ _typIannotatedTree value_+ {-# LINE 29322 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ VarDef _annIoriginalTree name_ _typIoriginalTree value_+ {-# LINE 29328 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29334 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29340 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29346 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29352 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29358 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29364 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29370 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _typOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29376 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _typIannotatedTree,_typInamedType,_typIoriginalTree) =+ typ_ _typOcat _typOflags _typOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_VarDef_ParamAlias :: T_Annotation ->+ NameComponent ->+ Integer ->+ T_VarDef+_sem_VarDef_ParamAlias ann_ name_ i_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: VarDef+ _lhsOoriginalTree :: VarDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 233, column 25)+ _annOtpe =+ ({-# LINE 233 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 29403 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ParamAlias _annIannotatedTree name_ i_+ {-# LINE 29409 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ ParamAlias _annIoriginalTree name_ i_+ {-# LINE 29415 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29421 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29427 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29433 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29439 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29445 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_VarDef_VarAlias :: T_Annotation ->+ NameComponent ->+ T_Name ->+ T_VarDef+_sem_VarDef_VarAlias ann_ name_ aliased_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _aliasedOtpe :: (Either [TypeError] TypeExtra)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _lhsOannotatedTree :: VarDef+ _lhsOoriginalTree :: VarDef+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _aliasedOcat :: Catalog+ _aliasedOflags :: TypeCheckFlags+ _aliasedOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _aliasedIannotatedTree :: Name+ _aliasedIoriginalTree :: Name+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 234, column 23)+ _aliasedOtpe =+ ({-# LINE 234 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 29476 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag"(line 235, column 23)+ _annOtpe =+ ({-# LINE 235 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/Boilerplate.ag" #-}+ Left []+ {-# LINE 29482 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ VarAlias _annIannotatedTree name_ _aliasedIannotatedTree+ {-# LINE 29488 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ VarAlias _annIoriginalTree name_ _aliasedIoriginalTree+ {-# LINE 29494 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29500 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29506 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29512 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29518 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29524 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _aliasedOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29530 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _aliasedOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29536 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _aliasedOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29542 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _aliasedIannotatedTree,_aliasedIoriginalTree) =+ aliased_ _aliasedOcat _aliasedOflags _aliasedOimCast _aliasedOtpe+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- VarDefList --------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : VarDefList + originalTree : VarDefList + alternatives:+ alternative Cons:+ child hd : VarDef + child tl : VarDefList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type VarDefList = [VarDef]+-- cata+_sem_VarDefList :: VarDefList ->+ T_VarDefList+_sem_VarDefList list =+ (Prelude.foldr _sem_VarDefList_Cons _sem_VarDefList_Nil (Prelude.map _sem_VarDef list))+-- semantic domain+type T_VarDefList = Catalog ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( VarDefList,VarDefList)+data Inh_VarDefList = Inh_VarDefList {_cat_Inh_VarDefList :: Catalog,_flags_Inh_VarDefList :: TypeCheckFlags,_imCast_Inh_VarDefList :: (Maybe TypeExtra)}+data Syn_VarDefList = Syn_VarDefList {_annotatedTree_Syn_VarDefList :: VarDefList,_originalTree_Syn_VarDefList :: VarDefList}+_wrap_VarDefList :: T_VarDefList ->+ Inh_VarDefList ->+ Syn_VarDefList+_wrap_VarDefList sem (Inh_VarDefList _lhsIcat _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOoriginalTree) = sem _lhsIcat _lhsIflags _lhsIimCast+ in (Syn_VarDefList _lhsOannotatedTree _lhsOoriginalTree))+_sem_VarDefList_Cons :: T_VarDef ->+ T_VarDefList ->+ T_VarDefList+_sem_VarDefList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: VarDefList+ _lhsOoriginalTree :: VarDefList+ _hdOcat :: Catalog+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: VarDef+ _hdIoriginalTree :: VarDef+ _tlIannotatedTree :: VarDefList+ _tlIoriginalTree :: VarDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 29613 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 29619 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29625 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29631 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29637 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29643 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29649 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29655 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29661 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29667 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIoriginalTree) =+ hd_ _hdOcat _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIoriginalTree) =+ tl_ _tlOcat _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+_sem_VarDefList_Nil :: T_VarDefList+_sem_VarDefList_Nil =+ (\ _lhsIcat+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOannotatedTree :: VarDefList+ _lhsOoriginalTree :: VarDefList+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 29685 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 29691 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 29697 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29703 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOoriginalTree)))+-- WithQuery ---------------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ catExtIncomp : Either [TypeError] Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : WithQuery + colAliases : Maybe [NameComponent]+ name : Text+ originalTree : WithQuery + upType : Maybe [(Text,TypeExtra)]+ alternatives:+ alternative WithQuery:+ child ann : Annotation + child name : {NameComponent}+ child colAliases : {Maybe [NameComponent]}+ child ex : QueryExpr + visit 0:+ local tpee : {Either [TypeError] [(Text,TypeExtra)]}+ local tpe : {Either [TypeError] TypeExtra}+ local annotatedTree : _+ local originalTree : _+-}+data WithQuery = WithQuery (Annotation) (NameComponent) ((Maybe [NameComponent])) (QueryExpr)+ deriving ( Data,Eq,Show,Typeable)+-- cata+_sem_WithQuery :: WithQuery ->+ T_WithQuery+_sem_WithQuery (WithQuery _ann _name _colAliases _ex) =+ (_sem_WithQuery_WithQuery (_sem_Annotation _ann) _name _colAliases (_sem_QueryExpr _ex))+-- semantic domain+type T_WithQuery = Catalog ->+ (Either [TypeError] Catalog) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( WithQuery,(Maybe [NameComponent]),Text,WithQuery,(Maybe [(Text,TypeExtra)]))+data Inh_WithQuery = Inh_WithQuery {_cat_Inh_WithQuery :: Catalog,_catExtIncomp_Inh_WithQuery :: (Either [TypeError] Catalog),_flags_Inh_WithQuery :: TypeCheckFlags,_imCast_Inh_WithQuery :: (Maybe TypeExtra)}+data Syn_WithQuery = Syn_WithQuery {_annotatedTree_Syn_WithQuery :: WithQuery,_colAliases_Syn_WithQuery :: (Maybe [NameComponent]),_name_Syn_WithQuery :: Text,_originalTree_Syn_WithQuery :: WithQuery,_upType_Syn_WithQuery :: (Maybe [(Text,TypeExtra)])}+_wrap_WithQuery :: T_WithQuery ->+ Inh_WithQuery ->+ Syn_WithQuery+_wrap_WithQuery sem (Inh_WithQuery _lhsIcat _lhsIcatExtIncomp _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOcolAliases,_lhsOname,_lhsOoriginalTree,_lhsOupType) = sem _lhsIcat _lhsIcatExtIncomp _lhsIflags _lhsIimCast+ in (Syn_WithQuery _lhsOannotatedTree _lhsOcolAliases _lhsOname _lhsOoriginalTree _lhsOupType))+_sem_WithQuery_WithQuery :: T_Annotation ->+ NameComponent ->+ (Maybe [NameComponent]) ->+ T_QueryExpr ->+ T_WithQuery+_sem_WithQuery_WithQuery ann_ name_ colAliases_ ex_ =+ (\ _lhsIcat+ _lhsIcatExtIncomp+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOname :: Text+ _lhsOannotatedTree :: WithQuery+ _lhsOcolAliases :: (Maybe [NameComponent])+ _tpee :: (Either [TypeError] [(Text,TypeExtra)])+ _tpe :: (Either [TypeError] TypeExtra)+ _lhsOupType :: (Maybe [(Text,TypeExtra)])+ _exOouterDownEnv :: (Maybe Environment)+ _annOtpe :: (Either [TypeError] TypeExtra)+ _exOexpectedType :: (Maybe [TypeExtra])+ _exOassignmentCastContext :: Bool+ _lhsOoriginalTree :: WithQuery+ _annOcat :: Catalog+ _annOflags :: TypeCheckFlags+ _annOimCast :: (Maybe TypeExtra)+ _exOcat :: Catalog+ _exOflags :: TypeCheckFlags+ _exOimCast :: (Maybe TypeExtra)+ _annIannotatedTree :: Annotation+ _annIoriginalTree :: Annotation+ _exIannotatedTree :: QueryExpr+ _exIoriginalTree :: QueryExpr+ _exIupType :: (Maybe [(Text,TypeExtra)])+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 56, column 9)+ _lhsOname =+ ({-# LINE 56 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ ncStrT name_+ {-# LINE 29789 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 57, column 9)+ _lhsOannotatedTree =+ ({-# LINE 57 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ WithQuery _annIannotatedTree name_ colAliases_ _exIannotatedTree+ {-# LINE 29795 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 58, column 9)+ _lhsOcolAliases =+ ({-# LINE 58 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ colAliases_+ {-# LINE 29801 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 62, column 9)+ _tpee =+ ({-# LINE 62 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ maybe (Left []) Right _exIupType+ {-# LINE 29807 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 64, column 9)+ _tpe =+ ({-# LINE 64 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM (mkTypeExtra . CompositeType) _tpee+ {-# LINE 29813 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 66, column 9)+ _lhsOupType =+ ({-# LINE 66 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ either (const Nothing) Just _tpee+ {-# LINE 29819 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 95, column 15)+ _exOouterDownEnv =+ ({-# LINE 95 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Nothing+ {-# LINE 29825 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 101, column 9)+ _annOtpe =+ ({-# LINE 101 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ Left []+ {-# LINE 29831 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 102, column 9)+ _exOexpectedType =+ ({-# LINE 102 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ liftM (map snd) _exIupType+ {-# LINE 29837 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag"(line 846, column 27)+ _exOassignmentCastContext =+ ({-# LINE 846 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/ScalarExprs.ag" #-}+ False+ {-# LINE 29843 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WithQuery _annIannotatedTree name_ colAliases_ _exIannotatedTree+ {-# LINE 29849 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ WithQuery _annIoriginalTree name_ colAliases_ _exIoriginalTree+ {-# LINE 29855 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 29861 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29867 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29873 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _annOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29879 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 29885 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 29891 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _exOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 29897 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _annIannotatedTree,_annIoriginalTree) =+ ann_ _annOcat _annOflags _annOimCast _annOtpe+ ( _exIannotatedTree,_exIoriginalTree,_exIupType) =+ ex_ _exOassignmentCastContext _exOcat _exOexpectedType _exOflags _exOimCast _exOouterDownEnv+ in ( _lhsOannotatedTree,_lhsOcolAliases,_lhsOname,_lhsOoriginalTree,_lhsOupType)))+-- WithQueryList -----------------------------------------------+{-+ visit 0:+ inherited attributes:+ cat : Catalog+ catExtIncomp : Either [TypeError] Catalog+ flags : TypeCheckFlags+ imCast : Maybe TypeExtra+ synthesized attributes:+ annotatedTree : WithQueryList + catExtComp : Either [TypeError] Catalog+ originalTree : WithQueryList + alternatives:+ alternative Cons:+ child hd : WithQuery + child tl : WithQueryList + visit 0:+ local annotatedTree : _+ local originalTree : _+ alternative Nil:+ visit 0:+ local annotatedTree : _+ local originalTree : _+-}+type WithQueryList = [WithQuery]+-- cata+_sem_WithQueryList :: WithQueryList ->+ T_WithQueryList+_sem_WithQueryList list =+ (Prelude.foldr _sem_WithQueryList_Cons _sem_WithQueryList_Nil (Prelude.map _sem_WithQuery list))+-- semantic domain+type T_WithQueryList = Catalog ->+ (Either [TypeError] Catalog) ->+ TypeCheckFlags ->+ (Maybe TypeExtra) ->+ ( WithQueryList,(Either [TypeError] Catalog),WithQueryList)+data Inh_WithQueryList = Inh_WithQueryList {_cat_Inh_WithQueryList :: Catalog,_catExtIncomp_Inh_WithQueryList :: (Either [TypeError] Catalog),_flags_Inh_WithQueryList :: TypeCheckFlags,_imCast_Inh_WithQueryList :: (Maybe TypeExtra)}+data Syn_WithQueryList = Syn_WithQueryList {_annotatedTree_Syn_WithQueryList :: WithQueryList,_catExtComp_Syn_WithQueryList :: (Either [TypeError] Catalog),_originalTree_Syn_WithQueryList :: WithQueryList}+_wrap_WithQueryList :: T_WithQueryList ->+ Inh_WithQueryList ->+ Syn_WithQueryList+_wrap_WithQueryList sem (Inh_WithQueryList _lhsIcat _lhsIcatExtIncomp _lhsIflags _lhsIimCast) =+ (let ( _lhsOannotatedTree,_lhsOcatExtComp,_lhsOoriginalTree) = sem _lhsIcat _lhsIcatExtIncomp _lhsIflags _lhsIimCast+ in (Syn_WithQueryList _lhsOannotatedTree _lhsOcatExtComp _lhsOoriginalTree))+_sem_WithQueryList_Cons :: T_WithQuery ->+ T_WithQueryList ->+ T_WithQueryList+_sem_WithQueryList_Cons hd_ tl_ =+ (\ _lhsIcat+ _lhsIcatExtIncomp+ _lhsIflags+ _lhsIimCast ->+ (let _tlOcatExtIncomp :: (Either [TypeError] Catalog)+ _hdOcat :: Catalog+ _lhsOannotatedTree :: WithQueryList+ _lhsOoriginalTree :: WithQueryList+ _lhsOcatExtComp :: (Either [TypeError] Catalog)+ _hdOcatExtIncomp :: (Either [TypeError] Catalog)+ _hdOflags :: TypeCheckFlags+ _hdOimCast :: (Maybe TypeExtra)+ _tlOcat :: Catalog+ _tlOflags :: TypeCheckFlags+ _tlOimCast :: (Maybe TypeExtra)+ _hdIannotatedTree :: WithQuery+ _hdIcolAliases :: (Maybe [NameComponent])+ _hdIname :: Text+ _hdIoriginalTree :: WithQuery+ _hdIupType :: (Maybe [(Text,TypeExtra)])+ _tlIannotatedTree :: WithQueryList+ _tlIcatExtComp :: (Either [TypeError] Catalog)+ _tlIoriginalTree :: WithQueryList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 34, column 9)+ _tlOcatExtIncomp =+ ({-# LINE 34 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ do+ let getWithEx (WithQuery _ _ _ ex) = ex+ upType' <- maybe (Left . anErrs . ann . getWithEx $ _hdIannotatedTree) Right+ _hdIupType+ colTyPairs <- mapM (secondM typeToCatName) upType'+ colTyPairs' <- case _hdIcolAliases of+ Just alsNms -> do+ unless (length alsNms == length colTyPairs) $+ Left [BadCatalogUpdate "number of aliases differs from number of expressions in the select"]+ return $ zip (map ncStrT alsNms) $ map snd colTyPairs+ Nothing -> return colTyPairs+ updateCatalog [CatCreateTable ("public", _hdIname ) colTyPairs'] =<< _lhsIcatExtIncomp+ {-# LINE 29990 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 47, column 9)+ _hdOcat =+ ({-# LINE 47 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ case _lhsIcatExtIncomp of+ Right catExtIncomp -> catExtIncomp+ Left _ -> _lhsIcat+ {-# LINE 29998 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIannotatedTree _tlIannotatedTree+ {-# LINE 30004 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ (:) _hdIoriginalTree _tlIoriginalTree+ {-# LINE 30010 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 30016 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 30022 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (up)+ _lhsOcatExtComp =+ ({-# LINE 29 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _tlIcatExtComp+ {-# LINE 30028 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOcatExtIncomp =+ ({-# LINE 24 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIcatExtIncomp+ {-# LINE 30034 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 30040 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _hdOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 30046 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOcat =+ ({-# LINE 116 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIcat+ {-# LINE 30052 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOflags =+ ({-# LINE 117 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIflags+ {-# LINE 30058 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- copy rule (down)+ _tlOimCast =+ ({-# LINE 129 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _lhsIimCast+ {-# LINE 30064 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ ( _hdIannotatedTree,_hdIcolAliases,_hdIname,_hdIoriginalTree,_hdIupType) =+ hd_ _hdOcat _hdOcatExtIncomp _hdOflags _hdOimCast+ ( _tlIannotatedTree,_tlIcatExtComp,_tlIoriginalTree) =+ tl_ _tlOcat _tlOcatExtIncomp _tlOflags _tlOimCast+ in ( _lhsOannotatedTree,_lhsOcatExtComp,_lhsOoriginalTree)))+_sem_WithQueryList_Nil :: T_WithQueryList+_sem_WithQueryList_Nil =+ (\ _lhsIcat+ _lhsIcatExtIncomp+ _lhsIflags+ _lhsIimCast ->+ (let _lhsOcatExtComp :: (Either [TypeError] Catalog)+ _lhsOannotatedTree :: WithQueryList+ _lhsOoriginalTree :: WithQueryList+ -- "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag"(line 52, column 9)+ _lhsOcatExtComp =+ ({-# LINE 52 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/QueryExprs/QueryExprs.ag" #-}+ _lhsIcatExtIncomp+ {-# LINE 30084 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _annotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 30090 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _originalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ []+ {-# LINE 30096 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOannotatedTree =+ ({-# LINE 118 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _annotatedTree+ {-# LINE 30102 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ -- self rule+ _lhsOoriginalTree =+ ({-# LINE 119 "hssqlppp/src/Database/HsSqlPpp/Internals/TypeChecking/TypeChecking.ag" #-}+ _originalTree+ {-# LINE 30108 "hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.hs" #-}+ )+ in ( _lhsOannotatedTree,_lhsOcatExtComp,_lhsOoriginalTree)))
+ src/Database/HsSqlPpp/Internals/Catalog/CatalogBuilder.lhs view
@@ -0,0 +1,151 @@++> {-# LANGUAGE DeriveDataTypeable,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Internals.Catalog.CatalogBuilder+> (updateCatalog+> ,deconstructCatalog+> -- todo: temporary export before the basecatalog is fixed not to use+> -- the catalog internals+> ,insertOperators+> ) where++>+> import Control.Monad+> --import Data.List+> --import Data.Data+> --import Data.Char+> --import Data.Maybe++> import qualified Data.Map as M+> import qualified Data.Set as S+> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Utils.Utils+> --import Data.Text (Text)+> import qualified Data.Text as T+> --import qualified Data.Text.Lazy as LT++> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Dialects.BaseCatalog+> import Database.HsSqlPpp.Internals.Catalog.CatalogUtils++> -- | Applies a list of 'CatalogUpdate's to an 'Catalog' value+> -- to produce a new Catalog value. TODO: there will be a split+> -- between the individual low level updates which just update+> -- one 'row' in the catalog type, and the high level updates+> -- which correspond to ddl (e.g. create type will also add the+> -- array type, create table will add a table, supply the+> -- private columns automatically, and add the composite type)+> -- highlevel not implemented yet. You must use the correct case and+> -- the canonical names for identifiers/types++> updateCatalog :: [CatalogUpdate]+> -> Catalog+> -> Either [TypeError] Catalog+> updateCatalog eus cat' =+> foldM updateCat' (cat' {catUpdates = catUpdates cat' ++ eus}) eus+> where+> updateCat' cat u = case u of+> CatCreateSchema n ->+> if S.member n (catSchemas cat)+> then Left [SchemaAlreadyExists n]+> else Right $ cat {catSchemas = S.insert n (catSchemas cat)}+> CatCreateScalarType n ->+> if S.member n (catScalarTypeNames cat)+> -- todo: need to check all the type lists+> -- and maybe need to check the name doesn't conflict with pseudo names or something?+> -- this should happen with other cases as well+> -- also: needs to take into account alias, so int and int4 are+> -- both disallowed for new types, and lookup of either finds int4+> then Left [InternalError $ "type already exists: " ++ show n]+> else Right $ cat {catScalarTypeNames = S.insert n (catScalarTypeNames cat)}+> CatCreateDomainType n b ->+> Right $ cat {catDomainTypes = M.insert n b (catDomainTypes cat)}+> CatCreateArrayType n b ->+> Right $ cat {catArrayTypes = M.insert n b (catArrayTypes cat)}+> -- todo: check the uniqueness of operator names (can overload by type)+> -- also check the name of the operator is a valid operator name+> -- and that the op has the correct number of args (1 or 2 resp.)+> CatCreatePrefixOp n lt ret -> do+> ltt <- catLookupType cat [QNmc $ T.unpack lt]+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> Right $ cat {catPrefixOps = insertOperators+> [(n,(n,[ltt],rett,False))]+> (catPrefixOps cat)}+> CatCreatePostfixOp n rt ret -> do+> rtt <- catLookupType cat [QNmc $ T.unpack rt]+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> Right $ cat {catPostfixOps = insertOperators+> [(n,(n,[rtt],rett,False))]+> (catPostfixOps cat)}+> CatCreateBinaryOp n lt rt ret -> do+> ltt <- catLookupType cat [QNmc $ T.unpack lt]+> rtt <- catLookupType cat [QNmc $ T.unpack rt]+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> Right $ cat {catBinaryOps = insertOperators+> [(n,(n,[ltt,rtt],rett,False))]+> (catBinaryOps cat)}++> CatCreateSpecialOp n ps rs ret -> do+> pst <- mapM (\nc -> catLookupType cat [QNmc $ T.unpack nc]) ps+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> let rett' = if rs+> then Pseudo $ SetOfType rett+> else rett+> -- thrown into the binary ops atm, todo: add a new namespace+> Right $ cat {catBinaryOps = insertOperators+> [(n,(n,pst,rett',False))]+> (catBinaryOps cat)}+> CatCreateFunction n ps rs ret -> do+> pst <- mapM (\nc -> catLookupType cat [QNmc $ T.unpack nc]) ps+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> let rett' = if rs+> then Pseudo $ SetOfType rett+> else rett+> Right $ cat {catFunctions = insertOperators+> [(n,(n,pst,rett',False))]+> (catFunctions cat)}+> -- this wraps the last parameter in the array type for now+> CatCreateVariadicFunction n ps rs ret -> do+> let promoteLastType [] = []+> promoteLastType [a] = [ArrayType a]+> promoteLastType (a:as) = a : promoteLastType as+> pst <- promoteLastType `fmap` mapM (\nc -> catLookupType cat [QNmc $ T.unpack nc]) ps+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> let rett' = if rs+> then Pseudo $ SetOfType rett+> else rett+> Right $ cat {catFunctions = insertOperators+> [(n,(n,pst,rett',True))]+> (catFunctions cat)}+> CatCreateAggregate n ps ret -> do+> pst <- mapM (\nc -> catLookupType cat [QNmc $ T.unpack nc]) ps+> rett <- catLookupType cat [QNmc $ T.unpack ret]+> Right $ cat {catAggregateFunctions = insertOperators+> [(n,(n,pst,rett,False))]+> (catAggregateFunctions cat)}+> CatCreateTable n cs -> do+> cts <- mapM (\(cn,te) -> do+> t' <- catLookupType cat [QNmc $ T.unpack $ catName te]+> -- for composite types, the information added here (about precision+> -- and nullability) is redundant+> let te' = TypeExtra t' (catPrecision te) (catScale te) (catNullable te)+> return (cn,te')) cs+> Right $ cat {catTables = M.insert n (cts,[]) (catTables cat)}+> CatCreateCast n0 n1 ctx -> do+> t0 <- catLookupType cat [QNmc $ T.unpack n0]+> t1 <- catLookupType cat [QNmc $ T.unpack n1]+> Right $ cat {catCasts = S.insert (t0,t1,ctx) (catCasts cat)}+> CatCreateTypeCategoryEntry n (c,p) -> do+> t <- catLookupType cat [QNmc $ T.unpack n]+> Right $ cat {catTypeCategories = M.insert t (c,p) $ catTypeCategories cat}++> deconstructCatalog :: Catalog -> [CatalogUpdate]+> deconstructCatalog = catUpdates++> insertOperators :: [(CatName,OperatorPrototype)]+> -> M.Map CatName [OperatorPrototype]+> -> M.Map CatName [OperatorPrototype]+> insertOperators vs m =+> foldr i m vs+> where+> i (k,v) = M.insertWith (++) k [v]
+ src/Database/HsSqlPpp/Internals/Catalog/CatalogInternal.lhs view
@@ -0,0 +1,249 @@++This module contains the implementation of the Catalog data types+and functions, and provides the api for the other type checking+modules.++NEW CATALOG!++create new types from scratch+1st version only supports checking type names+fix the read catalog code+continue to ignore schemas+start handling case sensitivity properly+ignore modifiers++= Catalog overview++The main purpose of the catalog is to support typechecking. A+secondary purpose is to be able to support documentation generation.++== What information does the catalog contain?++types:++base types+names of all types+domains+casts+type categories (what is this?)++tables, views, composite types++operators:+ prefix ops+ postfix ops+ binary ops+ regular fns+ aggregate fns+ window fns+++triggers++indexes++sequences+++> {-# LANGUAGE DeriveDataTypeable,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> (catLookupType+> ,catLookupTableAndAttrs+> ,catGetOpsMatchingName+> -- temp stuff for old typeconversion+> ,catLookupFns+> ,catPreferredType+> ,isOperatorName+> ,catTypeCategory+> ,catCast+> ,catCompositePublicAttrs+> ,catDomainBaseType+> ,typeToCatName+> ) where++>+> --import Control.Monad+> --import Data.List+> --import Data.Data+> --import Data.Char+> import Data.Maybe++> import qualified Data.Map as M+> import qualified Data.Set as S+> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Utils.Utils+> import Data.Text (Text)+> import qualified Data.Text as T+> --import qualified Data.Text.Lazy as LT++> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Internals.Catalog.BaseCatalog+> import Database.HsSqlPpp.Internals.Catalog.CatalogUtils++-----------------------------------++types:++What information does the catalog store and use on types?++The basic set of types recorded here are:++scalar types - the base types implemented outside of plpgsql++domain types - this is a base type with a constraint (can composite+types be used in a domain?)++enum types - the usual. The values are strings and are case+sensitive. I think you can overload the values so they can be members+of more than one enum type++named composite types - these are structs, created using 'create type+x as', and also a composite type is implicitly created for each table+and view definition with the same name as the table or view++array types - not sure exactly how to handle this, generally, postgres+automatically creates an array type for each scalar, domain, composite+and enum type (any others?), and you can't use arrays of something if+the type of the array isn't in the catalog. So lots of other types+can't be made into arrays (what about arrays of arrays? don't+know). Hssqlppp simply assumes that the array type of any type is+available+++None of the types apart from these exist in the same way in postgres -+so unnamed compositetypes, anonymous record type, unknown and pseudo+type are used in less contexts. Maybe one way of looking at them is to+consider them more like type generators which exist simply when they+are used, and don't have to be declared up front. Only the above+privileged types can be used for the types of columns in tables and+views (I think?).++for scalar types, no information is used apart from the fact that a+type with the given name exists and can be referred to.++for domain types, there is also the base type name, and the check+constraint++for enum types, name and the list of labels++for named composite types, you need the name of the type, and the+names and types of the fields++for array types, you only need the base type name, array types don't+have their own separate name++todo: where should this utility live? Probably should be connected +to the dialects++> typeToCatName :: TypeExtra -> Either [TypeError] CatNameExtra+> typeToCatName te = case teType te of+> ScalarType t -> return+> $ CatNameExtra t (tePrecision te) (teScale te) (teNullable te)+> _ -> Left [InternalError "typeToCatName on a non scalar type"]++-----------------------------------------------------------++queries+++gets a schema qualified catname, puts in the default 'public' if there+is only one name component. This will be altered when schema search+paths are implemented.++> getCatName2 :: [NameComponent] -> (CatName,CatName)+> -- todo: don't use error here+> getCatName2 [] = error "empty name component in catalog code"+> getCatName2 [a] = ("public",ncStrT a)+> getCatName2 [a,b] = (ncStrT a, ncStrT b)+> getCatName2 (_:xs) = getCatName2 xs+++TODO: add inverse of this operation, give a type, returns a typename+++> -- | takes a table name, and returns the exact table name (to deal+> -- with quoting), and the public and private attr names+> catLookupTableAndAttrs :: Catalog+> -> [NameComponent]+> -> Either [TypeError] ((Text,Text),[(Text,TypeExtra)], [(Text,Type)])+> catLookupTableAndAttrs cat nmcs = do+> let n = getCatName2 nmcs+> (pu,pv) <- maybe (Left [UnrecognisedRelation n]) Right+> $ M.lookup n (catTables cat)+> return (n,pu,pv)++++> catGetOpsMatchingName :: Catalog -> [NameComponent] -> [OperatorPrototype]+> catGetOpsMatchingName cat nmcs =+> let nm = getCatName nmcs+> in concatMap (\f -> fromMaybe [] $ M.lookup nm $ f cat)+> [catPrefixOps+> ,catPostfixOps+> ,catBinaryOps+> ,catFunctions+> ,catAggregateFunctions+> ,catWindowFunctions]++the TypeConversion module handles checking assignment compatibility,+'resolving result set types', and finding function call matches since+this relies on some heavy algorithms to match postgress really complex+overloading and implicit cast system.+++--------------------------------------------------------++old stuff chucked in to support the old typeconversion, to be promoted+to new code or deleted as typeconversion is rewritten++++> catCompositePublicAttrs :: Catalog -> [CompositeFlavour] -> Text+> -> Either [TypeError] [(Text,TypeExtra)]+> catCompositePublicAttrs cat _flvs ty = do+> (_,a,_) <- catLookupTableAndAttrs cat [Nmc $ T.unpack ty]+> return a++> catPreferredType :: Catalog -> Type -> Either [TypeError] Bool+> catPreferredType cat ty =+> fmap snd $ catGetCategoryInfo cat ty+>+> catCast :: Catalog -> CastContext -> Type -> Type -> Either [TypeError] Bool+> catCast cat ctx from to =+> case from of+> t@(DomainType _) -> do+> baseType <- catDomainBaseType cat t+> cc <- catCast cat ctx baseType to+> return $ (baseType == to) ||+> (cc || S.member (from, to, ctx) (catCasts cat))+> _ -> Right $ S.member (from, to, ctx) (catCasts cat)+>+> catDomainBaseType :: Catalog -> Type -> Either [TypeError] Type+> catDomainBaseType cat (ScalarType ty) =+> case M.lookup ty $ catDomainTypes cat of+> Just n -> Right $ ScalarType n+> Nothing -> Left [DomainDefNotFound $ ScalarType ty]+> catDomainBaseType _cat ty = Left [DomainDefNotFound ty]+>+> catLookupFns :: Catalog -> Text -> [OperatorPrototype]+> catLookupFns cat name =+> catGetOpsMatchingName cat [Nmc $ T.unpack name]++> catTypeCategory :: Catalog -> Type -> Either [TypeError] Text+> catTypeCategory cat ty =+> fmap fst $ catGetCategoryInfo cat ty++> isOperatorName :: Text -> Bool+> isOperatorName = T.any (`elem` ("+-*/<>=~!@#%^&|`?."::String))++> catGetCategoryInfo :: Catalog -> Type -> Either [TypeError] (Text, Bool)+> catGetCategoryInfo cat ty =+> case ty of+> Pseudo (SetOfType _) -> Right ("", False)+> AnonymousCompositeType _ -> Right ("", False)+> ArrayType (Pseudo _) -> Right ("A",False)+> Pseudo _ -> Right ("P",False)+> _ -> case M.lookup ty $ catTypeCategories cat of+> Nothing -> Left [InternalError $ "no type category for " ++ show ty]+> Just x -> Right x
+ src/Database/HsSqlPpp/Internals/Catalog/CatalogNew.lhs view
@@ -0,0 +1,978 @@++This catalog code:++1. is used by the typechecker internally to hssqlppp+2. does most of the validation on ddl updates and provides nice+error message when an update is not valid. It also tracks ownership,+dependencies and models cascade and restrict on drop++The CatalogUpdate's model alter and drop, as well as create. The+CatalogUpdate's are supposed to represent updates after they have been+desugared, so they don't correspond 1-1 with dml statements.++The catalog information is only to model enough for these features,+and e.g. doesn't have enough information for a complete catalog in a+sql dbms, for instance it doesn't track the current value for a+sequence.++The catalog code api follows these principles:+unquoted identifiers must be folded to the correct case for the dialect+ select * from t -> use 't' in postgres, and 'T' in sql server+ for instance+names of built in types must use the canonical names in the current+ dialect for those types+ integer -> int4 in postgres, int in ansi+escapes should already be applied for identifiers and strings+e.g. select * from "my "" table"+ this code should get: some_table_function "my \" table" (using+ haskell escaping)+names must always be schema qualified++This code does no validation on the identifier syntax.++There are separate helper functions to do the case transform,+canonicalize type names and to find the correct schema for a name+given the schema search path.++= supported objects++schemas+scalar types/ externally implemented types/built in types+domain types+composite types+enums+type catagories (used in implicit cast/matching resolution)+prefix,postfix,binary operators+special syntax operations (e.g. between, extract, position)+casts+functions+aggregates+windows+tables+constraints (used for row, table, domain constraints and assertions)+defaults (column defaults)+ constraints and defaults are considered separate objects to tables+ so that they can be dropped as part of a cascade without dropping+ the table with a more straightforward implementation+views+sequences+character sets+collations+roles (for ownership tracking only, permissions todo)++= TODO++understand routines, etc. in ansi+ + variadic, keyword args, function metadata/annotation-like stuff+ polymorphic functions+and types+and these in the main dialects+understand aggregate and windows options+summarize missing objects from sql server, oracle and db2+do the example syntax for all supported operations+detail all the dependency stuff+understand some of the questions like this:+ identifier, schema qualified identifier or string for e.g. character+ set+ do/can roles be in a schema+ +describe the helper apis (apply escapes, fold case, find schema, etc.)+make a list of all the query apis wanted, do the typeid+understand composite types, anonymous, tuples, arrays, multisets+understand what schema various built in objects should be in in+ different dialects+make a detailed spec and start working on it+write a catalog value consistency check function+multiple updates? - can avoid hardcoding the public schema, etc. with+ this++= not currently supported objects++== ansi++routines/procedures (where they differ from functions, I think the+ main thing missing is the function bodies and analysis based on+ these)+transliteration (conversion between character sets?)+trigger+ could use the dependency and some basic checking quite easily+user defined ordering (is this to order composite types?)+transform (conversion between sql representations and host language+ representations of values)+grant (this is on the todo)++missing from postgres:+ conversion+ database+ event trigger+ extensions+ foreign data wrapper+ foreign table+ index+ language+ materialized view+ operator stuff (for indexes?)+ policy (row level permissions)+ rule+ server+ tablespace+ text search stuff+ transform+ trigger+ user mapping++sql server full list:+aggregate+application role+assembly+asymmetric key+availabiltiy group+broker priority+certificate+column encryption key+column master key definition+columnstore index+contract+credential+cryptographic provider+database (azure sql database)+database (sql server)+database audit specification+database encryption key+default+endpoint+event notification+event session+external data source+external file format+external table+federation+fulltext catalog+fulltext index+fulltext stoplist+function+index+login+master key+message type+partition function+partition scheme+procedure+queue+remote service binding+resource pool+role+route+rule+schema+search property list+security policy+selective xml index+sequence+server audit+server audit specification+server role+service+spatial index+statistics+symmetric key+synonym+table+table (azure sql database)+trigger+type+user+view+workload group+xml index+xml schema collection++db2 full list:+alias+audit policy+bufferpool+database partition group+event monitor+event monitor (activities)+event monitor (change history)+event monitor (locking)+event monitor (package cache) statement+event monitor (statistics)+event monitor (threshold violations)+event monitor (unit of work)+event monitor dbactivities+function+function (external scalar)+function (external table)+function (ole db external table)+function (sourced or template)+function (sql scalar, table, or row)+function mapping+global temporary table+histogram template+index+index extension+mask+method+module+nickname+permission+permission csr_row_access on customer+permission teller_row_access on customer+procedure+procedure (external)+procedure (sourced)+procedure (sql)+role+schema+security label+security label component+security policy+sequence+sequence org_seq+server+service class+stogroup+synonym+table+tablespace+threshold+transform+trigger+trusted context+type+type (array)+type (cursor)+type (distinct)+type (row)+type (structurxxxxxxxxxxxxxxxxxxxxxxed)+type mapping+usage list+user mapping+variable+view+work action set+work class set+workload+wrapper++oracle full list:+audit policy (unified auditing)+cluster+context+controlfile+database+database link+dimension+directory+diskgroup+edition+flashback archive+function+index+indextype+java+library+materialized view+materialized view log+materialized zonemap+operator+outline+package+package body+pfile+pluggable database+procedure+profile+restore point+role+rollback segment+schema+sequence+spfile+synonym+table+tablespace+trigger+type+type body+user+view+++what would be nice to add:+triggers are pretty common+indexes are pretty common+synonyms: do a review of these in different dbmss+ what can we support synonyms for:+ not special syntax ops?+ not casts+ what about operator synonyms for functions and vice versa?+ defaults, constraints: doesn't make sense (even though constraints+ do have a name)+ everything else seems like fair game, including synonyms themselves+partition stuff??+global temporary tables?+distinct type: this is like a domain, but cannot be implicitly cast to+ the base type. Does this catalog need to know the difference between+ this and an external type?++= implementation progress notes+++New catalog lower level goals:++updates to the catalog are high level not low level+error checking+supports schemas and search paths properly+object dependencies with cascade and restrict+this catalog will be clear if an object is based on another object in+ the catalog (possibly with a bit of tweaking)+ (for instance, an alias to a type)+ or if the object is 'externally implemented' and its relationship+ with any possible base type is opaque++How should the catalog support syntax? This is needed in:+domain constraints+table constraints+view definitions+also: function/routine bodies++option 1: save them as strings+option 2: parameterize on the scalarexpr and queryexpr?+option 3: hardcode the scalarexp and queryexpr types++the possible benefits to parameterized versions are:+1. don't have to reparse+2. this module doesn't depend on the syntax module+3. this module cannot do anything with the syntax internals++later: add fuzzy matching to all relevant error messages++TODO docs:+how to use this catalog code:+if you have no schemas+if you don't have roles or permissions+if you don't want to use the bootstrap items (public schema, ascii+ charset, binary collation)++> {-# LANGUAGE DeriveDataTypeable #-}+> module Database.HsSqlPpp.Internals.Catalog.CatalogNew+> (CatalogUpdate(..)+> ,Catalog(..)+> ,Cascade(..)+> ,CatError(..)+> ,updateCatalog+> ,emptyCatalog+> ) where++> import qualified Data.Map as M+> import qualified Data.Set as S+> import Data.Data+++> --data TypeId = ...++a TypeId is one of:+astraction of the syntax for type names (probably just cut and paste+ the syntax)+one of these type names with nullablility information+a special type (some are internal):+ polymorphic function parameters+ unknown type used to type check literals (and a few other things) in+ some dialects+ void, used to represent the return type of functions which don't+ return a value+ setof, used to represent the return type of table returning functions+ ... not sure about this+ tref type used in typechecking joins and a few other places (kind of+ an anonymous composite type)++composite types:+ with names and order+ without names+ either single row or 0 or 1 rows, or 0-many rows+what about tuple types?+what about arrays and multisets?++question: should the catalog manage the following:+ if a scale/precision and what kind is allowable/mandatory for a+ type?+ if a type can be used in various operations+ (e.g. does == exist for it, ordering?, can it be used in an array+ or multiset?)++> -- | Represents an error from an invalid catalog update or query+> data CatError = RoleAlreadyExists String+> | RoleNotRecognised String+> deriving (Eq,Show)+++> -- | A schema qualified name. These should also have the+> -- canonicalization, case folding and escaping fixed+> data SchemadName = SN String String+> deriving (Eq,Show)++> -- | The model of a catalog use in hsqlppp for validating ddl+> -- updates and for typechecking sql.+> data Catalog = Catalog+> {cRoles :: S.Set String+> ,cSchemas :: M.Map String CatSchema+> ,cCharacterSets :: M.Map SchemadName CatCharacterSet+> ,cCollations :: M.Map SchemadName CatCollation+> ,cSequences :: M.Map SchemadName CatSequence+> ,cTypeCategories :: S.Set String -- this is internal, used in the+> -- implicit cast/function resolution+> ,cExternalTypes :: S.Set SchemadName -- externally implemented/built in types+> ,cCasts :: S.Set (SchemadName,SchemadName,CastContext)+> ,cFunctions :: M.Map SchemadName [CatFunSig]+> ,cPrefixOps :: M.Map SchemadName [CatFunSig]+> ,cPostfixOps :: M.Map SchemadName [CatFunSig]+> ,cBinaryOps :: M.Map SchemadName [CatFunSig]+> ,cSpecialOps :: M.Map SchemadName [CatFunSig]+> ,cWindows :: Int+> ,cAggregates :: Int+> ,cTables :: M.Map SchemadName [(String,SchemadName)]+> ,cConstraints :: Int+> ,cDefaults :: Int+> ,cViews :: M.Map SchemadName [(String,SchemadName)]+> ,cDomainTypes :: M.Map SchemadName SchemadName+> ,cCompositeTypes :: M.Map SchemadName [(String,SchemadName)]+> ,cEnums :: Int+> -- dependencies?+> }+> deriving (Eq,Show)++> data CastContext = ImplicitCastContext+> | AssignmentCastContext+> | ExplicitCastContext+> deriving (Eq,Show,Ord,Typeable,Data)++> -- | owner, default char set, default collation (if it+> -- is nothing, it is the global collation for the charset+> type CatSchema = (RoleName, String, Maybe String)++> -- | Character set: name, owner, default collation+> type CatCharacterSet = (RoleName, String)++> -- | Collation: owner, character set+> type CatCollation = (RoleName,String)++> -- | sequence info: data type+> -- this is used e.g. if we need to use an implicit+> -- cast around a call to 'next value for'.+> type CatSequence = SchemadName++> type CatFunSig = (SchemadName,[SchemadName],SchemadName{-,Options-})+> --type FunOptions = ++> -- | A catalog value containing nothing+> emptyCatalog :: Catalog+> emptyCatalog = Catalog {cRoles = S.empty+> ,cSchemas = M.empty+> ,cCharacterSets = M.empty+> ,cCollations = M.empty+> ,cSequences = M.empty+> ,cTypeCategories = S.empty+> ,cExternalTypes = S.empty+> ,cCasts = S.empty+> ,cFunctions = M.empty+> ,cPrefixOps = M.empty+> ,cPostfixOps = M.empty+> ,cBinaryOps = M.empty+> ,cSpecialOps = M.empty+> ,cWindows = 0+> ,cAggregates = 0+> ,cTables = M.empty+> ,cConstraints = 0+> ,cDefaults = 0+> ,cViews = M.empty+> ,cDomainTypes = M.empty+> ,cCompositeTypes = M.empty+> ,cEnums = 0+> }++> updateCatalog :: CatalogUpdate -> Catalog -> Either CatError Catalog+> updateCatalog (CreateRole r) c@(Catalog {cRoles = rs})+> | r `S.member` rs = Left $ RoleAlreadyExists r+> | otherwise = Right $ c {cRoles = S.insert r rs}++> updateCatalog (DropRole r _) c@(Catalog {cRoles = rs})+> | not (r `S.member` rs) = Left $ RoleNotRecognised r+> | otherwise = Right $ c {cRoles = S.delete r rs}++todo: cascade the rename++> updateCatalog (RenameRole r rn) c@(Catalog {cRoles = rs})+> | not (r `S.member` rs) = Left $ RoleNotRecognised r+> | rn `S.member` rs = Left $ RoleAlreadyExists rn+> | otherwise = Right $ c {cRoles = S.insert rn $ S.delete r rs}++> updateCatalog _ _ = error "update catalog not completed yet"+++> type RoleName = String+++used for dependencies:++> --data ObjectType = ...++now the dependencies can be tracked in one table++> data CatalogUpdate =++create schema _name_ [authorization _role_]+ [DEFAULT CHARACTER SET 'character set' [collate c]]++character sets are strings and not identifiers atm+roles are identifiers but don't exist in a schema or database (since+this catalog only covers a single database at a time, they look like+they exist in a database)++not going to support path for schema right now (I think this is+supposed to be for the bodies of routines in that schema, maybe it+could also be for all lookups for schema elements (such as views)++question: should there be a database default search path? one that can+contain variables (e.g. a schema with the same name as the current+user?) This would be the default for sessions. You cannot enter a+schema, so the schema default search path works differently.++question: I think in some dialects, character set names are+identifiers or schema-d identifiers (and collations also), and in+others they are strings. How should this be handled?++todo: add object dependencies to the updates (from dependent to+depended-upon in the dependent). Try to make these automatic as much+as possible.++list schemas+create schema: schema already exists+ character set invalid+ collation not valid+ auth not valid+later: more schema-based queries++question: how does a minimal catalog start out?+1. has a schema called public+2. has a global default character set called ascii+3. has a collation called binary for that character set+4. has a role called public which owns the above++In the tests, show an example of creating a catalog from this default+ without the public schema or role still existing+ and without the character set and collation++> CreateSchema String (Maybe (SchemadName,SchemadName)) RoleName++schema name, (default char set, default collation for that character set in+that schema), owner++> | RenameSchema String String+> | SetSchemaOwner String RoleName+> | SetSchemaDefaultCharacterSet (Maybe (SchemadName,SchemadName))++what happens when you change this default: existing columns are not+changed (there could be some utility to change them all for+consistency. This would mean storing a uses default flag on each+relevent place also).++> | DropSchema String Cascade++= Roles++roles are used for ownership tracking only at the moment++create role my_role;+drop role my_role;+alter role my_role rename to my_new_role;++dependencies: todo++anomalies: role already exist+ role doesn't exist++queries: list roles++> | CreateRole RoleName+> | DropRole RoleName Cascade+> | RenameRole RoleName RoleName -- from, to++= Collations and character sets++This code doesn't track character set and collation aliases++collations appear in separate namespaces according to their character+set, so you can have different collations for different character sets+with the same name++this catalog code will create a collation called 'binary' for each new+character set. If you don't want this collation, you can delete it+after creating another collation for the new character set, or rename+the collation. This is one way to avoid the catch-22 which can also+work for sql users.++create character set my_character_set+create character set my_character_set as get another_character_set+create character set my_character_set as 'some external source'+create character set my_character_set as 'some external source' collate 'some other external source'+create collation my_collation for my_character_set from some external source [set as default?]+alter character set set default collation 'collation_name'++drop character set+drop collation++alter character set my_set set schema my_schema+alter collation my_coll set schema my_schema+rename for both+set owner for both++question: does a character set have to have a collation?++dependencies: todo++queries:+list character sets (returns owner also)+list collations (returns the owner and character sets also)+lookup collation/ is collation valid for character set+get character set default collation++anomalies:+role no exist+already exist+doesn't exist+maybe nice message when schema is ambiguous, when collation is in another schema?+ as well as fuzzy name matching++> | CreateCharacterSet SchemadName RoleName+> | CreateCollation SchemadName SchemadName RoleName --second is the character set this collation is for+>+> | DropCollation SchemadName SchemadName Cascade -- the first is the character set this collation is for+> -- the front end can make this optional in the concrete+> -- syntax iff+> -- there is only+> -- one collation+> -- with this+> -- name for+> -- instance+> | DropCharacterSet SchemadName Cascade+> | RenameCharacterSet SchemadName SchemadName -- covers schema changes and name changes+> | RenameCollation SchemadName SchemadName SchemadName -- char set name, collation name, new collation name+> | SetCharacterSetOwner SchemadName RoleName+> | SetCollationOwner SchemadName SchemadName RoleName -- char set name, collation name+> | SetCharacterSetDefaultCollation SchemadName SchemadName++= basic types++TODO: understand basic syntax and semantics of types in ansi sql++-- external type represents a type whose implementation is outside the+-- system completely, either it is built in or implemented in C for+-- instance++-- external types can also be modelled using the other types such as+-- domain, compose, enum if this matches their behaviour++> {- | CreateExternalType SchemadName++> | CreateDomainType SchemadName SchemadName -- name, base name++> | CreateCompositeType++> | CreateEnum+++ a type category for each of the above++ a bool to say whether it is the preferred type for that category+todo: how can these be changed? is there a reason to change them+what about the ability to wipe the prefered type for a category only,+then other operations can be sugar on this+what about altering a type to set it as prefered or not preferred or+to change its type category++> | CreateTypeCategory+> | AlterTypeCategory?+> | DropTypeCategory++++> | DropType+> | AlterType - rename+> | AlterCompositeType - add, reorder or remove columns+> | AlterEnum - add, reorder or remove enum values++= scalar operations++by convention, it supports keyword operations as prefix,postfix or+binary if they match these, and if the operator is more than one+keyword separated by space then the name in the catalog is the+keywords separated by exactly one space each in lower case. Operators+which don't fit this set of options (such as mixfix or ternary+operators go in the SpecialOperators and are handled as special cases)++prefix, postfix, binary operators++> | CreatePrefixOp String String String String -- op schema, op name,+> -- input type schema, input type name, output type schema,name++> | CreatePostfixOp String String String String -- op schema, op name,+> -- input type schema, input type name, output type schema,name++> | CreateBinaryOp+> | DropPrefixOp, PostfixOp, BinaryOp++> | CreateSpecialOp -- should the list of names be a enum?+> -- if it is freeform, then the catalog doesn't need to know as much+> -- about the syntax, which is a good thing++> | CreateCast+> | DropCast+> | AlterCast? - doesn't seem like there is a real point++> | CreateFunction+> | AlterFunction - rename, change some metadata?++> -}+> deriving (Eq,Show)++aggregates+windows+tables+views+sequences+character sets+collations+roles+++> data Cascade = Cascade | Restrict+> deriving (Eq,Show)+++this e.g. is the return value when you want to get all the information+on a type. some of this information is contained in the typeid syntax,+and some is stored in the catalog or environment++> --data TypeInfo = ...++is scalar+precision, scale, nullability+char set, collation+isdomain, domain base, domain constraint+is composite, fields in the composite++++= dependencies, cascade, restrict++roles+schema+character set+collation+sequence+type category+external types+cast+functions, operators, windows, aggregates+tables+ constraints+ defaults+views+domain types+composite types+enums++question: what about ownership of dependencies, and does changing+owner ever cascade? (Maybe these are separate helper fns?)++rough set of cascade flavours:+1. remove connection, leave depender existing+2. update connection to point to new value (for alter)+3. drop the depender object (recursively to its dependents)++for alter, can use 1 or 2+for drop can use 2 or 3+policy it: make each version options on the updates, then a dialect or+some other code can decide which behavior to use++in order to track dependencies:++create separate concept of constraints so we can handle table and+domain constraints the same (plus assertions?)++maybe have a concept of a sql body or something to model constraints,+as well as view definitions and function bodies referencing things via+sql statements syntax + column defaults++things to add to this catalog:+constraints+defaults+character set conversions? - if we want to type check string+ operations a bit better++== schemas++alter and drop schema can restrict or cascade to schema objects:+all other catalog supported objects appear in a schema apart from+ roles+rename schema just cascades automatically, there is no restrict option+ there can be a generic has dependencies or list dependencies+ function to implement a restrict like this+set default character set will affect the character set of new:+ table columns, domains, views (in some obscure cases), composite+ types+ no existing objects will be changed to match the new characterset/collation+ they must be altered separately+set schema owner will not cascade to objects in the schema, or will??+ not sure, maybe just objects which are owned by a role with the same+ name as the schema? add this as an option?+drop schema will not work if any objects owned by the schema on restrict+ it will drop them also if on cascade++== role++rename role cascades automatically, no options+drop role will restrict if there are any objects owned+cascade drop role will drop all owned items+there can be a util to show all owned items+and to reown them to another role easily++later will have role membership in other roles to do shared ownership+and group permissions, this will work slightly differently for drop:++a dropped role will simply be removed from any roles it is in without+affecting them: only option++a dropped role will other roles in it: those roles will just be+removed from this role. Restrict can be used to not allow dropping the+role++permissions for a being dropped role will always be dropped also++== character set++dependencies:+table column+domain+schema - default char set+database - default char set+collations - belong to a single character set+types: each character type can have a whitelist or blacklist of+ allowed character sets+views will depend only indirectly+composite types++rename:+always cascades++alter default collation:+doesn't affect the collation on any existing dependencies++drop restrict:+if character set is used anywhere above, restrict will stop the drop+ (apart from types blacklist or whitelist, this char set will be+ removed from these lists and the drop will succeed (if it has no+ other dependencies)+drop cascade:+will delete:+tables(!)+domains+schema will always block??+database will definitely always block: you must set another default+ char set to drop the current default one+collations+types: same as restrict, types are not dropped+composite types are dropped (could be very destructive!)++== collation++dependencies:+character set default collation+table and domain collation on char type, composite type also+collation on default char set for database and schemas++drop restrict:+any use of collation will stop the drop++drop cascade:+will drop the character set (!)+will drop tables, domains, and composites (!)+will drop schema (!) - maybe these behaviours should be same as character sets?+cannot drop database, so must restrict this++== sequence++dependencies:+tables+functions+views+domains? - could reference the sequence in the constraint?++drop restrict:+if the sequence is reference in any of the above, the drop is stopped++drop cascade:+views, functions dropped+option table can be dropped (!) or the defaults/constraints dropped+same with domain++== type category++dependencies:+types++a type can have the default category which means no category++drop restrict:+if used in any types, cannot drop++drop cascade:+option 1: types categories changed to default+option 2: types are dropped++== external types++dependencies:+domains+functions+tables+views+composite types++restrict: if used anywhere, drop prevented+cascade: all dependents dropped++== cast++dependencies:+can be used in constraints or views++restrict: drop stopped+cascade, drops constraint and views also++== functions, operators, windows, aggregates++each function can have a set of dependencies supplied by the calling+code this represents e.g. the tables, functions, etc. referenced in+the body of the function. This is to help with cascade/restrict+behaviour.++what can a function depend on? what can't a function directly depend+on:+itself+type category++that's it. Potentially anything else. Unusual (direct) dependencies+would be: schema, roles, constraints, defaults.+++== tables++== constraints++== defaults+== views+== domain types+== composite types+== enums+
+ src/Database/HsSqlPpp/Internals/Catalog/CatalogTypes.lhs view
@@ -0,0 +1,192 @@++> {-# LANGUAGE DeriveDataTypeable,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> (+> -- catalog type plus values+> Catalog(..)+> ,emptyCatalog+> ,NameComponent(..)+> ,ncStr+> ,ncStrT+> ,CompositeFlavour(..)+> ,CatName+> ,CatNameExtra(..)+> ,mkCatNameExtra+> ,mkCatNameExtraNN+> -- catalog updates+> ,CatalogUpdate(..)+> -- temp stuff for old typeconversion+> ,OperatorPrototype++> ,CastContext(..)+> ) where++> --import Control.Monad+> --import Data.List+> import Data.Data+> import Data.Char+> --import Data.Maybe++> import qualified Data.Map as M+> import qualified Data.Set as S+> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Utils.Utils+> import Data.Text (Text)+> import qualified Data.Text as T+> --import qualified Data.Text.Lazy as LT++> -- | represents the name of something in the catalog, when schema+> -- support is added then this will change to (String,String)+> type CatName = Text+> -- | type name and precision and nullability+> data CatNameExtra = CatNameExtra {+> catName:: CatName,+> catPrecision:: Maybe Int,+> catScale:: Maybe Int,+> catNullable:: Bool+> } deriving (Eq,Ord,Show,Typeable,Data)+> mkCatNameExtra:: CatName -> CatNameExtra+> mkCatNameExtra cn = CatNameExtra cn Nothing Nothing True+> mkCatNameExtraNN:: CatName -> CatNameExtra+> mkCatNameExtraNN cn = CatNameExtra cn Nothing Nothing False++> data CompositeFlavour = Composite | TableComposite | ViewComposite+> deriving (Eq,Show,Ord,Data,Typeable)+++---------------------------------------------------------------++operators++operators is used as the generic term for all sorts of function things:+prefix, postfix, binary operators, functions, aggregate functions and+window functions++The information currently stored is:+name, parameter types, return type and variadic flag++> -- | name, inparams, outtype, is variadic?+> type OperatorPrototype = (CatName, [Type], Type, Bool)++> -- | The main datatype, this holds the catalog and context+> -- information to type check against.+> data Catalog = Catalog+> {catSchemas :: S.Set CatName+> ,catScalarTypeNames :: S.Set CatName -- one name component per type+> ,catDomainTypes :: M.Map CatName CatName -- stores the base type name+> -- constraint is stored separately+> --,catEnumTypes :: {[(String,[String])]}+> ,catCompositeTypes :: M.Map CatName+> (CompositeFlavour+> ,[(Text,CatNameExtra)] -- public attrs+> ,[(Text,CatName)])-- system columns+> ,catArrayTypes :: M.Map CatName CatName --pg array type name, base type name+> ,catPrefixOps :: M.Map CatName [OperatorPrototype]+> ,catPostfixOps :: M.Map CatName [OperatorPrototype]+> ,catBinaryOps :: M.Map CatName [OperatorPrototype]+> ,catFunctions :: M.Map CatName [OperatorPrototype]+> ,catAggregateFunctions :: M.Map CatName [OperatorPrototype]+> ,catWindowFunctions :: M.Map CatName [OperatorPrototype]+> ,catTables :: M.Map (CatName,CatName)+> ([(Text,TypeExtra)] -- public attrs+> ,[(Text,Type)]) -- system columns+> -- needs more work:+> ,catCasts :: S.Set (Type,Type,CastContext)+> ,catTypeCategories :: M.Map Type (Text,Bool)+> -- save the updates+> ,catUpdates :: [CatalogUpdate]+> }+> deriving (Eq,Show,Data,Typeable)+++> -- | Use to note what the flavour of a cast is, i.e. if/when it can+> -- be used implicitly.+> data CastContext = ImplicitCastContext+> | AssignmentCastContext+> | ExplicitCastContext+> deriving (Eq,Show,Ord,Typeable,Data)+++> -- | Represents an empty catalog.+> emptyCatalog :: Catalog+> emptyCatalog = Catalog S.empty S.empty M.empty M.empty M.empty+> M.empty M.empty+> M.empty M.empty M.empty M.empty M.empty+> S.empty M.empty+> []+++--------------------------------------------------+++name component - this represents quoted and unquoted+possibly-qualified names (so names of things are lists of+namecomponents). Perhaps should be a syntactic namecomponent which is+in AstInternal, and a semantic namecomponent which is used here, but I+am lazy so the same type is shared.++The name components are only used here so that the logic for ignoring+or respecting case is in one place, these are only used in the query+functions and not in catalog values themselves.++> data NameComponent = Nmc String+> | QNmc String -- quoted+> | AntiNameComponent String+> deriving (Data,Eq,Show,Typeable,Ord)+> -- this is a transition function+> -- it should be removed when ready, since all the code+> -- should be working with NameComponents directly+> ncStr :: NameComponent -> String+> ncStr (Nmc n) = map toLower n+> ncStr (QNmc n) = n+> ncStr (AntiNameComponent _n) =+> error "tried to get the name component string of an anti name component"++> ncStrT :: NameComponent -> Text+> ncStrT (Nmc n) = T.pack $ map toLower n+> ncStrT (QNmc n) = T.pack n+> ncStrT (AntiNameComponent _n) =+> error "tried to get the name component string of an anti name component"+++todo: use left or something instead of error++------------------------------------------------------++ updates++> data CatalogUpdate =+> -- | register a schema with the given name+> CatCreateSchema CatName+> -- | register a base scalar type with the given name+> | CatCreateScalarType CatName+> -- | register a domain type with name and base type+> | CatCreateDomainType CatName CatName+> -- | register an array type with name and base type+> | CatCreateArrayType CatName CatName+> -- | register a prefix op, opname, param type, return type+> | CatCreatePrefixOp CatName CatName CatName+> -- | register a postfix op, opname, param type, return type+> | CatCreatePostfixOp CatName CatName CatName+> -- | register a binary op, opname, the two param types, return type+> | CatCreateBinaryOp CatName CatName CatName CatName+> -- | register a function: name, param types, retsetof, return type+> | CatCreateFunction CatName [CatName] Bool CatName+> -- | register a variadic function: name, param types, retsetof, return type+> -- the last parameter will be wrapped in an array type+> | CatCreateVariadicFunction CatName [CatName] Bool CatName+> -- | special ops include between, substring, position, basically+> -- all operators/functions which use mixfix or extra syntax+> -- (not including non scalar functions like aggregates)+> | CatCreateSpecialOp CatName [CatName] Bool CatName++> -- | register a aggregate: name, param types, return type+> | CatCreateAggregate CatName [CatName] CatName+> -- | register a table only: name, (colname,typename) pairs+> | CatCreateTable (CatName,CatName) [(CatName,CatNameExtra)]+> -- | register a cast in the catalog+> | CatCreateCast CatName CatName CastContext+> -- | register a type category for a type (used in the implicit cast resolution)+> | CatCreateTypeCategoryEntry CatName (Text,Bool)+> deriving (Eq,Ord,Typeable,Data,Show)
+ src/Database/HsSqlPpp/Internals/Catalog/CatalogUtils.lhs view
@@ -0,0 +1,71 @@++some utilities which are used by catalog builder and by catalog+internals++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Internals.Catalog.CatalogUtils+> (catLookupType, getCatName) where++> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Control.Monad+> --import Data.List+> --import Data.Data+> --import Data.Char+> --import Data.Maybe++> import qualified Data.Map as M+> import qualified Data.Set as S+> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Utils.Utils+> --import Data.Text (Text)+> --import qualified Data.Text as T+> --import qualified Data.Text.Lazy as LT+> --import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Dialects.BaseCatalog++names to refer to the pseudo types. This is very postgresql+specific. Some of these should be deleted since hssqlppp has nothing+to do with them. Some of them will become postgresql dialect specific+and not appear here, and some we will repurpose to implement features+for non-postgresql dialects as well.++> pseudoTypes :: M.Map CatName Type+> pseudoTypes = M.fromList+> [("any",Pseudo Any)+> ,("anyarray",Pseudo AnyArray)+> ,("anyelement",Pseudo AnyElement)+> ,("anyenum",Pseudo AnyEnum)+> ,("anyrange",Pseudo AnyRange)+> ,("anynonarray",Pseudo AnyNonArray)+> --,("cstring",Pseudo Cstring)+> ,("record",Pseudo (Record Nothing))+> --,("trigger",Pseudo Trigger)+> -- todo: fix this?+> --,("event_trigger",Pseudo Trigger)+> ,("void",Pseudo Void)+> --("_cstring",ArrayType $ Pseudo Cstring)+> ,("_record",ArrayType $ Pseudo (Record Nothing))+> --,("internal",Pseudo Internal)+> --,("language_handler", Pseudo LanguageHandler)+> --,("opaque", Pseudo Opaque)+> --,("fdw_handler", Pseudo FdwHandler)+> ]++> -- | takes a [NameComponent] and returns the type for that name+> -- will return a type not recognised if the type isn't in the catalog+> catLookupType :: Catalog -> [NameComponent] -> Either [TypeError] Type+> catLookupType cat ncs =+> case getCatName ncs of+> -- check if is a pseudo type+> cn | Just p <- M.lookup cn pseudoTypes -> Right p+> -- check for base, domain, enum or composite, and array+> | S.member cn (catScalarTypeNames cat) -> Right $ ScalarType cn+> | M.member cn (catDomainTypes cat) -> Right $ DomainType cn+> | M.member cn (catCompositeTypes cat) -> Right $ NamedCompositeType cn+> | Just t <- M.lookup cn (catArrayTypes cat) -> Right $ ArrayType $ ScalarType t+> | otherwise -> Left [UnknownTypeName cn]++> getCatName :: [NameComponent] -> CatName+> getCatName [] = error "empty name component in catalog code"+> getCatName [x] = ncStrT x+> getCatName (_:xs) = getCatName xs
+ src/Database/HsSqlPpp/Internals/Dialect.lhs view
@@ -0,0 +1,174 @@+++New approach to dialacts, more rule driven so all the options for a+dialect can appear here.++It would be nice to make the dialects completely rule driven, but I+think this is much less maintainable than making them mainly rule+driven (primarily via the catalogs), but with some special cases+scattered in the source code.++The dialect contains:+the name of the dialect+some parsing options about what syntax is supported+some options about typechecking support++flags to control the details of the dialect (for instance, some+dialects have additional options to specify which kinds of string+literal escapes are valid, so this is like subdialect++stuff about types:++canonical names of types with multiple names (these are only the+built in types, user/catalog driven type aliases are not covered here)+the built in text types+the built in datetime types++default catalog for this dialect+++then supplied with hssqlppp are:+base dialect with minimal stuff in it+ansi2011 dialect+recent-ish postgresql dialect+recent-ish sql server dialect+recent-ish oracle dialect++the idea is that if you have one of these dialects, you can start here+then add your own catalog entries and use it as is. If your dialect is+not here, and is it similar enough to an existing dialect, you can+take that dialect and+ a) modify some of the dialect options+ b) modify the default catalog+ and you will get something useful++if the dialect is too different, then you will have to edit the+hssqlppp source.++> {-# LANGUAGE DeriveDataTypeable #-}+> module Database.HsSqlPpp.Internals.Dialect+> (Dialect(..)+> ,SyntaxFlavour(..)+> ,canonicalizeTypeName+> ,ansiTypeNameToDialect) where++> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> import Data.Data+> import Data.Text (Text)+> import qualified Data.Text as T+> import Data.List (find)+> import Data.Char (toLower)++> data Dialect = Dialect+> {diName :: String++represent the syntax variations with a crude enum. Later, can make+this more rule driven.++> ,diSyntaxFlavour :: SyntaxFlavour++map from alternative names to the canonical name of built in+types. This is used e.g. because in ansi the canonical name of boolean+type is 'boolean', and in postgresql the canonical name of this type+is 'bool'.+These should all be in lower case++> ,diCanonicalTypeNames :: [(Text,[Text])]++the names of the built in text types. This is used to help type check+built in functions like substring?++> ,diTextTypes :: [Text] -- names of the text types (canonical names must be used)++used to typecheck things like extract++todo: create a single function which takes the ansi name of a type and+returns the dialect specific name (as a maybe) - then don't have to+have a huge number of functions here.++Also, these functions should be -TypeName not -Type.++> ,diDatetimeTypes :: [Text]+> ,diNumberTypes :: [Text] -- names of the number types (canonical names must be used)+> -- this is a map from the canonical ansi name (in hssqlppp)+> -- to the canonical name in the dialect+> -- if there is no entry, then it means that type isn't+> -- supported in this dialect++todo: make a list of exactly what type names are needed in the type+checker and why. This should only be used for the type checker+internally, and not anywhere else. Should do the same for the+other fields above++> ,namesForAnsiTypes :: [(Text,Text)]++A small issue with having the default catalog like this is that we can+make a programming error where we have a function which takes the+dialect and a catalog, and we use this default catalog instead of the+supplied updated catalog.++> ,diDefaultCatalog :: Catalog+> } deriving (Eq,Show,Data,Typeable)++> data SyntaxFlavour = Ansi | Postgres | SqlServer | Oracle+> deriving (Eq,Show,Data,Typeable)++> ansiTypeNameToDialect :: Dialect -> Text -> Maybe Text+> ansiTypeNameToDialect d n = lookup n (namesForAnsiTypes d)++> canonicalizeTypeName :: Dialect -> Text -> Text+> canonicalizeTypeName d s =+> let m = diCanonicalTypeNames d+> in ct m s+> where+> hasType t p = let t' = T.map toLower t+> in t' `elem` snd p+> ct m tn = maybe tn fst+> $ find (hasType tn) m++TODO:+modify the catalog:+ when adding a type flags to say:+ if this type is a text or datetime or number type+ if it is built in+ if it is undroppable+ if it has a list of builtin aliases+ what the ansi equivalent type name is++this will get rid of most of the fields in the dialect and make it+much easier to keep everything consistent and maintainable++start adding flags for which bits of syntax to support instead of+using the syntax flavour thing+there will be flags like this for typechecking also++support functions to help create minimal dialects+ e.g. take ansi, and safely remove a bunch of types and functions++write the default catalogs and dialects all in one file+ (they are split into two at the moment)++export the ansidialect every module that exposes something with a+dialect (function or data type) - parse, pretty, lex, typecheck, etc.++then you only need to import the dialects module to get the other+dialects++consider how the catalog in the dialect can help with parsing+operators++minimal dialects:+mainly missing types then following through on implications:+no text types+only one text type covering char,varchar,nclob, etc.+no numeric or decimal+on decimal for all integers and precise decimals+no date or time types+++Types:+typeextra: needs fixing+how to represent e.g. 'varchar' without precision++invent some sort of concrete syntax (which is parseable) to+represent implicit casts (cast implicit x as varchar)?
+ src/Database/HsSqlPpp/Internals/LexInternal.lhs view
@@ -0,0 +1,552 @@++> {-# LANGUAGE TupleSections,OverloadedStrings #-}+> module Database.HsSqlPpp.Internals.LexInternal+> (Token(..)+> ,prettyToken+> ,lexToken+> ,lexTokens+> ) where++> --import qualified Data.Text as T+> import qualified Data.Text.Lazy as LT+> import Text.Parsec+> --Cimport Text.Parsec.String hdi+> import Text.Parsec.Text.Lazy+> import Control.Applicative hiding ((<|>), many)+> import Data.Char+> import Database.HsSqlPpp.Internals.Dialect+> import Control.Monad+> import Prelude hiding (takeWhile)+> import Data.Maybe++> -- | Represents a lexed token+> data Token+> -- | a symbol in postgresql dialect is one of the following:+> --+> -- * one of the characters (),;[]{} (the {} is for odbc)+> --+> -- * \'..\' or \':=\' or \'.\' or \':\'+> --+> -- * a compound symbol, which starts with one of \'*\/\<>=~!\@#%^&|\`?+-' and follows with 0 or more of '*\/<>=~!\@#%^&|\`?'+> --+> -- things that are not lexed as symbols:+> --+> -- * [] used in quoted identifiers, prefix \@,#,: used in identifiers+> --+> -- * $n positional arg+> --+> = Symbol String+>+> -- | This is an identifier or keyword.+> --+> -- The 'Maybe (Char,Char)' selects the quoted style - 'Nothing' means the+> -- identifier was unquoted+> -- otherwise the two characters are the start and end quote.+> --+> -- \'\"\' is used to quote identifiers in standard sql, sql server also uses [brackets]+> -- to quote identifiers.+> --+> -- The identifier also includes the \'variable marker prefix\'+> -- used in sql server (e.g. \@identifier, #identifier), and oracle+> -- (e.g. :identifier)+> | Identifier (Maybe (String,String)) String+>+> -- | This is a prefixed variable symbol, such as :var, @var or #var+> -- (only :var is used in ansi dialect)+> | PrefixedVariable Char String+>+> -- | a postgresql positional arg, e.g. $1+> | PositionalArg Int+>+> -- | This is a string literal.+> --+> -- The first field is the quotes used: single quote (\')+> -- for normal strings, E' for escape supporting strings,+> -- and $$ delimiter for postgresql dollar quoted strings.+> --+> -- The lexer doesn't process the escapes in strings, but passes+> -- on the literal source e.g. E\'\\n\' parses to SqlString \"E\'\" \"\\n\"+> -- with the literal characters \'\\\' and \'n\' in the string, not a newline character.+> -- quotes within a string (\'\') or escaped string (\'\' or \\\') are passed through unchanged+> | SqlString String String String+>+> -- | a number literal (integral or otherwise), stored in original format+> -- unchanged+> | SqlNumber String+>+> -- | non-significant whitespace (space, tab, newline) (strictly speaking,+> -- it is up to the client to decide whether the whitespace is significant+> -- or not)+> | Whitespace String+>+> -- | a commented line using --, contains every character starting with the+> -- \'--\' and including the terminating newline character if there is one+> -- - this will be missing if the last line in the source is a line comment+> -- with no trailing newline+> | LineComment String+>+> -- | a block comment, \/* stuff *\/, includes the comment delimiters+> | BlockComment String+>+> -- | an antiquotation splice, e.g. $x(stuff)+> | Splice Char String+>+> -- | the copy data in a copy from stdin+> | CopyPayload String+> deriving (Eq,Show)++> -- | Accurate pretty printing, if you lex a bunch of tokens,+> -- then pretty print them, should should get back exactly the+> -- same string+> prettyToken :: Dialect -> Token -> String+> prettyToken _ (Symbol s) = s+> prettyToken _ (Identifier Nothing t) = t+> prettyToken _ (Identifier (Just (a,b)) t) = a ++ t ++ b+> prettyToken _ (PrefixedVariable c s) = c:s+> prettyToken _ (SqlString q r t) = q ++ t ++ r+> prettyToken _ (SqlNumber r) = r+> prettyToken _ (Whitespace t) = t+> prettyToken _ (PositionalArg n) = '$':show n+> prettyToken _ (LineComment l) = l+> prettyToken _ (BlockComment c) = c+> prettyToken _ (Splice c t) = '$':c:'(':t ++ ")"+> prettyToken _ (CopyPayload s) = s ++ "\\.\n"+++not sure how to get the position information in the parse errors++TODO: try to make all parsers applicative only+investigate what is missing for postgresql+investigate differences for sql server, oracle, maybe db2 and mysql+ also++> lexTokens :: Dialect -> FilePath -> Maybe (Int,Int) -> LT.Text -> Either ParseError [((FilePath,Int,Int),Token)]+> lexTokens dialect fn' mp txt =+> let (l',c') = fromMaybe (1,1) mp+> in runParser (setPos (fn',l',c') *> many_p <* eof) () "" txt+> where++pretty hacky, want to switch to a different lexer for copy from stdin+statements++if we see 'from stdin;' then try to lex a copy payload++> many_p = some_p `mplus` return []+> some_p = do+> tok <- lexToken dialect+> case tok of+> (_, Identifier Nothing t) | map toLower t == "from" -> (tok:) <$> seeStdin+> _ -> (tok:) <$> many_p+> seeStdin = do+> tok <- lexToken dialect+> case tok of+> (_,Identifier Nothing t) | map toLower t == "stdin" -> (tok:) <$> seeColon+> (_,x) | isWs x -> (tok:) <$> seeStdin+> _ -> (tok:) <$> many_p+> seeColon = do+> tok <- lexToken dialect+> case tok of+> (_,Symbol ";") -> (tok:) <$> copyPayload+> _ -> (tok:) <$> many_p+> copyPayload = do+> p' <- getPosition+> let pos = (sourceName p',sourceLine p', sourceColumn p')+> tok <- char '\n' *>+> ((\x -> (pos, CopyPayload $ x ++ "\n"))+> <$> manyTill anyChar (try $ string "\n\\.\n"))+> --let (_,CopyPayload t) = tok+> --trace ("payload is '" ++ T.unpack t ++ "'") $ return ()+> (tok:) <$> many_p+> setPos (fn,l,c) = do+> fmap (flip setSourceName fn+> . flip setSourceLine l+> . flip setSourceColumn c) getPosition+> >>= setPosition+> isWs :: Token -> Bool+> isWs (Whitespace {}) = True+> isWs (BlockComment {}) = True+> isWs (LineComment {}) = True+> isWs _ = False++> -- | parser for a sql token+> lexToken :: Dialect -> Parser ((FilePath,Int,Int),Token)+> lexToken d = do+> p' <- getPosition+> let p = (sourceName p',sourceLine p', sourceColumn p')+> (p,) <$> choice [sqlString d+> ,identifier d+> ,lineComment d+> ,blockComment d+> ,sqlNumber d+> ,positionalArg d+> ,dontParseEndBlockComment d+> ,prefixedVariable d+> ,symbol d+> ,sqlWhitespace d+> ,splice d]++Parses identifiers:++simple_identifier_23+u&"unicode quoted identifier"+"quoted identifier"+"quoted identifier "" with double quote char"+`mysql quoted identifier`++> identifier :: Dialect -> Parser Token+> identifier d =+> choice+> [Identifier (Just ("\"","\"")) <$> qiden+> -- try is used here to avoid a conflict with identifiers+> -- and quoted strings which also start with a 'u'+> ,Identifier (Just ("u&\"","\"")) <$> (try (string "u&") *> qiden)+> ,Identifier (Just ("U&\"","\"")) <$> (try (string "U&") *> qiden)+> ,Identifier Nothing <$> identifierString+> -- todo: dialect protection+> -- Identifier (Just ("`","`"))+> -- <$> (char '`' *> takeWhile1 (/='`') <* char '`')+> ,guard (diSyntaxFlavour d == SqlServer) >>+> Identifier (Just ("[","]"))+> <$> (char '[' *> takeWhile1 (`notElem` ("[]"::String)) <* char ']')+> ]+> where+> qiden = char '"' *> qidenSuffix ""+> qidenSuffix t = do+> s <- takeTill (=='"')+> void $ char '"'+> -- deal with "" as literal double quote character+> choice [do+> void $ char '"'+> qidenSuffix $ concat [t,s,"\"\""]+> ,return $ concat [t,s]]+++This parses a valid identifier without quotes.++> identifierString :: Parser String+> identifierString =+> startsWith (\c -> c == '_' || isAlpha c) isIdentifierChar++this can be moved to the dialect at some point++> isIdentifierChar :: Char -> Bool+> isIdentifierChar c = c == '_' || isAlphaNum c++> prefixedVariable :: Dialect -> Parser Token+> prefixedVariable d = try $ choice+> [PrefixedVariable <$> char ':' <*> identifierString+> ,guard (diSyntaxFlavour d == SqlServer) >>+> PrefixedVariable <$> char '@' <*> identifierString+> ,guard (diSyntaxFlavour d `elem` [Oracle,SqlServer]) >>+> PrefixedVariable <$> char '#' <*> identifierString+> ]+++> positionalArg :: Dialect -> Parser Token+> -- uses try so we don't get confused with $splices+> positionalArg d =+> guard (diSyntaxFlavour d == Postgres) >>+> PositionalArg <$> try (char '$' *> (read <$> many1 digit))+++Strings in sql:+postgresql dialect:+strings delimited with single quotes+a literal quote is written ''+the lexer leaves the double quote in the string in the ast+strings can also be written like this:+E'string with quotes in \n \t'+the \n and \t are escape sequences. The lexer passes these through unchanged.+an 'E' escaped string can also contain \' for a literal single quote.+this are also passed into the ast unchanged+strings can be dollar quoted:+$$string$$+the dollar quote can contain an optional tag:+$tag$string$tag$+which allows nesting of dollar quoted strings with different tags++Not sure what behaviour in sql server and oracle, pretty sure they+don't have dollar quoting, but I think they have the other two+variants.++> sqlString :: Dialect -> Parser Token+> sqlString d = dollarString <|> csString <|> normalString+> where+> dollarString = do+> -- need a solution for the dialect for quasi quotes+> --guard $ diSyntaxFlavour d == Postgres+> delim <- (\x -> concat ["$",x,"$"])+> <$> try (char '$' *> option "" identifierString <* char '$')+> SqlString delim delim <$> manyTill anyChar (try $ string delim)+> normalString = SqlString "'" "'" <$> (char '\'' *> normalStringSuffix False "")+> normalStringSuffix allowBackslash t = do+> s <- takeTill $ if allowBackslash+> then (`elem` ("'\\"::String))+> else (== '\'')+> -- deal with '' or \' as literal quote character+> choice [do+> ctu <- choice ["''" <$ try (string "''")+> ,"\\'" <$ try (string "\\'")+> ,"\\" <$ char '\\']+> normalStringSuffix allowBackslash $ concat [t,s,ctu]+> ,concat [t,s] <$ char '\'']+> -- try is used to to avoid conflicts with+> -- identifiers which can start with n,b,x,u+> -- once we read the quote type and the starting '+> -- then we commit to a string+> -- it's possible that this will reject some valid syntax+> -- but only pathalogical stuff, and I think the improved+> -- error messages and user predictability make it a good+> -- pragmatic choice+> csString+> | diSyntaxFlavour d == Postgres =+> choice [SqlString <$> try (string "e'" <|> string "E'")+> <*> return "'" <*> normalStringSuffix True ""+> ,csString']+> | otherwise = csString'+> csString' = SqlString+> <$> try cs+> <*> return "'"+> <*> normalStringSuffix False ""+> csPrefixes = "nNbBxX"+> cs = choice $ (map (\x -> string ([x] ++ "'")) csPrefixes)+> ++ [string "u&'"+> ,string "U&'"]++postgresql number parsing++digits+digits.[digits][e[+-]digits]+[digits].digits[e[+-]digits]+digitse[+-]digits+where digits is one or more decimal digits (0 through 9). At least one digit must be before or after the decimal point, if one is used. At least one digit must follow the exponent marker (e), if one is present. There cannot be any spaces or other characters embedded in the constant. Note that any leading plus or minus sign is not actually considered part of the constant; it is an operator applied to the constant.++> sqlNumber :: Dialect -> Parser Token+> sqlNumber _ =+> SqlNumber <$> completeNumber+> -- this is for definitely avoiding possibly ambiguous source+> -- with a special exception for a .. operator+> <* choice+> [void $ lookAhead (string "..")+> ,void $ notFollowedBy (oneOf "eE.")+> ]+> where+> completeNumber =+> (int <??> (pp dot <??.> pp int)+> -- try is used in case we read a dot+> -- and it isn't part of a number+> -- if there are any following digits, then we commit+> -- to it being a number and not something else+> <|> try ((++) <$> dot <*> int))+> <??> pp expon++> int = many1 digit+> -- if we see two dots together, leave them+> -- so we can parse things like 1..2 (used in postgres)+> dot = try (string "." <* notFollowedBy (char '.'))+> expon = (:) <$> oneOf "eE" <*> sInt+> sInt = (++) <$> option "" (string "+" <|> string "-") <*> int+> pp = (<$$> (++))++> (<??>) :: Parser a -> Parser (a -> a) -> Parser a+> p <??> q = p <**> option id q++> (<??.>) :: Parser (a -> a) -> Parser (a -> a) -> Parser (a -> a)+> (<??.>) pa pb = (.) `c` pa <*> option id pb+> -- todo: fix this mess+> where c = (<$>) . flip++> (<$$>) :: Applicative f =>+> f b -> (a -> b -> c) -> f (a -> c)+> (<$$>) pa c = pa <**> pure (flip c)++A symbol is one of the two character symbols, or one of the single+character symbols in the two lists below.++> symbol :: Dialect -> Parser Token+> symbol d | diSyntaxFlavour d == Postgres =+> Symbol <$> choice (otherSymbol ++ [singlePlusMinus,opMoreChars])++rules++An operator name is a sequence of up to NAMEDATALEN-1 (63 by default) characters from the following list:+++ - * / < > = ~ ! @ # % ^ & | ` ?++There are a few restrictions on operator names, however:+-- and /* cannot appear anywhere in an operator name, since they will be taken as the start of a comment.++A multiple-character operator name cannot end in + or -, unless the name also contains at least one of these characters:++~ ! @ # % ^ & | ` ?++> where+> -- other symbols are all the tokens which parse as symbols in+> -- this lexer which aren't considered operators in postgresql+> -- a single ? is parsed as a operator here instead of an other+> -- symbol because this is the least complex way to do it+> otherSymbol = many1 (char '.') :+> try (string ":=") :+> -- parse :: and : and avoid allowing ::: or more+> try (string "::" <* notFollowedBy (char ':')) :+> try (string ":" <* notFollowedBy (char ':')) :+> (map (string . (:[])) "[],;()"+> ++ if True -- allowOdbc d+> then [string "{", string "}"]+> else []+> )++exception char is one of:+~ ! @ # % ^ & | ` ?+which allows the last character of a multi character symbol to be + or+-++> allOpSymbols = "+-*/<>=~!@#%^&|`?"+> -- these are the symbols when if part of a multi character+> -- operator permit the operator to end with a + or - symbol+> exceptionOpSymbols = "~!@#%^&|`?"++> -- special case for parsing a single + or - symbol+> singlePlusMinus = try $ do+> c <- oneOf "+-"+> notFollowedBy $ oneOf allOpSymbols+> return [c]++> -- this is used when we are parsing a potentially multi symbol+> -- operator and we have alread seen one of the 'exception chars'+> -- and so we can end with a + or -+> moreOpCharsException = do+> c <- oneOf (filter (`notElem` ("-/*"::String)) allOpSymbols)+> -- make sure we don't parse a comment starting token+> -- as part of an operator+> <|> try (char '/' <* notFollowedBy (char '*'))+> <|> try (char '-' <* notFollowedBy (char '-'))+> -- and make sure we don't parse a block comment end+> -- as part of another symbol+> <|> try (char '*' <* notFollowedBy (char '/'))+> (c:) <$> option [] moreOpCharsException++> opMoreChars = choice+> [-- parse an exception char, now we can finish with a + -+> (:)+> <$> oneOf exceptionOpSymbols+> <*> option [] moreOpCharsException+> ,(:)+> <$> (-- parse +, make sure it isn't the last symbol+> try (char '+' <* lookAhead (oneOf allOpSymbols))+> <|> -- parse -, make sure it isn't the last symbol+> -- or the start of a -- comment+> try (char '-'+> <* notFollowedBy (char '-')+> <* lookAhead (oneOf allOpSymbols))+> <|> -- parse / check it isn't the start of a /* comment+> try (char '/' <* notFollowedBy (char '*'))+> <|> -- make sure we don't parse */ as part of a symbol+> try (char '*' <* notFollowedBy (char '/'))+> <|> -- any other ansi operator symbol+> oneOf "<>=")+> <*> option [] opMoreChars+> ]++> symbol d | diSyntaxFlavour d == SqlServer =+> Symbol <$> choice (otherSymbol ++ regularOp)+> where+> otherSymbol = string "." :+> (map (string . (:[])) ",;():?"+> ++ if True -- allowOdbc d+> then [string "{", string "}"]+> else [])++try is used because most of the first characters of the two character+symbols can also be part of a single character symbol++> regularOp = map (try . string) [">=","<=","!=","<>"]+> ++ map (string . (:[])) "+-^*/%~&<>="+> ++ [char '|' *>+> choice ["||" <$ char '|' <* notFollowedBy (char '|')+> ,return "|"]]++> symbol _d =+> Symbol <$> choice (otherSymbol ++ regularOp)+> where+> otherSymbol = many1 (char '.') :+> (map (string . (:[])) "[],;():?"+> ++ if True -- allowOdbc d+> then [string "{", string "}"]+> else [])++try is used because most of the first characters of the two character+symbols can also be part of a single character symbol++> regularOp = map (try . string) [">=","<=","!=","<>"]+> ++ map (string . (:[])) "+-^*/%~&<>=[]"+> ++ [char '|' *>+> choice ["||" <$ char '|' <* notFollowedBy (char '|')+> ,return "|"]]+++> sqlWhitespace :: Dialect -> Parser Token+> sqlWhitespace _ = Whitespace <$> many1 (satisfy isSpace)++> lineComment :: Dialect -> Parser Token+> lineComment _ =+> (\s -> LineComment $ concat ["--",s]) <$>+> -- try is used here in case we see a - symbol+> -- once we read two -- then we commit to the comment token+> (try (string "--") *> (+> conc <$> manyTill anyChar (lookAhead lineCommentEnd) <*> lineCommentEnd))+> where+> conc a Nothing = a+> conc a (Just b) = a ++ b+> lineCommentEnd = Just "\n" <$ char '\n' <|> Nothing <$ eof++> blockComment :: Dialect -> Parser Token+> blockComment _ =+> (\s -> BlockComment $ concat ["/*",s]) <$>+> (try (string "/*") *> commentSuffix 0)+> where+> commentSuffix :: Int -> Parser String+> commentSuffix n = do+> -- read until a possible end comment or nested comment+> x <- takeWhile (\e -> e /= '/' && e /= '*')+> choice [-- close comment: if the nesting is 0, done+> -- otherwise recurse on commentSuffix+> try (string "*/") *> let t = concat [x,"*/"]+> in if n == 0+> then return t+> else (\s -> concat [t,s]) <$> commentSuffix (n - 1)+> -- nested comment, recurse+> ,try (string "/*") *> ((\s -> concat [x,"/*",s]) <$> commentSuffix (n + 1))+> -- not an end comment or nested comment, continue+> ,(\c s -> concat [x, [c], s]) <$> anyChar <*> commentSuffix n]++> dontParseEndBlockComment :: Dialect -> Parser Token+> dontParseEndBlockComment _ =+> -- don't use try, then it should commit to the error+> try (string "*/") *> fail "comment end without comment start"++> splice :: Dialect -> Parser Token+> splice _ = do+> Splice+> <$> (char '$' *> letter)+> <*> (char '(' *> identifierString <* char ')')++> startsWith :: (Char -> Bool) -> (Char -> Bool) -> Parser String+> startsWith p ps = do+> c <- satisfy p+> choice [(c:) <$> (takeWhile1 ps)+> ,return [c]]++> takeWhile1 :: (Char -> Bool) -> Parser String+> takeWhile1 p = many1 (satisfy p)++> takeWhile :: (Char -> Bool) -> Parser String+> takeWhile p = many (satisfy p)++> takeTill :: (Char -> Bool) -> Parser String+> takeTill p =+> manyTill anyChar (peekSatisfy p)++> peekSatisfy :: (Char -> Bool) -> Parser ()+> peekSatisfy p = do+> void $ lookAhead (satisfy p)
+ src/Database/HsSqlPpp/Internals/ParseErrors.lhs view
@@ -0,0 +1,71 @@++convert error messages to show source text fragment with little hat,+plus output error location in emacs friendly format.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Internals.ParseErrors+> (toParseErrorExtra+> ,ParseErrorExtra(..)) where+>+> import Text.Parsec+> import qualified Data.Text.Lazy as L+>+> showPE :: ParseError -> Maybe (Int,Int) -> L.Text -> String+> showPE pe sp src = show pe ++ "\n" ++ pePosToEmacs pe+> ++ "\n" ++ peToContext pe sp src+>+> pePosToEmacs :: ParseError -> String+> pePosToEmacs pe = let p = errorPos pe+> f = sourceName p+> l = sourceLine p+> c = sourceColumn p+> in f ++ ":" ++ show l ++ ":" ++ show c ++ ":"+>+> peToContext :: ParseError -> Maybe (Int,Int) -> L.Text -> String+> peToContext pe sp src =+> let ls = L.lines src+> line = safeGet ls (lineNo - 1)+> prelines = map (safeGet ls) [(lineNo - 5) .. (lineNo - 2)]+> postlines = map (safeGet ls) [lineNo .. (lineNo + 5)]+> caretLine = L.pack (replicate (colNo - 1) ' ' ++ "^")+> erLine = let s = "ERROR HERE"+> in L.pack (replicate (colNo - 1 - (length s `div` 2)) ' ' ++ s)+> errorHighlightText = prelines+> ++ [line, caretLine, erLine]+> ++ postlines+> in "\nContext:\n"+> ++ L.unpack (L.unlines (trimLines errorHighlightText)) ++ "\n"+> where+> safeGet a i = if i < 0 || i >= length a+> then ""+> else a !! i+> trimLines = trimStartLines . reverse . trimStartLines . reverse+> trimStartLines = dropWhile (=="")+> pos = errorPos pe+> lineNo = sourceLine pos - adjLine+> colNo = sourceColumn pos+> adjLine = case sp of+> Just (l, _) -> l - 1+> Nothing -> 0+>+> -- | Simple wrapper to allow showing the source context of a ParseError+> data ParseErrorExtra =+> ParseErrorExtra {+> -- | wrapped error+> parseErrorError :: ParseError+> -- | source position+> -- adjustment to get the+> -- context bit in error+> -- messages right - this is+> -- the same as what is passed+> -- into parseSqlWithPosition+> ,parseErrorPosition :: Maybe (Int, Int)+> -- | sql source+> ,parseErrorSqlSource :: L.Text+> }+>+> instance Show ParseErrorExtra where+> show (ParseErrorExtra pe sp src) = showPE pe sp src+>+> toParseErrorExtra :: L.Text -> Maybe (Int,Int) -> ParseError -> ParseErrorExtra+> toParseErrorExtra src sp e = ParseErrorExtra e sp src
+ src/Database/HsSqlPpp/Internals/ParseInternal.lhs view
@@ -0,0 +1,2728 @@++The main file for parsing sql, uses parsec. Not sure if parsec is the+right choice, but it seems to do the job pretty well at the moment.++> {-# LANGUAGE FlexibleContexts,ExplicitForAll,TupleSections,+> NoMonomorphismRestriction,OverloadedStrings #-}+> -- | Functions to parse SQL.+> module Database.HsSqlPpp.Internals.ParseInternal+> (-- * Main+> parseStatements+> ,parseQueryExpr+> ,parseScalarExpr+> ,parseProcSQL+> -- * parsing flags+> ,ParseFlags(..)+> --,Dialect(..)+> --,ansiDialect+> -- * errors+> --,ParseErrorExtra(..)+> -- other helpers for internal use+> ,tableAttribute+> ,keyword+> ,parens+> ,symbol+> ,idString+> ,commaSep1+> ,commaSep+> ,parseName+> ,parseNameComponent+> ) where+>+> import Text.Parsec hiding (label) -- many, optional, (<|>), string,+> import Text.Parsec.Expr+> import Text.Parsec.String+> import Text.Parsec.Perm+> import Text.Parsec.Pos+>+> import Control.Applicative hiding (many,optional,(<|>))+> import Control.Monad.Identity+> --import Control.Monad+>+> import Data.Maybe+> import Data.Char hiding (Format)+>+> import Data.Generics.Uniplate.Data+> import Data.Data hiding (Prefix,Infix)+>+> import qualified Database.HsSqlPpp.Internals.LexInternal as Lex+> import Database.HsSqlPpp.Internals.ParseErrors+> import Database.HsSqlPpp.Internals.AstInternal+> --import Database.HsSqlPpp.Annotation as A+> import Database.HsSqlPpp.Internals.Utils+> import Database.HsSqlPpp.Internals.Dialect+> import Data.Text (Text)+> import qualified Data.Text as T+> --import qualified Data.Text.Lazy as LT+> import Text.Parsec.Text ()+> --import Database.HsSqlPpp.Catalog++> import qualified Data.Text.Lazy as L+> --import Database.HsSqlPpp.Internals.StringLike++ import Debug.Trace++--------------------------------------------------------------------------------++Top level parsing functions+===========================++> -- | Parse a list of statements+> parseStatements :: ParseFlags -- ^ parse options+> -> FilePath -- ^ filename to use in errors+> -> Maybe (Int,Int) -- ^ set the line number and column number+> -- of the first char in the source (used in annotation)+> -> L.Text -- ^ a string containing the sql to parse+> -> Either ParseErrorExtra [Statement]+> parseStatements = parseIt' sqlStatements++> -- | Parse a single query expr+> parseQueryExpr :: ParseFlags -- ^ parse options+> -> FilePath -- ^ filename to use in errors+> -> Maybe (Int,Int) -- ^ set the line number and column number+> -> L.Text -- ^ a string containing the sql to parse+> -> Either ParseErrorExtra QueryExpr+> parseQueryExpr =+> parseIt' $ pQueryExpr <* optional (symbol ";") <* eof++> -- | Parse a single scalar expr+> parseScalarExpr :: ParseFlags -- ^ parse options+> -> FilePath -- ^ filename to use in errors+> -> Maybe (Int,Int) -- ^ set the line number and column number+> -> L.Text -- ^ a string containing the sql to parse+> -> Either ParseErrorExtra ScalarExpr+> parseScalarExpr = parseIt' $ expr <* eof++> -- | Parse a list of procedural sql statements+> parseProcSQL :: ParseFlags -- ^ parse options+> -> FilePath -- ^ filename to use in errors+> -> Maybe (Int,Int) -- ^ set the line number and column number+> -> L.Text -- ^ a string containing the sql to parse+> -> Either ParseErrorExtra [Statement]+> parseProcSQL = parseIt' $ many plPgsqlStatement <* eof++> parseIt' :: Data a =>+> SParser a+> -> ParseFlags+> -> FilePath+> -> Maybe (Int,Int)+> -> L.Text+> -> Either ParseErrorExtra a+> parseIt' ps flg fn sp src = do+> lxd <- lexem (pfDialect flg) fn sp src+> psd <- either (\e -> Left $ ParseErrorExtra e sp src) Right+> $ runParser ps flg fn lxd+> return $ fixupTree psd++> lexem :: Dialect+> -> FilePath+> -> Maybe (Int,Int)+> -> L.Text+> -> Either ParseErrorExtra [Token]+> lexem d fn sp src =+> let ts :: Either ParseErrorExtra [Token]+> ts = either (\e -> Left $ ParseErrorExtra e sp src) Right+> $ Lex.lexTokens d fn sp src+> in --trace ((\(Right r) -> intercalate "\n" $ map show r) ts) $+> filter keep `fmap` ts+> where+> keep (_,Lex.Whitespace {}) = False+> keep (_,Lex.LineComment {}) = False+> keep (_,Lex.BlockComment {}) = False+> keep _ = True++Parse state used for parse flags. Might be better to use a readerT+somehow, but I'm not smart enough to work out how to do this. This+state is never updated during parsing++> -- | Settings to influence the parsing+> data ParseFlags = ParseFlags+> {pfDialect :: Dialect+> }+> deriving (Show,Eq)++> type ParseState = ParseFlags++> isSqlServer :: SParser Bool+> isSqlServer = do+> ParseFlags {pfDialect = d} <- getState+> return $ diSyntaxFlavour d == SqlServer++> isOracle :: SParser Bool+> isOracle = do+> ParseFlags {pfDialect = d} <- getState+> return $ diSyntaxFlavour d == Oracle++couple of wrapper functions for the quoting++> parseName :: ParseFlags+> -> FilePath+> -> Maybe (Int,Int)+> -> L.Text+> -> Either ParseErrorExtra Name+> parseName = parseIt' $ name <* eof++> parseNameComponent :: ParseFlags+> -> FilePath+> -> Maybe (Int,Int)+> -> L.Text+> -> Either ParseErrorExtra NameComponent+> parseNameComponent = parseIt' $ nameComponent <* eof+++--------------------------------------------------------------------------------+++> type Token = ((FilePath,Int,Int),Lex.Token)++> type SParser = GenParser Token ParseState++Parsing top level statements+============================++> sqlStatements :: SParser [Statement]+> sqlStatements = many (sqlStatement True) <* eof+>+> sqlStatement :: Bool -> SParser Statement+> sqlStatement reqSemi =+> (choice [+> antiStatement+> ,queryStatement+> ,insert+> ,update+> ,delete+> ,truncateSt+> ,copy+> ,--do+> --not <$> isSqlServer >>= guard+> set+> ,notify+> ,keyword "create" *>+> choice [+> -- todo: this is bad+> -- why do we have create outside+> -- but then have 'or replace' inside the+> -- invididual parsers, making it impossible+> -- to get rid of the try here?+> try createTable+> ,createSequence+> ,createType+> ,createFunction+> ,createView+> ,createDomain+> ,createDatabase+> ,createLanguage+> ,createTrigger+> ,createIndex+> ,createLogin+> ,createUser+> ,createSchema]+> ,keyword "alter" *>+> choice [+> alterSequence+> ,alterTable+> ,alterDatabase+> ,alterLogin+> ,alterUser+> ,alterView+> ,alterSchema]+> ,keyword "drop" *>+> choice [+> dropSomething+> ,dropFunction+> ,dropTrigger]]+> <* stmtEnd (not reqSemi))+> <|> copyData++--------------------------------------------------------------------------------++statement flavour parsers+=========================++top level/sql statements first++query expr++> queryStatement :: SParser Statement+> queryStatement = QueryStatement <$> pos <*> pQueryExpr++this is the plpgsql into++> into :: SParser (Statement -> Statement)+> into = do+> p <- pos <* keyword "into"+> st <- option False (True <$ keyword "strict")+> is <- commaSep1 name+> return $ \s -> Into p st is s++> intoQueryStatement :: SParser Statement+> intoQueryStatement = do+> (i,_) <- pQueryExprX True+> case i of+> Nothing -> fail "not into"+> Just s -> return s++> pQueryExpr :: SParser QueryExpr+> pQueryExpr = snd <$> pQueryExprX False++bit convoluted to parse the into part+TODO: used to parse the into in the select list parser,+maybe it should still do this since it would probably be a lot clearer+++> pQueryExprX :: Bool -> SParser (Maybe Statement, QueryExpr)+> pQueryExprX allowInto =+> ((Nothing,) <$> with)+> <|> buildExpressionParser combTable selFactor+> where+> selFactor = choice [try ((Nothing,) <$> parens pQueryExpr)+> ,selQuerySpec+> ,(Nothing,) <$> values]+> with = WithQueryExpr <$> (pos <* keyword "with")+> <*> commaSep1 withQuery+> <*> pQueryExpr+> withQuery = WithQuery <$> pos+> <*> nameComponent+> <*> tryOptionMaybe (parens $ commaSep nameComponent)+> <*> (keyword "as" *> parens pQueryExpr)+> combTable =+> [map makeOp [(Except, keyword "except")+> ,(Intersect, keyword "intersect")+> ,(UnionAll, try (keyword "union" *> keyword "all"))+> ,(Union, keyword "union")]]+> makeOp (c,p) =+> Infix (do+> cmb <- CombineQueryExpr+> <$> pos+> <*> (c <$ p)+> return $ \s0 s1 -> (Nothing, cmb (snd s0) (snd s1))+> ) AssocLeft+> selQuerySpec = do+> p <- pos <* keyword "select"+> -- todo: support explicit all+> d <- option All (Distinct <$ distinctKeyword)+> -- hacky parsing of sql server 'top n' style select+> -- quiz: what happens when you use top n and limit at the same time?+> tp <- choice+> [do+> isSqlServer >>= guard+> optionMaybe $ try+> (keyword "top" *>+> choice [parens expr+> -- not sure why you can't write expr without parens+> -- but it doesn't work TODO: fix this+> -- the current hack only allows a single number+> -- if you don't also use parens+> ,NumberLit <$> pos <*> (show <$> integer)])+> ,return Nothing]+> -- todo: work out how to make this work properly - need to return+> -- the into+> (sl,intoBit) <- if allowInto+> then permute ((,)+> <$$> try selectList+> <|?> (Nothing, Just <$> into))+> else (,Nothing) <$> selectList+> s <- Select p d sl+> <$> option [] from+> <*> optionMaybe whereClause+> <*> option [] groupBy+> <*> optionMaybe having+> <*> orderBy+> <*> option tp (Just <$> limit)+> <*> optionMaybe offset+> <*> option [] hints+> return (case intoBit of+> Just f -> Just $ f $ QueryStatement p s+> Nothing -> Nothing+> ,s)+> from = keyword "from" *> commaSep1 tableRef+> groupBy = keyword "group" *> keyword "by"+> *> commaSep1 expr+> having = keyword "having" *> expr+> limit = keyword "limit" *> expr+> offset = keyword "offset" *> expr+> values = Values <$> (pos <* keyword "values")+> <*> commaSep1 (parens $ commaSep1 expr)+> hints = keyword "option" *> (parens $ commaSep1 queryHint)+++> distinctKeyword :: SParser ()+> distinctKeyword =+> choice+> [do+> isOracle >>= guard+> keyword "unique"+> return ()+> ,keyword "distinct"]++> queryHint :: SParser QueryHint+> queryHint = choice+> [QueryHintPartitionGroup <$ keyword "partition" <* keyword "group"+> ,QueryHintColumnarHostGroup <$ keyword "columnar" <* keyword "host" <* keyword "group"]++> orderBy :: SParser [(ScalarExpr,Direction, NullsOrder)]+> orderBy = option []+> (keyword "order" *> keyword "by"+> *> commaSep1 oneOrder)++> where+> oneOrder = (,,) <$> expr <*> direction <*> nullsOrder+> direction = option Asc (choice [+> Asc <$ keyword "asc"+> ,Desc <$ keyword "desc"])+> nullsOrder = option NullsDefault (keyword "nulls" >> choice [+> NullsFirst <$ keyword "first"+> ,NullsLast <$ keyword "last"])++table refs++only way of combining them is joins which parse left associative which+makes it easy++> tableRef :: SParser TableRef+> tableRef = nonJoin >>= optionalJoinSuffix+> where+> nonJoin = do+> -- read parens and a subquery or tableref+> -- or a funtref or just a tref+> t <- choice+> [do+> p <- pos+> parens $ choice [try $ SubTref p <$> pQueryExpr+> ,TableRefParens p <$> tableRef]+> -- should combine the funtref and tref parsing+> ,try $ FunTref <$> pos+> <*> (identifier >>= functionCallSuffix)+> ,OdbcTableRef <$> (pos <* symbol "{" <* keyword "oj")+> <*> (tableRef <* symbol "}")+> ,Tref <$> pos <*> name]+> optionalAlias t+> optionalAlias t = do+> -- try and read an alias+> a <- optionMaybe $ try alias+> -- ignore an optional hint if this is sql server+> _ <- choice [do isSqlServer >>= guard+> _ <- try $ optional tableHint+> return ()+> ,return ()]+> -- wrap the tref from before with the alias+> -- if got one+> return $ maybe t (\f -> f t) a++> alias :: SParser (TableRef -> TableRef)+> alias = do+> p <- pos+> optionalSuffix+> (TableAlias p) (optional (keyword "as") *> nameComponent)+> (FullAlias p) (parens $ commaSep1 nameComponent)+> optionalJoinSuffix tr =+> choice [try (joinSuffix tr)+> >>= optionalAlias+> >>= optionalJoinSuffix+> ,return tr]+> joinSuffix tr = do+> let p = getAnnotation tr+> (nat,hint,jt) <- joinKw+> JoinTref p tr nat jt hint+> <$> nonJoin+> <*> onExpr+> joinKw = do+> --look for the join flavour first+> n <- option Unnatural (Natural <$ keyword "natural")+> jt <- choice [+> LeftOuter <$ try (keyword "left"+> *> optional (keyword "outer"))+> ,RightOuter <$ try (keyword "right"+> *> optional (keyword "outer"))+> ,FullOuter <$ try (keyword "full"+> *> optional (keyword "outer"))+> ,Cross <$ keyword "cross"+> ,Inner <$ optional (keyword "inner")]+> hint <- option Nothing (Just <$> choice [Merge <$ keyword "merge"+> ,Loop <$ keyword "loop"+> ,Hash <$ keyword "hash"])+> keyword "join"+> return (n,hint,jt)+> onExpr = choice+> [Just <$> (JoinOn <$> pos <*> (keyword "on" *> expr))+> ,Just <$> (JoinUsing <$> pos+> <*> (keyword "using" *> columnNameList))+> ,return Nothing]++> tableHint = do++just acts as an incomplete recogniser for table hints:+it doesn't accept all valid table hints+and doesn't reject all invalid table hints+and it doesn't return anything in the ast+but allows you to parse some queries containing with hints and get+everything else++> try $ keyword "with"+> -- just allows any list of identifiers+> _ <- parens $ commaSep1 idString+> return ()+>+> optParens :: SParser a+> -> SParser a+> optParens p = try (parens p) <|> p+++insert, update and delete+-------------------------++insert statement: supports option column name list,+multiple rows to insert and insert from select statements++> insert :: SParser Statement+> insert = Insert+> <$> pos <* keyword "insert" <* keyword "into"+> <*> name+> <*> option [] (try columnNameList)+> <*> pQueryExpr+> <*> tryOptionMaybe returning+>+> update :: SParser Statement+> update = Update+> <$> pos <* keyword "update"+> <*> name+> <*> (keyword "set" *> commaSep1 setClause)+> <*> option [] (keyword "from" *> commaSep1 tableRef)+> <*> tryOptionMaybe whereClause+> <*> tryOptionMaybe returning+> where+> setClause =+> choice [do+> p <- pos+> l <- parens (commaSep1 nameComponent)+> symbol "="+> r <- parens (commaSep1 expr)+> return $ MultiSetClause p l $ SpecialOp p (nm p "rowctor") r+> ,do+> p <- pos+> l <- nameComponent+> symbol "="+> r <- expr+> return $ SetClause p l r]++> nm :: Annotation -> Text -> Name+> nm a s = Name a [Nmc $ T.unpack s]++> delete :: SParser Statement+> delete = Delete+> <$> pos <* keyword "delete" <* keyword "from"+> <*> name+> <*> option [] (keyword "using" *> commaSep1 tableRef)+> <*> tryOptionMaybe whereClause+> <*> tryOptionMaybe returning+>++other dml-type stuff+--------------------++> truncateSt :: SParser Statement+> truncateSt =+> Truncate+> <$> pos <* keyword "truncate" <* optional (keyword "table")+> <*> commaSep1 name+> <*> option ContinueIdentity (choice [+> ContinueIdentity <$ (keyword "continue"+> <* keyword "identity")+> ,RestartIdentity <$ (keyword "restart"+> <* keyword "identity")])+> <*> cascade+>+> copy :: SParser Statement+> copy = do+> p <- pos+> keyword "copy"+> -- todo: factor this a bit better++> choice -- left factoring to preserve error messages+> [ parens pQueryExpr >>= to p . CopyQuery+> , do (tblName, cols) <- liftA2 (,) name (option [] (parens $ commaSep1 nameComponent))+> choice+> [ from p tblName cols+> , to p (CopyTable tblName cols)+> ]+> ]++> where+> from p tableName cols = do+> keyword "from"+> src <- choice [+> CopyFilename <$> extrStr <$> stringLit+> ,Stdin <$ keyword "stdin"]+> opts <- option [] $ do+> keyword "with" *> copyFromOptions+> return $ CopyFrom p tableName cols src opts+> to p src = do+> keyword "to"+> fn <- extrStr <$> stringLit+> opts <- option [] $ do+> keyword "with" *> copyToOptions+> return $ CopyTo p src fn opts++> copyToOptions = do+> (a,b,c,d) <- permute ((,,,)+> <$?> (Nothing,Just <$> CopyToFormat <$>+> (keyword "format" *> idString))+> <|?> (Nothing,Just <$> CopyToDelimiter <$>+> (keyword "delimiter" *> stringN))+> <|?> (Nothing,Just <$> CopyToErrorLog <$>+> (keyword "error_log" *> stringN))+> <|?> (Nothing,Just <$> CopyToErrorVerbosity <$>+> (keyword "error_verbosity" *> (fromIntegral <$> integer)))+> )+> return $ catMaybes [a,b,c,d]++> copyFromOptions = do+> (a,b,c,d,e,f,g,h,i,j) <- permute ((,,,,,,,,,)+> <$?> (Nothing,Just <$> CopyFromFormat <$>+> (keyword "format" *> idString))+> <|?> (Nothing,Just <$> CopyFromDelimiter <$>+> (keyword "delimiter" *> stringN))+> <|?> (Nothing,Just <$> CopyFromErrorLog <$>+> (keyword "error_log" *> (stringN <?> "path wrapped in apostrophes. for example: 'file.csv'.")))+> <|?> (Nothing,Just <$> CopyFromErrorVerbosity <$>+> (keyword "error_verbosity" *> (fromIntegral <$> integer)))+> <|?> (Nothing,Just <$> CopyFromParsers <$>+> (keyword "parsers" *> stringN) <?> "list of parsers")+> <|?> (Nothing,Just <$> (CopyFromDirectory <$ keyword "directory"))+> <|?> (Nothing,Just <$> CopyFromOffset <$>+> (keyword "offset" *> (integer <?> "positive integer")) <?> "offset with integer")+> <|?> (Nothing,Just <$> CopyFromLimit <$>+> (keyword "limit" *> (integer <?> "positive integer")) <?> "limit with integer")+> <|?> (Nothing,Just <$> CopyFromErrorThreshold <$>+> (keyword "stop" *> keyword "after" *> (fromIntegral <$> (integer <?> "positive integer")) <* keyword "errors"))+> <|?> (Nothing,Just <$> CopyFromNewlineFormat <$>+> (keyword "record" *> keyword "delimiter" *> stringN))+> )+> return $ catMaybes [a,b,c,d,e,f,g,h,i,j]++> copyData :: SParser Statement+> copyData = CopyData <$> pos <*> mytoken (\tok ->+> case tok of+> Lex.CopyPayload n -> Just n+> _ -> Nothing)+>++--------------------------------------------------------------------------------++misc+====++> set :: SParser Statement+> set = Set <$> pos+> <*> (keyword "set" *> idString)+> <*> ((keyword "to" <|> symbol "=") *>+> commaSep1 sv)+> where+> sv = choice [+> SetStr <$> pos <*> stringN+> ,SetId <$> pos <*> idString+> ,SetNum <$> pos <*> (try (fromInteger <$> integer)+> <|> (read <$> numString))]+>+> notify :: SParser Statement+> notify = Notify <$> pos+> <*> (keyword "notify" *> idString)++--------------------------------------------------------------------------------+ +ddl+===++> createTable :: SParser Statement+> createTable = do+> p <- pos+> rep <- choice [NoReplace <$ keyword "table"+> ,Replace <$ mapM_ keyword ["or", "replace", "table"]+> ] +> tname <- name+> choice [+> CreateTableAs p tname rep <$> (keyword "as" *> pQueryExpr)+> ,do+> (atts,cons) <- readAttsAndCons+> pdata <- readPartition+> ts <- option [] tableOptions+> return $ CreateTable p tname atts cons pdata rep ts+> ]+> where+> --parse the unordered list of attribute defs or constraints, for+> --each line want to try the constraint parser first, then the+> --attribute parser, so you need the swap to feed them in the+> --right order into createtable+> readAttsAndCons =+> parens (swap <$> multiPerm+> (try tableConstraint)+> tableAttribute+> (symbol ","))+> where swap (a,b) = (b,a)+> readPartition = tryOptionMaybe (tablePartition)++>+> tableAttribute :: SParser AttributeDef+> tableAttribute = AttributeDef+> <$> pos+> <*> nameComponent+> <*> typeName+> <*> many rowConstraint+> <*> option [] tableOptions+> where+> rowConstraint = do+> p <- pos+> cn <- option "" (keyword "constraint" *> idString)+> choice [+> RowUniqueConstraint p cn <$ keyword "unique"+> ,RowPrimaryKeyConstraint p cn <$ keyword "primary" <* keyword "key"+> ,RowCheckConstraint p cn <$> (keyword "check" *> parens expr)+> ,DefaultConstraint p cn <$> (keyword "default" *> expr)+> ,NullConstraint p cn <$ keyword "null"+> ,NotNullConstraint p cn <$ (keyword "not" <* keyword "null")+> ,IdentityConstraint p cn <$> (keyword "identity" *>+> tryOptionMaybe (parens $ (,) <$>+> signedInteger <*> (symbol "," *> signedInteger)))+> ,RowReferenceConstraint p cn+> <$> (keyword "references" *> name)+> <*> option Nothing (try $ parens $ Just <$> nameComponent)+> <*> onDelete+> <*> onUpdate+> ]+>++> tableOptions :: SParser [TableOption]+> tableOptions =+> keywords ["with","options"]+> *> parens (many1 tableOption)+> where+> tableOption = do+> onm <- many1 idString+> choice [symbol "=" *> choice+> [TableOptionStringVal onm <$> stringN+> ,TableOptionNameVal onm <$> many1 name+> ,TableOptionNumberVal onm <$> numString]+> ,pure $ TableOptionKeywords onm+> ]++> tablePartition :: SParser TablePartitionDef+> tablePartition = do+> p <- pos+> -- partition by range (<col name>) ( every 5 minutes )+> cn <- (keyword "partition" *> keyword "by" *> keyword "range" *> (parens nameComponent))+> (a,b) <- parens $ keyword "every" *> try ((,) <$>+> (option 1 integer) <*> timeframe)+> return $ TablePartitionDef p cn a b+> where+> timeframe =+> choice [Year <$ keyword "years"+> ,Year <$ keyword "year"+> ,Month <$ keyword "months"+> ,Month <$ keyword "month"+> ,Day <$ keyword "days"+> ,Day <$ keyword "day"+> ,Hour <$ keyword "hours"+> ,Hour <$ keyword "hour"+> ,Minute <$ keyword "minutes"+> ,Minute <$ keyword "minute"+> ,Second <$ keyword "seconds"+> ,Second <$ keyword "second"+> ,Millisecond <$ keyword "milliseconds"+> ,Millisecond <$ keyword "millisecond"+> ]+>+> onDelete,onUpdate :: SParser Cascade+> onDelete = onSomething "delete"+> onUpdate = onSomething "update"+>+> onSomething :: Text -> SParser Cascade+> onSomething k = option Restrict $ try $ keyword "on"+> *> keyword k *> cascade+>+> tableConstraint :: SParser Constraint+> tableConstraint = do+> p <- pos+> cn <- option "" (keyword "constraint" *> option "" conName)+> choice [+> UniqueConstraint p cn+> <$> try (keyword "unique" *> optParens columnNameList)+> ,PrimaryKeyConstraint p cn+> <$> try (keyword "primary" *> keyword "key"+> *> choice [+> (:[]) <$> nameComponent+> ,parens (commaSep1 nameComponent)])+> ,CheckConstraint p cn+> <$>try (keyword "check" *> parens expr)+> ,ReferenceConstraint p cn+> <$> try (keyword "foreign" *> keyword "key"+> *> parens (commaSep1 nameComponent))+> <*> (keyword "references" *> name)+> <*> option [] (parens $ commaSep1 nameComponent)+> <*> onUpdate+> <*> onDelete]+> where+> conName = try $ do+> x <- idString+> if map toLower x `elem` [+> "unique"+> ,"primary"+> ,"check"+> ,"foreign"+> ,"references"]+> then fail $ "not keyword (constraint name): " ++ x+> else return x+>+> alterDatabase :: SParser Statement+> alterDatabase = AlterDatabase+> <$> (pos <* keyword "database")+> <*> name+> <*> operation+> where+> operation = try renameDatabase+> renameDatabase = RenameDatabase+> <$> (pos <* keyword "rename" <* keyword "to")+> <*> name+> alterTable :: SParser Statement+> alterTable = AlterTable <$> (pos <* keyword "table"+> <* optional (keyword "only"))+> <*> name+> <*> operation+> where+> operation = choice [try renameTable,try renameColumn,actions]+> renameTable = RenameTable+> <$> (pos <* keyword "rename" <* keyword "to")+> <*> name+> renameColumn = RenameColumn+> <$> (pos <* keyword "rename" <* keyword "column")+> <*> nameComponent+> <*> (keyword "to" *> nameComponent)+> actions = AlterTableActions <$> pos <*> commaSep1 action+> action = choice [try addColumn+> ,try dropColumn+> ,try alterColumn+> ,addConstraint]+> addColumn = AddColumn+> <$> pos+> <*> (keyword "add" *> keyword "column" *> tableAttribute)+> dropColumn = DropColumn+> <$> pos+> <*> (keyword "drop" *> keyword "column" *> nameComponent)+> alterColumn = AlterColumn+> <$> (pos <* keyword "alter" <* keyword "column")+> <*> nameComponent+> <*> alterColumnAction+> alterColumnAction = choice [try alterType+> ,try setNotNull+> ,try dropNotNull+> ,try setDefault+> ,dropDefault]+> alterType = SetDataType+> <$> pos+> <*> (keyword "set" *> keyword "data" *> keyword "type" *> typeName)+> setNotNull = SetNotNull+> <$> (pos <* keyword "set" <* keyword "not" <* keyword "null")+> dropNotNull = DropNotNull+> <$> (pos <* keyword "drop" <* keyword "not" <* keyword "null")+> setDefault = SetDefault+> <$> pos+> <*> (keyword "set" *> keyword "default" *> expr)+> dropDefault = DropDefault+> <$> (pos <* keyword "drop" <* keyword "default")+> addConstraint = AddConstraint+> <$> (pos <* keyword "add")+> <*> tableConstraint+> createType :: SParser Statement+> createType = CreateType+> <$> pos <* keyword "type"+> <*> name+> <*> (keyword "as" *> parens (commaSep1 typeAtt))+> where+> typeAtt = TypeAttDef <$> pos <*> nameComponent <*> typeName+>+> createSequence :: SParser Statement+> createSequence = do+> p <- pos+> keyword "sequence"+> snm <- name+> (stw, incr, mn, mx, c) <-+> permute ((,,,,) <$?> (1,startWith)+> <|?> (1,increment)+> <|?> (Nothing, sequenceMinValue)+> <|?> (Nothing, sequenceMaxValue)+> <|?> (1, cache))+> return $ CreateSequence p snm incr mn mx stw c+> where+> startWith = keyword "start" *> optional (keyword "with") *> integer+> increment = keyword "increment" *> optional (keyword "by") *> integer+> cache = keyword "cache" *> integer+>+> alterSequence :: SParser Statement+> alterSequence = AlterSequence <$> pos+> <*> (keyword "sequence" *> name)+> <*> operation+> where+> operation = choice [try renameSequence,try changeOwner,actions]+> renameSequence = AlterSequenceRename <$> (pos <* keyword "rename" <* keyword "to") <*> name+> changeOwner = AlterSequenceOwned <$> (pos <* keyword "owned" <* keyword "by") <*> name+> actions = AlterSequenceActions <$> pos <*> many1 action+> action = choice [try alterIncrement+> ,try alterMin+> ,try alterMax+> ,try alterStart+> ,try alterRestart+> ,alterCache]+> alterIncrement = AlterSequenceIncrement <$> (pos <* keyword "increment" <* optional (keyword "by")) <*> integer+> alterMin = AlterSequenceMin <$> pos <*> sequenceMinValue+> alterMax = AlterSequenceMax <$> pos <*> sequenceMaxValue+> alterStart = AlterSequenceStart <$> (pos <* keyword "start" <* optional (keyword "with")) <*> integer+> alterRestart = AlterSequenceRestart <$> (pos <* keyword "restart")+> <*> optionMaybe (optional (keyword "with") *> integer)+> alterCache = AlterSequenceCache <$> (pos <* keyword "cache") <*> integer++> sequenceMinValue :: SParser (Maybe Integer)+> sequenceMinValue = choice [try (Nothing <$ keyword "no" <* keyword "minvalue")+> ,Just <$> (keyword "minvalue" *> integer)]++> sequenceMaxValue :: SParser (Maybe Integer)+> sequenceMaxValue = choice [try (Nothing <$ keyword "no" <* keyword "maxvalue")+> ,Just <$> (keyword "maxvalue" *> integer)]+++++create function, support sql functions and plpgsql functions. Parses+the body in both cases and provides a statement list for the body+rather than just a string. TODO: maybe support other languages by+returning the function body just as a string instead of attempting to+parse it++> createFunction :: SParser Statement+> createFunction = do+> p <- pos+> rep <- choice [NoReplace <$ keyword "function"+> ,Replace <$ mapM_ keyword ["or", "replace", "function"]+> ]+> fnName <- name+> params <- parens $ commaSep param+> retType <- keyword "returns" *> typeName+> ((bodypos,body), lang,vol) <-+> permute ((,,) <$$> parseAs+> <||> readLang+> <|?> (Volatile,pVol))+> flg <- getState+> case parseBody flg lang body bodypos of+> Left er -> fail er+> Right b ->+> return $ CreateFunction p fnName params retType rep lang b vol+> where+> parseAs = do+> keyword "as"+> bodypos <- toMySp <$> getPosition+> body <- stringLit+> return (bodypos,body)+> pVol = matchAKeyword [("volatile", Volatile)+> ,("stable", Stable)+> ,("immutable", Immutable)]+> readLang = keyword "language" *> matchAKeyword [("plpgsql", Plpgsql)+> ,("sql",Sql)]+> parseBody :: ParseFlags -> Language -> ScalarExpr -> MySourcePos+> -> Either String FnBody+> parseBody flg lang body (fileName,line,col) =+> case parseIt'+> (functionBody lang)+> flg+> fileName+> (Just (line,col))+> (L.fromChunks [T.pack $ extrStr body]) of+> Left er@(ParseErrorExtra {}) -> Left $ show er+> Right body' -> Right body'+> -- sql function is just a list of statements, the last one+> -- has the trailing semicolon optional+> functionBody Sql = do+> p <- pos+> a <- many (try $ sqlStatement True)+> -- this makes my head hurt, should probably write out+> -- more longhand+> SqlFnBody p <$> option a (((a++) . (:[])) <$> sqlStatement False)+> -- plpgsql function has an optional declare section, plus+> -- the statements are enclosed in begin ... end; (semi colon+> -- after end is optional)+> functionBody Plpgsql =+> PlpgsqlFnBody <$> pos <*> do+> p <- pos+> l <- label+> block p l <* optional (symbol ";") <* eof++params to a function++> param :: SParser ParamDef+> param = choice [+> try (ParamDef <$> pos <*> nameComponent <*> typeName)+> ,ParamDefTp <$> pos <*> typeName]++variable declarations in a plpgsql function++> varDef :: SParser VarDef+> varDef = do+> p <- pos+> a <- nameComponent+> choice [do+> keyword "alias"+> keyword "for"+> choice [+> VarAlias p a <$> name+> ,ParamAlias p a <$> liftPositionalArgTok]+> ,VarDef p a+> <$> typeName+> <*> tryOptionMaybe ((symbol ":=" <|> symbol "=")*> expr)+> ]+> <* symbol ";"+>+> createView :: SParser Statement+> createView = CreateView+> <$> pos <* keyword "view"+> <*> name+> <*> tryOptionMaybe (parens $ commaSep nameComponent)+> <*> (keyword "as" *> pQueryExpr)++> alterView :: SParser Statement+> alterView = AlterView+> <$> pos <* keyword "view"+> <*> name+> <*> tryOptionMaybe (parens $ commaSep nameComponent)+> <*> (keyword "as" *> pQueryExpr)++> alterSchema :: SParser Statement+> alterSchema = AlterSchema+> <$> pos <* keyword "schema"+> <*> name+> <*> operation+> where+> operation = choice [try changeOwner, renameSchema]+> renameSchema = AlterSchemaName+> <$> (pos <* keyword "rename" <* keyword "to")+> <*> name+> changeOwner = AlterSchemaOwner+> <$> (pos <* keyword "owner" <* keyword "to")+> <*> name++>+> createDomain :: SParser Statement+> createDomain = CreateDomain+> <$> pos <* keyword "domain"+> <*> name+> <*> (tryOptionMaybe (keyword "as") *> typeName)+> <*> option "" (keyword "constraint" *> idString)+> <*> tryOptionMaybe (keyword "check" *> parens expr)++> createDatabase :: SParser Statement+> createDatabase = CreateDatabase+> <$> pos <* keyword "database"+> <*> name+>++> createSchema :: SParser Statement+> createSchema = CreateSchema+> <$> pos <* keyword "schema"+> <*> name+> <*> tryOptionMaybe (keyword "authorization" *> name)++> dropSomething :: SParser Statement+> dropSomething = do+> p <- pos+> x <- try (choice [+> Domain <$ keyword "domain"+> ,Type <$ keyword "type"+> ,Table <$ keyword "table"+> ,View <$ keyword "view"+> ,Database <$ keyword "database"+> ,User <$ keyword "user"+> ,Login <$ keyword "login"+> ,Schema <$ keyword "schema"+> ])+> (i,e,r) <- parseDrop name+> return $ DropSomething p x i e r+>+> dropTrigger :: SParser Statement+> dropTrigger = do+> p <- pos+> _ <- keyword "trigger"+> (i,e,t,r) <- parseDrop' nameComponent name+> return $ DropTrigger p i e t r+>+> dropFunction :: SParser Statement+> dropFunction = do+> p <- pos+> keyword "function"+> (i,e,r) <- parseDrop pFun+> return $ DropFunction p i e r+> where+> pFun = (,) <$> name+> <*> parens (commaSep typeName)++> parseDrop :: SParser a+> -> SParser (IfExists, [a], Cascade)+> parseDrop p = (,,)+> <$> ifExists+> <*> commaSep1 p+> <*> cascade+> where+> ifExists = option Require+> (try $ IfExists <$ (keyword "if"+> *> keyword "exists"))+>+> parseDrop' :: SParser a+> -> SParser b+> -> SParser (IfExists, a, b, Cascade)+> parseDrop' p q = (,,,)+> <$> ifExists+> <*> p+> <*> (keyword "on" *> q)+> <*> cascade+> where+> ifExists = option Require+> (try $ IfExists <$ (keyword "if"+> *> keyword "exists"))+>+> createLanguage :: SParser Statement+> createLanguage =+> CreateLanguage <$> pos+> <*> (optional (keyword "procedural") *>+> keyword "language" *>+> idString)+>+> createTrigger :: SParser Statement+> createTrigger =+> CreateTrigger <$> pos+> <*> (keyword "trigger" *> nameComponent)+> <*> twhen+> <*> tevents+> <*> (keyword "on" *> name)+> <*> tfiring+> <*> (keyword "execute" *> keyword "procedure"+> *> name)+> <*> parens (commaSep expr)+> where+> twhen = choice [TriggerBefore <$ keyword "before"+> ,TriggerAfter <$ keyword "after"]+> tevents :: SParser [TriggerEvent]+> tevents = sepBy1 (choice [+> AntiTriggerEvent <$> splice 't'+> ,TInsert <$ keyword "insert"+> ,TUpdate <$ keyword "update"+> ,TDelete <$ keyword "delete"]) (keyword "or")+> tfiring = option EachStatement+> (keyword "for" *> optional (keyword "each") *>+> choice [+> EachRow <$ keyword "row"+> ,EachStatement <$ keyword "statement"])++> createAlterLoginUser :: (Annotation -> Name -> String -> Statement) -> Text -> SParser Statement+> createAlterLoginUser ctor k = ctor+> <$> pos <* keyword k+> <*> name+> <*> (keyword "with" *> keyword "password" *> symbol "=" *> (extrStr <$> stringLit))++> createLogin :: SParser Statement+> createLogin = createAlterLoginUser CreateLogin "login"+> createUser :: SParser Statement+> createUser = createAlterLoginUser CreateUser "user"+> alterLogin :: SParser Statement+> alterLogin = createAlterLoginUser AlterLogin "login"+> alterUser :: SParser Statement+> alterUser = createAlterLoginUser AlterUser "user"+++anti statement+--------------++> antiStatement :: SParser Statement+> antiStatement = AntiStatement <$> splice 's'++--------------------------------------------------------------------------------++component parsers for sql statements+====================================++> whereClause :: SParser ScalarExpr+> whereClause = keyword "where" *> expr++selectlist and selectitem: the bit between select and from+check for into either before the whole list of select columns+or after the whole list++> selectList :: SParser SelectList+> selectList = SelectList <$> pos+> <*> itemList+> where+> itemList = commaSep1 selectItem+> selectItem = pos >>= \p ->+> optionalSuffix+> (SelExp p) (starExpr <|> expr)+> (SelectItem p) (optional (keyword "as") *> asAlias)++should try to factor this into the standard expr parse (use a flag) so+that can left factor the 'name component . ' part and avoid the try++> starExpr :: SParser ScalarExpr+> starExpr = choice [Star <$> pos <* symbol "*"+> ,try $ do+> p <- pos+> nc <- nameComponent+> symbol "."+> symbol "*"+> return $ QStar p nc]++>+> returning :: SParser SelectList+> returning = keyword "returning" *> selectList+>+> columnNameList :: SParser [NameComponent]+> columnNameList = parens $ commaSep1 nameComponent+>+> typeName :: SParser TypeName+> typeName =+> choice [+> SetOfTypeName <$> pos <*> (keyword "setof" *> typeName)+> ,otherTypeName]+> where+> otherTypeName = do+> p <- pos+> s <- pTypeNameString+> choice [try (Prec2TypeName p s+> <$> (symbol "(" *> integer)+> <*> (symbol "," *> integer <* symbol ")"))+> ,PrecTypeName p s <$> parens integer+> ,arrayTypeName p s+> ,return $ SimpleTypeName p s]+> arrayTypeName p s = ArrayTypeName p (SimpleTypeName p s)+> <$ symbol "[" <* symbol "]"+> pTypeNameString :: SParser Name+> pTypeNameString = (Name <$> pos+> <*> choice [[Nmc "double precision"]+> <$ try (keyword "double"+> <* keyword "precision")+> ,[Nmc "character varying"]+> <$ try (keyword "character"+> <* keyword "varying")])+> <|> name+>+> cascade :: SParser Cascade+> cascade = option Restrict (choice [+> Restrict <$ keyword "restrict"+> ,Cascade <$ keyword "cascade"])++> stmtEnd :: Bool -> SParser ()+> stmtEnd alwaysOptional = do+> ss <- isSqlServer+> if alwaysOptional || ss+> then optional (symbol ";") >>= \_ -> return ()+> else symbol ";" >>= \_ -> return ()++--------------------------------------------------------------------------------++plpgsql statements+==================++> plPgsqlStatement :: SParser Statement+> plPgsqlStatement =+> choice [+> -- modified sql statements+> choice [+> try intoQueryStatement+> ,choice [insert+> ,update+> ,delete] >>= intoSuffix+> ] <* stmtEnd False+> -- regular sql statements+> ,sqlStatement True+> -- regular plpgsql statements+> ,choice [+> declareStatement+> ,setAssign+> ,continue+> ,execute >>= intoSuffix+> ,caseStatement+> ,assignment+> ,ifStatement+> ,returnSt+> ,raise+> ,perform+> ,labelPrefixed+> ,nullStatement+> ,exitStatement]+> <* stmtEnd False+> ]+> where+> intoSuffix e =+> option e (try $ do+> i <- into+> return $ i e)+> labelPrefixed = do+> p <- pos+> l <- label+> choice [block p l+> ,forStatement p l+> ,whileStatement p l+> ,loopStatement p l]++> label :: SParser (Maybe String)+> label = optionMaybe (symbol "<<" *> idString <* symbol ">>")+>+> block :: Annotation -> Maybe String -> SParser Statement+> block p l = Block p l+> <$> option [] declarePart+> <*> statementPart+> where+> statementPart = keyword "begin"+> *> many plPgsqlStatement+> <* keyword "end"+> declarePart = keyword "declare"+> *> manyTill (try varDef) (lookAhead $ keyword "begin")+>+>+> nullStatement :: SParser Statement+> nullStatement = NullStatement <$> (pos <* keyword "null")+>+> exitStatement :: SParser Statement+> exitStatement = ExitStatement <$> (pos <* keyword "exit")+> <*> optionMaybe idString+>+>+> continue :: SParser Statement+> continue = ContinueStatement <$> (pos <* keyword "continue")+> <*> optionMaybe idString+>+> perform :: SParser Statement+> perform = Perform <$> (pos <* keyword "perform") <*> expr+>++> execute :: SParser Statement+> execute =+> choice+> [do+> isSqlServer >>= guard+> _ <- keyword "exec" <|> keyword "execute"+> ExecStatement <$> pos+> <*> name+> <*> commaSep expr+> ,Execute <$> (pos <* keyword "execute")+> <*> expr]+>+> assignment :: SParser Statement+> assignment = Assignment+> <$> pos+> -- put the := in the first try to attempt to get a+> -- better error if the code looks like malformed+> -- assignment statement+> <*> try (name <* (symbol ":=" <|> symbol "="))+> <*> expr++> setAssign :: SParser Statement+> setAssign = do+> isSqlServer >>= guard+> Assignment <$> (pos <* keyword "set")+> <*> name+> <*> (symbol "=" *> expr)++>+> returnSt :: SParser Statement+> returnSt = pos >>= \p -> keyword "return" >>+> choice [+> ReturnNext p <$> (keyword "next" *> expr)+> ,ReturnQuery p <$> (keyword "query" *> pQueryExpr)+> ,Return p <$> tryOptionMaybe expr]+>+> raise :: SParser Statement+> raise = pos >>= \p -> keyword "raise" >>+> Raise p+> <$> raiseType+> <*> (extrStr <$> stringLit)+> <*> option [] (symbol "," *> commaSep1 expr)+> where+> raiseType = matchAKeyword [("notice", RNotice)+> ,("exception", RException)+> ,("error", RError)]+>+> forStatement :: Annotation -> Maybe String -> SParser Statement+> forStatement p l = do+> keyword "for"+> start <- nameComponent+> keyword "in"+> choice [ForQueryStatement p l start+> <$> try pQueryExpr <*> theRest+> ,ForIntegerStatement p l start+> <$> expr+> <*> (symbol ".." *> expr)+> <*> theRest]+> where+> theRest = keyword "loop" *> many plPgsqlStatement+> <* keyword "end" <* keyword "loop"+>+> whileStatement :: Annotation -> Maybe String -> SParser Statement+> whileStatement p l = WhileStatement p l+> <$> (keyword "while" *> expr <* keyword "loop")+> <*> many plPgsqlStatement <* keyword "end" <* keyword "loop"+> loopStatement :: Annotation -> Maybe String -> SParser Statement+> loopStatement p l = LoopStatement p l+> <$> (keyword "loop" *> many plPgsqlStatement <* keyword "end" <* keyword "loop")+>++>+> ifStatement :: SParser Statement+> ifStatement = do+> ss <- isSqlServer+> if ss+> -- no else if in sql server+> -- no end if in sql server+> then If+> <$> (pos <* keyword "if")+> <*> ((:[]) <$> (expr <.> someStatements ss))+> <*> elsePart ss+> else If+> <$> (pos <* keyword "if")+> <*> (ifPart ss <:> elseifParts ss)+> <*> (elsePart ss <* endIf)+> where+> ifPart ss =+> if ss+> -- no then keyword in tsql+> then expr <.> someStatements ss+> else expr <.> (thn *> someStatements ss)+> elseifParts ss = many ((elseif *> expr) <.> (thn *> someStatements ss))+> elsePart ss = option [] (keyword "else" *> someStatements ss)+> endIf = keyword "end" <* keyword "if"+> thn = keyword "then"+> elseif = keyword "elseif" <|> keyword "elsif"+> (<.>) a b = (,) <$> a <*> b+> someStatements ss =+> if ss+> then+> -- sql server only allows multiple statements if wrapped+> -- in a begin end block+> choice [keyword "begin"+> *> many plPgsqlStatement+> <* keyword "end"+> ,(:[]) <$> plPgsqlStatement]+> else many plPgsqlStatement++> caseStatement :: SParser Statement+> caseStatement = do+> p <- pos+> keyword "case"+> choice [try (CaseStatementSimple p+> <$> expr+> <*> many whenSt+> <*> option [] (keyword "else" *> many plPgsqlStatement)+> <* keyword "end" <* keyword "case")+> ,CaseStatement p+> <$> many whenSt+> <*> option [] (keyword "else" *> many plPgsqlStatement)+> <* keyword "end" <* keyword "case"]+> where+> whenSt = keyword "when" >>+> (,) <$> commaSep1 expr+> <*> (keyword "then" *> many plPgsqlStatement)++> declareStatement :: SParser Statement+> declareStatement = do+> isSqlServer >>= guard+> DeclareStatement+> <$> pos+> <*> (keyword "declare"+> *> commaSep1 de)+> where+> de = (,,) <$> localVarName+> <*> typeName+> <*> optionMaybe (symbol "=" *> expr)+> localVarName = do+> i <- idString+> guard (head i == '@')+> return i+++only limited support for tsql create index atm++> createIndex :: SParser Statement+> createIndex =+> CreateIndexTSQL+> <$> try (pos <* flavs <* keyword "index")+> <*> nameComponent+> <*> (keyword "on" *> name)+> <*> parens (commaSep1 nameComponent) <* opts+> where+> flavs = do+> _ <- optional $ keyword "unique"+> _ <- optional (keyword "clustered" <|> keyword "nonclustered")+> return ()+> opts = do+> _ <- optional $ do+> _ <- keyword "include"+> _ <- parens (commaSep1 nameComponent)+> return ()+> return ()++--------------------------------------------------------------------------------++expressions+===========++This is the bit that makes it the most obvious that I don't really+know haskell, parsing theory or parsec ... robbed a parsing example+from haskell-cafe and mainly just kept changing it until it seemed to+work++> expr :: SParser ScalarExpr+> expr = do+> ParseFlags {pfDialect = d} <- getState+> buildExpressionParser (table d) factor+> <?> "expression"++>+> factor :: SParser ScalarExpr+> factor =++First job is to take care of forms which start like a vanilla+expression, and then add a suffix on++> fct >>= tryExprSuffix+> where+> tryExprSuffix e =+> option e (choice (map (\f -> try $ f e) -- Try added because betweenSuffix may eat up "not" in betweenSuffix+> [inPredicateSuffix+> ,functionCallSuffix+> ,windowFnSuffix+> ,castSuffix+> ,betweenSuffix+> ,arraySubSuffix+> ,qualIdSuffix])+> >>= tryExprSuffix)+> fct = choice [++order these so the ones which can be valid prefixes of others appear+further down the list (used to be a lot more important when there+wasn't a separate lexer), probably want to refactor this to use the+optionalsuffix parsers to improve speed.++start with the factors which start with parens - eliminate scalar+subqueries since they're efficient to distinguish from the others+using try, then parse an expression in parens which can either be the+start of a row constructor or just a parenthesized expression. This is+left factored because using try with the rowctor version first leads+to exponential backtracking for nested parenthesized expressions which+is very slow.++> parens (scalarSubQuery <|> exprInParens)++try a few random things which can't start a different expression++> ,positionalArg+> ,placeholder+> ,stringLit+> ,numberLit++put the factors which start with keywords before the ones which start+with a function, so you don't try an parse a keyword as a function name++> ,rowCtor+> ,caseScalarExpr+> ,exists+> ,booleanLit+> ,nullLit+> ,arrayLit+> ,castKeyword+> ,try substring -- use try cos there is also a regular function called substring+> ,extract+> ,odbcExpr++> ,try interval+> ,try typedStringLit+> ,antiScalarExpr+> ,sqlServerConvert+> ,keywordFunction+> ,identifier+> ,Identifier <$> pos <*> (AntiName <$> splice 'n')+> ]++operator table+--------------++proper hacky, but sort of does the job+the 'missing' notes refer to pg operators which aren't yet supported,+or supported in a different way (e.g. cast uses the type name parser+for one of it's argument, not the expression parser - I don't know if+there is a better way of doing this but there usually is in parsec)++pg's operator table is on this page:+http://www.postgresql.org/docs/8.4/interactive/sql-syntax-lexical.html#SQL-SYNTAX-OPERATORS++will probably need something more custom to handle full range of sql+syntactical novelty, in particular the precedence rules mix these+operators up with irregular syntax operators, you can create new+operators during parsing, and some operators are prefix/postfix or+binary depending on the types of their operands++The full list of operators from a standard template1 database should+be used here.++TODO: handle the completely different list of sql server operators a+bit better++TODO: this follows the old, incorrect postgresql precedence, update to+the 9.5 behaviour which is much more in line with ansi sql and other+sql dbmss.++> tableAB :: Dialect+> -> Bool+> -> [[Operator [Token] ParseState Identity ScalarExpr]]+> tableAB d isB = [[{-binary "." AssocLeft-}]+> --[binary "::" (BinOpCall Cast) AssocLeft]+> --missing [] for array element select+> ,[prefix "+" "+"] -- Unary plus - Exists in pgsql 9.4++> ,[prefix "-" "-"] -- Unary minus++> ,[binary "^" AssocLeft] -- Exponent++> ,[binary "*" AssocLeft+> ,idHackBinary "*" AssocLeft+> ,binary "/" AssocLeft+> ,binary "%" AssocLeft]++> ,[binary "+" AssocLeft+> ,binary "-" AssocLeft]++> ------- All custom operators must go here:+> --other operators all added in this list according to the pg docs:+> ,[prefix "~" "~"+> ,binary "|" AssocLeft+> ,binary "&" AssocLeft+> ,binary "#" AssocLeft+> ,binary "<<" AssocLeft+> ,binary ">>" AssocLeft+> ,binary "<->" AssocNone+> ,binary "||" AssocLeft]+> ++ [prefix "@" "@" | diSyntaxFlavour d == Postgres]+> -- Stop custom operators.+> --in should be here, but is treated as a factor instead+> --between+> --overlaps++> ,[binaryk "like" "like" AssocNone+> ,binaryk "rlike" "rlike" AssocNone+> ,binaryks ["not","like"] "notlike" AssocNone]++> ,[binary "<" AssocNone+> ,binary ">" AssocNone+> --(also ilike similar)+> ,binary "=" AssocRight+> ,binary "<=" AssocRight+> ,binary ">=" AssocRight+> ,binary "<>" AssocRight+> ,binarycust (symbol "!=") "<>" AssocRight]++> ,[postfixks ["is", "not", "null"] "isnotnull"+> ,postfixks ["is", "null"] "isnull"]++> ,[notNot+> ,prefixk "not" "not"+> ]++> ,if isB+> then []+> else [binaryk "and" "and" AssocLeft]++> ,[binaryk "or" "or" AssocLeft]+> ]+> where+> binary s = binarycust (symbol s) s+> -- '*' is lexed as an id token rather than a symbol token, so+> -- work around here+> idHackBinary s = binarycust (keyword s) s+> binaryk = binarycust . keyword+> binaryks = binarycust . mapM_ keyword+> prefix = prefCust Prefix . symbol+> prefixk = prefCust Prefix . keyword+> postfixks = postCust Postfix . mapM_ keyword+> binarycust opParse t =+> Infix $ try $+> BinaryOp <$> pos <*> (nm emptyAnnotation t <$ opParse)+> prefCust ctor opParse t =+> ctor $ try $+> PrefixOp <$> pos <*> (nm emptyAnnotation t <$ opParse)+> postCust ctor opParse t =+> ctor $ try $+> PostfixOp <$> pos <*> (nm emptyAnnotation t <$ opParse)+> -- hack - haven't worked out why parsec buildexpression parser won't+> -- parse something like "not not EXPR" without parens so hack here+> notNot =+> Prefix $ try $ do+> p1 <- pos+> keyword "not"+> p2 <- pos+> keyword "not"+> return $ PrefixOp p1 (nm p1 "not")+> . PrefixOp p2 (nm p2 "not")++From postgresql src/backend/parser/gram.y++~~~~~++ * We have two expression types: a_expr is the unrestricted kind, and+ * b_expr is a subset that must be used in some places to avoid shift/reduce+ * conflicts. For example, we can't do BETWEEN as "BETWEEN a_expr AND a_expr"+ * because that use of AND conflicts with AND as a boolean operator. So,+ * b_expr is used in BETWEEN and we remove boolean keywords from b_expr.+ *+ * Note that '(' a_expr ')' is a b_expr, so an unrestricted expression can+ * always be used by surrounding it with parens.++~~~~~++> table :: Dialect -> [[Operator [Token] ParseState Identity ScalarExpr]]+> table d = tableAB d False++> tableB :: Dialect -> [[Operator [Token] ParseState Identity ScalarExpr]]+> tableB d = tableAB d True++use the same factors++> b_expr :: SParser ScalarExpr+> b_expr = do+> ParseFlags {pfDialect = d} <- getState+> buildExpressionParser (tableB d) factor+> <?> "expression"+>++factor parsers+--------------++I think the lookahead is used in an attempt to help the error messages.++> scalarSubQuery :: SParser ScalarExpr+> scalarSubQuery = ScalarSubQuery+> <$> pos+> <*> pQueryExpr++in predicate - an identifier or row constructor followed by 'in'+then a list of expressions or a subselect++> inPredicateSuffix :: ScalarExpr -> SParser ScalarExpr+> inPredicateSuffix e = try $+> InPredicate+> <$> pos+> <*> return e+> <*> option True (False <$ keyword "not")+> <*> (keyword "in" *> parens ((InQueryExpr <$> pos <*> pQueryExpr)+> <|>+> (InList <$> pos <*> commaSep1 expr)))++row ctor: one of++* row ()+* row (expr)+* row (expr, expr1, ...)+* (expr, expr2,...) [implicit (no row keyword) version, at least two elements+ must be present]++(expr) parses to just expr rather than row(expr)+and () is a syntax error.++the rowCtor parses a ctor with the row keyword exprInParens parses+either a rowCtor without the row keyword (there must be more than one+comma separated expression, or it parses a parens expr).++> rowCtor :: SParser ScalarExpr+> rowCtor = SpecialOp+> <$> pos+> <*> (nm <$> pos <*> return "rowctor")+> <*> (keyword "row" *> parens (commaSep expr))++question: is a parenthesized expression different to a single element+row?++> exprInParens :: SParser ScalarExpr+> exprInParens = do+> p <- pos+> e1 <- expr+> choice [do+> void $ symbol ","+> es <- commaSep1 expr+> return $ SpecialOp p (nm p "rowctor") (e1:es)+> ,return $ Parens p e1]++>+> numberLit :: SParser ScalarExpr+> numberLit = NumberLit <$> pos <*> numString+>++> integer :: SParser Integer+> integer = do+> l <- numString+> guard (all (`elem` digChars) l)+> return $ read l+> where+> digChars = concatMap show [(0::Int)..9]++> signedInteger :: SParser Integer+> signedInteger = choice [try $ negate <$> (symbol "-" *> integer)+> ,integer]+++>+> caseScalarExpr :: SParser ScalarExpr+> caseScalarExpr = do+> p <- pos+> keyword "case"+> choice [+> try $ CaseSimple p <$> expr+> <*> many whenParse+> <*> tryOptionMaybe (keyword "else" *> expr)+> <* keyword "end"+> ,Case p <$> many whenParse+> <*> tryOptionMaybe (keyword "else" *> expr)+> <* keyword "end"]+> where+> whenParse = (,) <$> (keyword "when" *> commaSep1 expr)+> <*> (keyword "then" *> expr)+>+> exists :: SParser ScalarExpr+> exists = Exists <$> pos <* keyword "exists" <*> parens pQueryExpr+>++> booleanLit :: SParser ScalarExpr+> booleanLit = BooleanLit <$> pos <*> (True <$ keyword "true"+> <|> False <$ keyword "false")++>+> nullLit :: SParser ScalarExpr+> nullLit = NullLit <$> pos <* keyword "null"+>+> arrayLit :: SParser ScalarExpr+> arrayLit = SpecialOp <$> pos <* keyword "array"+> <*> (nm <$> pos <*> return "arrayctor")+> <*> squares (commaSep expr)+>+> arraySubSuffix :: ScalarExpr -> SParser ScalarExpr+> arraySubSuffix e = SpecialOp <$> pos+> <*> (nm <$> pos <*> return "arraysub")+> <*> ((e:) <$> squares (commaSep1 expr))+>+> windowFnSuffix :: ScalarExpr -> SParser ScalarExpr+> windowFnSuffix e = WindowApp <$> pos <*> return e+> <*> (keyword "over"+> *> (symbol "(" *> option [] partitionBy))+> <*> orderBy+> <*> frm+> <* symbol ")"+> where+> partitionBy = keyword "partition" *> keyword "by" *> commaSep1 expr+> frm = optionMaybe $ choice $ map (\(a,b) -> a <$ try (ks b)) [+> (FrameUnboundedPreceding, ["range","unbounded","preceding"])+> ,(FrameUnboundedPreceding, ["range"+> ,"between"+> ,"unbounded"+> ,"preceding"+> ,"and"+> ,"current"+> ,"row"])+> ,(FrameUnboundedFull, ["range"+> ,"between"+> ,"unbounded"+> ,"preceding"+> ,"and"+> ,"unbounded"+> ,"following"])+> ,(FrameUnboundedFull, ["rows"+> ,"between"+> ,"unbounded"+> ,"preceding"+> ,"and"+> ,"unbounded"+> ,"following"])+> ,(FrameRowsUnboundedPreceding, ["rows","unbounded","preceding"])+> ,(FrameRowsUnboundedPreceding, ["rows"+> ,"between"+> ,"unbounded"+> ,"preceding"+> ,"and"+> ,"current"+> ,"row"])]+> ks = mapM keyword+>+> betweenSuffix :: ScalarExpr -> SParser ScalarExpr+> betweenSuffix a = try $ do+> p <- pos+> opname <- option "between" ("notbetween" <$ keyword "not") -- Discern between `between` and `not between`+> keyword "between"+> b <- b_expr+> keyword "and"+> c <- b_expr+> return $ SpecialOp p (nm p opname) [a,b,c]++handles aggregate business as well++can use a * in aggregate calls and in window functions. This+represents a call to an aggregate which has no parameters, so count(*)+actually means count():++select count() from pg_attrdef;+ERROR: count(*) must be used to call a parameterless aggregate function+LINE 1: select count() from pg_attrdef;++But you can't write it as count() ... ?++You cannot use * together with either distinct or order by, and it+cannot be qualified.++This parser is used as the prefix of the window function parser so+both are handled here. This will parse non aggregate calls containing+a single * argument without error - this will have to be caught during+typechecking. It also parses the aggregate extras (distinct and order+by) for non aggregate calls without error, so this also will need to+be caught during typechecking. The typechecker doesn't really do much+checking with aggregates at the moment so should fix it all together.++> functionCallSuffix :: ScalarExpr -> SParser ScalarExpr+> functionCallSuffix ex =+> -- bit hacky, if exp is a identifier or qualified, then+> -- convert to function, also support antiquote for function name+> case ex of+> Identifier _ nm' -> fn nm'+> s -> fail $ "cannot make functioncall from " ++ show s+> where+> fn :: Name -> SParser ScalarExpr+> fn fnName = do+> p <- pos+> (di,as,ob) <- parens+> $ choice [ -- handle a single *+> (Nothing,,[]) <$> ((:[]) <$> (Star <$> pos <* symbol "*"))+> ,(,,)+> <$> optionMaybe+> (choice [Distinct <$ distinctKeyword+> ,All <$ keyword "all"])+> <*> commaSep expr+> <*> orderBy]+> return $ case (di,ob) of+> (Nothing,[]) -> App p fnName as+> (d,o) -> AggregateApp p (fromMaybe All d) (App p fnName as) o++these won't parse as normal functions because they use keywords so do+a special case for them++> keywordFunction :: SParser ScalarExpr+> keywordFunction = try $ do+> p <- pos+> i <- nameComponentAllows kfs+> guard (iskfs i)+> functionCallSuffix (Identifier p (Name p [i]))+> where+> kfs = ["any","all","isnull","left","right","convert"]+> iskfs (Nmc n) | map toLower n `elem` kfs = True+> iskfs _ = False++>+> castKeyword :: SParser ScalarExpr+> castKeyword =+> Cast+> <$> pos <* keyword "cast" <* symbol "("+> <*> expr+> <*> (keyword "as" *> typeName <* symbol ")")++parse both odbc style convert:+ convert(expr, type name) -- type name is an identifier+ and sql server+ convert(type name, expr [,style]) -- the type name is a normal sql type name++the style is ignored+the first form is represented as a function called convert (App ctor)+the second form is represented as Cast ctor for now++it needs fixing: at least add a specific ctor for the second form+plus review use of try++> sqlServerConvert :: SParser ScalarExpr+> sqlServerConvert = try $ do+> isSqlServer >>= guard+> p <- pos+> _ <- keyword "convert" <* symbol "("+> choice [try $ do+> ex <- expr+> _ <- symbol ","+> ex1 <- expr+> _ <- symbol ")"+> return $ App p (Name p [Nmc "convert"]) [ex, ex1]+> ,do+> tn <- typeName+> _ <- symbol ","+> e <- expr+> -- ignores the style+> _ <- optional $ symbol "," *> integer+> _ <- symbol ")"+> return $ Cast p e tn+> ]++> castSuffix :: ScalarExpr -> SParser ScalarExpr+> castSuffix ex = pos >>= \p -> Cast p ex <$> (symbol "::" *> typeName)++> typedStringLit :: SParser ScalarExpr+> typedStringLit = TypedStringLit+> <$> pos+> <*> typeName+> <*> (extrStr <$> stringLit)++> extract :: SParser ScalarExpr+> extract = try $ do+> p <- pos+> _ <- keyword "extract"+> _ <- symbol "("+> f <- extractField+> _ <- keyword "from"+> e <- expr+> _ <- symbol ")"+> return $ Extract p f e+> where+> extractField =+> choice [ExtractCentury <$ keyword "century"+> ,ExtractDay <$ keyword "day"+> ,ExtractDecade <$ keyword "decade"+> ,ExtractDow <$ keyword "dow"+> ,ExtractDoy <$ keyword "doy"+> ,ExtractEpoch <$ keyword "epoch"+> ,ExtractHour <$ keyword "hour"+> ,ExtractIsodow <$ keyword "isodow"+> ,ExtractIsoyear <$ keyword "isoyear"+> ,ExtractMicroseconds <$ keyword "microseconds"+> ,ExtractMillennium <$ keyword "millennium"+> ,ExtractMilliseconds <$ keyword "milliseconds"+> ,ExtractMinute <$ keyword "minute"+> ,ExtractMonth <$ keyword "month"+> ,ExtractQuarter <$ keyword "quarter"+> ,ExtractSecond <$ keyword "second"+> ,ExtractTimezone <$ keyword "timezone"+> ,ExtractTimezoneHour <$ keyword "timezone_hour"+> ,ExtractTimezoneMinute <$ keyword "timezone_minute"+> ,ExtractWeek <$ keyword "week"+> ,ExtractYear <$ keyword "year"]++> interval :: SParser ScalarExpr+> interval = Interval+> <$> pos+> <*> (keyword "interval" *> (extrStr <$> stringLit))+> <*> intervalField+> <*> tryOptionMaybe (parens (fromInteger <$> integer))+> where+> intervalField =+> choice [IntervalYear <$ keyword "year"+> ,IntervalMonth <$ keyword "month"+> ,IntervalDay <$ keyword "day"+> ,IntervalHour <$ keyword "hour"+> ,IntervalMinute <$ keyword "minute"+> ,IntervalSecond <$ keyword "second"+> {-,IntervalYearToMonth <$ keyword "day"+> ,IntervalDayToHour <$ keyword "day"+> ,IntervalDayToMinute <$ keyword "day"+> ,IntervalDayToSecond <$ keyword "day"+> ,IntervalHourToMinute <$ keyword "day"+> ,IntervalHourToSecond <$ keyword "day"+> ,IntervalMinuteToSecond <$ keyword "day"-}]+>+> substring :: SParser ScalarExpr+> substring = do+> p <- pos+> keyword "substring"+> symbol "("+> a <- expr+> keyword "from"+> b <- expr+> keyword "for"+> c <- expr+> symbol ")"+> return $ SpecialOp p (nm p "substring") [a,b,c]+>++odbc++date, time, and timestamp literals, and scalar function calls++> odbcExpr :: SParser ScalarExpr+> odbcExpr = between (symbol "{") (symbol "}")+> (odbcTimeLit <|> odbcFunc <|> odbcInterval)+> where+> odbcTimeLit =+> OdbcLiteral <$> pos+> <*> choice [OLDate <$ keyword "d"+> ,OLTime <$ keyword "t"+> ,OLTimestamp <$ keyword "ts"]+> <*> stringN+> odbcFunc = OdbcFunc+> <$> pos+> <*> (keyword "fn" *> expr) -- TODO: should limit this to function call or extract+> odbcInterval = interval++++------------------------------------------------------------++identifier parsing, quite a few variations ...++parse x.y, x.y.z, etc.++> qualIdSuffix :: ScalarExpr -> SParser ScalarExpr+> qualIdSuffix (Identifier _p (Name _ is)) =+> qualIdX is++> qualIdSuffix e = do+> p <- pos+> i1 <- symbol "." *> nameComponent+> return $ BinaryOp p (nm p ".") e (Identifier p (Name p [i1]))++> qualIdX :: [NameComponent] -> SParser ScalarExpr+> qualIdX is = do+> ss <- isSqlServer+> if ss+> then sqls+> else regular+> where+> regular = do+> p <- pos+> i1 <- symbol "." *> nameComponent+> return $ Identifier p (Name p (is ++ [i1]))+> sqls = do+> p <- pos+> numDots <- readNDots+> let eis = replicate (numDots - 1) (Nmc "")+> i1 <- nameComponent+> return $ Identifier p (Name p (is ++ eis ++ [i1]))++the cranky lexer lexes lots of dots ......+as mixtures of symbol "." and symbol ".."+we just want to know how many dots in a row there are++> readNDots :: SParser Int+> readNDots = sum <$> many1 (choice [1 <$ symbol "."+> ,2 <$ symbol ".."])++++> identifier :: SParser ScalarExpr+> identifier = Identifier <$> pos <*> name++see sql-keywords appendix in pg manual++doesn't deal with non-reserved, and reserved with qualifications yet+(e.g. the may be function or type catagory), and other categories++I think the categories should be:+reserved+reserved but can be function or type+not reserved but cannot be function or type++these categories affect the parser and typechecker differently++(the parser has to parse some reserved and 'not reserved but cannot be+function or type' keywords as function names, maybe there are others)++> reservedWords :: SParser [String]+> reservedWords = do+> ss <- isSqlServer+> if not ss+> then return+> ["all"+> ,"analyse"+> ,"analyze"+> ,"and"+> ,"any"+> ,"array"+> ,"as"+> ,"asc"+> ,"symmetric"+> ,"authorization"+> ,"binary"+> ,"both"+> ,"case"+> ,"cast"+> ,"check"+> ,"collate"+> ,"column"+> ,"concurrently"+> ,"constraint"+> ,"create"+> ,"cross"+> ,"current_catalog"+> ,"current_role"+> ,"current_time"+> ,"current_user"+> ,"default"+> ,"deferrable"+> ,"desc"+> ,"distinct"+> ,"do"+> ,"else"+> ,"end"+> ,"except"+> ,"false"+> ,"fetch"+> ,"for"+> ,"freeze"+> ,"from"+> ,"full"+> ,"grant"+> ,"group"+> ,"having"+> ,"ilike"+> ,"in"+> ,"initially"+> ,"inner"+> ,"intersect"+> ,"into"+> ,"is"+> ,"isnull"+> ,"join"+> ,"leading"+> ,"left"+> ,"like"+> ,"limit"+> ,"localtime"+> ,"localtimestamp"+> ,"natural"+> ,"not"+> ,"notnull"+> ,"null"+> ,"offset"+> ,"on"+> ,"only"+> ,"option"+> ,"or"+> ,"order"+> ,"outer"+> ,"over"+> ,"overlaps"+> ,"placing"+> ,"primary"+> ,"references"+> ,"returning"+> ,"right"+> ,"rlike"+> ,"select"+> ,"session_user"+> ,"similar"+> ,"some"+> ,"symmetric"+> ,"table"+> ,"then"+> ,"to"+> ,"trailing"+> ,"true"+> ,"union"+> ,"unique"+> ,"user"+> ,"using"+> ,"variadic"+> ,"verbose"+> ,"when"+> ,"where"+> ,"window"+> ,"with"+> --extras for hssqlppp: Todo: fix this+> ,"loop","merge","hash"]++sql server keywords from this page:+http://msdn.microsoft.com/en-us/library/ms189822.aspx+(this is the list for 2008 R2)++> else return+> ["add"+> ,"all"+> ,"alter"+> ,"and"+> ,"any"+> ,"as"+> ,"asc"+> ,"authorization"+> ,"backup"+> ,"begin"+> ,"between"+> ,"break"+> ,"browse"+> ,"bulk"+> ,"by"+> ,"cascade"+> ,"case"+> ,"check"+> ,"checkpoint"+> ,"close"+> ,"clustered"+> --,"coalesce"+> ,"collate"+> ,"column"+> ,"commit"+> ,"compute"+> ,"constraint"+> -- ,"contains" todo: fix properly, oracle has function called contains+> ,"containstable"+> ,"continue"+> ,"convert"+> ,"create"+> ,"cross"+> ,"current"+> ,"current_time"+> ,"current_user"+> ,"cursor"+> ,"database"+> ,"dbcc"+> ,"deallocate"+> ,"declare"+> ,"default"+> ,"delete"+> ,"deny"+> ,"desc"+> ,"disk"+> ,"distinct"+> ,"distributed"+> --,"double"+> ,"drop"+> ,"dump"+> ,"else"+> ,"end"+> ,"errlvl"+> ,"escape"+> ,"except"+> ,"exec"+> ,"execute"+> ,"exists"+> ,"exit"+> ,"external"+> ,"fetch"+> ,"file"+> ,"fillfactor"+> ,"for"+> ,"foreign"+> ,"freetext"+> ,"freetexttable"+> ,"from"+> ,"full"+> ,"function"+> ,"goto"+> ,"grant"+> ,"group"+> ,"hash"+> ,"having"+> ,"holdlock"+> ,"identity"+> ,"identity_insert"+> ,"identitycol"+> ,"if"+> ,"in"+> ,"index"+> ,"inner"+> ,"insert"+> ,"intersect"+> ,"into"+> ,"is"+> ,"join"+> ,"key"+> ,"kill"+> ,"left"+> ,"like"+> ,"lineno"+> ,"load"+> ,"loop"+> ,"merge"+> ,"national"+> ,"natural"+> ,"nocheck"+> ,"nonclustered"+> ,"not"+> ,"null"+> ,"nullif"+> ,"of"+> ,"off"+> ,"offsets"+> ,"on"+> ,"open"+> ,"opendatasource"+> ,"openquery"+> ,"openrowset"+> ,"openxml"+> ,"option"+> ,"or"+> ,"order"+> ,"outer"+> ,"over"+> ,"percent"+> ,"pivot"+> -- ,"plan" -- temporarily unkeyword this+> ,"precision"+> ,"primary"+> ,"print"+> ,"proc"+> ,"procedure"+> -- ,"public"+> ,"raiserror"+> ,"read"+> ,"readtext"+> ,"reconfigure"+> ,"references"+> ,"replication"+> ,"restore"+> ,"restrict"+> ,"return"+> ,"revert"+> ,"revoke"+> ,"right"+> ,"rollback"+> ,"rowcount"+> ,"rowguidcol"+> ,"rule"+> ,"save"+> ,"schema"+> ,"securityaudit"+> ,"select"+> ,"session_user"+> ,"set"+> ,"setuser"+> ,"shutdown"+> ,"some"+> ,"statistics"+> ,"system_user"+> ,"table"+> ,"tablesample"+> ,"textsize"+> ,"then"+> ,"to"+> ,"top"+> ,"tran"+> ,"transaction"+> ,"trigger"+> ,"truncate"+> ,"tsequal"+> ,"union"+> ,"unique"+> ,"unpivot"+> ,"update"+> ,"updatetext"+> ,"use"+> ,"user"+> ,"values"+> ,"varying"+> ,"view"+> ,"waitfor"+> ,"when"+> ,"where"+> ,"while"+> ,"with"+> ,"writetext"]++> ncs :: SParser [NameComponent]+> ncs = do+> ss <- isSqlServer+> if ss+> then do+> -- what a mess+> let another = do+> numDots <- readNDots+> let empties = replicate (numDots - 1) (Nmc "")+> nc <- nameComponent+> suf <- choice [another+> ,return []]+> return $ empties ++ [nc] ++ suf+> i <- nameComponent+> suf <- choice [another+> ,return []]+> return (i:suf)+> else+> sepBy1 nameComponent (symbol ".")++parse a complete name++> name :: SParser Name+> name = choice [AntiName <$> splice 'n'+> ,Name <$> pos <*> ncs+> ]++> nameComponent :: SParser NameComponent+> nameComponent = nameComponentAllows []++parser for a name component where you supply the exceptions to the+reserved identifier list to say you want these to parse successfully+instead of failing with a no keyword error++> nameComponentAllows :: [String] -> SParser NameComponent+> nameComponentAllows allows = do+> p <- pos+> x <- unrestrictedNameComponent+> rw <- reservedWords+> case x of+> Nmc n | map toLower n `elem` allows -> return x+> | map toLower n `elem` rw ->+> fail $ "no keywords " ++ show p ++ " " ++ n+> _ -> return x++ignore reserved keywords completely++> unrestrictedNameComponent :: SParser NameComponent+> unrestrictedNameComponent =+> choice [Nmc <$> idString+> ,QNmc <$> qidString+> ,AntiNameComponent <$> splice 'm']++quick hack to support identifiers like this: 'test' for sql server++not sure how to do this properly, you must not be able to write+strings in sql server using single quotes.++> asAlias :: SParser NameComponent+> asAlias = do+> ss <- isSqlServer+> if ss+> then choice [nameComponent+> ,do+> s <- stringN+> return $ QNmc s]+> else nameComponent++--------------------------------------------------------------------------------++Utility parsers+===============++> keyword :: Text -> SParser ()+> keyword k = mytoken (\tok -> case tok of+> Lex.Identifier Nothing i | lcase (T.unpack k) == lcase i -> Just ()+> _ -> Nothing)+> where+> lcase = map toLower++> keywords :: [Text] -> SParser ()+> keywords [] = pure ()+> keywords (x:xs) = keyword x *> keywords xs++>+> idString :: SParser String+> idString = mytoken (\tok -> case tok of+> Lex.Identifier Nothing i -> Just i+> Lex.PrefixedVariable c s -> Just (c : s)+> _ -> Nothing)+> qidString :: SParser String+> qidString = mytoken (\tok -> case tok of+> Lex.Identifier _ i -> Just i+> _ -> Nothing)++> splice :: Char -> SParser String+> splice c = mytoken (\tok -> case tok of+> Lex.Splice c' i | c == c' -> Just i+> _ -> Nothing)++>+> symbol :: Text -> SParser ()+> symbol c = mytoken (\tok -> case tok of+> Lex.Symbol s | T.unpack c==s -> Just ()+> _ -> Nothing)+>+> liftPositionalArgTok :: SParser Integer+> liftPositionalArgTok =+> mytoken (\tok -> case tok of+> Lex.PositionalArg n -> Just $ fromIntegral n+> _ -> Nothing)++> positionalArg :: SParser ScalarExpr+> positionalArg = PositionalArg <$> pos <*> liftPositionalArgTok+>+> antiScalarExpr :: SParser ScalarExpr+> antiScalarExpr = AntiScalarExpr <$> splice 'e'+>+> placeholder :: SParser ScalarExpr+> placeholder = (Placeholder <$> pos) <* symbol "?"+>+> numString :: SParser String+> numString = mytoken (\tok -> case tok of+> Lex.SqlNumber n -> Just n+> _ -> Nothing)++>+> liftStringTok :: SParser String+> liftStringTok = mytoken (\tok ->+> case tok of+> Lex.SqlString _ _ s ->+> -- bit hacky, the lexer doesn't process quotes+> -- but the parser expects them to have been replaced+> Just $ T.unpack $ T.replace "''" "'" $ T.replace "\'" "'" $ T.pack s+> _ -> Nothing)++> stringLit :: SParser ScalarExpr+> stringLit = choice+> [StringLit <$> pos <*> liftStringTok+> -- bit crap at the moment, not sure how to fix without+> -- mangling the ast types+> ,StringLit <$> pos <*> ((\s -> concat ["$s(",s,")"]) <$> splice 's')+> ]+>+> stringN :: SParser String+> stringN = mytoken (\tok ->+> case tok of+> Lex.SqlString _ _ s -> Just s+> _ -> Nothing)++> extrStr :: ScalarExpr -> String+> extrStr (StringLit _ s) = s+> -- todo: use fail or something?+> extrStr x =+> error $ "internal error: extrStr not supported for this type " ++ show x++== combinatory things++> parens :: SParser a+> -> SParser a+> parens = between (symbol "(") (symbol ")")+>+> squares :: SParser a+> -> SParser a+> squares = between (symbol "[") (symbol "]")+>+> tryOptionMaybe :: (Stream s m t) =>+> ParsecT s u m a -> ParsecT s u m (Maybe a)+> tryOptionMaybe p = try (optionMaybe p) <|> return Nothing+>+> {-commaSep2 :: SParser a+> -> SParser [a]+> commaSep2 p = sepBy2 p (symbol ",")+>+> sepBy2 :: (Stream s m t) =>+> ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m [a]+> sepBy2 p sep = (p <* sep) <:> sepBy1 p sep-}+>+> commaSep :: SParser a+> -> SParser [a]+> commaSep p = sepBy p (symbol ",")+>+> commaSep1 :: SParser a+> -> SParser [a]+> commaSep1 p = sepBy1 p (symbol ",")++pass a list of pairs of strings and values+try each pair k,v in turn,+if keyword k matches then return v+doesn't really add a lot of value++> matchAKeyword :: [(Text, a)] -> SParser a+> matchAKeyword [] = fail "no matches"+> matchAKeyword ((k,v):kvs) = v <$ keyword k <|> matchAKeyword kvs++optionalSuffix++parse the start of something -> parseResultA,+then parse an optional suffix -> parseResultB+if this second parser succeeds, return fn2 parseResultA parseResultB+else return fn1 parseResultA++e.g.+parsing an identifier in a select list can be+fieldName+or+fieldName as alias+so you can pass+* IdentifierCtor+* identifier (returns aval)+* AliasedIdentifierCtor+* parser for (as b) (returns bval)+as the args, which I like to ident like:+parseOptionalSuffix+ IdentifierCtor identifierParser+ AliasedIdentifierCtor () asAliasParser+and you get either+* IdentifierCtor identifierValue+or+* AliasedIdentifierCtor identifierValue aliasValue+as the result depending on whether the asAliasParser+succeeds or not.++there must be a standard way of writing this++> optionalSuffix :: (Stream s m t2) =>+> (t1 -> b)+> -> ParsecT s u m t1+> -> (t1 -> a -> b)+> -> ParsecT s u m a+> -> ParsecT s u m b+> optionalSuffix c1 p1 c2 p2 = do+> x <- p1+> option (c1 x) (c2 x <$> try p2)+++couldn't work how to to perms so just did this hack instead+e.g.+a1,a2,b1,b2,a2,b3,b4 parses to ([a1,a2,a3],[b1,b2,b3,b4])++> multiPerm :: (Stream s m t) =>+> ParsecT s u m a1+> -> ParsecT s u m a+> -> ParsecT s u m sep+> -> ParsecT s u m ([a1], [a])+>+> multiPerm p1 p2 sep = do+> (r1, r2) <- unzip <$> sepBy1 parseAorB sep+> return (catMaybes r1, catMaybes r2)+> where+> parseAorB = choice [+> (\x -> (Just x, Nothing)) <$> p1+> ,(\y -> (Nothing, Just y)) <$> p2]++== position stuff++wrapper for parsec source positions, probably not really useful++> type MySourcePos = (String,Int,Int)+>+> toMySp :: SourcePos -> MySourcePos+> toMySp sp = (sourceName sp,sourceLine sp,sourceColumn sp)++parser combinator to return the current position as an ast annotation++> pos :: SParser Annotation+> pos =+> (\a -> emptyAnnotation {anSrc = Just a}) <$> toMySp <$> getPosition++== lexer stuff++> mytoken :: (Lex.Token -> Maybe a) -> SParser a+> mytoken test+> = token showToken posToken testToken+> where+> showToken (_,tok) = show tok+> posToken ((a,b,c),_) = newPos a b c+> testToken (_,tok) = test tok++--------------------------------------------------------------------------------++= fixup tree++this is where some generics code is used to transform the parse trees+to alter the nodes used where it's too difficult to do whilst+parsing. The only item at the moment that needs this treatment is the+any/some/all construct which looks like this:+expr operator [any|some|all] (expr)++This gets parsed as+binop operator [expr1,app [any|some|all] [expr2,...]]++and we want to transform it to+liftoperator operator any|some|all [expr1, expr2,...]+not doing anything if the funcall name isn't any,some,all+any other checks are left to the type checking stage+(e.g. there can only be one expression in the expr2 part, and it must+be an array or subselect, etc)++> fixupTree :: Data a => a -> a+> fixupTree =+> transformBi $ \x ->+> case x of+> BinaryOp an op expr1 (App _ fn (expr2s:expr3s))+> | Name _ [Nmc fnm] <- fn+> , Just flav <- case map toLower fnm of+> "any" -> Just LiftAny+> "some" -> Just LiftAny+> "all" -> Just LiftAll+> _ -> Nothing+> -> LiftApp an op flav ([expr1,expr2s] ++ expr3s)+> x1 -> x1
+ src/Database/HsSqlPpp/Internals/PrettyInternal.lhs view
@@ -0,0 +1,1271 @@+++> {- | Functions to convert sql asts to valid SQL source code.+>+> Some effort is made produce human readable output.+> -}+> {-# LANGUAGE PatternGuards,OverloadedStrings,TypeSynonymInstances,FlexibleInstances #-}+> module Database.HsSqlPpp.Internals.PrettyInternal+> (--convert a sql ast to text+> prettyStatements+> --,printStatementsAnn+> ,prettyQueryExpr+> --convert a single expression parse node to text+> ,prettyScalarExpr+> ,PrettyFlags(..)+> )+> where+>+> import Prelude hiding ((<>))+> import Text.PrettyPrint+> import Data.Maybe+>+> import Database.HsSqlPpp.Syntax hiding (ann)+> import Database.HsSqlPpp.Internals.AstInternal (+> Annotation(..)+> ,emptyAnnotation)+> --import Database.HsSqlPpp.Utils.Utils++> import Database.HsSqlPpp.Internals.Dialect++todo: get rid of the types internal+the ImplicitCast ctor uses Type instead of syntax only, this should be+changed and then this import can be removed++> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Internals.StringLike+> import qualified Data.Text as T+> import qualified Data.Text.Lazy as L+> import Database.HsSqlPpp.Internals.Utils++--------------------------------------------------------------------------------++Public functions++> data PrettyFlags =+> PrettyFlags++todo: actually use the dialect. this will forced when the parser is+adjusted to reject postgres only syntax when in sql server dialect++> {ppDialect :: Dialect+> }+> deriving (Show,Eq)++> -- | Convert an ast back to valid SQL source.+> prettyStatements :: PrettyFlags -> [Statement] -> L.Text+> prettyStatements f = prettyStatementsAnn f (const "")+>+> -- | Convert the ast back to valid source, and convert any annotations to+> -- text using the function provided and interpolate the output of+> -- this function (inside comments) with the SQL source.++this needs some work++> prettyStatementsAnn :: PrettyFlags -> (Annotation -> String) -> [Statement] -> L.Text+> prettyStatementsAnn flg f ast =+> renderText $ vcat (map (statement flg True f) ast) <> text "\n"++> -- | pretty print a query expression+> prettyQueryExpr :: PrettyFlags -> QueryExpr -> L.Text+> prettyQueryExpr f ast = renderText (queryExpr f True True Nothing ast <> statementEnd True)++> -- | pretty print a scalar expression+> prettyScalarExpr :: PrettyFlags -> ScalarExpr -> L.Text+> prettyScalarExpr f = renderText . scalExpr f++direct = true means attempt to pretty print straight to text+direct = false means pretty print to string then pack to text+no idea which is better, since pretty printing to text directly uses a+ lot of Text.cons which might be pretty slow and bloated++> direct :: Bool+> direct = True++> renderText :: Doc -> L.Text+> renderText doc =+> if direct+> then fullRender (mode style) (lineLength style) (ribbonsPerLine style)+> dataTextPrettyer "" doc+> else L.pack $ render doc+++> dataTextPrettyer :: TextDetails -> L.Text -> L.Text+> dataTextPrettyer (Chr c) s = L.cons c s+> dataTextPrettyer (Str s1) s2 = L.pack s1 `L.append` s2+> dataTextPrettyer (PStr s1) s2 = L.pack s1 `L.append` s2++-------------------------------------------------------------------------------++Conversion routines - convert Sql asts into Docs++> -- Statements+>+> statement :: PrettyFlags -> Bool -> (Annotation -> String) -> Statement -> Doc+> statement _flg _se _ca (AntiStatement s) = text $ "$(" ++ s ++ ")"+>+> -- selects+>+> statement flg se ca (QueryStatement ann s) =+> annot ca ann <+>+> queryExpr flg True True Nothing s <> statementEnd se+>+> --dml+>+> statement flg se pa (Insert ann tb atts idata rt) =+> annot pa ann <+>+> text "insert into" <+> name tb+> <+> ifNotEmpty (parens . sepCsvMap nmc) atts+> $+$ queryExpr flg True True Nothing idata+> $+$ returning flg rt+> <> statementEnd se+>+> statement flg se ca (Update ann tb scs fr wh rt) =+> annot ca ann <+>+> text "update" <+> name tb <+> text "set"+> <+> sepCsvMap (set flg) scs+> <+> ifNotEmpty (\_ -> text "from" <+> sepCsvMap (tref flg) fr) fr+> <+> whr flg wh+> $+$ returning flg rt <> statementEnd se+>+> statement flg se ca (Delete ann tbl us wh rt) =+> annot ca ann <+>+> text "delete from" <+> name tbl+> <+> ifNotEmpty (\_ -> text "using" <+> sepCsvMap (tref flg) us) us+> <+> whr flg wh+> $+$ returning flg rt+> <> statementEnd se+>+> statement flg se ca (Truncate ann names ri casc) =+> annot ca ann <+>+> text "truncate"+> <+> sepCsvMap name names+> <+> case (diSyntaxFlavour $ ppDialect flg) of+> SqlServer -> empty+> _ -> text (case ri of+> RestartIdentity -> "restart identity"+> ContinueIdentity -> "continue identity")+> <+> cascade casc+> <> statementEnd se+>+> -- ddl+>+> statement flg se ca (CreateTable ann tbl atts cns partition rep opts) =+> annot ca ann <+>+> text ("create " ++ (case rep of+> Replace -> "or replace "+> _ -> "") ++ "table")+> <+> name tbl <+> lparen+> $+$ nest 2 (vcat (csv (map (attrDef flg) atts ++ map (constraint flg) cns)))+> $+$ rparen+> $+$ case (diSyntaxFlavour $ ppDialect flg) of+> SqlServer -> empty+> _ -> (tablePartition partition)+> $+$ tableOpts flg opts+> <> statementEnd se+>+> statement flg se ca (AlterTable ann tnm op) =+> annot ca ann <+>+> text "alter table" <+> name tnm+> <+> alterOperation op <> statementEnd se+> where+> alterOperation (RenameTable _ nm) = +> text "rename to" <+> name nm+> alterOperation (RenameColumn _ old new) = +> text "rename column" <+> nmc old <+> "to" <+> nmc new+> alterOperation (AlterTableActions _ actions) = hcatCsvMap alterAction actions+> alterAction (AddColumn _ att) = +> text "add column" <+> attrDef flg att+> alterAction (DropColumn _ nm) = +> text "drop column" <+> nmc nm+> alterAction (AlterColumn _ nm action) = +> text "alter column" <+> nmc nm <+> alterColumnAction action+> alterAction (AddConstraint _ con) =+> text "add" <+> constraint flg con+> alterColumnAction (SetDataType _ t) =+> text "set data type" <+> typeName t+> alterColumnAction (SetNotNull _) =+> text "set not null"+> alterColumnAction (DropNotNull _) =+> text "drop not null"+> alterColumnAction (SetDefault _ def) =+> text "set default" <+> scalExpr flg def+> alterColumnAction (DropDefault _) =+> text "drop default"+>+> statement _flg se ca (CreateSequence ann nm incr minv maxv start cache) =+> annot ca ann <+>+> text "create sequence" <+> name nm <+>+> text "increment" <+> text (show incr) <+>+> maybe (text "no minvalue") ((text "minvalue" <+>) . (text . show)) minv <+>+> maybe (text "no maxvalue") ((text "maxvalue" <+>) . (text . show)) maxv <+>+> text "start with" <+> text (show start) <+>+> text "cache" <+> text (show cache) <> statementEnd se+>+> statement _flg se ca (AlterSequence ann nm op) =+> annot ca ann <+>+> text "alter sequence" <+> name nm+> <+> alterOperation op <> statementEnd se+> where+> alterOperation (AlterSequenceOwned _ o) = +> text "owned by" <+> name o+> alterOperation (AlterSequenceRename _ rnm) = +> text "rename to" <+> name rnm+> alterOperation (AlterSequenceActions _ actions) = hsep $ map alterAction actions+> alterAction (AlterSequenceIncrement _ incr) = +> text "increment by" <+> text (show incr)+> alterAction (AlterSequenceMin _ minv) =+> maybe (text "no minvalue") ((text "minvalue" <+>) . (text . show)) minv+> alterAction (AlterSequenceMax _ maxv) =+> maybe (text "no maxvalue") ((text "maxvalue" <+>) . (text . show)) maxv+> alterAction (AlterSequenceStart _ start) = +> text "start with" <+> text (show start)+> alterAction (AlterSequenceRestart _ restart) = +> text "restart" <+> text (maybe "" (("with " ++) . show) restart)+> alterAction (AlterSequenceCache _ cache) = +> text "cache" <+> text (show cache)++>+> statement flg se ca (CreateTableAs ann t rep sel) =+> annot ca ann <+>+> text ("create " ++ (case rep of+> Replace -> "or replace "+> _ -> "") ++ "table")+> <+> name t <+> text "as"+> $+$ queryExpr flg True True Nothing sel+> <> statementEnd se+>+> statement flg se ca (CreateFunction ann nm args retType rep lang body vol) =+> annot ca ann <+>+> text ("create " ++ (case rep of+> Replace -> "or replace "+> _ -> "") ++ "function")+> <+> name nm+> <+> parens (sepCsvMap paramDefn args)+> <+> text "returns" <+> typeName retType <+> text "as" <+> text "$$"+> $+$ functionBody body+> $+$ text "$$" <+> text "language"+> <+> text (case lang of+> Sql -> "sql"+> Plpgsql -> "plpgsql")+> <+> text (case vol of+> Volatile -> "volatile"+> Stable -> "stable"+> Immutable -> "immutable")+> <> statementEnd se+> where+> functionBody (SqlFnBody ann1 sts) =+> annot ca ann1 <+>+> nestedStatements flg ca sts+> functionBody (PlpgsqlFnBody ann1 blk) =+> annot ca ann1 <+>+> statement flg True ca blk+> paramDefn (ParamDef _ n t) = nmc n <+> typeName t+> paramDefn (ParamDefTp _ t) = typeName t+>+> statement flg se ca (Block ann lb decls sts) =+> annot ca ann <+>+> label lb <>+> ifNotEmpty (\l -> text "declare"+> $+$ nest 2 (vcat $ map varDefn l)) decls+> $+$ text "begin"+> $+$ nestedStatements flg ca sts+> $+$ text "end" <> statementEnd se+> where+> varDefn (VarDef _ n t v) =+> nmc n <+> typeName t+> <+> maybePrint (\x -> text ":=" <+> scalExpr flg x) v <> semi+> varDefn (VarAlias _ n n1) =+> nmc n <+> text "alias for" <+> name n1 <> semi+> varDefn (ParamAlias _ n p) =+> nmc n <+> text "alias for $" <> text (show p) <> semi+>+>+> statement flg se ca (CreateView ann nm cols sel) =+> annot ca ann <+>+> text "create view" <+> name nm+> <> case cols of+> Nothing -> empty+> Just cs -> parens (sepCsvMap nmc cs)+> <+> text "as"+> $+$ nest 2 (queryExpr flg True True Nothing sel) <> statementEnd se+>+> statement flg se ca (AlterView ann nm cols sel) =+> annot ca ann <+>+> text "alter view" <+> name nm+> <> case cols of+> Nothing -> empty+> Just cs -> parens (sepCsvMap nmc cs)+> <+> text "as"+> $+$ nest 2 (queryExpr flg True True Nothing sel) <> statementEnd se+>+> statement flg se ca (CreateDomain ann nm tp n ex) =+> annot ca ann <+>+> text "create domain" <+> name nm <+> text "as"+> <+> typeName tp <+> cname <+> checkExp ex <> statementEnd se+> where+> checkExp = maybePrint (\e -> text "check" <+> parens (scalExpr flg e))+> cname = if n == ""+> then empty+> else text "constraint" <+> ttext n+>+> statement _flg se ca (CreateDatabase ann nm) =+> annot ca ann <+>+> text "create database" <+> name nm <> statementEnd se++> statement _flg se ca (CreateSchema ann nm musr) =+> annot ca ann <+> text "create schema" <+> name nm +> <+> case musr of+> Nothing -> empty+> Just u -> text "authorization" <+> name u+> <> statementEnd se++> statement _flg se ca (AlterDatabase ann nm op) =+> annot ca ann <+> text "alter database" <+>+> name nm <+> alterDbOperation op <> statementEnd se+> where+> alterDbOperation (RenameDatabase _ nm') =+> text "rename to" <+> name nm'++> statement _flg se ca (AlterSchema ann snm op) =+> annot ca ann <+>+> text "alter schema" <+> name snm+> <+> alterOperation op <> statementEnd se+> where+> alterOperation (AlterSchemaName _ nsnm) = +> text "rename to" <+> name nsnm+> alterOperation (AlterSchemaOwner _ nunm) = +> text "owner to" <+> name nunm++> statement _flg se ca (DropFunction ann ifE fns casc) =+> annot ca ann <+>+> text "drop function"+> <+> ifExists ifE+> <+> sepCsvMap doFunction fns+> <+> cascade casc+> <> statementEnd se+> where+> doFunction (nm,types) =+> name nm <> parens (sepCsvMap typeName types)+>+> statement flg se ca (DropSomething ann dropType ifE names casc) =+> annot ca ann <+>+> text "drop"+> <+> text (case dropType of+> Table -> "table"+> View -> "view"+> Domain -> "domain"+> Type -> "type"+> Database -> "database"+> User -> "user"+> Login -> "login"+> Schema -> "schema")+> <+> ifExists ifE+> <+> sepCsvMap name names+> <+> case (diSyntaxFlavour $ ppDialect flg) of+> SqlServer -> empty+> _ -> cascade casc+> <> statementEnd se+>+> statement _flg se ca (DropTrigger ann ifE nam tbn casc) =+> annot ca ann <+>+> text "drop"+> <+> text "trigger"+> <+> ifExists ifE+> <+> nmc nam+> <+> text "on"+> <+> name tbn+> <+> cascade casc+> <> statementEnd se+>+> statement _flg se ca (CreateType ann nm atts) =+> annot ca ann <+>+> text "create type" <+> name nm <+> text "as" <+> lparen+> $+$ nest 2 (vcat (csv+> (map (\(TypeAttDef _ n t) -> nmc n <+> typeName t) atts)))+> $+$ rparen <> statementEnd se+>+> statement _flg se ca (CreateLanguage ann nm) =+> annot ca ann <+>+> text "create language" <+> ttext nm <> statementEnd se+>+> statement flg se ca (CreateTrigger ann nm wh events tbl firing fnName fnArgs) =+> annot ca ann <+>+> text "create trigger" <+> nmc nm+> <+> text (case wh of+> TriggerBefore -> "before"+> TriggerAfter -> "after")+> <+> evs+> <+> text "on" <+> name tbl+> <+> text "for" <+> text (case firing of+> EachRow -> "row"+> EachStatement -> "statement")+> <+> text "execute procedure" <+> name fnName+> <> parens (sepCsvMap (scalExpr flg) fnArgs) <> statementEnd se+> where+> evs = sep $ punctuate (text " or ") $ map+> (text . (\e -> case e of+> TInsert -> "insert"+> TUpdate -> "update"+> TDelete -> "delete"+> AntiTriggerEvent s -> "$(" ++ s ++ ")")) events+>+> -- plpgsql+>+> statement _flg se ca (NullStatement ann) =+> annot ca ann <+> text "null" <> statementEnd se+> statement _flg se ca (ExitStatement ann lb) =+> annot ca ann <+> text "exit"+> <+> maybe empty ttext lb <> statementEnd se+>++> statement flg se ca (Into ann str is (QueryStatement _ q)) =+> annot ca ann <+>+> queryExpr flg True True (Just (str,is)) q <> statementEnd se+++> statement flg se ca (Into ann str into st) =+> annot ca ann <+>+> statement flg False ca st+> <+> text "into"+> <> (if str+> then empty <+> text "strict"+> else empty)+> <+> sepCsvMap name into+> <> statementEnd se+> --fixme, should be insert,update,delete,execute++> statement flg se ca (Assignment ann nm val) =+> annot ca ann <+>+> name nm <+> text ":=" <+> scalExpr flg val <> statementEnd se+>+> statement flg se ca (Return ann ex) =+> annot ca ann <+>+> text "return" <+> maybePrint (scalExpr flg) ex <> statementEnd se+>+> statement flg se ca (ReturnNext ann ex) =+> annot ca ann <+>+> text "return" <+> text "next" <+> scalExpr flg ex <> statementEnd se+>+> statement flg se ca (ReturnQuery ann sel) =+> annot ca ann <+>+> text "return" <+> text "query"+> <+> queryExpr flg True True Nothing sel <> statementEnd se+>+> statement flg se ca (Raise ann rt st exps) =+> annot ca ann <+>+> text "raise"+> <+> case rt of+> RNotice -> text "notice"+> RException -> text "exception"+> RError -> text "error"+> <+> scalExpr flg (StringLit emptyAnnotation st)+> <> ifNotEmpty (\e -> comma <+> csvExp flg e) exps+> <> statementEnd se+>+> statement flg se ca (ForQueryStatement ann lb i sel stmts) =+> annot ca ann <+>+> label lb <>+> text "for" <+> nmc i <+> text "in"+> <+> queryExpr flg True True Nothing sel <+> text "loop"+> $+$ nestedStatements flg ca stmts+> $+$ text "end loop" <> statementEnd se+>+> statement flg se ca (ForIntegerStatement ann lb var st en stmts) =+> annot ca ann <+>+> label lb <>+> text "for" <+> nmc var <+> text "in"+> <+> scalExpr flg st <+> text ".." <+> scalExpr flg en <+> text "loop"+> $+$ nestedStatements flg ca stmts+> $+$ text "end loop" <> statementEnd se+>+> statement flg se ca (WhileStatement ann lb ex stmts) =+> annot ca ann <+>+> label lb <>+> text "while" <+> scalExpr flg ex <+> text "loop"+> $+$ nestedStatements flg ca stmts+> $+$ text "end loop" <> statementEnd se+> statement flg se ca (LoopStatement ann lb stmts) =+> annot ca ann <+>+> label lb <>+> text "loop"+> $+$ nestedStatements flg ca stmts+> $+$ text "end loop" <> statementEnd se+>+> statement _flg se ca (ContinueStatement ann lb) =+> annot ca ann <+> text "continue"+> <+> maybe empty ttext lb <> statementEnd se+> statement flg se ca (Perform ann f@(App {})) =+> annot ca ann <+>+> text "perform" <+> scalExpr flg f <> statementEnd se+> statement _ _ _ (Perform _ x) =+> -- todo: don't use error+> error $ "internal error: statement not supported for " ++ show x+>+> statement _flg se ca (CopyFrom ann tb cols src opts) =+> annot ca ann <+>+> text "copy" <+> name tb+> <+> ifNotEmpty (parens . sepCsvMap nmc) cols+> <+> text "from"+> <+> case src of+> CopyFilename s -> (quotes $ ttext s)+> <+> copyFromOpts opts+> <> statementEnd se++> Stdin -> text "stdin"+> <+> copyFromOpts opts+> -- put statement end without new line+> -- so that the copydata follows immediately after+> -- without an extra blank line inbetween+> <> statementEndNNL se++> statement flg se ca (CopyTo ann src fn opts) =+> annot ca ann <+>+> text "copy" <+> s src+> <+> text "to"+> <+> quotes (ttext fn)+> <+> copyToOpts opts+> <> statementEnd se+> where+> s (CopyTable tb cols) = name tb+> <+> ifNotEmpty (parens . sepCsvMap nmc) cols+> s (CopyQuery qry) = parens (queryExpr flg True True Nothing qry)+>+> statement _ _ ca (CopyData ann s) =+> annot ca ann <+>+> tltext s <> text "\\." <> newline+>+> statement flg se ca (If ann conds els) =+> if tsql+> then+> annot ca ann <+>+> text "if" <+> scalExpr flg (fst $ head conds)+> <+> blck (snd $ head conds)+> $+$ ifNotEmpty (\e -> text "else" <+> blck e) els+> <> statementEnd se+> else+> annot ca ann <+>+> text "if" <+> constraintd (head conds)+> $+$ vcat (map (\c -> text "elseif" <+> constraintd c) $ tail conds)+> $+$ ifNotEmpty (\e -> text "else" $+$ nestedStatements flg ca e) els+> $+$ text "end if" <> statementEnd se+> where+> constraintd (ex, sts) = scalExpr flg ex <+> text "then"+> $+$ nestedStatements flg ca sts+> tsql = diSyntaxFlavour (ppDialect flg) == SqlServer+> blck sts = sep [text "begin"+> ,nestedStatements flg ca sts+> ,text "end"]+> statement flg se ca (Execute ann s) =+> annot ca ann <+>+> text "execute" <+> scalExpr flg s <> statementEnd se+>+>+> statement flg se ca (CaseStatementSimple ann c conds els) =+> annot ca ann <+>+> text "case" <+> scalExpr flg c+> $+$ nest 2 (+> vcat (map (uncurry whenStatement) conds)+> $+$ elseStatement els+> ) $+$ text "end case" <> statementEnd se+> where+> whenStatement ex sts = text "when" <+> sepCsvMap (scalExpr flg) ex+> <+> text "then" $+$ nestedStatements flg ca sts+> elseStatement = ifNotEmpty (\s -> text "else"+> $+$ nestedStatements flg ca s)+> statement flg se ca (CaseStatement ann conds els) =+> annot ca ann <+>+> text "case"+> $+$ nest 2 (+> vcat (map (uncurry whenStatement) conds)+> $+$ elseStatement els+> ) $+$ text "end case" <> statementEnd se+> where+> whenStatement ex sts = text "when" <+> sepCsvMap (scalExpr flg) ex+> <+> text "then" $+$ nestedStatements flg ca sts+> elseStatement = ifNotEmpty (\s -> text "else"+> $+$ nestedStatements flg ca s)++> statement flg _se ca (DeclareStatement ann des) =+> annot ca ann <+>+> text "declare" <+> sepCsvMap de des+> where+> de (nm,ty,val) =+> ttext nm <+> typeName ty+> <+> maybe empty (\e -> text "=" <+> scalExpr flg e) val++>+> -- misc+>+> statement _flg se _ (Set _ n vs) =+> text "set" <+> ttext n <+> text "="+> <+> sepCsvMap (text . dv) vs <> statementEnd se+> where+> dv (SetStr _ s) = "'" ++ s ++ "'"+> dv (SetId _ i) = i+> dv (SetNum _ nm) = show nm+>+> statement _flg se _ (Notify _ n) =+> text "notify" <+> ttext n <> statementEnd se++> statement flg _se _ (ExecStatement _ nm args) =+> text "exec" <+> name nm <+> sepCsvMap (scalExpr flg) args++> statement _flg _se _ (CreateIndexTSQL _ nm obj cols) =+> text "create" <+> text "index"+> <+> nmc nm <+> text "on"+> <+> name obj <+> parens (sepCsvMap nmc cols)++> statement _flg _se _ (CreateUser _ nm pw) =+> text "create user" <+> name nm+> <+> text "with password=" <> quotes (text pw)++> statement _flg _se _ (CreateLogin _ nm pw) =+> text "create login" <+> name nm+> <+> text "with password=" <> quotes (text pw)++> statement _flg _se _ (AlterUser _ nm pw) =+> text "alter user" <+> name nm+> <+> text "with password=" <> quotes (text pw)++> statement _flg _se _ (AlterLogin _ nm pw) =+> text "alter login" <+> name nm+> <+> text "with password=" <> quotes (text pw)+++> statementEnd :: Bool -> Doc+> statementEnd b = if b+> then semi <> newline+> else empty++> statementEndNNL :: Bool -> Doc+> statementEndNNL b = if b+> then semi+> else empty+++-------------------------------------------------------------------------------++Statement components++> -- selects+>+> queryExpr :: PrettyFlags -> Bool -> Bool -> Maybe (Bool,[Name]) -> QueryExpr -> Doc+> queryExpr flg writeSelect _ intoi (Select _ dis l tb wh grp hav+> order lim off hs) =+> (text (if writeSelect then "select" else "")+> <+> (case dis of+> All -> empty+> Distinct -> text "distinct"))+> <+> (case lim of+> Just lime | useTop -> text "top" <+> scalExpr flg lime+> _ -> empty)+> $+$ nest 2 (vcat $ catMaybes+> [fmap (\(str,is) -> text "into"+> <+> (if str+> then text "strict"+> else empty)+> <+> sepCsvMap name is) intoi+> ,Just $ nest 2 $ selectList flg l+> ,Just $ if null tb+> then empty+> else text "from" $+$ nest 2 (sepCsvMap (tref flg) tb)+> ,Just $ whr flg wh+> ,case grp of+> [] -> Nothing+> g -> Just $ text "group by" $+$ nest 2 (sepCsvMap (scalExpr flg) g)+> ,flip fmap hav $ \h -> text "having" $+$ nest 2 (scalExpr flg h)+> ,Just $ orderBy flg order+> ,if useTop then Nothing else flip fmap lim $ \lm -> text "limit" <+> scalExpr flg lm+> ,flip fmap off $ \offs -> text "offset" <+> scalExpr flg offs+> ,if null hs then Nothing else Just $ text "option" $+$ parens (sepCsvMap (text . prettyQueryHint) hs)+> ])+> where+> useTop = (diSyntaxFlavour $ ppDialect flg) == SqlServer+> prettyQueryHint QueryHintPartitionGroup = "partition group"+> prettyQueryHint QueryHintColumnarHostGroup = "columnar host group"+>+> queryExpr flg writeSelect topLev _ (CombineQueryExpr _ tp s1 s2) =+> let p = queryExpr flg writeSelect False Nothing s1+> $+$ (case tp of+> Except -> text "except"+> Union -> text "union"+> UnionAll -> text "union" <+> text "all"+> Intersect -> text "intersect")+> $+$ queryExpr flg True False Nothing s2+> in if topLev then p else parens p+> queryExpr flg _ _ _ (Values _ expss) =+> text "values" $$ nest 2 (vcat $ csv $ map (parens . csvExp flg) expss)+> queryExpr flg _ _ _ (WithQueryExpr _ wqs ex) =+> text "with" $$ nest 2 (vcat $ csv $ map pwq wqs)+> $+$ queryExpr flg True False Nothing ex+> where+> pwq (WithQuery _ nm cs ex1) =+> nmc nm <> case cs of+> Nothing -> empty+> Just cs' -> parens $ sepCsvMap nmc cs'+> <+> text "as"+> <+> parens (queryExpr flg True False Nothing ex1)++> name :: Name -> Doc+> name (Name _ ns) = nmcs ns+> name (AntiName n) = text ("$n(" ++ n ++ ")")++> nmcs :: [NameComponent] -> Doc+> nmcs ns = hcat $ punctuate (text ".") $ map nmc ns++> nmc :: NameComponent -> Doc+> nmc (Nmc ns) = ttext ns+> nmc (QNmc ns) = doubleQuotes $ ttext ns+> nmc (AntiNameComponent n) = text ("$m(" ++ n ++ ")")++>+> tref :: PrettyFlags -> TableRef -> Doc+> tref _ (Tref _ f) = name f+> tref flg (SubTref _ sub) =+> parens (queryExpr flg True True Nothing sub)+> tref flg (FunTref _ f@(App {})) = scalExpr flg f+> tref _flg (FunTref _ x) =+> -- todo: don't use error+> error $ "internal error: node not supported in function tref: "+> ++ show x+> tref flg (TableRefParens _ t) = parens (tref flg t)+> tref flg (OdbcTableRef _ t) = text "{oj" <+> tref flg t <> text "}"+> tref flg (TableAlias _ t tr) = maybeParen flg tr <+> text "as" <+> nmc t+> -- hack this out for now. When the type checking is fixed, can try+> -- to eliminate unneeded aliases?+> tref flg (FullAlias _ t s tr) =+> maybeParen flg tr <+> text "as"+> <+> nmc t <> parens (sepCsvMap nmc s)++> tref flg (JoinTref _ t1 nat jt ht t2 ex) =+> sep [tref flg t1+> ,hsep ([case nat of+> Natural -> text "natural"+> Unnatural -> empty+> ,text $ case jt of+> Inner -> "inner"+> Cross -> "cross"+> LeftOuter -> "left outer"+> RightOuter -> "right outer"+> FullOuter -> "full outer"]+> ++ maybe [] (\h -> [text $ case h of+> Merge -> "merge"+> Loop -> "loop"+> Hash -> "hash"])+> ht+> ++ [text "join"])+> ,tref flg t2+> ,maybePrint (nest 2 . joinScalarExpr) ex]+> where+> joinScalarExpr (JoinOn _ e) = text "on" <+> scalExpr flg e+> joinScalarExpr (JoinUsing _ ids) =+> text "using" <+> parens (sepCsvMap nmc ids)++todo: don't want to do this here since it changes pretty . parse = id+so if you don't add the parens explicitly you get incorrect/ invalid+syntax maybe should error instead of silently breaking++> maybeParen :: PrettyFlags -> TableRef -> Doc+> --maybeParen flg t@(JoinTref {}) = parens $ tref flg t+> maybeParen = tref++> direction :: Direction -> Doc+> direction d = text $ case d of+> Asc -> "asc"+> Desc -> "desc"+>++> nullsOrder :: NullsOrder -> Doc+> nullsOrder d = case d of+> NullsDefault -> empty+> NullsFirst -> text "nulls " <+> text "first"+> NullsLast -> text "nulls " <+> text "last"+>+> whr :: PrettyFlags -> Maybe ScalarExpr -> Doc+> whr flg (Just ex) = text "where" $+$ nest 2 (scalExpr flg ex)+> whr _ Nothing = empty+>+> selectList :: PrettyFlags -> SelectList -> Doc+> selectList flg (SelectList _ ex) =+> sepCsvMap selectItem ex+> where+> selectItem (SelectItem _ ex1 nm) = scalExprSl flg ex1 <+> text "as" <+> nmc nm+> selectItem (SelExp _ e) = scalExprSl flg e+>+> cascade :: Cascade -> Doc+> cascade casc = text $ case casc of+> Cascade -> "cascade"+> Restrict -> "restrict"++> copyToOpts :: [CopyToOption] -> Doc+> copyToOpts opts =+> ifNotEmpty (const $ "with" <+> sep (map po opts)) opts+> where+> po (CopyToFormat s) = text "format" <+> text s+> po (CopyToDelimiter s) = text "delimiter" <+> quotes (text s)+> po (CopyToErrorLog s) = text "error_log" <+> quotes (text s)+> po (CopyToErrorVerbosity s) = text "error_verbosity" <+> int s++> copyFromOpts :: [CopyFromOption] -> Doc+> copyFromOpts opts =+> ifNotEmpty (const $ "with" <+> sep (map po opts)) opts+> where+> po (CopyFromFormat s) = text "format" <+> text s+> po (CopyFromDelimiter s) = text "delimiter" <+> quotes (text s)+> po (CopyFromErrorLog s) = text "error_log" <+> quotes (text s)+> po (CopyFromErrorVerbosity s) = text "error_verbosity" <+> int s+> po (CopyFromParsers s) = text "parsers" <+> quotes (text s)+> po (CopyFromDirectory) = text "directory"+> po (CopyFromOffset i) = text "offset" <+> integer i+> po (CopyFromLimit i) = text "limit" <+> integer i+> po (CopyFromErrorThreshold i) = text "stop after" <+> int i <+> text "errors"+> po (CopyFromNewlineFormat n) = text "record delimiter" <+> text n+> -- ddl+>+> constraint :: PrettyFlags -> Constraint -> Doc+> constraint _flg (UniqueConstraint _ n c) =+> mname n <+> text "unique"+> <+> parens (sepCsvMap nmc c)+> constraint _flg (PrimaryKeyConstraint _ n p) =+> mname n <+>+> text "primary key"+> <+> parens (sepCsvMap nmc p)+> constraint flg (CheckConstraint _ n c) =+> mname n <+> text "check" <+> parens (scalExpr flg c)+> constraint _flg (ReferenceConstraint _ n at tb rat ondel onupd) =+> mname n <+>+> text "foreign key" <+> parens (sepCsvMap nmc at)+> <+> text "references" <+> name tb+> <+> ifNotEmpty (parens . sepCsvMap nmc) rat+> <+> text "on update" <+> cascade onupd+> <+> text "on delete" <+> cascade ondel+>+> mname :: String -> Doc+> mname n = if n == ""+> then empty+> else text "constraint" <+> text n+>+> returning :: PrettyFlags -> Maybe SelectList -> Doc+> returning flg l = case l of+> Nothing -> empty+> Just ls -> nest 2 (text "returning" <+> selectList flg ls)+>+> ifExists :: IfExists -> Doc+> ifExists i = case i of+> Require -> empty+> IfExists -> text "if exists"+>++> tablePartition :: Maybe TablePartitionDef -> Doc+> tablePartition Nothing = text ""+> tablePartition (Just (TablePartitionDef _ cn tf interval)) =+> text "partition by range" <+> parens (nmc cn)+> <> parens ((text "every") <+> (text $ show tf) <+> (intervalify interval))+> where+> intervalify = \x-> text $ case x of+> Year -> "years"+> Month -> "months"+> Day -> "days"+> Hour -> "hours"+> Minute -> "minutes"+> Second -> "seconds"+> Millisecond -> "milliseconds"+> -- _ -> "unknown type " ++ (show x)++> attrDef :: PrettyFlags -> AttributeDef -> Doc+> attrDef flg (AttributeDef _ n t cons opts) =+> nmc n <+> typeName t+> <+> hsep (map cCons cons)+> <+> tableOpts flg opts+> where+> cCons (DefaultConstraint _ cn e) =+> mname cn <+> text "default" <+> scalExpr flg e+> cCons (NullConstraint _ cn) =+> mname cn <+> text "null"+> cCons (NotNullConstraint _ cn) =+> mname cn <+> text "not null"+> cCons (RowCheckConstraint _ cn ew) =+> mname cn <+> text "check" <+> parens (scalExpr flg ew)+> cCons (RowUniqueConstraint _ cn) =+> mname cn <+> text "unique"+> cCons (RowPrimaryKeyConstraint _ cn) =+> mname cn <+> text "primary key"+> cCons (RowReferenceConstraint _ cn tb att ondel onupd) =+> mname cn <+> text "references" <+> name tb+> <+> maybePrint (parens . nmc) att+> <+> text "on delete" <+> cascade ondel+> <+> text "on update" <+> cascade onupd+> cCons (IdentityConstraint _ cn si) =+> mname cn <+> text "identity" <> text (maybe "" show si)++> tableOpts :: PrettyFlags -> [TableOption] -> Doc+> tableOpts _ [] = empty+> tableOpts flg as = text "with" <+> text "options"+> <+> parens (nest 4 $ sep $ map to as)+> where+> to (TableOptionKeywords ks) = hsep (map text ks)+> to (TableOptionStringVal nm v) = tov nm [scalExpr flg (StringLit emptyAnnotation v)]+> to (TableOptionNameVal nm v) = tov nm $ map name v+> to (TableOptionNumberVal nm v) = tov nm [text v]+> tov nm x = hsep (map text nm ++ [text "="] ++ x)++> -- plpgsql+>+> nestedStatements :: PrettyFlags -> (Annotation -> String) -> [Statement] -> Doc+> nestedStatements flg pa = nest 2 . vcat . map (statement flg True pa)+>+> typeName :: TypeName -> Doc+> typeName (SimpleTypeName _ s) = name s+> typeName (PrecTypeName _ s i) = name s <> parens(integer i)+> typeName (Prec2TypeName _ s i i1) = name s <> parens (sepCsv [integer i, integer i1])+> typeName (ArrayTypeName _ t) = typeName t <> text "[]"+> typeName (SetOfTypeName _ t) = text "setof" <+> typeName t+>+> ppType:: Type -> Doc+> ppType (ScalarType t) = text "scalar type" <> parens (text $ T.unpack t)+> ppType (DomainType t) = text "domain type" <> parens (text $ T.unpack t)+> ppType (EnumType t) = text "enum type" <> parens (text $ T.unpack t)+> ppType (UnknownType) = text "unknown type"+> ppType (ArrayType t) = text "array type" <> parens (ppType t)+> ppType (NamedCompositeType t) = text "named composite type" <> parens (text $ T.unpack t)+> ppType (CompositeType ts)+> = text "composite type"+> <> brackets (sepCsv+> $ map (\(t,te)+> -> parens $ sepCsv [text (T.unpack t), typeExtra te])+> ts)+> ppType (TrefType ts)+> = text "tref type"+> <> brackets (sepCsv+> $ map (\((t1,t2),te)+> -> parens $ sepCsv+> [parens $ sepCsv+> [text (T.unpack t1)+> ,text (T.unpack t2)]+> , typeExtra te])+> ts)+> ppType (AnonymousCompositeType ts)+> = text "anonymous composite type"+> <> brackets (sepCsv $ map ppType ts)+> ppType (Pseudo _) = text "pseudo type"+>+> typeExtra:: TypeExtra -> Doc+> typeExtra te = parens $ sepCsv+> [ppType (teType te)+> ,ppPrec "precision" (tePrecision te)+> ,ppPrec "scale" (teScale te)+> ,ppNullability (teNullable te)]++> ppPrec :: String -> Maybe Int -> Doc+> ppPrec precType prec = case prec of+> Nothing -> text $ "no " ++ precType+> Just p -> text $ precType ++ ' ':show p++> ppNullability :: Bool -> Doc+> ppNullability n = text $ (if n then "" else "not ") ++ "nullable"+>+> -- expressions+>+> scalExpr :: PrettyFlags -> ScalarExpr -> Doc+> scalExpr flg (Parens _ e) = parens (scalExpr flg e)+> scalExpr _ (AntiScalarExpr s) = text $ "$(" ++ s ++ ")"+> scalExpr _ (Star _) = text "*"+> scalExpr _ (QStar _ i) = nmc i <> text ".*"+> scalExpr _ (Identifier _ (AntiName _)) =+> -- todo: don't use error+> error "Antiname component"++> scalExpr _flg (Identifier _a (Name _ is)) =+> hcat (punctuate (text ".") (map nmc is))+++> scalExpr _ (NumberLit _ n) = ttext n+> scalExpr _ (StringLit _ s) = -- needs some thought about using $$?+> text "'" <> ttext replaceQuotes <> text "'"+> where+> replaceQuotes = replace "'" "''" s+>+> scalExpr flg (SpecialOp _ n es) =+> case getTName n of+> Just "arrayctor" -> text "array" <> brackets (csvExp flg es)+> Just "between" -> scalExpr flg (head es) <+> text "between"+> <+> scalExpr flg (es !! 1)+> <+> text "and"+> <+> scalExpr flg (es !! 2)+> Just "notbetween" -> scalExpr flg (head es) <+> text "not between"+> <+> scalExpr flg (es !! 1)+> <+> text "and"+> <+> scalExpr flg (es !! 2)+> Just "substring" -> text "substring"+> <> parens (scalExpr flg (head es)+> <+> text "from" <+> scalExpr flg (es !! 1)+> <+> text "for" <+> scalExpr flg (es !! 2))+> Just "arraysub" ->+> case es of+> (Identifier _ i : es1) -> name i+> <> brackets (csvExp flg es1)+> (e:es') -> scalExpr flg e+> <> brackets (csvExp flg es')+> _ -> error $ "bad args to !arraysub: " ++ show es+> Just "rowctor" -> text "row" <> parens (sepCsvMap (scalExpr flg) es)+> x -> error $ "bad special operator name: " ++ show x++> scalExpr flg (BinaryOp _ n e0 e1) =+> case getTName n of+> Just "and" | otherwise -> sep [scalExpr flg e0+> ,text "and"+> ,scalExpr flg e1]+> Just n' | Just n'' <- lookup n' [("or","or")+> ,("like","like")+> ,("rlike","rlike")+> ,("notlike","not like")] ->+> scalExpr flg e0+> <+> text n''+> <+> scalExpr flg e1+> Just "." -- special case to avoid ws around '.'. Don't know if this is important+> -- or just cosmetic+> -> scalExpr flg e0 <> text "." <> scalExpr flg e1+> Just n' -> scalExpr flg e0 <+> ttext n' <+> scalExpr flg e1+> Nothing -> error $ "bad binary operator name:" ++ show n++> scalExpr flg (PrefixOp _ n e0)+> | Just "not" <- getTName n =+> text "not" <+> scalExpr flg e0+> | Just n' <- getTName n =+> ttext n'+> <+> scalExpr flg e0+> | otherwise = error $ "bad prefix operator name:" ++ show n+++> scalExpr flg (PostfixOp _ n e0)+> | Just n' <- getTName n >>= flip lookup [("isnull", "is null")+> ,("isnotnull", "is not null")] =+> scalExpr flg e0 <+> ttext n'+> | Just n' <- getTName n =+> scalExpr flg e0 <+> ttext n'+> | otherwise = error $ "bad postfix operator name:" ++ show n++> scalExpr flg (App _ n es) =+> name n <> parens (csvExp flg es)++>+> scalExpr _ (BooleanLit _ b) = bool b+> scalExpr flg (InPredicate _ att t lst) =+> scalExpr flg att <+> (if not t then text "not" else empty) <+> text "in"+> <+> parens (case lst of+> InList _ expr -> csvExp flg expr+> InQueryExpr _ sel -> queryExpr flg True True Nothing sel)+> scalExpr flg (LiftApp _ op flav args) =+> scalExpr flg (head args) <+> name op+> <+> text (case flav of+> LiftAny -> "any"+> LiftAll -> "all")+> <+> parens (scalExpr flg $ head $ tail args)+> scalExpr flg (ScalarSubQuery _ s) = parens (queryExpr flg True True Nothing s)+> scalExpr _ (NullLit _) = text "null"+> scalExpr flg (WindowApp _ fn part order frm) =+> scalExpr flg fn <+> text "over"+> <+> parens (if hp || ho+> then (if hp+> then text "partition by" <+> csvExp flg part+> else empty)+> <+> orderBy flg order+> <+> frameStuff+> else empty)+> where+> hp = not (null part)+> ho = not (null order)+> frameStuff = case frm of+> Nothing -> empty+> Just FrameUnboundedPreceding -> text "range unbounded preceding"+> Just FrameUnboundedFull -> text "range between unbounded preceding and unbounded following"+> Just FrameRowsUnboundedPreceding -> text "rows unbounded preceding"+>+> scalExpr flg (AggregateApp _ d (App _ fn es) o) =+> name fn <> parens ((case d of+> All -> text "all"+> Distinct -> text "distinct")+> <+> csvExp flg es+> <+> orderBy flg o)+> scalExpr _ a@(AggregateApp {}) = error $ "bad syntax for aggregate function" ++ show a+> scalExpr flg (Case _ whens els) =+> text "case"+> $+$ nest 2 (vcat (map whn whens)+> $+$ maybePrint (\e -> text "else" <+> scalExpr flg e) els)+> $+$ text "end"+> where+> whn (ex1, ex2) =+> text "when" <+> sepCsvMap (scalExpr flg) ex1+> <+> text "then" <+> scalExpr flg ex2+>+> scalExpr flg (CaseSimple _ val whens els) =+> text "case" <+> scalExpr flg val+> $+$ nest 2 (vcat (map whn whens)+> $+$ maybePrint (\e -> text "else" <+> scalExpr flg e) els)+> $+$ text "end"+> where+> whn (ex1, ex2) =+> text "when" <+> sepCsvMap (scalExpr flg) ex1+> <+> text "then" <+> scalExpr flg ex2+>+> scalExpr _ (PositionalArg _ a) = text "$" <> integer a+> scalExpr _ (Placeholder _) = text "?"+> scalExpr flg (Exists _ s) =+> text "exists" <+> parens (queryExpr flg True True Nothing s)+> scalExpr flg (Cast _ ex t) = text "cast" <> parens (scalExpr flg ex+> <+> text "as"+> <+> typeName t)+> scalExpr flg (ImplicitCast _ ex te) = text "impl_cast" <> parens (scalExpr flg ex+> <+> text "as"+> <+> typeExtra te)+> scalExpr flg (TypedStringLit a t s) =+> typeName t <+> scalExpr flg (StringLit a s)+> scalExpr flg (Interval a v f p) =+> text "interval" <+> scalExpr flg (StringLit a v)+> <+> intervalField <+> precision+> where+> intervalField =+> text $ case f of+> IntervalYear -> "year"+> IntervalMonth -> "month"+> IntervalDay -> "day"+> IntervalHour -> "hour"+> IntervalMinute -> "minute"+> IntervalSecond -> "second"+> IntervalYearToMonth -> "year to month"+> IntervalDayToHour -> "day to hour"+> IntervalDayToMinute -> "day to minute"+> IntervalDayToSecond -> "day to second"+> IntervalHourToMinute -> "hour to minute"+> IntervalHourToSecond -> "hour to second"+> IntervalMinuteToSecond -> "minute to second"+> precision = case p of+> Nothing -> empty+> Just i -> parens (int i)+> scalExpr flg (Extract _ f e) =+> text "extract"+> <> parens (text field <+> text "from" <+> scalExpr flg e)+> where+> field =+> case f of+> ExtractCentury -> "century"+> ExtractDay -> "day"+> ExtractDecade -> "decade"+> ExtractDow -> "dow"+> ExtractDoy -> "doy"+> ExtractEpoch -> "epoch"+> ExtractHour -> "hour"+> ExtractIsodow -> "isodow"+> ExtractIsoyear -> "isoyear"+> ExtractMicroseconds -> "microseconds"+> ExtractMillennium -> "millennium"+> ExtractMilliseconds -> "milliseconds"+> ExtractMinute -> "minute"+> ExtractMonth -> "month"+> ExtractQuarter -> "quarter"+> ExtractSecond -> "second"+> ExtractTimezone -> "timezone"+> ExtractTimezoneHour -> "timezone_hour"+> ExtractTimezoneMinute -> "timezone_minute"+> ExtractWeek -> "week"+> ExtractYear -> "year"++> scalExpr _flg (OdbcLiteral _ t s) =+> text "{" <> lt t <+> quotes (text s) <> text "}"+> where+> lt OLDate = "d"+> lt OLTime = "t"+> lt OLTimestamp = "ts"++> scalExpr flg (OdbcFunc _ e) =+> text "{fn" <+> scalExpr flg e <> text "}"+++> scalExprSl :: PrettyFlags -> ScalarExpr -> Doc+> scalExprSl flg (App _ f es) | Just "." <- getTName f+> , [a@(Identifier _ _), b] <- es =+> scalExprSl flg a <> text "." <> scalExprSl flg b+> scalExprSl flg x = scalExpr flg x++>+> set :: PrettyFlags -> SetClause -> Doc+> set flg (SetClause _ a e) =+> nmc a <+> text "=" <+> scalExpr flg e+> set flg (MultiSetClause _ is (SpecialOp _ f es)) | Just "rowctor" <- getTName f =+> parens (sepCsvMap nmc is) <+> text "="+> <+> parens (sepCsvMap (scalExpr flg) es)+> set _ a = error $ "bad expression in set in update: " ++ show a+>+> --utils+>+> -- convert a list of expressions to horizontal csv+>+> csvExp :: PrettyFlags -> [ScalarExpr] -> Doc+> csvExp flg = hcatCsvMap (scalExpr flg)+>+> maybePrint :: (t -> Doc) -> Maybe t -> Doc+> maybePrint f c =+> case c of+> Nothing -> empty+> Just a -> f a+>+> csv :: [Doc] -> [Doc]+> csv = punctuate comma+>+> hcatCsv :: [Doc] -> Doc+> hcatCsv = hcat . csv++> sepCsv :: [Doc] -> Doc+> sepCsv = sep . csv+>+> ifNotEmpty :: ([a] -> Doc) -> [a] -> Doc+> ifNotEmpty c l = if null l then empty else c l+>+> hcatCsvMap :: (a -> Doc) -> [a] -> Doc+> hcatCsvMap ex = hcatCsv . map ex++> sepCsvMap :: (a -> Doc) -> [a] -> Doc+> sepCsvMap ex = sepCsv . map ex++> orderBy :: PrettyFlags -> [(ScalarExpr,Direction,NullsOrder)] -> Doc+> orderBy _ [] = empty+> orderBy flg os =+> text "order by"+> $+$ nest 2 (sepCsvMap (\(oe,od,on) -> scalExpr flg oe+> <+> direction od <+> nullsOrder on) os)++> --vcatCsvMap :: (a -> Doc) -> [a] -> Doc+> --vcatCsvMap ex = vcat . csv . map ex++>+> bool :: Bool -> Doc+> bool b = if b then text "true" else text "false"+>+> newline :: Doc+> newline = text "\n"+>+> annot :: (Annotation -> String) -> Annotation -> Doc+> annot ca a = let s = ca a+> in if s == ""+> then empty+> else text "/*\n" <+> text s+> <+> text "*/\n"++> label :: Maybe String -> Doc+> label =+> maybe empty (\l -> text "<<"+> <+> text l+> <+> text ">>" <> text "\n")++util: to be removed when outputting names is fixed++> getTName :: Name -> Maybe String+> getTName (Name _ [n]) = Just $ ncStr n+> getTName _ = Nothing++> ttext :: String -> Doc+> ttext = text++> tltext :: String -> Doc+> tltext = text
+ src/Database/HsSqlPpp/Internals/TypeChecking/Environment.lhs view
@@ -0,0 +1,427 @@+++This module represents part of the bound names environment used in the+type checker. It doesn't cover the stuff that is contained in the+catalog (so it is slightly misnamed), but focuses only on identifiers+introduced by things like tablerefs, sub selects, plpgsql parameters+and variables, etc.++> {-# LANGUAGE DeriveDataTypeable,TupleSections,ScopedTypeVariables,OverloadedStrings #-}+> module Database.HsSqlPpp.Internals.TypeChecking.Environment+> (-- * abstract environment value+> Environment+> ,JoinType(..)+> -- * environment create and update functions+> ,emptyEnvironment+> ,isEmptyEnv+> ,envCreateTrefEnvironment+> ,createJoinTrefEnvironment+> ,envSelectListEnvironment+> ,createCorrelatedSubqueryEnvironment+> ,createTrefAliasedEnvironment+> ,brokeEnvironment+> ,orderByEnvironment+> -- * environment query functions+> ,envLookupIdentifier+> ,envExpandStar+> ) where++> import Data.Data+> import Data.Char+> --import Data.Maybe+> import Control.Monad+> import Control.Arrow+> import Data.List+> --import Debug.Trace+> --import Text.Show.Pretty++> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion+> import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes hiding (ncStr)+> import Data.Generics.Uniplate.Data+> import Data.Text (Text)+> import qualified Data.Text as T++---------------------------------++Alex:+ Not sure that handling of USING joins (and specifically of join keys) is correct, but+ don't know, have to investigate all the connections in the code.+ One problem is that types for the purpose of comparison are different from the output types.+ Moreover, major DBs are imprecise in their definitions of USING joins.+ For instance, what Postgre writes about output columns seems to be related only to the+ star expansion. I still can explicitly reference a key column from the inner table+ in the output expression, with the use of table name or alias. Or can I not?+ Have to look at ANSI.+ More precisely, we have:+ 1. Type check join keys to see that they are compatible.+ 2. If needed, create additional columns that would exist for the purpose of comparison+ only. The scalar expressions that create them are casts from join keys.+ 3. If a join key is used in an output scalar expression, the original' key type is used.+ For a qualified column reference, including qualified star expansion, original' type+ is same as original type, except that it is possibly cast to nullable for an inner table+ of an outer join.+ For star expansion:+ The original' type is defined strictly for LeftOuter and RightOuter.+ It is unclear what to do in case of Inner and FullOuter if the types differ (but, as we+ already know, are compatible).+ There are two choices:+ 1. Reject the query.+ 2. Resolve the types and return the result type.+ For now, I'll do the 2nd thing, let's see what happens.+ And I don't implement the rest of this plan either, of course:+ - I convert things to nullable for outer joins, but don't separate between+ condition columns and output columns, of course;+ - For Right Outer Joins, I reverse the order of input environments in listBindingsTypes,+ for the purpose of getting the key types.+ And now I see that TypeExtra's in join ids are not actually used.++> -- | Represent an environment using an abstracted version of the syntax+> -- which produced the environment. This structure has all the catalog+> -- queries resolved. No attempt is made to combine environment parts from+> -- different sources, they are just stacked together, the logic for+> -- working with combined environments is in the query functions below+> data Environment =+> -- | represents an empty environment, makes e.g. joining+> -- the environments for a list of trefs in a select list+> -- more straightforward+> EmptyEnvironment+> -- | represents the bindings introduced by a tableref:+> -- the name, the public fields, the private fields+> | SimpleTref (Text,Text) [(Text,TypeExtra)] [(Text,TypeExtra)]+> -- | environment from joining two tables+> | JoinTref [(Text,TypeExtra)] -- join ids+> JoinType -- added because outer join makes some things nullabie+> Environment Environment+> -- | environment from a sub select+> | SelectListEnv [(Text,TypeExtra)]+> -- | correlated subquery environment+> | CSQEnv Environment -- outerenv+> Environment -- main env+> -- | an aliased tref+> | TrefAlias Text (Maybe [Text]) Environment+> | BrokeEnvironment+> -- order by: can use the name of a select list column+> -- or anything from the same environment which select+> -- list operates on+> | OrderByEnvironment Environment Environment+> deriving (Data,Typeable,Show,Eq)+>+> data JoinType = Inner | LeftOuter | RightOuter | FullOuter+> deriving (Data,Typeable,Show,Eq)++---------------------------------------------------++Create/ update functions, these are shortcuts to create environment variables,+the main purpose is to encapsulate looking up information in the+catalog and combining environment values with updates++TODO: remove the create prefixes++> emptyEnvironment :: Environment+> emptyEnvironment = EmptyEnvironment++> isEmptyEnv :: Environment -> Bool+> isEmptyEnv EmptyEnvironment = True+> isEmptyEnv _ = False++> envCreateTrefEnvironment :: Catalog -> [NameComponent] -> Either [TypeError] Environment+> envCreateTrefEnvironment cat tbnm = do+> (nm,pub,prv) <- catLookupTableAndAttrs cat tbnm+> return $ SimpleTref nm pub (second mkTypeExtraNN `map` prv)++> envSelectListEnvironment :: [(Text,TypeExtra)] -> Either [TypeError] Environment+> envSelectListEnvironment cols =+> return $ SelectListEnv $ map (first $ T.map toLower) cols+++> -- | create an environment as two envs joined together+> createJoinTrefEnvironment :: Catalog+> -> Environment+> -> Environment+> -> JoinType+> -> Maybe [NameComponent] -- join ids: empty if cross join+> -- nothing for natural join+> -> Either [TypeError] Environment+> createJoinTrefEnvironment cat tref0 tref1 jt jsc = do+> -- todo: handle natural join case+> (jids::[Text]) <- case jsc of+> Nothing -> do+> j0 <- fmap (map (snd . fst)) $ envExpandStar Nothing tref0+> j1 <- fmap (map (snd . fst)) $ envExpandStar Nothing tref1+> return $ j0 `intersect` j1+> Just x -> return $ map nmcString x++> -- maybe (error "natural join ids") (map (nnm . (:[]))) jsc++> jts <- forM jids $ \i -> do+> (_,t0) <- envLookupIdentifier [QNmc $ T.unpack i] tref0+> (_,t1) <- envLookupIdentifier [QNmc $ T.unpack i] tref1+> let adjustTypeExtra te = case jt of+> Inner -> te+> LeftOuter -> t0+> RightOuter -> t1+> FullOuter -> mkNullable te+> fmap ((i,) . adjustTypeExtra) $ resolveResultSetTypeExtra cat [t0,t1]+> -- ImplicitCastToDo: remove or restore+> --fmap (i,) $ resolveResultSetTypeExtra cat [t0,t1]+> -- todo: check type compatibility+> return $ JoinTref jts jt tref0 tref1++> createCorrelatedSubqueryEnvironment :: Environment -> Environment -> Environment+> createCorrelatedSubqueryEnvironment = CSQEnv++> createTrefAliasedEnvironment :: Text -> Maybe [Text] -> Environment -> Environment+> createTrefAliasedEnvironment = TrefAlias++> -- | represents type check failure upstream, don't produce additional+> -- type check errors+> brokeEnvironment :: Environment+> brokeEnvironment = BrokeEnvironment++> isBroken :: Environment -> Bool+> isBroken env = not $ null [() | BrokeEnvironment <- universeBi env]++> orderByEnvironment :: Environment -> Environment -> Environment+> orderByEnvironment = OrderByEnvironment++-------------------------------------------------------+++The main hard work is done in the query functions: so the idea is that+the update functions create environment values which contain the+context free contributions of each part of the ast to the current+environment, and these query functions do all the work of resolving+implicit correlation names, ambigous identifiers, etc.++for each environment type, provide two functions which do identifier+lookup and star expansion++> listBindingsTypes :: Environment -> ((Maybe Text,Text) -> [((Text,Text),TypeExtra)]+> ,Maybe Text -> [((Text,Text),TypeExtra)] -- star expand+> )+> listBindingsTypes EmptyEnvironment = (const [],const [])+> listBindingsTypes BrokeEnvironment = (const [],const [])++> listBindingsTypes (TrefAlias ta Nothing env) =+> (\(q,n) -> if q `elem` [Nothing, Just ta]+> then req $ fst (listBindingsTypes env) (Nothing,n)+> else []+> ,\q -> if q `elem` [Nothing, Just ta]+> then req $ snd (listBindingsTypes env) Nothing+> else [])+> where+> req = map (\((_,i),t) -> ((ta,i),t))++> listBindingsTypes (TrefAlias ta (Just cs) env) =+> (\(q,n) -> --trace ("lookup: " ++ show (q,n)) $+> if q `elem` [Nothing, Just ta]+> then --really hacky, assume the ids come out of the star expansion in same order+> -- almost certainly wrong some of the time+> case elemIndex n cs of+> Just i -> let s :: [((Text, Text), TypeExtra)]+> s = (snd (listBindingsTypes env) Nothing)+> in {-trace ("getit : " ++ show (i,show s))+> $ -}+> -- map to change the qualifier name to match+> -- this alias not the source tref+> map (\((_,_j),t) -> ((ta,n),t)) $ take 1 $ drop i s+> Nothing -> []+> else []+> ,\q -> if q `elem` [Nothing, Just ta]+> then let -- if there are too many aliases for the aliased tref+> -- the extras are ignored (not sure if this is correct)+> -- if there are not enough, the extras are kept without+> -- being renamed (think this is correct)+> repColNames = map Just cs ++ repeat Nothing+> aliasize :: [((Text, Text), TypeExtra)] -> [((Text, Text), TypeExtra)]+> aliasize =+> flip zipWith repColNames (\r ((_,n),t) ->+> case r of+> Just r' -> ((ta,r'),t)+> Nothing -> ((ta,n),t))+> in aliasize $ snd (listBindingsTypes env) Nothing+> else [])+> where+> -- not sure why this is here, code layout is a bit confusing+> _req = map (\((_,i),t) -> ((ta,i),t))+++FIXME!!! (_,nm) ?++> listBindingsTypes (SimpleTref (_,nm) pus pvs) =+> (\(q,n) -> let m (n',_) = (q `elem` [Nothing,Just nm])+> && n == n'+> in addQual nm $ filter m $ pus ++ pvs+> ,\q -> case () of+> _ | q `elem` [Nothing, Just nm] -> addQual nm pus+> | otherwise -> [])++> listBindingsTypes (JoinTref jids jt env0 env1) =+> (idens,starexp)+> where++> idens k = let [iOuter,iInner] = (if jt==RightOuter then reverse else id) [is0 k, is1 k]+> in if not (null iOuter) && snd k `elem` jnames+> then iOuter+> else iOuter ++ iInner++> _useResolvedType tr@((q,n),_) = case lookup n jids of+> Just t' -> ((q,n),t')+> Nothing -> tr+> jnames = map fst jids+> isJ ((_,n),_) = n `elem` jnames++todo: use useResolvedType++unqualified star:+reorder the ids so that the join columns are first++> starexp Nothing = let (aj,anj) = partition isJ (st0 Nothing)+> bnj = filter (not . isJ) (st1 Nothing)+> in aj ++ anj ++ bnj+> starexp q@(Just _) =+> let s0 = st0 q+> s1 = st1 q+> in case (s0,s1) of+> -- if we only get ids from one side, then don't+> -- reorder them (is this right?)+> (_:_,[]) -> s0+> ([], _:_) -> s1+> -- have ids coming from both sides+> -- no idea how this is supposed to work+> _ -> let (aj,anj) = partition isJ s0+> bnj = filter (not . isJ) s1+> in aj ++ anj ++ bnj+> (is0,st0) = (if jt `elem` [RightOuter,FullOuter] then addNullability else id)+> $ listBindingsTypes env0+> (is1,st1) = (if jt `elem` [LeftOuter,FullOuter] then addNullability else id)+> $ listBindingsTypes env1+> addNullability = (map (second mkNullable) .) *** (map (second mkNullable) .)++selectlistenv: not quite right, but should always have an alias so the+empty qualifier never gets very far++> listBindingsTypes (SelectListEnv is) =+> (\(_,n) -> addQual "" $ filter ((==n).fst) is+> ,const $ addQual "" is)++not quite right, see queryexprs.ag++> listBindingsTypes (OrderByEnvironment sl tr) =+> (\i ->+> -- hack: return the tref first so that+> -- a qualifier can be added. This+> -- is probably more wrong than the other+> -- way round+> case (fst (listBindingsTypes tr) i+> ,fst (listBindingsTypes sl) i) of+> ([],x) -> x+> (y,_) -> y+> ,const [])+++csq just uses standard shadowing for iden lookup+for star expand, the outer env is ignored++> listBindingsTypes (CSQEnv outerenv env) =+> (\k -> case (fst (listBindingsTypes env) k+> ,fst (listBindingsTypes outerenv) k) of+> (x,_) | not (null x) -> x+> (_, x) | not (null x) -> x+> _ -> []+> ,snd $ listBindingsTypes env)+++> addQual :: Text -> [(Text,TypeExtra)] -> [((Text,Text),TypeExtra)]+> addQual q = map (\(n,t) -> ((q,n),t))+++-------------------------------------------------------++use listBindingsTypes to implement expandstar and lookupid++> envExpandStar:: Maybe NameComponent -> Environment+> -> Either [TypeError] [((Text,Text),TypeExtra)]++> envExpandStar {-nmc env-} = {-let r =-} envExpandStar2 {-nmc env-}+> {-in trace ("env expand star: " ++ show nmc ++ " " ++ show r)+> r-}++> envExpandStar2 :: Maybe NameComponent -> Environment -> Either [TypeError] [((Text,Text),TypeExtra)]+> envExpandStar2 nmc env =+> if isBroken env+> then Left []+> else+> let st = snd (listBindingsTypes env) $ fmap nmcString nmc+> in if null st+> then case nmc of+> Just x -> Left [UnrecognisedCorrelationName $ nmcString x]+> Nothing -> Left [BadStarExpand]+> else Right st++> nmcString :: NameComponent -> Text+> nmcString (QNmc n) = T.pack n+> nmcString (Nmc n) = T.pack $ map toLower n+> -- todo: don't use error+> nmcString (AntiNameComponent _) = error "tried to get ncstr of antinamecomponent"++> envLookupIdentifier :: [NameComponent] -> Environment+> -> Either [TypeError] ((Text,Text), TypeExtra)+> envLookupIdentifier nmc env = --trace ("lookup: " ++ show nmc ++ "\n" ++ ppShow env) $+> if isBroken env+> then Left []+> else do+> k <- case nmc of+> [a,b] -> Right (Just $ nmcString a, nmcString b)+> [b] -> Right (Nothing, nmcString b)+> [_,_,_] -> Left [SchemadColumnName "an identifier cannot be used with an explicit schema name, please use only a correlation name without a schema name (you can use a table reference alias to disambiguate if you need to)."]+> [_,_,_,_] -> Left [DbSchemadColumnName "an identifier cannot be used with an explicit database name and schema name, please use only a correlation name without a schema name (you can use a table reference alias to disambiguate if you need to)."]+> _ -> Left [InternalError "too many nmc components in envlookupiden"]+> case (fst $ listBindingsTypes env) k of+> [] -> Left [UnrecognisedIdentifier $ nmcString $ last nmc]+> [x] -> Right $ keepCasehack x+> _ -> Left [AmbiguousIdentifier $ nmcString $ last nmc]+> where+> keepCasehack ((na,nb),t) =+> case nmc of+> [a,b] -> let x = ((keepcase a na,keepcase b nb),t)+> in {-(if True -- map toLower nb == "ou_id"+> then trace ("\n\n*********************\n\nlookup: " ++ show x ++ "\n\n********************************\n\n" ++ ppShow env ++ "\n\n********************************\n\n")+> else id)-} x+> [b] -> ((na,keepcase b nb),t)+> _ -> error "too many nmc components in envlookupiden(2)"+> keepcase orig new = -- sanity check: make sure the nmcs are equal+> if T.map toLower new == nmcString orig+> then noLower orig+> else new+> noLower (QNmc n) = T.pack n+> noLower (Nmc n) = T.pack n+> noLower (AntiNameComponent n) = error $ "bad antinamecomponent in Environment.envLookupIdentifier.noLower " ++ n++--------------------------+adding for plpgsql notes:++additional envs+* parameter in function+* declaration in function block+* implicit integer loop var in for loop+* set explicit record type in for loop/ assignment to record type+* for constraints in create table, create domain++Write tests to quickly check each bit of code which uses these using+the full typechecking:+update: sets, where, returning+select: tref -> select list, where, group by, order by+join: out to tref, into on expression+implicit variable in for loop+record type in for loop+record type in assignment+record type in select into+delete where and returning+block declarations+constraints in create table, create domain+parameters in function body+statementlist: pass on record updates?+insert: columns?, returning
+ src/Database/HsSqlPpp/Internals/TypeChecking/OldTediousTypeUtils.lhs view
@@ -0,0 +1,60 @@++The reason this file exists is because the representation of types in+hssqlppp (in the module ...Internals.TypesInternal) is not good. I'm+not sure it can be improved that much though.++> {-# LANGUAGE FlexibleInstances,DeriveDataTypeable #-}+>+> module Database.HsSqlPpp.Internals.TypeChecking.OldTediousTypeUtils where++> import Database.HsSqlPpp.Internals.TypesInternal+> import Control.Arrow+> import Data.Text (Text)+> --import qualified Data.Text as T++> isArrayType :: Type -> Bool+> isArrayType (ArrayType _) = True+> isArrayType _ = False+>+> isDomainType :: Type -> Bool+> isDomainType (DomainType _) = True+> isDomainType _ = False+>+> isCompositeType :: Type -> Bool+> isCompositeType (CompositeType _) = True+> isCompositeType (NamedCompositeType _) = True+> isCompositeType (AnonymousCompositeType _) = True+> isCompositeType (Pseudo (Record _)) = True+> isCompositeType _ = False+>+> isCompositeOrSetOfCompositeType :: Type -> Bool+> isCompositeOrSetOfCompositeType (Pseudo (SetOfType a)) = isCompositeType a+> isCompositeOrSetOfCompositeType a = isCompositeType a+>+> unwrapArray :: Type -> Either [TypeError] Type+> unwrapArray (ArrayType t) = Right t+> unwrapArray x = Left [InternalError $ "can't get types from non array " ++ show x]+>+> unwrapSetOfWhenComposite :: Type -> Either [TypeError] Type+> unwrapSetOfWhenComposite (Pseudo (SetOfType a@(CompositeType _))) = Right a+> unwrapSetOfWhenComposite x = Left [InternalError $ "tried to unwrapSetOfWhenComposite on " ++ show x]+>+> unwrapSetOfComposite :: Type -> Either [TypeError] [(Text,Type)]+> unwrapSetOfComposite (Pseudo (SetOfType (CompositeType a))) = Right $ map (second teType) a+> unwrapSetOfComposite x = Left [InternalError $ "tried to unwrapSetOfComposite on " ++ show x]+>+> unwrapSetOf :: Type -> Either [TypeError] Type+> unwrapSetOf (Pseudo (SetOfType a)) = Right a+> unwrapSetOf x = Left [InternalError $ "tried to unwrapSetOf on " ++ show x]+>+> unwrapComposite :: Type -> Either [TypeError] [(Text,Type)]+> unwrapComposite (CompositeType a) = Right $ map (second teType) a+> unwrapComposite x = Left [InternalError $ "cannot unwrapComposite on " ++ show x]+>+> consComposite :: (Text,Type) -> Type -> Either [TypeError] Type+> consComposite l (CompositeType a) = Right $ CompositeType (second mkTypeExtra l :a)+> consComposite a b = Left [InternalError $ "called consComposite on " ++ show (a,b)]+>+> unwrapRowCtor :: Type -> Either [TypeError] [Type]+> unwrapRowCtor (AnonymousCompositeType a) = Right a+> unwrapRowCtor x = Left [InternalError $ "cannot unwrapRowCtor on " ++ show x]
+ src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/OldTypeConversion.lhs view
@@ -0,0 +1,742 @@+++This file contains the functions for resolving types and+function/operator resolution (which is seriously crazy). See the pg+manual chapter 10:++http://www.postgresql.org/docs/8.4/interactive/typeconv.html++This code is really spaghettified.++findCallMatch - pass in a name and a list of arguments, and it returns+the matching function. (pg manual 10.2,10.3)++resolveResultSetType - pass in a set of types, and it tries to find+the common type they can all be cast to. (pg manual 10.5)++checkAssignmentValid - pass in source type and target type, returns+ typelist[] if ok, otherwise error, pg manual 10.4+ Value Storage++I wrote this when I was still struggling with haskell basics so it is+probably the worst bit of code in the codebase (there are a few+other contenders for this accolade). A rewrite is planned, but it+seems to do the job reasonably well at the moment so keeps getting put+off.+++> {-# LANGUAGE PatternGuards,OverloadedStrings,NondecreasingIndentation #-}+> module Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.OldTypeConversion (+> findCallMatch+> ,resolveResultSetType+> ,resolveResultSetTypeExtra+> ,adjustStringCastPrec+> ,joinPrecision+> ,joinScale+> ,joinNullability+> ,checkAssignmentValid+> ,checkAssignmentsValid+> ) where+>+> import Data.Maybe+> import Data.List+> import Data.Either+> --import Debug.Trace+> import Data.Char+> import Control.Monad+> import Control.Arrow+>+> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Utils.Utils+> import Database.HsSqlPpp.Internals.TypeChecking.OldTediousTypeUtils+> import Data.Text (Text)+> import qualified Data.Text as T+> --import Text.Show.Pretty++ > traceIt :: Show a => String -> a -> a+ > traceIt s t = trace (s ++ ": " ++ show t) t++= findCallMatch++~~~~++findCallMatch - partially implements the type conversion rules for+finding an operator or function match given a name and list of+arguments with partial or fully specified types++TODO:, qualifiers+namespaces+function style casts not in catalog+variadic args+default args+domains -> base type+what about aggregates and window functions?++Algo:++cands = all fns with matching names+ and same number of args++if exact match on types in this list, use it+ (if binary operator being matched, and one arg is typed and one is+ unknown, also match an operator by assuming the unknown is the same+ as the typed arg)++best match part:++filter cands with args which don't exactly match input args, and input+args cannot be converted by an implicit cast. unknowns count as+matching anything+if one left: use it++filter for preferred types:++for each cand, count each arg at each position which needs conversion,+and the cand type is a preferred type at that position.+if there are cands with count>0, keep only cands with the max count,+if one return it+if there are no cands with count>0, keep them all++check unknowns:+if any input args are unknown, and any cand accepts string at that+position, fix that arg's category as string, otherwise if all cands+accept same category at that position, fix that input args as that+category.+if we still have unknowns, then fail++discard cands which don't match the new input arg/category list++for each categorised input arg, if any cand accepts preferred type at+that position, get rid of cands which don't accept preferred type at+that position++if one left: use+else fail++polymorphic matching:+want to create a set of matches to insert into the cast pairs list+so:++find all matches on name, num args and have polymorphic parameters++for each one, check the polymorphic categories - eliminate fns that+have params in wrong category - array, non array, enum.+work out the base types for the polymorphic args at each spot based on+the args passed - so each arg is unchanged except arrays which have+the array part stripped off++now we have a list of types to match against the polymorphic params,+use resolveResultSetType to see if we can produce a match, if so,+create a new prototype which is the same as the polymorphic function+but with this matching arg swapped in, work out the casts and add it+into cand cast pairs, after exact match has been run.+++findCallMatch is a bit of a mess++todos:++rewrite this to try to make it a bit clearer++find some way to draw a data flow diagram of the code easily++add a logging facility so the function can explain what has happened+at each state, so you can provide a detailed explanation e.g. if the+code can't find an operator match to see what it has tried to match+against.++~~~~++> type ProtArgCast = (OperatorPrototype, [ArgCastFlavour])++> {-+> between, greatest and least are treated as syntactic sugar so we+> delegate the function lookups to the <=/>= operators.+> the row comparison should be more general than this, since it supports+> any operator satisfying some properties+> -}+> findCallMatch :: Dialect -> Catalog -> Text -> [Type] -> Either [TypeError] OperatorPrototype+> findCallMatch d cat fnName' argsType =+> --trace (if fnName=="=" then "typecheckfncall " ++ fnName' ++ show argsType else "") $+> --dependsOnRTpe argsType $+> case fnName of+> "between" | as@[_,_,_] <- argsType -> do+> -- not sure if this is correct - use the result set resolution+> -- to make the argument types compatible+> -- then just check there is a >=, <= returning a pair+> -- of somethings which can be anded+> t <- resolveResultSetType cat as+> f1 <- lookupReturnType ">=" [t,t]+> f2 <- lookupReturnType "<=" [t,t]+> _ <- lookupFn "and" [f1,f2]+> bt <- maybe (Left []) Right $ ansiTypeNameToDialect d "boolean"+> return ("between", [t,t,t], ScalarType bt, False)+> "notbetween" | as@[_,_,_] <- argsType -> do+> -- not sure if this is correct - use the result set resolution+> -- to make the argument types compatible+> -- then just check there is a >=, <= returning a pair+> -- of somethings which can be anded+> t <- resolveResultSetType cat as+> f1 <- lookupReturnType "<" [t,t]+> f2 <- lookupReturnType ">" [t,t]+> _ <- lookupFn "or" [f1,f2]+> bt <- maybe (Left []) Right $ ansiTypeNameToDialect d "boolean"+> return ("notbetween", [t,t,t], ScalarType bt, False)+> "greatest" -> do+> (_,a,t,x) <- lookupFn fnName argsType+> _ <- lookupFn ">=" [t,t]+> return ("greatest",a,t,x)+> "least" -> do+> (_,a,t,x) <- lookupFn fnName argsType+> _ <- lookupFn "<=" [t,t]+> return ("greatest",a,t,x)+> "rowctor" -> return ("rowCtor", argsType, AnonymousCompositeType argsType, False)+> -- special case the row comparison ops+> -- this needs to be fixed: we want to match+> -- any implicit casts to functions on composite types+> -- first, then we can use the anonymous record type on+> -- any composite+> "." | [_,b] <- argsType -> Right (".", argsType, b, False)+> _ | fnName `elem` ["=", "<>", "<=", ">=", "<", ">"]+> && length argsType == 2+> && all isCompositeOrSetOfCompositeType argsType,+> Just bt <- ansiTypeNameToDialect d "boolean",+> Just a1 <- matchCompTypes argsType ->+> -- && compositesCompatible cat (head argsType) (head $ tail argsType) ->+> return (fnName, a1, ScalarType bt, False)+> --checked for all special cases, so run general case now+> s -> lookupFn s argsType+> where+> lookupReturnType :: Text -> [Type] -> Either [TypeError] Type+> lookupReturnType s1 args = fmap (\(_,_,r,_) -> r) $ lookupFn s1 args+> lookupFn :: Text -> [Type] -> Either [TypeError] OperatorPrototype+> lookupFn = findCallMatch1 cat+> fnName = T.map toLower fnName'+> -- help the type inference for rowCtors. pretty unfinished. If we compare+> -- two compatible row constructors, then replace any unknown types with the+> -- pair type+> matchCompTypes :: [Type] -> Maybe [Type]+> matchCompTypes [a@(AnonymousCompositeType as),b@(AnonymousCompositeType bs)] =+> if not (compositesCompatible cat a b)+> then Nothing+> else let (nt1,nt2) = unzip $ map (\(t,t1) -> case (t,t1) of+> (UnknownType, u) -> (u,u)+> (u, UnknownType) -> (u,u)+> _ -> (t,t1)) $ zip as bs+> in Just [AnonymousCompositeType nt1,AnonymousCompositeType nt2]+> matchCompTypes [a,b] =+> if not (compositesCompatible cat a b)+> then Nothing+> else Just [a,b]+> matchCompTypes _ = Nothing++>+> findCallMatch1 :: Catalog -> Text -> [Type] -> Either [TypeError] OperatorPrototype+> findCallMatch1 cat f inArgs =+> let x = [exactMatch+> ,binOp1UnknownMatch+> ,polymorpicExactMatches+> ,reachable+> ,mostExactMatches+> ,filteredForPreferred+> ,unknownMatchesByCat]+> y = returnIfOnne ({-trace (if f `elem` ["=","lower"]+> then ("\n-----------------\n"+> -- ++ ppShow (let c = catUpdates cat in drop (length c - 30) c)+> -- ++ "\n-----------------\n"+> ++ ppShoe (f,inArgs) ++ "\n" ++ groom x)+> else "")-} x)+> [NoMatchingOperator f inArgs]+> in {-trace (if f `elem` ["=","lower"] then "y = " ++ show y else "")-} y+> where+> -- basic lists which roughly mirror algo+> -- get the possibly matching candidates+> initialCandList :: [OperatorPrototype]+> initialCandList = filter (\(_,candArgs,_,_) ->+> length candArgs == length inArgs) $+> map expandVariadic $ catLookupFns cat f+>+> expandVariadic fp@(fn,a,r,v) =+> if v+> then case last a of+> ArrayType t -> (fn, na,r,v)+> where na = init a ++ replicate (length inArgs - length a + 1) t+> _ -> fp --should be error+> else fp+>+> -- record what casts are needed for each candidate+> castPairs :: [[ArgCastFlavour]]+> castPairs = map (listCastPairs . getFnArgs) initialCandList+>+> candCastPairs :: [ProtArgCast]+> candCastPairs = {-traceIt "candCastPairs" $-} zip initialCandList castPairs+>+> -- see if we have an exact match+> exactMatch :: [ProtArgCast]+> exactMatch = filterCandCastPairs (all (==ExactMatch)) candCastPairs+>+> -- implement the one known, one unknown resolution for binary operators+> binOp1UnknownMatch :: [ProtArgCast]+> binOp1UnknownMatch = getBinOp1UnknownMatch candCastPairs+>+> --collect possible polymorphic matches+> polymorphicMatches :: [ProtArgCast]+> polymorphicMatches = filterPolymorphics candCastPairs+>+> polymorpicExactMatches :: [ProtArgCast]+> polymorpicExactMatches = filterCandCastPairs (all (==ExactMatch)) polymorphicMatches+>+> -- eliminate candidates for which the inargs cannot be casted to+> reachable :: [ProtArgCast]+> reachable = mergePolys (filterCandCastPairs (none (==CannotCast)) candCastPairs)+> polymorphicMatches+>+> mostExactMatches :: [ProtArgCast]+> mostExactMatches =+> let inArgsBase = map (replaceWithBase cat) inArgs+> exactCounts :: [Int]+> exactCounts =+> map ((length+> . filter (\(a1,a2) -> a1==replaceWithBase cat a2)+> . zip inArgsBase)+> . (\((_,a,_,_),_) -> a)) reachable+> pairs = zip reachable exactCounts+> maxm = maximum exactCounts+> in case () of+> _ | null reachable -> []+> | maxm > 0 -> map fst $ filter (\(_,b) -> b == maxm) pairs+> | otherwise -> []+>+> -- keep the cands with the most casts to preferred types+> preferredTypesCounts = countPreferredTypeCasts reachable+> keepCounts = maximum preferredTypesCounts+> itemCountPairs :: [(ProtArgCast,Int)]+> itemCountPairs = zip reachable preferredTypesCounts+> filteredForPreferred :: [ProtArgCast]+> filteredForPreferred = map fst $ filter (\(_,i) -> i == keepCounts) itemCountPairs+>+> -- collect the inArg type categories to do unknown inArg resolution+> argCats :: [Either () Text]+> argCats = getCastCategoriesForUnknowns filteredForPreferred+> unknownMatchesByCat :: [ProtArgCast]+> unknownMatchesByCat = getCandCatMatches filteredForPreferred argCats+>+> -------------+>+> listCastPairs :: [Type] -> [ArgCastFlavour]+> listCastPairs = listCastPairs' inArgs+> where+> listCastPairs' :: [Type] -> [Type] -> [ArgCastFlavour]+> listCastPairs' (ia:ias) (ca:cas) =+> (case () of+> _ | ia == ca -> ExactMatch+> | castableFromTo cat ImplicitCastContext ia ca ->+> either (error . show)+> (\b -> if b+> then ImplicitToPreferred+> else ImplicitToNonPreferred)+> (catPreferredType cat ca)+> | otherwise -> CannotCast+> ) : listCastPairs' ias cas+> listCastPairs' [] [] = []+> listCastPairs' _ _ = error "internal error: mismatched num args in implicit cast algorithm"+>+>+> getBinOp1UnknownMatch :: [ProtArgCast] -> [ProtArgCast]+> getBinOp1UnknownMatch cands =+> if not (isOperatorName f &&+> length inArgs == 2 &&+> count (==UnknownType) inArgs == 1)+> then []+> else let newInArgs =+> replicate 2 (if head inArgs == UnknownType+> then inArgs !! 1+> else head inArgs)+> in filter (\((_,a,_,_),_) -> a == newInArgs) cands+>+> filterPolymorphics :: [ProtArgCast] -> [ProtArgCast]+> filterPolymorphics cl =+> let ms :: [ProtArgCast]+> ms = filter canMatch polys+> polyTypes :: [Maybe Type]+> polyTypes = map resolvePolyType ms+> polyTypePairs :: [(Maybe Type, ProtArgCast)]+> polyTypePairs = zip polyTypes ms+> keepPolyTypePairs :: [(Type, ProtArgCast)]+> keepPolyTypePairs =+> mapMaybe (\(t,p) -> case t of+> Nothing -> Nothing+> Just t' -> Just (t',p))+> polyTypePairs+> finalRows = map (\(t,p) -> instantiatePolyType p t)+> keepPolyTypePairs+> --create the new cast lists+> cps :: [[ArgCastFlavour]]+> cps = map (listCastPairs . getFnArgs . fst) finalRows+> in zip (map fst finalRows) cps+> where+> polys :: [ProtArgCast]+> polys = filter (\((_,a,_,_),_) -> any (`elem`+> -- bit hacky+> [Pseudo Any+> ,Pseudo AnyArray+> ,Pseudo AnyElement+> ,Pseudo AnyEnum+> ,Pseudo AnyNonArray]) a) cl+> canMatch :: ProtArgCast -> Bool+> canMatch pac =+> let ((_,fnArgs,_,_),_) = pac+> in canMatch' inArgs fnArgs+> where+> canMatch' [] [] = True+> canMatch' (ia:ias) (pa:pas) =+> case pa of+> Pseudo Any -> nextMatch+> Pseudo AnyArray -> isArrayType ia && nextMatch+> Pseudo AnyElement -> nextMatch+> Pseudo AnyEnum -> False+> Pseudo AnyNonArray -> if isArrayType ia+> then False+> else nextMatch+> _ -> True+> where+> nextMatch = canMatch' ias pas+> canMatch' _ _ = error "internal error: mismatched lists in canMatch'"+> resolvePolyType :: ProtArgCast -> Maybe Type+> resolvePolyType ((_,fnArgs,_,_),_) =+> {-trace ("\nresolving " ++ show fnArgs ++ " against " ++ show inArgs ++ "\n") $-}+> let argPairs = zip inArgs fnArgs+> typeList :: [Type]+> typeList = catMaybes $ flip map argPairs+> $ \(ia,fa) -> case fa of+> Pseudo Any -> if isArrayType ia+> then either (const Nothing) Just $ unwrapArray ia+> else Just ia+> Pseudo AnyArray -> either (const Nothing) Just $ unwrapArray ia+> Pseudo AnyElement -> if isArrayType ia+> then either (const Nothing) Just $ unwrapArray ia+> else Just ia+> Pseudo AnyEnum -> Nothing+> Pseudo AnyNonArray -> Just ia+> _ -> Nothing+> in {-trace ("\nresolve types: " ++ show typeList ++ "\n") $-}+> case resolveResultSetType cat typeList of+> Left _ -> Nothing+> Right t -> Just t+> instantiatePolyType :: ProtArgCast -> Type -> ProtArgCast+> instantiatePolyType pac t =+> let ((fn,a,r,v),_) = pac+> instArgs = swapPolys t a+> p1 = (fn, instArgs, swapPoly t r,v)+> in let x = (p1,listCastPairs instArgs)+> in {-trace ("\nfixed:" ++ show x ++ "\n")-} x+> where+> swapPolys :: Type -> [Type] -> [Type]+> swapPolys = map . swapPoly+> swapPoly :: Type -> Type -> Type+> swapPoly pit at =+> case at of+> Pseudo Any -> if isArrayType at+> then ArrayType pit+> else pit+> Pseudo AnyArray -> ArrayType pit+> Pseudo AnyElement -> if isArrayType at+> then ArrayType pit+> else pit+> Pseudo AnyEnum -> pit+> Pseudo AnyNonArray -> pit+> Pseudo (SetOfType (Pseudo AnyElement)) ->+> if isArrayType at+> then Pseudo $ SetOfType (ArrayType pit)+> else Pseudo $ SetOfType pit+> _ -> at+> --merge in the instantiated poly functions, with a twist:+> -- if we already have the exact same set of args in the non poly list+> -- as a poly, then don't include that poly+> mergePolys :: [ProtArgCast] -> [ProtArgCast] -> [ProtArgCast]+> mergePolys orig polys =+> let origArgs = map (\((_,a,_,_),_) -> a) orig+> filteredPolys = filter (\((_,a,_,_),_) -> a `notElem` origArgs) polys+> in orig ++ filteredPolys+>+> countPreferredTypeCasts :: [ProtArgCast] -> [Int]+> countPreferredTypeCasts =+> map (\(_,cp) -> count (==ImplicitToPreferred) cp)+>+> -- Left () is used for inArgs which aren't unknown,+> -- and for unknowns which we don't have a+> -- unique category+> -- Right s -> s is the single letter category at+> -- that position+> getCastCategoriesForUnknowns :: [ProtArgCast] -> [Either () Text]+> getCastCategoriesForUnknowns cands =+> filterArgN 0+> where+> candArgLists :: [[Type]]+> candArgLists = map (\((_,a,_,_), _) -> a) cands+> filterArgN :: Int -> [Either () Text]+> filterArgN n =+> if n == length inArgs+> then []+> else let targType = inArgs !! n+> in ((if targType /= UnknownType+> then Left ()+> else getCandsCatAt n) : filterArgN (n+1))+> where+> getCandsCatAt :: Int -> Either () Text+> getCandsCatAt n' =+> let typesAtN = map (!!n') candArgLists+> catsAtN = map (either (error . show) id . catTypeCategory cat) typesAtN+> in case () of+> --if any are string choose string+> _ | "S" `elem` catsAtN -> Right "S"+> -- if all are same cat choose that+> | all (== head catsAtN) catsAtN -> Right $ head catsAtN+> -- otherwise no match, this will be+> -- picked up as complete failure to match+> -- later on+> | otherwise -> Left ()+>+> getCandCatMatches :: [ProtArgCast] -> [Either () Text] -> [ProtArgCast]+> getCandCatMatches candsA cats = getMatches candsA 0+> where+> getMatches :: [ProtArgCast] -> Int -> [ProtArgCast]+> getMatches cands n =+> case () of+> _ | n == length inArgs -> cands+> | (inArgs !! n) /= UnknownType -> getMatches cands (n + 1)+> | otherwise ->+> let catMatches :: [ProtArgCast]+> catMatches = filter (\c -> Right (getCatForArgN n c) ==+> (cats !! n)) cands+> prefMatches :: [ProtArgCast]+> prefMatches = filter (either (error . show) id . catPreferredType cat .+> getTypeForArgN n) catMatches+> keepMatches :: [ProtArgCast]+> keepMatches = if length prefMatches > 0+> then prefMatches+> else catMatches+> in getMatches keepMatches (n + 1)+> getTypeForArgN :: Int -> ProtArgCast -> Type+> getTypeForArgN n ((_,a,_,_),_) = a !! n+> getCatForArgN :: Int -> ProtArgCast -> Text+> getCatForArgN n = either (error . show) id . catTypeCategory cat . getTypeForArgN n+>+> -- utils+> -- filter a candidate/cast flavours pair by a predicate on each+> -- individual cast flavour+> filterCandCastPairs :: ([ArgCastFlavour] -> Bool)+> -> [ProtArgCast]+> -> [ProtArgCast]+> filterCandCastPairs predi = filter (\(_,cp) -> predi cp)+>+> getFnArgs :: OperatorPrototype -> [Type]+> getFnArgs (_,a,_,_) = a+> returnIfOnne [] e = Left e+> returnIfOnne (l:ls) e = if length l == 1+> then Right $ getHeadFn l+> else returnIfOnne ls e+>+> getHeadFn :: [ProtArgCast] -> OperatorPrototype+> getHeadFn l = let ((hdFn, _):_) = l+> in hdFn+> none p = not . any p+> count p = length . filter p+>+> data ArgCastFlavour = ExactMatch+> | CannotCast+> | ImplicitToPreferred+> | ImplicitToNonPreferred+> deriving (Eq,Show)+>++~~~~+resolveResultSetType -+partially implement the typing of results sets where the types aren't+all the same and not unknown+used in union,except,intersect columns, case, array ctor, values, greatest and least++algo:+if all inputs are same and not unknown -> that type+replace domains with base types+if all inputs are unknown then text+if the non unknown types aren't all in same category then fail+choose first input type that is a preferred type if there is one+choose last non unknown type that has implicit casts from all preceding inputs+check all can convert to selected type else fail++code is not as much of a mess as findCallMatch+~~~~++> resolveResultSetTypeExtra:: Catalog -> [TypeExtra] -> Either [TypeError] TypeExtra+> resolveResultSetTypeExtra cat inArgs+> = liftM addPrecAndNull $ resolveResultSetType cat $ map teType inArgs+> where+> addPrecAndNull t = if null inArgs+> then mkTypeExtra t+> else TypeExtra t (prec t) scale nullability+> nullability = joinNullability $ map teNullable inArgs+> prec t = joinPrecision $ adjustStringCastPrec t inArgs+> scale = joinScale $ map teScale inArgs++> adjustStringCastPrec:: Type -> [TypeExtra] -> [Maybe Int]+> adjustStringCastPrec tTo = map $ uncurry adjust . (teType&&&tePrecision)+> where+> stringTypes = map ScalarType ["char","varchar","nvarchar","text"]+> adjust tFrom precFrom = msum [guard (tTo `elem` stringTypes) >> lookup tFrom typePrecs+> -- if there will be problems with literals, add here+> -- a treatment for UnknownType+> ,precFrom]+> typePrecs = map (first ScalarType) [("bool",1)+> ,("int1",4), ("int2",6), ("int4",12), ("int8",24)+> ,("float4",23), ("float8",23)+> ,("date",40), ("timestamp",40)]++> resolveResultSetType :: Catalog -> [Type] -> Either [TypeError] Type+> resolveResultSetType cat inArgs = do+> when (null inArgs) $ Left [TypelessEmptyArray]+> if allSameType then return (head inArgs) else do+> if allSameBaseType then return (head inArgsBase) else do+> --returnWhen allUnknown (UnknownType) $ do+> unless allSameCat $ Left [IncompatibleTypeSet inArgs]+> if isJust targetType+> && allConvertibleToFrom (fromMaybe (error "TypeConversion.resolveresultsettype 1: fromJust") targetType) inArgs+> then return (fromMaybe (error "TypeConversion.resolveresultsettype 2: fromJust") targetType)+> else Left [IncompatibleTypeSet inArgs]+> where+> allSameType = all (== head inArgs) inArgs -- &&+> --head inArgs /= UnknownType+> allSameBaseType = all (== head inArgsBase) inArgsBase &&+> head inArgsBase /= UnknownType+> inArgsBase = map (replaceWithBase cat) inArgs+> --allUnknown = all (==UnknownType) inArgsBase+> allSameCat = let firstCat = catTypeCategory cat (head knownTypes)+> in all (\t -> catTypeCategory cat t == firstCat)+> knownTypes+> targetType = case catMaybes [firstPreferred, lastAllConvertibleTo] of+> [] -> Nothing+> (x:_) -> Just x+> firstPreferred = find (either (error . show) id . catPreferredType cat) knownTypes+> lastAllConvertibleTo = firstAllConvertibleTo (reverse knownTypes)+> firstAllConvertibleTo (x:xs) = if allConvertibleToFrom x xs+> then Just x+> else firstAllConvertibleTo xs+> firstAllConvertibleTo [] = Nothing+> knownTypes = filter (/=UnknownType) inArgsBase+> allConvertibleToFrom = all . flip (castableFromTo cat ImplicitCastContext)++todo:+cast empty array, where else can an empty array work?++--------------------++join (in Order Theory terms) of precision, scale, and nullability++> joinNullability:: [Bool] -> Bool+> joinNullability = or+> -- questionable logic; to be revisited+> joinPrecision:: [Maybe Int] -> Maybe Int+> joinPrecision ps = if null ps' then Nothing else Just $ maximum ps'+> where+> ps' = catMaybes ps+> -- same thing for now+> joinScale:: [Maybe Int] -> Maybe Int+> joinScale = joinPrecision++================================================================================++= checkAssignmentValue++> checkAssignmentValid :: Catalog -> Type -> Type -> Either [TypeError] ()+> checkAssignmentValid cat from to =+> if castableFromTo cat AssignmentCastContext from to+> then Right ()+> else Left [IncompatibleTypes to from]+>+> compositesCompatible :: Catalog -> Type -> Type -> Bool+> compositesCompatible cat =+> castableFromTo cat ImplicitCastContext++> checkAssignmentsValid :: Catalog -> [Type] -> [Type] -> Either [TypeError] ()+> checkAssignmentsValid cat from to = do+> -- special case for assigning to composite+> let f = case to of+> [t] | isCompositeType t -> [AnonymousCompositeType from]+> _ -> from+> when (length f /= length to) $ Left [WrongNumberOfColumns]+> let ls = concat $ lefts $ zipWith (checkAssignmentValid cat) f to+> unless (null ls) $ Left ls+++================================================================================++= castable function++wrapper around the catalog to add a bunch of extra valid casts++> castableFromTo :: Catalog -> CastContext -> Type -> Type -> Bool+> castableFromTo cat cc from to =+> --trace ("check cast " ++ show from ++ "->" ++ show to) $+> -- put this here to avoid having to write it everywhere else+> from == to+> -- unknown can be implicitly cast to anything (is this completely true?)+> || from == UnknownType+> --hack?+> || to == UnknownType+> -- check base types of domains+> || ((isDomainType from || isDomainType to)+> && castableFromTo cat cc (replaceWithBase cat from)+> (replaceWithBase cat to))+> -- check the casts listed in the catalog+> || either (error . show) id (catCast cat cc from to)+> -- implicitcast => assignment cast+> || (cc == AssignmentCastContext+> && either (error . show) id (catCast cat ImplicitCastContext from to))+> -- can assign composite to record+> || (cc == AssignmentCastContext+> && isCompOrSetoOfComp from+> && case to of+> Pseudo (Record _) -> True+> _ -> False)+> -- check unboxing: wrapped single attribute+> || recurseTransFrom (unboxedSingleType from)+> || recurseTransTo (unboxedSingleType to)+> -- check unboxing: wrapped composite+> || recurseTransFrom (unboxedSetOfType from)+> || recurseTransTo (unboxedSetOfType to)+> -- check composites compatible by comparing attribute types+> || case (getCompositeTypes from+> ,getCompositeTypes to) of+> -- zip almost does the right thing here, needs a bit of tweaking+> (Just ft, Just tt) | length ft == length tt -> all (uncurry $ castableFromTo cat cc) $ zip ft tt+> _ -> False+> where+>+> getCompositeTypes (NamedCompositeType n) =+> Just $ map (teType . snd) $ either (const []) id $ catCompositePublicAttrs cat [] n+> getCompositeTypes (CompositeType t) = Just $ map (teType . snd) t+> getCompositeTypes (AnonymousCompositeType t) = Just t+> getCompositeTypes (Pseudo (Record Nothing)) = Nothing+> getCompositeTypes (Pseudo (Record (Just t))) = getCompositeTypes t+> getCompositeTypes _ = Nothing+>+> isCompOrSetoOfComp (Pseudo (SetOfType c)) = isCompositeType c+> isCompOrSetoOfComp c = isCompositeType c+>+> unboxedSingleType (Pseudo (SetOfType (CompositeType [(_,t)]))) = Just $ teType t+> unboxedSingleType (Pseudo (Record (Just t))) = unboxedSingleType t+> unboxedSingleType _ = Nothing+>+> unboxedSetOfType (Pseudo (SetOfType a)) = Just a+> unboxedSetOfType (Pseudo (Record (Just t))) = unboxedSetOfType t+> unboxedSetOfType _ = Nothing+>+> recurseTransFrom = maybe False (flip (castableFromTo cat cc) to)+> recurseTransTo = maybe False (castableFromTo cat cc from)+>+> replaceWithBase :: Catalog -> Type -> Type+> replaceWithBase cat t@(DomainType _) = either (error . show) id $ catDomainBaseType cat t+> replaceWithBase _ t = t
+ src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/SqlTypeConversion.lhs view
@@ -0,0 +1,77 @@++Code for the sql server type conversion rules (and implicit/explicit+casting)++The plan is to follow the same functions as postgresql support for now:++findCallMatch+resolveResultSetType+checkAssignmentValid++The rules in sql server for implicit casting and function resolution+are quite different to postgresql. The biggest one is that e.g. select+cast(1 as int) + cast('2' as varchar(20)) works in sql server but not+in postgresql.+++just hack for operators for now: if one argument is a number type, and+the other is a text type, then cast the text to number.++> {-# LANGUAGE PatternGuards,OverloadedStrings #-}+> module Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.SqlTypeConversion (+> findCallMatch+> ) where+>+> --import Data.Maybe+> --import Data.List+> --import Data.Either+> --import Debug.Trace+> --import Data.Char+> --import Control.Monad+>+> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Utils.Utils+> --import Database.HsSqlPpp.Internals.TypeChecking.OldTediousTypeUtils+> import qualified Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.OldTypeConversion as T+> import Data.Text (Text)++> findCallMatch :: Dialect -> Catalog -> Text -> [Type] -> Either [TypeError] OperatorPrototype+> findCallMatch d cat fnName argsType =+> case argsType of+> [_a,_b] | Just x <- checkOperator d cat fnName argsType -> Right x+> _ -> T.findCallMatch d cat fnName argsType++hack to allow implicit casting one of the args to a numeric operator+from a text type to the correct numeric type:++check is an operator+check on arg is numeric, the other text+match an exact operator itself with two args the same numeric type+- in this case, cast the text arg to the numeric type and return a match+++> checkOperator :: Dialect -> Catalog -> Text -> [Type] -> Maybe OperatorPrototype+> checkOperator d cat fnName [a,b] | Just t <- ty a b =+> -- have the argument type in t+> -- find all the matching fns by name+> let nm = catLookupFns cat fnName+> -- keep the ones which have exactly two args with the+> -- type t, only proceed if there is onne match+> cands = filter (\(_,as,_,_) -> as == [t,t]) nm+> in case cands of+> [c] -> return c+> _ -> Nothing+> where+> ty a' b' | isNumber a' && isText b' = Just a'+> ty a' b' | isText a' && isNumber b' = Just b'+> ty _ _ = Nothing+> isNumber x =+> x `elem` (map ScalarType $ diNumberTypes d)+> --isNumber _ = False+> isText x =+> x `elem` (map ScalarType $ diTextTypes d)+> --isText _ = False+> checkOperator _ _ _ _ = Nothing
+ src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/TypeConversion.lhs view
@@ -0,0 +1,662 @@+++This file contains the functions for resolving types and+function/operator resolution (which is seriously crazy). See the pg+manual chapter 10:++http://www.postgresql.org/docs/8.4/interactive/typeconv.html++sql server todo: want to match sql server implicit cast rules better+when doing tsql type checking. Follows a completely different approach, possible info here:+http://msdn.microsoft.com/en-us/library/ms187928.aspx+http://msdn.microsoft.com/en-us/library/ms190309.aspx+linked from here:+http://blogs.msdn.com/b/craigfr/archive/2010/01/20/more-on-implicit-conversions.aspx+++TODO: rewrite+Wrappers to zap:++tcAppLike+matchApp+matchAppExtra+resolveResultSetType+resolveResultSetTypeExtra+findcallmatch+resolveresultsettype+checkassignments++We should have one function for each of the resolvers (3 just like+postgres) all the nullability, precision, dialect and special hacks+should all be in one place.++> {-# LANGUAGE OverloadedStrings, TupleSections, MultiWayIf,FlexibleInstances,ScopedTypeVariables #-}+> module Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion+> (matchApp+> ,matchAppExtra+> ,tcAppLike+> ,resolveResultSetType+> ,resolveResultSetTypeExtra+> ,checkAssignmentValid+> ,MatchAppLiteralList -- (..)+> ) where+>+> import Data.Maybe+> import Data.List+> import Data.Either+> import Data.Char+>+> import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> import Database.HsSqlPpp.Internals.Utils+> import Control.Monad+> import Control.Applicative+> import Control.Arrow++> import Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.OldTypeConversion+> import Database.HsSqlPpp.Internals.Dialect+> import qualified Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.SqlTypeConversion as TSQL+> import Data.Text ()+> import qualified Data.Text as T+> import Text.Printf+> --import Debug.Trace++******************************************************************++matchApp: takes the function name and argument types, and returns the+matching operator/function++This needs a lot more tests++> type MatchAppLiteralList = [Maybe Int]++> matchApp :: Dialect+> -> Catalog+> -> [NameComponent]+> -> [Type]+> -> Either [TypeError] ([Type],Type)+> matchApp d cat nmcs =+> ambiguityResolver $ matchApp' d nmcs+> where+> -- matchApp' a b c | trace (show (a,b,c)) False = undefined+> -- hack in support for sql server datediff function+> -- need to think of a better way to handle this when+> -- have a better idea of all the weird syntax used in+> -- tsql+> -- this is a todo since currently the sql server dialect uses+> -- postgresql type names, and this is about to be fixed+> matchApp' (Dialect {diSyntaxFlavour = SqlServer})+> [Nmc dd] [_+> ,ScalarType "date"+> ,ScalarType "date"]+> | map toLower dd == "datediff" =+> -- check there are 3 args+> -- first is identifier from list+> -- other two are date types+> Right ([ScalarType "int4",ScalarType "date",ScalarType "date"], ScalarType "int4")+> matchApp' (Dialect {diSyntaxFlavour = SqlServer}) [Nmc dd] [_,ScalarType "date"]+> | map toLower dd == "datepart" =+> Right ([ScalarType "int4",ScalarType "date"], ScalarType "int4")++> matchApp' (Dialect {diSyntaxFlavour = SqlServer}) [Nmc dd] [_,ScalarType "timestamp"]+> | map toLower dd == "datepart" =+> Right ([ScalarType "int4",(ScalarType "timestamp")], ScalarType "int4")+++> matchApp' (Dialect {diSyntaxFlavour = SqlServer}) [Nmc dd] [_,_,ScalarType "date"]+> | map toLower dd == "dateadd" =+> Right ([ScalarType "int4",ScalarType "int4",ScalarType "date"], ScalarType "date")++> matchApp' (Dialect {diSyntaxFlavour = SqlServer}) [Nmc dd] [_,_,ScalarType "timestamp"]+> | map toLower dd == "dateadd" =+> Right ([ScalarType "int4",ScalarType "int4",ScalarType "timestamp"], ScalarType "timestamp")++double hack: support oracle decode when in tsql mode:++> matchApp' (Dialect {diSyntaxFlavour = SqlServer}) [Nmc dd] as+> | map toLower dd == "decode" =++decode is just syntax for simple case statement:+demand at least 3 arguments+get the type of the first argument: this is the test target++> case as of+> (tt:as'@(_:_:_)) -> do++for each pair of arguments following: check the first+one can be compared to the test target++collect all the second types+if there is a single trailing argument this is the else++> let checkBranches [] acc = return $ reverse acc+> checkBranches [els] acc = return $ reverse (els:acc)+> checkBranches (w:t:xs) acc = do+> _ <- matchApp' d [Nmc "="] [tt,w]+> checkBranches xs (t:acc)+> sndTypes <- checkBranches as' []++check the seconds types + the else for type compatilibility+return this type+todo: add the implicit casting where needed++> (as,) <$> resolveResultSetType cat sndTypes+++> _ -> Left [NoMatchingOperator (T.pack dd) as]++++> matchApp' d' nmcs' pts = {-trace ("matchapp: " ++ show (d,nmcs,pts)) $ -} do+> (_,ps,r,_) <- case d' of+> (Dialect {diSyntaxFlavour = SqlServer}) -> TSQL.findCallMatch d' cat nm pts+> _ -> findCallMatch d' cat nm pts+> return (ps,r)+> where+> nm = case last nmcs' of+> Nmc n -> T.pack $ map toLower n+> QNmc n -> T.pack n+> AntiNameComponent _ -> -- todo: use left instead of error+> error "tried to find function matching an antinamecomponent"++hack to support literal arguments to overloaded functions+ currently, the problem arises only for date/datetime arguments+ the solution reflects this+for long argument lists with several literals, there can be a lot of variants generated, but+ this shouldn't slow down the execution because lazyness composes well with the functions used++> ambiguityResolver:: ([Type] -> Either [TypeError] ([Type],Type))+> -> [Type] -> Either [TypeError] ([Type],Type)+> ambiguityResolver f ts = let rs :: [Either [TypeError] ([Type], Type)]+> rs = map f $ expandList variants ts+> -- this is needed in order to preserve the original error+> -- in case when all the attempts fail+> in case rights rs of+> x:_ -> Right x+> [] -> head rs+> where+> variants t = case t of+> UnknownType -> [t, ScalarType "timestamp"]+> _ -> [t]+> -- similar to handling of superaggregates+> -- ToDo: move to a general library+> expandList:: (a -> [a]) -> [a] -> [[a]]+> expandList f' = foldr (liftM2 (:) . f') [[]]++------------- precision and nullability of function application --------------++uses matchApp for inferring basic types++> matchAppExtra :: Dialect+> -> Catalog+> -> [NameComponent]+> -> MatchAppLiteralList+> -> [TypeExtra]+> -> Either [TypeError] ([TypeExtra],TypeExtra)+> matchAppExtra dialect cat nmcs lits tes = {-trace ("mae" ++ show (nmcs,tes)) $ -} do+> (ts',t') <- matchApp dialect cat nmcs $ map teType tes+> tes' <- joinArgsExtra appName tes $ zipWith addArgExtra tes ts'+> return (tes', addResultExtra appName tes' t' lits)+> where+> addArgExtra te t = te {teType = t}+> appName = case nmcs of+> [Nmc dd] -> map toLower dd+> _ -> ""++precision and nullability of the result++> addResultExtra:: String -> [TypeExtra] -> Type -> MatchAppLiteralList -> TypeExtra+> addResultExtra appName tes t lits = checkPrecisionRelevance . checkResultPrecisionClass tesr+> $ TypeExtra t jp js jn+> where+> jp = if+> | appName == "||" -> Just $ sum $ mapMaybe tePrecision tesr+> | appName == "substring" ->+> -- Substring is an interesting case. If we have both the+> -- start and length as literals, we can figure out the resulting precision+> -- Otherwise, treat as before with joinPrecision+> let totalLen = joinPrecision $ map tePrecision tesr+> in case (map teType tesr) of+> [ScalarType "nvarchar"] -> totalLen+> _ ->+> case lits of+> (Nothing:(Just startPos):(Just len):_) -> do+> totalLen' <- totalLen+> return $ if startPos + len > totalLen' then totalLen' - startPos else len+> _ -> totalLen++> -- precision of the result is unknown+> | appName `elem` ["replace"] -- is actually known for 2-argument "replace"+> -> Nothing+> | otherwise+> -> joinPrecision $ map tePrecision tesr+> js = joinScale $ map teScale tesr+> jn = if+> | appName `elem`+> ( ["isnotnull","isdate","isnumeric"]+> -- standard "is null" expression+> ++ ["isnull" | length tes == 1]+> -- currently, aggregate functions are handled as scalar functions+> ++ ["count","count_big"])+> -> False+> | appName `elem`+> ( ["coalesce","greatest","least"]+> -- 2-argument function "isnull" of SqlServer+> -- ImplicitCastToDo: isnull has quite complex cast rules,+> -- not really reflected here and in the cast of arguments+> ++ ["isnull" | length tes == 2]+> -- nullability of corresponding SqlServer function "charindex"+> -- may or may not differ, depending on database compatibility level+> -- I implement the level above 70, so it goes to the default case+> ++ ["strpos","position"])+> -> all teNullable tesr+> -- can produce null independently on the nullability of the arguments+> -- ImplicitCastToDo: check again: doesn't it depend on the presence of "else" part+> | appName `elem` ["case","decode","nullif","replicate"]+> -> True+> -- the default+> | appName `elem` ["substr","substring"] -> any teNullable tes+> | otherwise -> joinNullability $ map teNullable tesr+> -- arguments that participate in the inference of the result type+> tesr = case appName of+> "decode" -> caseResultTypes tes+> -- only the first argument influences precision and nullability+> _ | appName `elem` ["nullif","substr","substring","left","right","ltrim","rtrim","replicate","translate","like","notlike","rlike"]+> -> take 1 tes+> -- the first two arguments influence+> | appName `elem` ["charindex"]+> -> take 2 tes+> -- the first argument doesn't influence+> | appName `elem` ["datepart","datediff"]+> -> drop 1 tes+> -- the first two arguments don't influence+> | appName `elem` ["dateadd"]+> -> drop 2 tes+> -- the default case+> | otherwise -> tes+> -- tail is safe here because matchApp did all the checks+> caseResultTypes tes' = caseResultTypes' (tail tes') []+> where+> caseResultTypes' [] acc = acc+> caseResultTypes' [els] acc = els:acc+> caseResultTypes' (_:t':xs) acc = caseResultTypes' xs (t':acc)++------------- cast of arguments --------------++Bring relevant arguments of a function to common precision and nullability.+The meaning of "relevant" is complicated:+ - the list of arguments is split into partitions;+ - precision and nullability is partition-wise joined;+ - the results are broadcast back to the arguments that constituted partitions.+The algorithm follows this outline.+Examples:+ - for binary operators, like "=", both arguments constitute a single partition;+ - for some functions, like "substr", each argument belongs to its own partition;+ - arguments of "case" and "decode" form two partitions which, except for the analyzed value+ and the 'else' argument, are intervened with one another.+Actually, partitions for precision and partitions for nullability can be different.+Example:+ "||": both arguments must be brought to common nullability, but remain with same precision.+Additionaly:+ Before splitting onto partitions, check each argument for:+ - precision class of the original (before matchApp) argument;+ - precision relevance.+ After splitting onto partitions, check each precision partition:+ - all arguments must have same precision class (return an error if they don't).++What the is this function doing? What is it for?++> joinArgsExtra:: String -> [TypeExtra] -> [TypeExtra] -> Either [TypeError] [TypeExtra]+> joinArgsExtra "!odbc-left" _t0 t1 = Right t1+> joinArgsExtra "!odbc-timestampdiff" _t0 t1 = Right t1+> joinArgsExtra "!odbc-timestampadd" _t0 t1 = Right t1++> joinArgsExtra appName tes0 tes1+> = liftM (uncurry $ zipWith3 combine tes) $ uncurry (liftM2 (,))+> $ (joinDim joinPrec partitionPrec &&& joinDim joinNull partitionNull) tes+> where+> -- checks and adjustments before partitioning+> tes = map checkPrecisionRelevance+> $ zipWith adjust tes0+> $ zipWith checkPrecisionClass tes0 tes1+> where+> adjust te0 te1 = te1{tePrecision = head $ adjustStringCastPrec (teType te1) [te0]}+> -- checks after partitioning+> checkPartition ptes = if length (nub ppcs) > 1+> then Left [InternalError $ printf "implicit cast: arguments of '%s' that belong to same partition are of different precision classes: %s -> %s" appName (show ptes) (show ppcs)]+> else return ptes+> where+> ppcs = map (precisionClass . teType) ptes+> -- the algorithm for a single partitioning dimension+> joinDim:: ([TypeExtra] -> [TypeExtra])+> -> ([TypeExtra] -> Either [TypeError]+> ([[TypeExtra]] -> [TypeExtra], [[TypeExtra]]))+> -> [TypeExtra] -> Either [TypeError] [TypeExtra]+> joinDim join' partitionArgs'+> = liftM (uncurry ($) . second (map join')) . partitionArgs'+> -- combine results for precision and nullability+> combine te tePrec teNull = te {+> tePrecision = tePrecision tePrec,+> teScale = teScale tePrec,+> teNullable = teNullable teNull+> }+> -- joins of precision and nullability partitions+> joinPrec tes' = map promote tes'+> where+> promote (TypeExtra t p s n) = TypeExtra t (p' `mplus` p) (s' `mplus` s) n+> p' = joinPrecision $ map tePrecision tes+> s' = joinScale $ map teScale tes+> joinNull tes' = map promote tes'+> where+> promote (TypeExtra t p s n) = TypeExtra t p s (n' || n)+> n' = joinNullability $ map teNullable tes+> -- the partitioning functions return partitions paired with a function+> -- that puts them back into their places+> -- because, in many cases, partitions for precision and for nullability are the same,+> -- the partitioning code for such cases is factored out+> partitionArgs:: [a] -> ([[a]] -> [a], [[a]])+> partitionArgs as = case () of+> -- functions whose arguments are independent+> -- instead of splitting into partitions, just return the original list+> _ | appName `elem`+> ( ["datepart","dateadd"]+> ++ ["substr","substring","left","right","ltrim","rtrim"]+> ++ ["replicate","like","notlike","rlike"]+> ++ ["strpos","position","replace"]+> -- Oracle joins the datatypes (needed for the comparison)+> ++ ["nullif"]+> -- SQream specific regex functions+> ++ ["regexp_substr","regexp_count","regexp_instr"]+> ++ ["string_agg"]+> )+> -> (const as, [])+> -- first argument is special, the rest are processed together+> | appName `elem` ["datediff"]+> -> (concat, pairToList $ splitAt 1 as)+> | appName `elem` ["decode"]+> -> let (ws,ts) = decomposeDecodeTail (tail as) ([],[])+> in (composeDecodePartitions, [head as :ws, ts])+> -- the default is to return a single partition+> | otherwise -> (concat, [as])+> partitionPrec as = secondM (mapM checkPartition) $ case () of+> -- independent arguments+> _ | appName `elem` ["||","concat","translate","charindex"]+> -> (const as, [])+> -- single partition+> | appName `elem`+> ( ["coalesce","greatest","least"]+> -- ImplicitCastToDo: think how to handle this properly+> ++ ["isnull" | length as == 2]+> )+> -> (concat, [as])+> | otherwise -> partitionArgs as+> partitionNull as = return $ case () of+> _ | appName `elem`+> ( ["coalesce","greatest","least"]+> ++ ["isnull" | length as == 2]+> )+> -> (const as, [])+> | appName `elem` ["charindex"]+> -> (concat, pairToList $ splitAt 2 as)+> | otherwise -> partitionArgs as+> -- utility+> pairToList (x,y) = [x,y]+> decomposeDecodeTail [] acc = (reverse***reverse) acc+> decomposeDecodeTail [els] acc = (reverse.(els:)***reverse) acc+> decomposeDecodeTail (w:t:xs) acc = decomposeDecodeTail xs $ ((w:)***(t:)) acc+> composeDecodePartitions [t:ts,ws] = t : concat (transpose [ts,ws])+> -- redundant+> composeDecodePartitions xs = concat xs++------------- precision class --------------++This is a small library for checking whether inference of precision does make sense.+It is used both in inference of precision of arguments and result of a function.++It is theoretically possible that types belong to different precision classes,+ but inference of precision still makes sense (consider, for instance,+ conversion between string and decimal).+ Such cases must be handled specially.++> data PrecisionClass = String | Number | FlexiblePrecisionClass+> deriving (Eq,Show)+>+> precisionClass:: Type -> Maybe PrecisionClass+> precisionClass (ScalarType tn)+> | tn `elem` ["text","varchar","nvarchar","char"] = Just String+> | tn `elem` ["int1","int2","int4","int8","float4","float8","numeric"] = Just Number+> | otherwise = Nothing+> precisionClass UnknownType = Just FlexiblePrecisionClass+> precisionClass _ = Nothing++Do original and new type have compatible precision classes?+Note: this function is not commutative.++> infix 4 .~>.+> (.~>.):: TypeExtra -> TypeExtra -> Bool+> t0 .~>. t = Just FlexiblePrecisionClass `elem` [pc0,pc] || pc0 == pc+> where+> [pc0,pc] = map (precisionClass . teType) [t0,t]++retreat to default when original and new type are incompatible++> checkPrecisionClass:: TypeExtra -> TypeExtra -> TypeExtra+> checkPrecisionClass t0 t = if t0 .~>. t then t else t{tePrecision = Nothing, teScale = Nothing}++check precision class of result against precision classes of arguments++> checkResultPrecisionClass:: [TypeExtra] -> TypeExtra -> TypeExtra+> checkResultPrecisionClass tes t+> = if and $ map (.~>. t) tes then t else t{tePrecision = Nothing, teScale = Nothing}++check whether precision/scale is relevant for a type (consider "round").++> checkPrecisionRelevance:: TypeExtra -> TypeExtra+> checkPrecisionRelevance te = if+> | Just String <- pc+> -> te{teScale = Nothing}+> | Just FlexiblePrecisionClass <- pc+> -> te+> | ScalarType tn <- t, tn == "numeric"+> -> te+> | otherwise+> -> te{tePrecision = Nothing, teScale = Nothing}+> where+> t = teType te+> pc = precisionClass t+++The purpose of the tcapplike wrapper is to partially fix up the+keyword 'enums' in some of the ms style functions (like+datepart). This is a horrible hack and will be fixed.++> tcAppLike :: Dialect -> Catalog -> [NameComponent]+> -> [Maybe Int] -> [Maybe TypeExtra]+> -> Either [TypeError] ([TypeExtra],TypeExtra)++> tcAppLike d cat anm@[Nmc dd] lits [_,a0,a1]+> | map toLower dd == "datediff" = do+> -- dodgy hack for datediff+> tys <- mapM (maybe (Left []) Right) [a0,a1]+> typeInt <- ScalarType <$> maybe (Left []) Right+> (ansiTypeNameToDialect d "int")+> let --Name _ ns = anm+> (ats,rt) <- matchAppExtra d cat anm lits (mkTypeExtraNN typeInt : tys)+> return (ats,rt)+> tcAppLike d cat anm@[Nmc dd] lits [_,a0]+> | map toLower dd == "datepart" = do+> tys <- mapM (maybe (Left []) Right) [a0]+> typeInt <- ScalarType <$> maybe (Left []) Right+> (ansiTypeNameToDialect d "int")+> (ats,rt) <- matchAppExtra d cat anm lits (mkTypeExtraNN typeInt : tys)+> return (ats,rt)+> tcAppLike d cat anm@[Nmc dd] lits [_,a0,a1]+> | map toLower dd == "dateadd" = do+> tys <- mapM (maybe (Left []) Right) [a0,a1]+> typeInt <- ScalarType <$> maybe (Left []) Right+> (ansiTypeNameToDialect d "int")+> (ats,rt) <- matchAppExtra d cat anm lits (mkTypeExtraNN typeInt : tys)+> return (ats,rt)++> --tcAppLike d cat anm@(Name _ [Nmc dd]) a b+> -- | trace ("xz: " ++ show (a,b)) False = undefined++> tcAppLike d cat anm@[Nmc dd] _ ts+> | map toLower dd == "!odbc-convert" = do+> (tys :: [TypeExtra]) <- mapM (maybe (Left []) Right) ts+> --let Name _ ns = anm+> (ats,rt) <- matchAppExtra d cat anm [] tys+> return (ats,rt)++> tcAppLike d cat anm@[Nmc dd] _ [_,a0,a1]+> | map toLower dd `elem` ["!odbc-timestampadd","!odbc-timestampdiff"] = do+> tys <- mapM (maybe (Left []) Right) [a0,a1]+> --let Name _ ns = anm+> typeInt <- ScalarType <$> maybe (Left []) Right+> (ansiTypeNameToDialect d "int")+> (ats,rt) <- matchAppExtra d cat anm [] (mkTypeExtraNN typeInt : tys)+> return (ats,rt)++> tcAppLike d cat anm lits teArgs = do+> -- get the types of the arguments+> -- then lookup in TypeConversion.matchAppExtra+> tys <- mapM (maybe (Left []) Right) teArgs+> (ats,rt) <- matchAppExtra d cat anm lits tys+> return (ats,rt)+++******************************************************************++ findCallMatch :: Catalog -> String -> [Type] -> Either [TypeError] OperatorPrototype+ findCallMatch cat fnName' argsType =++code interspersed with text cut and pasted from postgresql manual+10.3. Functions++Function Type Resolution++Select the functions to be considered from the pg_proc system+catalog. If a non-schema-qualified function name was used, the+functions considered are those with the matching name and argument+count that are visible in the current search path (see Section+5.7.3). If a qualified function name was given, only functions in the+specified schema are considered.++[HsSqlPpp doesn't support schema stuff yet, so just get a list of all+the functions with a matching name]++> {-let matchingNames = catGetOpsMatchingName cat nmcs+> exactMatches = filter (\(_,ts,_,_) -> ts == pts) matchingNames+> case exactMatches of+> [(_,tys,rt,_)] -> return (tys, rt)+> [] -> error $ "no matching fn: " ++ show nmcs+> ++ "(" ++ intercalate "," (map show pts) ++ ")"+> _xs -> error "ambiguous"-}++++If the search path finds multiple functions of identical argument+types, only the one appearing earliest in the path is+considered. Functions of different argument types are considered on an+equal footing regardless of search path position.++If a function is declared with a VARIADIC array parameter, and the+call does not use the VARIADIC keyword, then the function is treated+as if the array parameter were replaced by one or more occurrences of+its element type, as needed to match the call. After such expansion+the function might have effective argument types identical to some+non-variadic function. In that case the function appearing earlier in+the search path is used, or if the two functions are in the same+schema, the non-variadic one is preferred.++Functions that have default values for parameters are considered to+match any call that omits zero or more of the defaultable parameter+positions. If more than one such function matches a call, the one+appearing earliest in the search path is used. If there are two or+more such functions in the same schema with identical parameter types+in the non-defaulted positions (which is possible if they have+different sets of defaultable parameters), the system will not be able+to determine which to prefer, and so an "ambiguous function call"+error will result if no better match to the call can be found.++Check for a function accepting exactly the input argument types. If+one exists (there can be only one exact match in the set of functions+considered), use it. (Cases involving unknown will never find a match+at this step.)++If no exact match is found, see if the function call appears to be a+special type conversion request. This happens if the function call has+just one argument and the function name is the same as the (internal)+name of some data type. Furthermore, the function argument must be+either an unknown-type literal, or a type that is binary-coercible to+the named data type, or a type that could be converted to the named+data type by applying that type's I/O functions (that is, the+conversion is either to or from one of the standard string+types). When these conditions are met, the function call is treated as+a form of CAST specification. [1]++Look for the best match.++Discard candidate functions for which the input types do not match and+cannot be converted (using an implicit conversion) to match. unknown+literals are assumed to be convertible to anything for this+purpose. If only one candidate remains, use it; else continue to the+next step.++Run through all candidates and keep those with the most exact matches+on input types. (Domains are considered the same as their base type+for this purpose.) Keep all candidates if none have exact matches. If+only one candidate remains, use it; else continue to the next step.++Run through all candidates and keep those that accept preferred types+(of the input data type's type category) at the most positions where+type conversion will be required. Keep all candidates if none accept+preferred types. If only one candidate remains, use it; else continue+to the next step.++If any input arguments are unknown, check the type categories accepted+at those argument positions by the remaining candidates. At each+position, select the string category if any candidate accepts that+category. (This bias towards string is appropriate since an+unknown-type literal looks like a string.) Otherwise, if all the+remaining candidates accept the same type category, select that+category; otherwise fail because the correct choice cannot be deduced+without more clues. Now discard candidates that do not accept the+selected type category. Furthermore, if any candidate accepts a+preferred type in that category, discard candidates that accept+non-preferred types for that argument.++If only one candidate remains, use it. If no candidate or more than+one candidate remains, then fail.+++++exact match+binop1unknownmatch+polymorphic matches+reachable+mostexactmatches+filteredforpreferred+unknownmatchesbycat++++TODO: do a log monad, which can record the tests and then return this+process along with the resolved function+++--------------------------------+todo:++> {-resolveResultSetType :: Catalog -> [Type] -> Either [TypeError] Type+> resolveResultSetType _cat [] = error "resolveResultSetType: empty type set"+> resolveResultSetType _cat (t:ts) =+> if all (==t) ts+> then Right t+> else Left [IncompatibleTypeSet (t:ts)]-}++todo:++assignmentCheck
+ src/Database/HsSqlPpp/Internals/TypeChecking/TypeConversion/TypeConversion2.lhs view
@@ -0,0 +1,550 @@+++TODO: most of this code will move to the internals type conversion.+rewrite the code to be nice and literate explaining everything++> {-# LANGUAGE OverloadedStrings,LambdaCase,MultiWayIf,PatternGuards #-}+> module Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion2+> (matchApp,LitArg(..)) where++TODO: explicit imports++> import Control.Monad+> --import Control.Applicative+> --import Control.Arrow++> import Data.Text ()+> import qualified Data.Text as T+> import Data.Maybe+> import Data.List+> import Data.Either+> import Data.Char+> import Control.Arrow++> import Text.Show.Pretty+> import Debug.Trace++> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Internals.Catalog.DefaultTemplate1Catalog+> --import Database.HsSqlPpp.Utils.Utils++> -- import Database.HsSqlPpp.Internals.TypeChecking.OldTypeConversion+> import Database.HsSqlPpp.Internals.Dialect+> -- import qualified Database.HsSqlPpp.Internals.TypeChecking.SqlTypeConversion as TSQL+++three kinds of type conversion where we might have to insert implicit+casts:++function overload resolution+result set type resolution+is assignment valid++The arg types take a LitArg since we want to say the result type of e.g.+substring(x from 2 for 3) as varchar(3), but if we get+substring(x from a for b) then we don't know the precision from the+for part (but it can't be bigger than the x)++It also supports stuff like odbc convert whose return type depends on+the identifier in the second parameter.++for the special cases for null and precision, have a map of functions+from the function name to the special case transform function which+modifies the return type. Then can try to isolate the special cases a+little bit -> probably need some other special cases, add hooks and+maps of functions for these too++> data LitArg = NumLitArg String+> | StringLitArg String+> | NullLitArg+> | BooleanLitArg Bool+> deriving (Show,Eq)+> -- todo: add other literals if needed+++> type MyFunType = (CatName, [Type], Type, Bool)++match app matches a function + argument types, and determines (using a+bunch of hacks and special cases) the precision, scale and nullability+of the result type also.++> matchApp :: Dialect+> -> Catalog+> -> [NameComponent]+> -> [(TypeExtra, Maybe LitArg)]+> -> Either [TypeError] ([TypeExtra],TypeExtra)+> matchApp d cat appName argTypes = do+> x <- findMatchingApp d cat appName+> (map (first teType) argTypes)+> return $ fixNP x+> where++todo: fix nulls and precision++precision and scale:++default is to match the precision and scale of any matching input args+or to choose the default for that type++for nulls: default is to assume function produces nullable if any+input args are nullable, and doesn't produce nullable otherwise++> fixNP :: MyFunType -> ([TypeExtra],TypeExtra)+> fixNP (_,ts,r,_) =+> let anyInputsNull = isJust $ find (teNullable . fst) argTypes+> -- copy nullability of input types+> carryNulls = zipWith (\(a,_) b -> lt b $ teNullable a)+> argTypes ts+> in (carryNulls, lt r anyInputsNull)+> lt ty n = TypeExtra ty Nothing Nothing n+++find matching app is the code which matches a function prototype to a+list of input argument types, dealing with implicit casts and+overloaded functions. It is based on the algorithm in postgresql.++> findMatchingApp :: Dialect+> -> Catalog+> -> [NameComponent]+> -> [(Type, Maybe LitArg)]+> -> Either [TypeError] (CatName,[Type],Type,Bool)+> findMatchingApp _d cat appName argTypes =+> (\case+> -- represents a short cut error+> Left (Left e) -> Left e+> -- represents a short cut valid result+> Left (Right r) -> Right r+> -- represents a normal result at the end+> Right r -> Right r) $ do+> let++1. get all the candidates - matching by name+++todo: variadic stuff, default stuff+todo: if there are multiple matches with different schemas+ only keep the matches in the first schema in the search path++todo: deal with case and with schemas++todo: polymorphic++> nameMatches :: [MyFunType]+> nameMatches = catLookupFns cat appName'+> -- create a map from arg types to prototype+> nameMatchMap :: [([Type], MyFunType)]+> nameMatchMap = map (\v@(_,as,_,_) -> (as,v)) nameMatches+> -- the raw input types to match against+> rawArgTypes = map fst argTypes++2. if there is one candidate with the exact args - choose it++> exactMatches :: [MyFunType]+> exactMatches = map snd $ flip filter nameMatchMap+> ((==rawArgTypes) . fst)++if this is a binary operator, and one of the types is unknown and the+other is known, and there is onne exact match if the unknown is made+to match the known type, then select it++> oneKnown = case rawArgTypes of+> [UnknownType,UnknownType] -> Nothing+> [UnknownType,t] -> Just t+> [t,UnknownType] -> Just t+> _ -> Nothing+> binaryOpKnownUnknownMatches :: [MyFunType]+> binaryOpKnownUnknownMatches =+> case () of+> _ | isOperatorName appName'+> , Just t <- oneKnown+> -> map snd $ flip filter nameMatchMap+> ((==[t,t]) . fst)+> | otherwise -> []++2.5 check for type conversion function?: function name is name of type+ only has one argument, this type is unknown or castable to target++> typeConversionMatch :: [MyFunType]+> typeConversionMatch = case (appName', rawArgTypes) of+> _ -> [] -- todo++3. discard candidates which cannot be reached by implicit casts+ convert domains to base types+ keep only candidates which have the most exact matches+ if one: use it+ if none: still consider them all++> reachableViaImplicitCasts :: [MyFunType]+> reachableViaImplicitCasts =+> let candReachableViaImplicitCasts as =+> length rawArgTypes == length as+> && and (zipWith canImplicitCastOrSame rawArgTypes as)+> in map snd $ flip filter nameMatchMap+> (candReachableViaImplicitCasts . fst)++4. keep candidates which accept the most preferred types where type+ conversion is needed: if one, use it+ else continue with all++> acceptsMostPreferredTypes :: [MyFunType]+> acceptsMostPreferredTypes =+> let preferredTypeCounts :: [(Int,MyFunType)]+> preferredTypeCounts = flip map reachableViaImplicitCasts+> $ \v@(_,as,_,_) ->+> (length $ filter id $+> zipWith isCastToPreferred rawArgTypes as+> ,v)+> maxCount = maximum $ map fst preferredTypeCounts+> in map snd $ filter ((==maxCount) .fst) preferredTypeCounts++Keep all candidates if none accept preferred types. If only one+candidate remains, use it; else continue to the next step.++> acceptsMostPreferredNextStep :: [MyFunType]+> acceptsMostPreferredNextStep =+> if null acceptsMostPreferredTypes+> then reachableViaImplicitCasts+> else acceptsMostPreferredTypes++5. if any input types are unknown:+for each unknown++a) select string cat for each position if any cands accept string in+that position++b) if all the cands accept the same category for that position, choose+it, otherwise fail++discard any candidates not matching the selected category (this can+only happen if string was chosen for an unknown)++for each unknown, if any cands accept the preferred type in that+position, drop all the ones which don't accept that type in that+position+if one left: use it+else: keep all for next+++transpose the arguments+calculate the category for each argument:+ will be just string if any strings+ will be just cat if all the same cat+ otherwise nothing++This doesn't take into account which positions are unknown in the+input arg list yet.++> transposedCandidateArgs = transpose $ map (\(_,x,_,_) -> x)+> acceptsMostPreferredNextStep++> argumentCategories :: [Maybe T.Text]+> argumentCategories =+> let resolveTypeSetCat ts =+> case () of+> _ | any (==UnknownType) ts -> Just "unk"+> | Right (c:cs) <- mapM (catTypeCategory cat) ts+> , all (==c) cs -> Just c+> | otherwise -> Nothing+> in map resolveTypeSetCat transposedCandidateArgs++then: zip with the unknown positions+ if we get any pairs of unknown + nothing for the cat:+ fail with ambiguous error++> chooseCat :: Type -> Maybe T.Text+> -> Either [TypeError] (Maybe T.Text)+> chooseCat a x = case (a,x) of+> (UnknownType,Nothing) ->Left [AmbiguousOperator appName' rawArgTypes]+> (UnknownType,Just y) -> Right (Just y)+> (_,_) -> Right Nothing+> let _argumentCategoriesNeeded :: Either [TypeError] [Maybe T.Text]+> _argumentCategoriesNeeded =+> zipWithM chooseCat rawArgTypes argumentCategories++TODO: filter the cands by argument categories needed+keep the left, if we need to use bestPreferredMatches then the left+escapes++> {-matchesPreferredCategories =+> let candMatches (_,ts,_,_) cn =+> catTypeCategory-}++then:+ convert the list of just cat to a list of preferred types+ do another transpose of the remaining functions and+ zip with the preferred type+ keep the preferred type as just if any cands match this preferred+ type, otherwise set to nothing++> let myIsPreferred ty = either (const False) (const True)+> $ catPreferredType cat ty+> choosePreferredType :: [Type] -> Maybe Type+> choosePreferredType ts =+> let pts = filter myIsPreferred ts+> in case pts of+> (t:_) -> Just t+> [] -> Nothing++> preferredTypes :: [Maybe Type]+> preferredTypes = map choosePreferredType transposedCandidateArgs+++now have a list of just/nothings with justs for the types which have+to match++filter the cands using this just list+now have the final best prefered match list and can+ either return one if there is one+ return ambiguous if there is more than one ?is this possible+ or return ambiguous with the previous list if none get through this+ filter++> matchesPreferred (_,ts,_,_) =+> let f _ Nothing = True+> f t (Just pt) = t == pt+> in and $ zipWith f ts preferredTypes+> bestPreferredMatches :: [MyFunType]+> bestPreferredMatches =+> filter matchesPreferred acceptsMostPreferredNextStep++> bestPreferredMatchesNextStep :: [MyFunType]+> bestPreferredMatchesNextStep =+> if null bestPreferredMatches+> then acceptsMostPreferredTypes+> else bestPreferredMatches++6. if there are unknown and known, and all the knowns are the same,+assume the unknowns to be this type. If there is one match, use it++> hasUnknown = isJust $ find (==UnknownType) rawArgTypes+> allKnownsType :: Maybe Type+> allKnownsType =+> let allNonUnknowns = filter (/=UnknownType) rawArgTypes+> in case allNonUnknowns of+> [] -> Nothing+> (x:xs) | all (==x) xs -> Just x+> | otherwise -> Nothing+> allUnknownsMatchAllKnowns :: [MyFunType]+> allUnknownsMatchAllKnowns =+> [c | c@(_,as,_,_) <- bestPreferredMatchesNextStep+> , hasUnknown+> , t <- maybeToList allKnownsType+> , let tys = map (\x -> case x of+> UnknownType -> t+> _ -> x) rawArgTypes+> , as == tys+> ]++> let showl l = show (length l) ++ "\n" ++ ppShow l+> let _showProcess =+> "Name matches: " ++ showl nameMatches+> ++ "\n\nRaw arg types: " ++ ppShow rawArgTypes+> ++ "\n\nexactMatches: " ++ showl exactMatches+> ++ "\n\nbinaryOpKnownUnknownMatches: " ++ showl binaryOpKnownUnknownMatches+> ++ "\n\ntypeConversionMatches: " ++ showl typeConversionMatch+> ++ "\n\nreachableViaImplicitCasts: " ++ showl reachableViaImplicitCasts+> -- ++ "\n\npreferredTypeCounts: " ++ showl preferredTypeCounts+> ++ "\n\nacceptsMostPreferredTypes: " ++ showl acceptsMostPreferredTypes+> ++ "\n\nbestPreferredMatches: " ++ showl bestPreferredMatches+> ++ "\n\nallUnknownsMatchAllKnowns: " ++ showl allUnknownsMatchAllKnowns++2. exact matches+2.1 binary operator known/unknown special case+2.5 typeConversion matches+4. candidate which accepts most preferred types+5. candidate matching preferred types+6. unknowns match knowns++> let zeroOrOne x = case x of+> [] -> Right ()+> [a] -> Left (Right a)+> _ -> Left (Left [AmbiguousOperator appName' rawArgTypes])+> oneOrContinue x = case x of+> [a] -> Left (Right a)+> _ -> Right ()+> trace (_showProcess) $ do+> zeroOrOne exactMatches+> zeroOrOne typeConversionMatch+> oneOrContinue binaryOpKnownUnknownMatches+> oneOrContinue reachableViaImplicitCasts+> oneOrContinue acceptsMostPreferredTypes+> oneOrContinue bestPreferredMatches+> oneOrContinue allUnknownsMatchAllKnowns++otherwise fail++TODO:++When the matching errors, what are the possibilities in user+understandable terms?++1. no functions with that name match+(could return functions with a similar name + show types)++2. have functions which match the name, but the number of args is+wrong:++list the functions + show types+should this show similarly named functions? (what about highlighting+ones with matching arg types?)++3. have functions which have the right # args, but aren't reachable+via implicit casts++could list all the functions, does it make sense to highlight the ones+which can be reached by explicit casts (or are there basically+explicit casts for nearly all pairs of types?)+should this show similarly named functions?+should this show name matches with the wrong number of args++4. I think the only other one that matters is that there are functions+which match via implicit casts, but the system cannot pick a particlar+one+should it also list the other possibilities as above?++Fix the error to contain this information.++> Left $ Left [NoMatchingOperator appName' rawArgTypes]+++> where+> -- don't use last+> -- check for empty list+> appName' = case last appName of+> Nmc n -> T.pack $ map toLower n+> QNmc n -> T.pack n+> AntiNameComponent _ -> -- todo: use left instead of error+> error "tried to find function matching an antinamecomponent"+> canImplicitCastOrSame :: Type -> Type -> Bool+> canImplicitCastOrSame from to =+> from == to || isRight (catCast cat ImplicitCastContext from to)+> -- check if casting type 'from' to type 'to' is casting+> -- to the 'from' type's prefered type in the 'from' type's+> -- category+> isCastToPreferred :: Type -> Type -> Bool+> isCastToPreferred from to = maybe False (const True) $ do+> when (from == to) Nothing+> when (isLeft (catPreferredType cat to)) Nothing+> t1 <- either (const Nothing) Just+> $ catTypeCategory cat from+> t2 <- either (const Nothing) Just+> $ catTypeCategory cat to+> if t1 == t2+> then Just ()+> else Nothing++what are all the special cases currently:+special cases for precision+special cases for result null+in OldTypeConverion.findCallMatch:+ between, not between, greatest, least+ rowctor+ .+ comparisons for composite/set types+more stuff in TypeConversion.matchApp+ sql server date stuff+ decode+ something to do with datetimes?+ string precisions?:+ ||, substring, replace+ some nullability special cases?+ jesus, more bullshit, no idea what it is all for+ no tests and documentation as per usual+SqlTypeConversions: special case for implicit casts from text types to+ numeric (see if can handle in rule system)+ScalarExprs.ag+ needs implicit cast+ implicit cast type+ check the types (e.g. cast syntax should use this typeconversion+ machinery)+ tcAppLike: more mssql date shit++ getmaybeintsfromliterals: also suggests only need to support int+ literals in the matchapp function here++on the way out:++we have to add implicit casts for possible nullability and precision+adjustments and work out the result type precision and nullability++dealing with nullable: assume functions are strict, and never return+null if none of the inputs are null. Every function which doesn't work+this way will be special cased here.++precision+precision and scale apply to the following types:+array-style types (will we need 2d arrays?)+numeric+strings+byte arrays++for numeric, the precision and scale for a result are always -1 which+represents the text equivalent for numeric: unlimited scale and+precision.++the precision on a float is fake, and represents a weird short hand to+one of two fixed types, float4 and float8++the precision of char and varchar is the sum of all the precisions of+these in the input by default, lots of special cases here. Also have+literals to deal with.+++> --resolveResultSetType :: Catalog -> [TypeExtra] -> Either [TypeError] TypeExtra+> --resolveResultSetType cat tys = undefined+++> --checkAssignmentValid :: Catalog -> Type -> Type -> Either [TypeError] ()+> --checkAssignmentValid cat from to = undefined+++resolve result set types:+numeric+text+domains+time+precision+nullability++used for union, intersect, except, case, array, values, greatest,+least, join keys+++If all inputs are of the same type, and it is not unknown, resolve as+that type.++If any input is of a domain type, treat it as being of the domain's+base type for all subsequent steps. [1]++If all inputs are of type unknown, resolve as type text (the preferred+type of the string category). Otherwise, unknown inputs are ignored.++If the non-unknown inputs are not all of the same type category, fail.++Choose the first non-unknown input type which is a preferred type in+that category, if there is one.++Otherwise, choose the last non-unknown input type that allows all the+preceding non-unknown inputs to be implicitly converted to it. (There+always is such a type, since at least the first type in the list must+satisfy this condition.)++Convert all inputs to the selected type. Fail if there is not a+conversion from a given input to the selected type.++++checkassignmentvalid:++++++also:+text encoding, char set + collations, what else?+++TODO: get the list of all the hacks sqream does at the+typechecking sql layer and move it here
+ src/Database/HsSqlPpp/Internals/TypesInternal.lhs view
@@ -0,0 +1,273 @@+++Type identifiers and anonymous types++Basic type identified by name+These can be quoted or unquoted, and with or without schema++unknown type: this is used for the types of literals in a kind of poor+mans type inference, modelled on postgresql's behaviour. Dialects can+choose not to use this approach and give a literal a type based only+on its syntax (and thus the dialect would never use the unknown+type. (The direct unknown typing isn't quite implemented yet).++any types++these are used to implement a kind of poor man's polymorphism. based+on the any types in postgresql. These are used for polymorphic+udfs. This is separate to overloading functions.++anonymous composite type++this represents a tuple of types, all, some or none of which can have+field names. This is used for composite types which are created on the+fly and don't have a name in the catalog or environment. Maybe this+should be changed so they are given a temporary name to reduce the+special cases++tref type++this is an internal type used by the typechecker (todo: can this be+hidden?) Maybe could add optional correlation names to the field names+in anonymous composite type and reuse that?++setof?+record?+void?++typeextra++ugly way to add nullability and precision to a type. This should get a+big rethink++step 1 todo:+combine composite and anonymous composite types+combine scalartype, domaintype, enum, named composite type++get rid of explicit array types and figure out a better way to handle+them++Split the errors into another module, and in the public api+The errors should contain not contain 'Type's.++figure out a better way of handling nullability, precision, scale than+the typeextra++> {-# LANGUAGE FlexibleInstances,DeriveDataTypeable,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Internals.TypesInternal where+>+> import Data.Data+> --import Data.Generics.Uniplate.Data+> --import Data.Char+> import Data.Text (Text)+> --import qualified Data.Text as T+> --import Database.HsSqlPpp.Internals.Dialect+> --import Data.List+> --import Debug.Trace++> --import Control.Monad.Error+> --import Control.Monad.Except+> --import Control.Monad.Trans.Except++where should precision and nullability go?+++TODO:+rename UnknownType to ScalarType "!unknown" ? or something else?+do we need separate entries for domain and enums?+think of a better way to implement array types - get rid of the+ special casing which is based on a postgresql implementation detail+get rid of pseudo types, maybe use ScalarType or SpecialType String+ which is dialect specific?++Maybe there should be a concept of a typeid, and a typedescription?+So the typeid is used everywhere and is just a string or something,+and the typedescription is got from the catalog/environment when+needed in the typechecking?+++> -- | Standard types of things. This covers all the usual postgres types+> -- plus some extra ones added for use by the hssqlppp typechecker+> data Type = -- | basic type of a scalar value. These are either built in types+> -- in postgres, or implemented in C or similar+> ScalarType Text+> -- | a domain type is used for a constraint on a table column which+> -- would used on multiple columns on a table or in multiple tables,+> -- using a domain type is a way of just writing the constraint once+> | DomainType Text+> -- | enum type, not really supported in hssqlppp yet+> | EnumType Text+> -- | String literals in postgres have an unknown type. The effective+> -- type is determined using what seems to amount to some simple ad hoc rules+> -- based on the context of the string literal. Hssqlppp also treats+> -- ? placeholders and nulls the same way, so they have UnknownType,+> -- not sure how closely this matches postgres+> | UnknownType+> -- | postgres automatically creates an array type for every scalar type+> -- (plus some other types?) If there is no array type for a type in the+> -- catalog, then you can't work with arrays of that type+> | ArrayType Type+> -- | refer to composite type in catalog by name. not sure if this needs+> -- to exist along with CompositeType+> | NamedCompositeType Text+> -- | refer to composite type by structure+> | CompositeType [(Text,TypeExtra)]+> -- | CompositeTypeExtra [(Text,TypeExtra)]+> -- | hack to support the environment for a tref+> | TrefType [((Text,Text),TypeExtra)]+> -- | the fields are anonymous as well as the type itself+> | AnonymousCompositeType [Type]+> -- | The pseudo type is used for types which only appear+> -- as argument or return types in function definitions and/or+> -- are used only in plpgsql and not regular sql. hssqlppp also+> -- follows this usage for the types used in hssqlppp which don't+> -- have an exact counterpart in postgres+> | Pseudo PseudoType+> deriving (Eq,Show,Ord,Typeable,Data)+>++> -- | Quick fix to add precision and nullable information to the+> -- annotation types. This approach should be revisited, maybe this+> -- information should be in the Type type?+> data TypeExtra = TypeExtra {teType :: Type+> ,tePrecision :: Maybe Int+> ,teScale :: Maybe Int+> ,teNullable :: Bool}+> deriving (Eq,Ord,Show,Typeable,Data)+> mkTypeExtra :: Type -> TypeExtra+> mkTypeExtra t = TypeExtra t Nothing Nothing True+> mkTypeExtraNN :: Type -> TypeExtra+> mkTypeExtraNN t = TypeExtra t Nothing Nothing False+> mkNullable:: TypeExtra -> TypeExtra+> mkNullable te = te{teNullable=True}++> -- | Pseudo types: mainly used for the argument and return types of+> -- functions. The weird undocumented types are just used to represent+> -- functions with those types which are in the postgres default catalog+> data PseudoType =+> -- | setof is used for set returning functions+> SetOfType Type+> -- | used to represent polymorphic functions, all the+> -- AnyElement parameters and the return type if+> -- AnyElement must be the same type for a given function+> -- call invocation.+> | AnyElement+> -- | like AnyElement, but the type must be an array type+> | AnyArray+> -- | like AnyElement, but the type must be an enum type+> | AnyEnum+> -- | like AnyElement, but the type must be a non array type+> | AnyNonArray+> | AnyRange+> -- | Any drops the restriction that all the Any types must+> -- be the same type+> | Any+> -- | record types are used in plpgsql for a sort of dynamic+> -- typing or rough polymorphism substitute. They can refer to+> -- values of named composite type, composite type or+> -- anonymous composite type, not sure if non composite types as well.+> | Record (Maybe Type)+> -- | presumably used for the types of OLD and NEW in a trigger+> -- function. Hssqlppp will probably use the Record type above+> -- for these.+> -- | TriggerRecord+> -- | Trigger+> -- | cstring - a C string+> -- | Cstring+> -- | represents the return type of a function which doesn't return+> -- anything. Not sure if it is used anywhere else+> | Void+> -- | Internal+> -- | LanguageHandler+> -- | Opaque+> -- | FdwHandler+> deriving (Eq,Show,Ord,Typeable,Data)++TODO idea++> {-data Type = -- | A normal type identified by name. Includes scalar+> -- types, domain types, enums, (non-anonymous)+> -- structured types+> Type (Maybe Text,Text)+> -- | represents a unknown type like in postgres. Used+> -- for literals in some dialects and a few other places+> | UnknownType+> | ArrayType Type+> | CompositeType [(Text,TypeExtra)]+> -- | hack to support the environment for a tref+> | TrefType [((Text,Text),TypeExtra)]+> -- | the fields are anonymous as well as the type itself+> | AnonymousCompositeType [Type]+> | SetOfType Type+> -- | record types are used in plpgsql for a sort of dynamic+> -- typing or rough polymorphism substitute. They can refer to+> -- values of named composite type, composite type or+> -- anonymous composite type, not sure if non composite types as well.+> | Record (Maybe Type)+> deriving (Eq,Show,Ord,Typeable,Data)-}+++The possible type errors. This is a bit unorganised, at some point if+better error messages are wanted, then a lot more information could be+added.++> data TypeError = {-+> | UnknownTypeError Type+> | UnknownTypeName String+> | NoMatchingOperator String [Type]+> | TypelessEmptyArray+> | IncompatibleTypeSet [Type]+> | IncompatibleTypes Type Type+> | ValuesListsMustBeSameLength+> | NoRowsGivenForValues+> | UnrecognisedIdentifier String+> | UnrecognisedRelation String+> | UnrecognisedCorrelationName String+> | BadStarExpand+> | ContextError String+> | MissingJoinAttribute+> | ExpressionMustBeBool+> | WrongNumberOfColumns+> | ExpectedDomainType Type+> | BadCatalogUpdate String+> | TypeAlreadyExists Type+> | AnyAllError String+> | InternalError String+> | FromToTypesNotSame Type Type+> | WrongNumberOfAliasCols Int Int++type conversion errors++> | -} NoMatchingOperator Text [Type]+> | AmbiguousOperator Text [Type]+> | TypelessEmptyArray+> | IncompatibleTypeSet [Type]+> | IncompatibleTypes Type Type+> | WrongNumberOfColumns+> | WrongTypes Type [Type]+> | IncompatibleUnionTypes Type Type+++old catalog type errors: to be replaced when the catalog code is+gutted and rewritten++> | TypeAlreadyExists Type+> | SchemaAlreadyExists Text+> | BadCatalogUpdate Text+> | UnrecognisedRelation (Text,Text)+> | DomainDefNotFound Type+> | TypeNotKnown Type+> | UnknownTypeName Text+> | UnrecognisedIdentifier Text+> | UnrecognisedCorrelationName Text+> | SchemadColumnName Text+> | DbSchemadColumnName Text+> | BadStarExpand+> | InternalError String+> | AmbiguousIdentifier Text+> | OdbcFuncBadContent+> | DuplicateColumnName Text+> | TooManyColumnsInInsert+> deriving (Eq,Show,Ord,Typeable,Data)+>
+ src/Database/HsSqlPpp/Internals/Utils.lhs view
@@ -0,0 +1,81 @@++This file contains some generic utility stuff++> {-# LANGUAGE TupleSections #-}+> {-# LANGUAGE FlexibleContexts #-}+> module Database.HsSqlPpp.Internals.Utils where+>+> import Control.Arrow+> import Control.Applicative+> import Data.List+> import Data.Char++> infixl 9 |>+> (|>) :: (a -> b) -> (b -> c) -> a -> c+> (|>) = flip (.)+>+> both :: (a->b) -> (a,a) -> (b,b)+> both fn = fn *** fn+>+> (<:>) :: (Applicative f) =>+> f a -> f [a] -> f [a]+> (<:>) a b = (:) <$> a <*> b++> firstM :: Functor f => (t -> f a) -> (t, t1) -> f (a, t1)+> firstM f (a,b) = (,b) <$> f a++> secondM :: Functor f => (t -> f a) -> (t1, t) -> f (t1, a)+> secondM f (a,b) = (a,) <$> f b++> replace :: (Eq a) => [a] -> [a] -> [a] -> [a]+> replace _ _ [] = []+> replace old new xs@(y:ys) =+> case stripPrefix old xs of+> Nothing -> y : replace old new ys+> Just ys' -> new ++ replace old new ys'+>+> split :: Char -> String -> [String]+> split _ "" = []+> split c s = let (l, s') = break (== c) s+> in l : case s' of+> [] -> []+> (_:s'') -> split c s''+>+> npartition :: Eq b => (a -> b) -> [a] -> [(b,[a])]+> npartition keyf =+> np []+> where+> np = foldl (\acc p -> insertWith (++) (keyf p) [p] acc)+>+> insertWith :: Eq k => (a -> a -> a) -> k -> a -> [(k,a)] -> [(k,a)]+> insertWith ac k v m =+> case lookup k m of+> Nothing -> m ++ [(k,v)]+> Just v' -> let nv = ac v' v+> in map (\p@(k1,_) -> if k1 == k+> then (k1,nv)+> else p) m++This should preserve order, so in the result, the keys (k in+[(k,[a],[b])]) are ordered by their first appearance in as, then bs,+and the values are ordered the matches in the same order as they+appear in the two lists ([a] and [b] in [(k,[a],[b])])++> joinLists :: Eq k => (a -> k) -> (b -> k)+> -> [a] -> [b] -> [(k,[a],[b])]+> joinLists ka kb as bs =+> let -- arrange the two lists by key+> kasps = npartition ka as+> kbsps = npartition kb bs+> -- get the list of keys+> ks = nub $ map fst kasps ++ map fst kbsps+> -- put together the two lists by key+> in flip map ks $ \k ->+> (k, getem k kasps, getem k kbsps)+> where+> getem :: Eq k => k -> [(k,[a])] -> [a]+> getem k = concatMap snd . filter ((==k) . fst)++> trim :: String -> String+> trim = f . f+> where f = reverse . dropWhile isSpace
+ src/Database/HsSqlPpp/Lex.lhs view
@@ -0,0 +1,15 @@++> {-# LANGUAGE TupleSections,OverloadedStrings #-}+> module Database.HsSqlPpp.Lex+> (Token(..)+> ,prettyToken+> ,lexToken+> ,lexTokens+> ,Dialect(..)+> ,ansiDialect+> ) where++> import Database.HsSqlPpp.Internals.LexInternal+> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Dialects.Ansi+
+ src/Database/HsSqlPpp/Parse.lhs view
@@ -0,0 +1,31 @@++Forward the public part of ParserInternal++> -- | Functions to parse SQL.++> module Database.HsSqlPpp.Parse+> (-- * Main+> parseStatements+> ,parseProcSQL+> ,parseQueryExpr+> ,parseScalarExpr+> -- * Parsing options+> ,ParseFlags(..)+> ,defaultParseFlags+> ,Dialect(..)+> ,ansiDialect+> -- * errors+> ,ParseErrorExtra(..)+> -- * internals+> ,parseName+> ,parseNameComponent++> ) where+>+> import Database.HsSqlPpp.Internals.ParseInternal+> import Database.HsSqlPpp.Internals.ParseErrors+> import Database.HsSqlPpp.Dialects.Ansi+> import Database.HsSqlPpp.Internals.Dialect++> defaultParseFlags :: ParseFlags+> defaultParseFlags = ParseFlags {pfDialect = ansiDialect}
+ src/Database/HsSqlPpp/Pretty.lhs view
@@ -0,0 +1,21 @@+> module Database.HsSqlPpp.Pretty+> (--convert a sql ast to text+> prettyStatements+> --,printStatementsAnn+> ,prettyQueryExpr+> --convert a single expression parse node to text+> ,prettyScalarExpr+> ,PrettyFlags(..)+> ,defaultPrettyFlags+> ,Dialect(..)+> ,ansiDialect+> )+> where++> import Database.HsSqlPpp.Internals.PrettyInternal+> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Dialects.Ansi++> defaultPrettyFlags :: PrettyFlags+> defaultPrettyFlags = PrettyFlags {ppDialect = ansiDialect}+
+ src/Database/HsSqlPpp/Syntax.lhs view
@@ -0,0 +1,120 @@++> {- | This module contains the ast node data types. They are very+> permissive, in that they allow a lot of invalid SQL to be+> represented. The type checking process should catch all invalid+> trees, but doesn't quite manage at the moment. Sorry about all+> the seemingly pointless type synonyms below, they are an+> artefact of using UUAGC. You can see labels for the fields by+> looking at the ag source here:+> <https://raw.githubusercontent.com/JakeWheat/hssqlppp/master/hssqlppp/src/Database/HsSqlPpp/Internals/AstInternal.ag>+> -}+>+> module Database.HsSqlPpp.Syntax+> (+> -- * Name and TypeName+> Name(..)+> ,NameComponent(..)+> ,nameComponents+> ,ncStr+> ,TypeName(..)+> -- * Scalar expressions+> ,ScalarExpr(..)+> ,InList(..)+> ,LiftFlavour(..)+> ,Direction(..)+> ,NullsOrder(..)+> ,Distinct(..)+> ,CombineType(..)+> ,IntervalField(..)+> ,ExtractField(..)+> ,FrameClause(..)+> ,OdbcLiteralType(..)+> -- * Query expressions+> ,QueryExpr(..)+> ,makeSelect+> ,WithQuery(..)+> ,SelectList(..)+> ,SelectItem(..)+> ,TableRef(..)+> ,JoinExpr(..)+> ,JoinType(..)+> ,JoinHint(..)+> ,QueryHint(..)+> ,OnExpr+> ,Natural(..)+> -- * Statements+> ,Statement(..)+> -- ** dml components+> ,CopyToSource(..)+> ,CopyFromSource(..)+> ,CopyToOption(..)+> ,CopyFromOption(..)+> ,SetClause(..)+> -- ** ddl components+> ,AttributeDef(..)+> ,TableOption(..)+> ,RowConstraint(..)+> ,Constraint(..)+> ,TablePartitionDef(..)+> ,TablePartitionDateTimeInterval(..)+> ,TypeAttributeDef(..)+> ,AlterDatabaseOperation(..)+> ,AlterSchemaOperation(..)+> ,AlterTableOperation(..)+> ,AlterTableAction(..)+> ,AlterSequenceOperation(..)+> ,AlterSequenceAction(..)+> ,AlterColumnAction(..)+> ,TriggerWhen(..)+> ,TriggerEvent(..)+> ,TriggerFire(..)+> ,DropType(..)+> ,Cascade(..)+> ,IfExists(..)+> ,RestartIdentity(..)+> -- *** function ddl components+> ,Replace(..)+> ,Volatility(..)+> ,Language(..)+> ,FnBody(..)+> -- ** PlPgsql components+> ,ParamDef(..)+> ,VarDef(..)+> ,RaiseType(..)+> -- * utility+> ,SetValue(..)+> -- * misc+> {-,WithQueryList+> ,MaybeSelectList+> ,TableRefList+> ,MaybeScalarExpr+> ,ScalarExprList+> ,ScalarExprListList+> ,SetClauseList+> ,AttributeDefList+> ,ConstraintList+> ,TypeAttributeDefList+> ,ParamDefList+> ,TypeNameList+> ,NameTypeNameListPair+> ,NameTypeNameListPairList+> ,ScalarExprListStatementListTriple+> ,ScalarExprListStatementListTripleList+> ,ScalarExprStatementListPair+> ,ScalarExprStatementListPairList+> ,VarDefList+> ,SelectItemList+> ,RowConstraintList+> ,CaseScalarExprListScalarExprPair+> ,CaseScalarExprListScalarExprPairList+> ,StatementList+> ,ScalarExprDirectionPair+> ,ScalarExprDirectionPairList+> ,AlterTableActionList+> ,MaybeNameComponentList+> ,NameComponentList+> ,MaybeBoolExpr-}+> ) where+>+> import Database.HsSqlPpp.Internals.AstInternal+> --import Database.HsSqlPpp.Internals.Name
+ src/Database/HsSqlPpp/TypeCheck.lhs view
@@ -0,0 +1,35 @@++This is the public module for the type checking functionality.++> {- | Contains functions for typechecking sql asts.+> -}+> module Database.HsSqlPpp.TypeCheck+> (+> -- * typechecking/ annotation functions+> typeCheckStatements+> ,typeCheckQueryExpr+> ,typeCheckScalarExpr+> ,TypeCheckFlags(..)+> ,Dialect(..)+> ,ansiDialect+> ,defaultTypeCheckFlags+> ,emptyEnvironment+> ) where+>+> import Database.HsSqlPpp.Internals.AstInternal+> import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Dialects.Ansi+> import Database.HsSqlPpp.Internals.TypeChecking.Environment (emptyEnvironment)+> --import Database.HsSqlPpp.Internals.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.AstAnnotation++> -- | reasonable defaults for type checking, doesn't add anything+> -- optional+> defaultTypeCheckFlags :: TypeCheckFlags+> defaultTypeCheckFlags =+> TypeCheckFlags+> {tcfAddQualifiers = False+> ,tcfAddFullTablerefAliases = False+> ,tcfAddSelectItemAliases = False+> ,tcfExpandStars = False+> ,tcfDialect = ansiDialect}
+ src/Database/HsSqlPpp/Types.lhs view
@@ -0,0 +1,21 @@++This is the public module to the SQL data types, mainly from TypeType.++> {- | Contains the SQL data types, type errors, and a few supporting+> functions.+> -}+>+> module Database.HsSqlPpp.Types+> (+> -- * SQL types+> Type (..)+> ,TypeExtra (..)+> ,PseudoType (..)+> {-,typeSmallInt,typeBigInt,typeInt,typeNumeric,typeFloat4+> ,typeFloat8,typeVarChar,typeChar,typeBool,typeDate+> ,typeTime,typeTimestamp,typeInterval-}+> -- * Type errors+> ,TypeError (..)+> ) where+>+> import Database.HsSqlPpp.Internals.TypesInternal
+ src/Database/HsSqlPpp/Utility.lhs view
@@ -0,0 +1,80 @@++> -- | This module contains a collection of utility functions++> {-# LANGUAGE FlexibleContexts #-}+> module Database.HsSqlPpp.Utility+> (-- * ast utils+> resetAnnotations+> ,queryType+> --,canonicalizeTypeName+> --,canonicalizeTypeNames+> -- * typechecked ast utils+> ,addExplicitCasts+> ,addImplicitCasts+> ,tcTreeInfo+> ,emacsShowErrors+> ) where++> import Data.Generics.Uniplate.Data+> import Data.Data+> import Data.List+> import Data.Maybe++> import Database.HsSqlPpp.Internals.AstInternal+> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Internals.ParseInternal+> import Database.HsSqlPpp.Internals.Catalog.CatalogTypes+> --import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Parse+> import Database.HsSqlPpp.TypeCheck+> --import Text.Parsec.Prim+> --import Control.Monad.Identity+> import qualified Data.Text.Lazy as L++> -- | replace all the annotations in a tree with 'emptyAnnotation'+> resetAnnotations :: Data a => a -> a+> resetAnnotations = transformBi (const emptyAnnotation)++> -- | Gets the type of the sql source passed in. Expects the string to contain+> -- a query expr+> queryType :: Catalog -> L.Text -> Maybe Type+> queryType cat src = do+> ast <- either (const Nothing) Just $ parseQueryExpr defaultParseFlags "" Nothing src+> fmap teType $ anType $ getAnnotation $ typeCheckQueryExpr defaultTypeCheckFlags cat ast++> -- | Gets some information useful for checking a typechecked tree+> -- returns the type of the top level node, a list of type errors from+> -- the tree, a list of the queryexpr nodes, and a list of the scalar+> -- exprs respectively, which have their type as nothing which indicates+> -- that the typechecking didn't complete successfully+> tcTreeInfo :: Data a =>+> a+> -> (Maybe TypeExtra,[([TypeError],Maybe SourcePosition)]+> ,[QueryExpr],[ScalarExpr])+> tcTreeInfo ast =+> let noTypeSEs :: [ScalarExpr]+> noTypeSEs = [x | x <- universeBi ast+> , isNothing (anType (getAnnotation x))]+> noTypeQEs :: [QueryExpr]+> noTypeQEs = [x | x <- universeBi ast+> , isNothing (anType (getAnnotation x))]+> -- get the list of type errors with source positions+> -- from the typechecked ast+> tes :: [([TypeError],Maybe SourcePosition)]+> tes = [(e,sp) | a@(Annotation {}) <- universeBi ast+> , let e = anErrs a+> , let sp = anSrc a+> , not (null e)]+> ty = anType $ getAnnotation ast+> in (ty,tes,noTypeQEs,noTypeSEs)++> -- | show a type error list in emacs format+> emacsShowErrors :: [([TypeError],Maybe SourcePosition)] -> String+> emacsShowErrors tes =+> intercalate "\n" $ map se tes+> where+> se (es,sp) =+> (case sp of+> Nothing -> "unknown source"+> Just (fn,l,c) -> fn ++ ":" ++ show l ++ ":" ++ show c ++ ":")+> ++ " " ++ intercalate "\n" (map show es)
+ tests/Database/HsSqlPpp/Tests/Parsing/CombineQueryExprs.lhs view
@@ -0,0 +1,65 @@+++> {-# LANGUAGE QuasiQuotes,OverloadedStrings,TemplateHaskell #-}+>+> module Database.HsSqlPpp.Tests.Parsing.CombineQueryExprs (combineQueryExprs) where+>+> import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> import qualified Data.Text as T++> combineQueryExprs :: Item+> combineQueryExprs =+> Group "combineSelects"+> [q "select a from tbl\n\+> \except\n\+> \select a from tbl1;"+> $ cq Except stbl stbl1+> ,q "select a from tbl where true\n\+> \except\n\+> \select a from tbl1 where true;"+> $ cq Except+> (stbl {selWhere = Just lTrue})+> (stbl1 {selWhere = Just lTrue})+> ,q "select a from tbl\n\+> \union\n\+> \select a from tbl1;"+> $ cq Union stbl stbl1+> ,q "select a from tbl\n\+> \union all\n\+> \select a from tbl1;"+> $ cq UnionAll stbl stbl1+> ,q "(select 1 union select 2) union select 3;"+> $ cq Union (cq Union (sel 1) (sel 2)) (sel 3)+> ,q "select 1 union (select 2 union select 3);"+> $ cq Union (sel 1) (cq Union (sel 2) (sel 3))+> ,q [here|+> with a as (select a from tbl),+> b as (select a from tbl1)+> select 1; |]+> $ with [("a",stbl)+> ,("b",stbl1)] $ sel 1+> ,q [here|+> with a as (select a from tbl),+> b as (select a from tbl1)+> select 1+> union select 2; |]+> $ with [("a",stbl)+> ,("b",stbl1)] $ cq Union (sel 1) (sel 2)+> ]+> where+> stbl = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl"]}+> stbl1 = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl1"]}+> sel :: Int -> QueryExpr+> sel n = makeSelect {selSelectList = sl [si $ num $ T.pack $ show n]}+> q = ParseQueryExpr defaultParseFlags+> cq = CombineQueryExpr ea
+ tests/Database/HsSqlPpp/Tests/Parsing/CreateTable.lhs view
@@ -0,0 +1,364 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.CreateTable (createTableTests) where+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> createTableTests :: Item+> createTableTests =+> Group "create table" [+> Group "simple tables" [+> s "create table test (\n\+> \ fielda text,\n\+> \ fieldb int\n\+> \);"+> [(createTable "test")+> [att "fielda" "text"+> ,att "fieldb" "int"]+> ]+> ,s "create table tbl (\n\+> \ fld boolean default false);"+> [createTable "tbl"+> [AttributeDef ea (Nmc "fld") (st "boolean")+> [DefaultConstraint ea "" lFalse] []]]+>+> ,s "create table tbl (\n\+> \ fld boolean not null default false);"+> [createTable "tbl"+> [AttributeDef ea (Nmc "fld") (st "boolean")+> [NotNullConstraint ea "",+> DefaultConstraint ea "" lFalse] []]]+>+> ,s "create table tbl as select 1;"+> [CreateTableAs ea (name "tbl") NoReplace+> (makeSelect+> {selSelectList = sl [si $ num "1"]})]+>+> ,s "create table tbl (\n\+> \ fld int not null identity(1,1));"+> [createTable "tbl"+> [AttributeDef ea (Nmc "fld") (st "int")+> [NotNullConstraint ea "",+> IdentityConstraint ea "" (Just(1,1))] []]]+> ,s "create table tbl (\n\+> \ fld int not null identity(-1,-1));"+> [createTable "tbl"+> [AttributeDef ea (Nmc "fld") (st "int")+> [NotNullConstraint ea "",+> IdentityConstraint ea "" (Just(-1,-1))] []]]+>+> ,s "create table tbl (\n\+> \ fld int not null identity);"+> [createTable "tbl"+> [AttributeDef ea (Nmc "fld") (st "int")+> [NotNullConstraint ea "",+> IdentityConstraint ea "" Nothing] []]]+>+> ,s "alter table a rename to b;"+> [AlterTable ea (name "a") $ RenameTable ea (name "b")]+> ,s "alter table a rename column b to c;"+> [AlterTable ea (name "a") $ RenameColumn ea (Nmc "b") (Nmc "c")]+>+> ,s "alter table a add column b int;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AddColumn ea $ att "b" "int"]]+>+> ,s "alter table a drop column b;"+> [AlterTable ea (name "a") $ AlterTableActions ea [DropColumn ea (Nmc "b")]]+>+> ,s "alter table a alter column b set data type int;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AlterColumn ea (Nmc "b") $ SetDataType ea (st "int")]]+>+> ,s "alter table a alter column b set data type int;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AlterColumn ea (Nmc "b") $ SetDataType ea (st "int")]]+>+> ,s "alter table a alter column b set default 1;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AlterColumn ea (Nmc "b") $ SetDefault ea (num "1")]]+> ,s "alter table a alter column b drop default;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AlterColumn ea (Nmc "b") $ DropDefault ea]]+>+> ,s "alter table a alter column b set not null;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AlterColumn ea (Nmc "b") $ SetNotNull ea]]+> ,s "alter table a alter column b drop not null;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AlterColumn ea (Nmc "b") $ DropNotNull ea]]+>+> ,s "alter table a add column b int,drop column c;"+> [AlterTable ea (name "a") $ AlterTableActions ea [AddColumn ea $ att "b" "int"+> ,DropColumn ea (Nmc "c")]]+>+> ,s "alter table a drop column b;"+> [AlterTable ea (name "a") $ AlterTableActions ea [DropColumn ea (Nmc "b")]]+> ,s "alter table a add constraint unique(b);"+> [AlterTable ea (name "a") $ AlterTableActions ea [AddConstraint ea (UniqueConstraint ea "" [Nmc "b"])]]+> ]+> ,Group "constraints" [+> Group "nulls" [+> s "create table t1 (\n\+> \ a text null\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "a") (st "text")+> [NullConstraint ea ""] []]]+> ,s "create table t1 (\n\+> \ a text not null\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "a") (st "text")+> [NotNullConstraint ea ""] []]]+> ]+>+> ,Group "unique" [+> s "create table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ unique (x,y)\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [UniqueConstraint ea "" [Nmc "x",Nmc "y"]]]++test arbitrary ordering++> ,s "create table t1 (\n\+> \ x int,\n\+> \ unique (x),\n\+> \ y int\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [UniqueConstraint ea "" [Nmc "x"]]]+++test partitioning parser++> ,s "create table t1(\n\+> \ x int,\n\+> \ ts datetime\n\+> \ )\n\+> \ partition by range(ts)\n\+> \ (\n\+> \ every 5 months\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "ts" "datetime"]+> `setTablePartition`+> (Just (TablePartitionDef ea (Nmc "ts") 5 Month))]+++unique row++> ,s "create table t1 (\n\+> \ x int unique\n\+> \);"+> [createTable "t1"+> [AttributeDef ea (Nmc "x") (st "int")+> [RowUniqueConstraint ea ""] []]]+>+> ,s "create table t1 (\n\+> \ x int unique not null\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowUniqueConstraint ea ""+> ,NotNullConstraint ea ""] []]]++quick sanity check++> ,s "create table t1 (\n\+> \ x int not null unique\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [NotNullConstraint ea ""+> ,RowUniqueConstraint ea ""] []]]+> ]+>+> ,Group "primary key" [+> s "create table t1 (\n\+> \ x int primary key\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowPrimaryKeyConstraint ea ""] []]]+>+> ,s "create table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ primary key (x,y)\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [PrimaryKeyConstraint ea "" [Nmc "x", Nmc "y"]]]+> ]+>+> ,Group "check" [+> s "create table t (\n\+> \f text check (f in('a', 'b'))\n\+> \);"+> [createTable "t"+> [AttributeDef ea (Nmc "f") (st "text")+> [RowCheckConstraint ea "" (InPredicate ea+> (ei "f") True+> (InList ea [stringQ "a", stringQ "b"]))] []]]+>+> ,s "create table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ check (x>y)\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [CheckConstraint ea "" (binop ">" (ei "x") (ei "y"))]]+> ]+>+> ,Group "misc" [+> s "create table t (\n\+> \f text not null unique check (f in('a', 'b'))\n\+> \);"+> [createTable "t"+> [AttributeDef ea (Nmc "f") (st "text")+> [NotNullConstraint ea ""+> ,RowUniqueConstraint ea ""+> ,RowCheckConstraint ea "" (InPredicate ea+> (ei "f") True+> (InList ea [stringQ "a"+> ,stringQ "b"]))] []]]+> ]++> ,Group "references" [+> s "create table t1 (\n\+> \ x int references t2\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowReferenceConstraint ea "" (name "t2") Nothing+> Restrict Restrict] []]]+>+> ,s "create table t1 (\n\+> \ x int references t2(y)\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowReferenceConstraint ea "" (name "t2") (Just $ Nmc "y")+> Restrict Restrict] []]]+> ,s "create table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ foreign key (x,y) references t2\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [ReferenceConstraint ea "" [Nmc "x", Nmc "y"] (name "t2") []+> Restrict Restrict]]+>+> ,s "create table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ foreign key (x,y) references t2(z,w)\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [ReferenceConstraint ea "" [Nmc "x", Nmc "y"] (name "t2") [Nmc "z", Nmc "w"]+> Restrict Restrict]]+>+> ,s "create table t1 (\n\+> \ x int references t2 on delete cascade\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowReferenceConstraint ea "" (name "t2") Nothing+> Cascade Restrict] []]]+>+> ,s "create table t1 (\n\+> \ x int references t2 on update cascade\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowReferenceConstraint ea "" (name "t2") Nothing+> Restrict Cascade] []]]+>+> ,s "create table t1 (\n\+> \ x int references t2 on delete cascade on update cascade\n\+> \);"+> [createTable "t1" [AttributeDef ea (Nmc "x") (st "int")+> [RowReferenceConstraint ea "" (name "t2") Nothing+> Cascade Cascade] []]]+>+> ,s "create table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ foreign key (x,y) references t2 on update cascade on delete cascade\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [ReferenceConstraint ea "" [Nmc "x", Nmc "y"] (name "t2") []+> Cascade Cascade]]+> ,s "create or replace table test (\n\+> \ fielda text,\n\+> \ fieldb int\n\+> \);"+> [createTable "test" [att "fielda" "text"+> ,att "fieldb" "int"]+> `setTableReplace` Replace]+>+> ,s "create or replace table tbl as select 1;"+> [CreateTableAs ea (name "tbl") Replace+> (makeSelect+> {selSelectList = sl [si $ num "1"]})]+>+> ,s "create or replace table t1 (\n\+> \ x int,\n\+> \ y int,\n\+> \ foreign key (x,y) references t2(z,w)\n\+> \);"+> [createTable "t1" [att "x" "int"+> ,att "y" "int"]+> `setTableCons`+> [ReferenceConstraint ea "" [Nmc "x", Nmc "y"] (name "t2") [Nmc "z", Nmc "w"]+> Restrict Restrict]+> `setTableReplace` Replace]+> ]+> ]++> ,Group "options"+> [s "create table t (\n\+> \ a int with options(test)\n\+> \);"+> [createTable "t" [att "a" "int"+> `setAttOpts` [TableOptionKeywords ["test"]]]]+> ,s "create table t (\n\+> \ a int with options(test two)\n\+> \);"+> [createTable "t" [att "a" "int"+> `setAttOpts` [TableOptionKeywords ["test", "two"]]]]+> ,s "create table t (\n\+> \ a int\n\+> \) with options(test two);"+> [createTable "t" [att "a" "int"]+> `setTableOpts` [TableOptionKeywords ["test", "two"]]]+> ,s "create table t (\n\+> \ a int\n\+> \) with options(yes='no');"+> [createTable "t" [att "a" "int"]+> `setTableOpts` [TableOptionStringVal ["yes"] "no"]]+> ,s "create table t (\n\+> \ a int\n\+> \) with options(yes=a.b);"+> [createTable "t" [att "a" "int"]+> `setTableOpts` [TableOptionNameVal ["yes"] [Name ea [Nmc "a", Nmc "b"]]]]+> ,s "create table t (\n\+> \ a int\n\+> \) with options(yes=5.5);"+> [createTable "t" [att "a" "int"]+> `setTableOpts` [TableOptionNumberVal ["yes"] "5.5"]]+> {-,s "create table t (\n\+> \ a int\n\+> \) with options(yes=5M);" -- TODO+> [createTable "t" [att "a" "int"]+> `setTableOpts` [TableOptionNumberVal ["yes"] "5.5"]]-}+> ]++> ]++> where+> s = ParseStmts defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/Dml.lhs view
@@ -0,0 +1,154 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.Dml (dml) where+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++TODO:++from in update, using in delete (+ type check these)++> dml:: Item+> dml =+> Group "dml" [+> Group "insert" [+> s "insert into testtable\n\+> \(columna,columnb)\n\+> \values (1,2);\n"+> [Insert ea+> (name "testtable")+> [Nmc "columna", Nmc "columnb"]+> (Values ea [[num "1", num "2"]])+> Nothing]++multi row insert, test the stand alone values statement first, maybe+that should be in the select section?++> ,s "values (1,2), (3,4);"+> [QueryStatement ea $ Values ea [[num "1", num "2"]+> ,[num "3", num "4"]]]+>+> ,s "insert into testtable\n\+> \(columna,columnb)\n\+> \values (1,2), (3,4);\n"+> [Insert ea+> (name "testtable")+> [Nmc "columna", Nmc "columnb"]+> (Values ea [[num "1", num "2"]+> ,[num "3", num "4"]])+> Nothing]++insert from select++> ,s "insert into a\n\+> \ select b from c;"+> [Insert ea (name "a") []+> (makeSelect+> {selSelectList = sl [si $ ei "b"]+> ,selTref = [tref "c"]})+> Nothing]+>+> ,s "insert into testtable\n\+> \(columna,columnb)\n\+> \values (1,2) returning id;\n"+> [Insert ea+> (name "testtable")+> [Nmc "columna", Nmc "columnb"]+> (Values ea [[num "1", num "2"]])+> (Just $ sl [si $ ei "id"])]+> ]+>+> ,Group "update" [+> s "update tb\n\+> \ set x = 1, y = 2;"+> [Update ea (name "tb") [set "x" $ num "1"+> ,set "y" $ num "2"]+> [] Nothing Nothing]+> ,s "update tb\n\+> \ set x = 1, y = 2 where z = true;"+> [Update ea (name "tb") [set "x" $ num "1"+> ,set "y" $ num "2"]+> []+> (Just $ binop "=" (ei "z") lTrue)+> Nothing]+> ,s "update tb\n\+> \ set x = 1, y = 2 returning id;"+> [Update ea (name "tb") [set "x" $ num "1"+> ,set "y" $ num "2"]+> [] Nothing (Just $ sl [si $ ei "id"])]+> ,s "update tb\n\+> \ set (x,y) = (1,2);"+> [Update ea (name "tb")+> [MultiSetClause ea [Nmc "x",Nmc "y"]+> $ specop "rowctor" [num "1"+> ,num "2"]]+> []+> Nothing Nothing]+> ]++App ea "=" [App ea "rowctor" [Identifier ea "x",Identifier ea "y"],App ea "rowctor" [num "1",num "2"]])+++>+> ,Group "delete" [+> s "delete from tbl1 where x = true;"+> [Delete ea (name "tbl1") [] (Just $ binop "=" (ei "x") lTrue)+> Nothing]+> ,s "delete from tbl1 where x = true returning id;"+> [Delete ea (name "tbl1") [] (Just $ binop "=" (ei "x") lTrue)+> (Just $ sl [si $ ei "id"])]+> ]+>+> ,Group "truncate" [+> s "truncate test;"+> [Truncate ea [name "test"] ContinueIdentity Restrict]+>+> ,s "truncate table test, test2 restart identity cascade;"+> [Truncate ea [name "test",name "test2"] RestartIdentity Cascade]+> ]++copy, bit crap at the moment++> ,Group "copy" [+> s "copy tbl(a,b) from stdin;\n\+> \bat\tt\n\+> \bear\tf\n\+> \\\.\n"+> [CopyFrom ea (name "tbl") [Nmc "a", Nmc "b"] Stdin []+> ,CopyData ea "\+> \bat\tt\n\+> \bear\tf\n"]+> ,s "copy tbl (a,b) from 'filename' with delimiter '|';"+> [CopyFrom ea (name "tbl") [Nmc "a", Nmc "b"]+> (CopyFilename "filename")+> [CopyFromDelimiter "|"]]+> ,s "copy tbl (a,b) from 'filename' with delimiter '|' parsers 'b=oracle';"+> [CopyFrom ea (name "tbl") [Nmc "a", Nmc "b"]+> (CopyFilename "filename")+> [CopyFromDelimiter "|",CopyFromParsers "b=oracle"]]+> ,s "copy tbl (a,b) from 'filename' with delimiter '|' error_log 'errors.log';"+> [CopyFrom ea (name "tbl") [Nmc "a", Nmc "b"]+> (CopyFilename "filename")+> [CopyFromDelimiter "|",CopyFromErrorLog "errors.log"]]+> ,s "copy tbl (a,b) from 'filename' with delimiter '|' error_log 'errors.log' error_verbosity 1;"+> [CopyFrom ea (name "tbl") [Nmc "a", Nmc "b"]+> (CopyFilename "filename")+> [CopyFromDelimiter "|", CopyFromErrorLog "errors.log", CopyFromErrorVerbosity 1]]+> ,s "copy tbl (a,b) from 'filename' with delimiter '|' error_log 'errors.log' error_verbosity 1 parsers 'b=oracle';"+> [CopyFrom ea (name "tbl") [Nmc "a", Nmc "b"]+> (CopyFilename "filename")+> [CopyFromDelimiter "|", CopyFromErrorLog "errors.log", CopyFromErrorVerbosity 1,CopyFromParsers "b=oracle"]]+> ,s "copy tbl to 'file';"+> [CopyTo ea (CopyTable (name "tbl") []) "file" []]+> ,s "copy tbl(a,b) to 'file';"+> [CopyTo ea (CopyTable (name "tbl") [Nmc "a", Nmc "b"]) "file" []]+> ,s "copy (select * from tbl) to 'file' with format binary;"+> [CopyTo ea (CopyQuery $ makeSelect {selSelectList = sl [si $ Star ea]+> ,selTref = [tref "tbl"]})+> "file" [CopyToFormat "binary"]]+> ]]+> where+> s = ParseStmts defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/FunctionsDdl.lhs view
@@ -0,0 +1,150 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.FunctionsDdl (functionsDdl) where+>+> import Database.HsSqlPpp.Syntax+> import Database.HsSqlPpp.Dialect++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> functionsDdl:: Item+> functionsDdl =+> Group "functionsddl" [+> Group "basics" [+> s "create function t1(text) returns text as $$\n\+> \select a from t1 where b = $1;\n\+> \$$ language sql stable;"+> [CreateFunction ea (name "t1") [ParamDefTp ea $ st "text"]+> (st "text") NoReplace Sql+> (SqlFnBody ea+> [QueryStatement ea $+> makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "t1"]+> ,selWhere = Just $ binop "=" (ei "b") (PositionalArg ea 1)}])+> Stable]+> ,s "create function fn() returns void as $$\n\+> \declare\n\+> \ a int;\n\+> \ b text;\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \$$ language plpgsql volatile;"+> [CreateFunction ea (name "fn") [] (st "void") NoReplace Plpgsql+> (PlpgsqlFnBody ea (Block ea Nothing [varDef "a" (st "int")+> ,varDef "b" (st "text")]+> [NullStatement ea]))+> Volatile]+> ,s "create function fn() returns void as $$\n\+> \declare\n\+> \ a int;\n\+> \ b text;\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \$$ language plpgsql volatile;"+> [CreateFunction ea (name "fn") [] (st "void") NoReplace Plpgsql+> (PlpgsqlFnBody ea+> (Block ea Nothing [varDef "a" (st "int")+> ,varDef "b" (st "text")]+> [NullStatement ea]))+> Volatile]+> ,s "create function fn(a text[]) returns int[] as $$\n\+> \declare\n\+> \ b xtype[] := '{}';\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \$$ language plpgsql immutable;"+> [CreateFunction ea (name "fn")+> [paramDef "a" $ at "text"]+> (at "int") NoReplace Plpgsql+> (PlpgsqlFnBody ea+> (Block ea Nothing+> [varDefv "b" (at "xtype") (stringQ "{}")]+> [NullStatement ea]))+> Immutable]+> ,s "create function fn() returns void as '\n\+> \declare\n\+> \ a int := 3;\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \' language plpgsql stable;"+> [CreateFunction ea (name "fn") [] (st "void") NoReplace Plpgsql+> (PlpgsqlFnBody ea+> (Block ea Nothing+> [varDefv "a" (st "int") (num "3")]+> [NullStatement ea]))+> Stable]+> ,s "create function fn(int) returns void as '\n\+> \declare\n\+> \ a alias for $1;\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \' language plpgsql stable;"+> [CreateFunction ea (name "fn")+> [ParamDefTp ea $ st "int"]+> (st "void") NoReplace Plpgsql+> (PlpgsqlFnBody ea+> (Block ea Nothing+> [ParamAlias ea (Nmc "a") 1]+> [NullStatement ea]))+> Stable]+> ,s "create function fn(b int) returns void as '\n\+> \declare\n\+> \ a alias for b;\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \' language plpgsql stable;"+> [CreateFunction ea (name "fn")+> [ParamDef ea (Nmc "b") $ st "int"]+> (st "void") NoReplace Plpgsql+> (PlpgsqlFnBody ea+> (Block ea Nothing+> [VarAlias ea (Nmc "a") (name "b")]+> [NullStatement ea]))+> Stable]+> ,s "create function fn() returns setof int as $$\n\+> \begin\n\+> \ null;\n\+> \end;\n\+> \$$ language plpgsql stable;"+> [CreateFunction ea (name "fn") []+> (SetOfTypeName ea $ st "int") NoReplace Plpgsql+> (PlpgsqlFnBody ea (Block ea Nothing [] [NullStatement ea]))+> Stable]+> ,s "create function fn() returns void as $$\n\+> \begin\n\+> \ null;\n\+> \end\n\+> \$$ language plpgsql stable;"+> [CreateFunction ea (name "fn") []+> (st "void") NoReplace Plpgsql+> (PlpgsqlFnBody ea (Block ea Nothing [] [NullStatement ea]))+> Stable]+> ,s "create or replace function fn() returns void as $$\n\+> \begin\n\+> \ null;\n\+> \end\n\+> \$$ language plpgsql stable;"+> [CreateFunction ea (name "fn") []+> (st "void") Replace Plpgsql+> (PlpgsqlFnBody ea (Block ea Nothing [] [NullStatement ea]))+> Stable]+> ,s "drop function test(text);"+> [DropFunction ea Require [(name "test",[st "text"])] Restrict]+> ,s "drop function test(int,int);"+> [DropFunction ea Require [(name "test",[st "int"+> ,st "int"])] Restrict]+> ,s "drop function if exists a(),test(text) cascade;"+> [DropFunction ea IfExists [(name "a",[])+> ,(name "test",[st "text"])] Cascade]+> ]]+> where+> s = ParseStmts defaultParseFlags {pfDialect = postgresDialect}
+ tests/Database/HsSqlPpp/Tests/Parsing/Joins.lhs view
@@ -0,0 +1,108 @@+++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.Joins (joins) where+>+> --import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> joins :: Item+> joins =+> Group "joins"+> [q "select a from t1,t2"+> stbl {selTref = [tref "t1", tref "t2"]}+> ,q "select a from t1 natural inner join t2"+> stbl {selTref = [naturalInnerJoin (tref "t1") (tref "t2")]}+> ,q "select a from t1 inner join t2 using (a)"+> stbl {selTref = [usingInnerJoin (tref "t1") (tref "t2") ["a"]]}++todo: these aren't quite right: any join which isn't natural requires+a using or on clause. maybe the syntax should be fixed to represent+this?++> ,q "select a from t1 left outer join t2"+> stbl {selTref = [tjoin (tref "t1") LeftOuter (tref "t2") Nothing]}+> ,q "select a from t1 right outer join t2"+> stbl {selTref = [tjoin (tref "t1") RightOuter (tref "t2") Nothing]}+> ,q "select a from t1 full outer join t2"+> stbl {selTref = [tjoin (tref "t1") FullOuter (tref "t2") Nothing]}+> ,q "select a from t1 cross join t2"+> stbl {selTref = [tjoin (tref "t1") Cross (tref "t2") Nothing]}+> ,q "select a from t1 join t2"+> stbl {selTref = [tjoin (tref "t1") Inner (tref "t2") Nothing]}+> ,q "select a from (b natural join c);"+> stbl {selTref = [tfp $ naturalInnerJoin (tref "b") (tref "c")]}++> ,q "select a from a cross join b cross join c;"+> stbl {selTref = [tjoin+> (tjoin (tref "a") Cross (tref "b") Nothing)+> Cross+> (tref "c") Nothing]}+> ,q "select a from (a cross join b) cross join c;"+> stbl {selTref = [tjoin+> (tfp $ tjoin (tref "a") Cross (tref "b") Nothing)+> Cross+> (tref "c") Nothing]}+> ,q "select a from ((a cross join b) cross join c);"+> stbl {selTref = [tfp $ tjoin+> (tfp $ tjoin (tref "a") Cross (tref "b") Nothing)+> Cross+> (tref "c") Nothing]}++> ,q "select a from a cross join (b cross join c);"+> stbl {selTref = [tjoin+> (tref "a") Cross+> (tfp $ tjoin (tref "b") Cross (tref "c") Nothing)+> Nothing]}++> ,q "select a from (a cross join (b cross join c));"+> stbl {selTref = [tfp $ tjoin+> (tref "a") Cross+> (tfp $ tjoin (tref "b") Cross (tref "c") Nothing)+> Nothing]}++> ,q "select a from ((a cross join b) cross join c) cross join d;"+> stbl {selTref = [tjoin+> (tfp $ tjoin+> (tfp $ tjoin (tref "a") Cross (tref "b") Nothing)+> Cross+> (tref "c") Nothing)+> Cross+> (tref "d") Nothing]}++> ,q "select a from a cross join b cross join c cross join d;"+> stbl {selTref = [tjoin+> (tjoin+> (tjoin (tref "a") Cross (tref "b") Nothing)+> Cross+> (tref "c") Nothing)+> Cross+> (tref "d") Nothing]}+> {-,q "select a from (t cross join u) x"+> stbl {selTref = [TableAlias ea (Nmc "x") $ tfp+> $ (join (tref "t") Cross (tref "u") Nothing)]}+> ,q "select a from (t as t(a, b) cross join u as t(c, d)) as t(a, b, c, d);"+> stbl {selTref = [TableAlias ea (Nmc "x") $ tfp+> $ (join (tref "t") Cross (tref "u") Nothing)]}-}+++> ,q "select a from b\n\+> \ inner join c\n\+> \ on true\n\+> \ inner join d\n\+> \ on 1=1;"+> stbl {selTref = [innerJoin+> (innerJoin (tref "b") (tref "c") (Just lTrue))+> (tref "d") (Just $ binop "=" (num "1") (num "1"))]}+> ]++> where+> stbl = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl"]}+> q = ParseQueryExpr defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/LexerTests.lhs view
@@ -0,0 +1,98 @@++todo:+quickcheck:+generate random symbols+print then parse, check equal+generate random strings++try to parse, if parses, print and check equal to original string++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.LexerTests where++> import Database.HsSqlPpp.Lex+> --import Database.HsSqlPpp.Internals.Dialect+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.Tests.Parsing.Utils++> lexerTests :: Item+> lexerTests = Group "lexing"+> [Lex postgresDialect "'string'" [SqlString "'" "'" "string"]+> ,Lex postgresDialect "E'string\\n'" [SqlString "E'" "'" "string\\n"] -- the \\n is to put a literal \ and n in the string+> ,Lex postgresDialect "E'bsquoteend\\''" [SqlString "E'" "'" "bsquoteend\\'"]+> ,Lex postgresDialect "E'bsquote\\'xx'" [SqlString "E'" "'" "bsquote\\'xx"]+> ,Lex postgresDialect "E'quoteend'''" [SqlString "E'" "'" "quoteend''"]+> ,Lex postgresDialect "E'quote''x'" [SqlString "E'" "'" "quote''x"]+> ,Lex postgresDialect "'normal '' quote'" [SqlString "'" "'" "normal '' quote"]+> ,Lex postgresDialect "'normalendquote '''" [SqlString "'" "'" "normalendquote ''"]+> ,Lex postgresDialect "$$dollar quoting$$" [SqlString "$$" "$$" "dollar quoting"]+> ,Lex postgresDialect "$x$dollar $$ quoting$x$" [SqlString "$x$" "$x$" "dollar $$ quoting"]++identifiers++> ,Lex postgresDialect "test" [Identifier Nothing "test"]+> ,Lex postgresDialect "_test" [Identifier Nothing "_test"]+> ,Lex postgresDialect "\"test test\"" [Identifier (Just ("\"","\"")) "test test"]+> ,Lex postgresDialect "test123" [Identifier Nothing "test123"]+> ,Lex sqlServerDialect "[test \"]" [Identifier (Just ("[","]")) "test \""]+> ,Lex sqlServerDialect "@test" [PrefixedVariable '@' "test"]+> ,Lex sqlServerDialect "#test" [PrefixedVariable '#' "test"]+> ,Lex oracleDialect ":test" [PrefixedVariable ':' "test"]++symbols++> ,Lex postgresDialect "+" [Symbol "+"]+> ,Lex postgresDialect "*" [Symbol "*"]++numbers++> ,Lex postgresDialect "10" [SqlNumber "10"]+> ,Lex postgresDialect ".1" [SqlNumber ".1"]+> ,Lex postgresDialect "5e3" [SqlNumber "5e3"]+> ,Lex postgresDialect "5e+3" [SqlNumber "5e+3"]+> ,Lex postgresDialect "5e-3" [SqlNumber "5e-3"]+> ,Lex postgresDialect "10.2" [SqlNumber "10.2"]+> ,Lex postgresDialect "10.2e7" [SqlNumber "10.2e7"]++whitespace++> ,Lex postgresDialect " " [Whitespace " "]+> ,Lex postgresDialect " " [Whitespace " "]+> ,Lex postgresDialect "\n" [Whitespace "\n"]+> ,Lex postgresDialect "\t" [Whitespace "\t"]++check dots++> ,Lex postgresDialect "a.b" [Identifier Nothing "a"+> ,Symbol "."+> ,Identifier Nothing "b"]++positional arg++> ,Lex postgresDialect "$1" [PositionalArg 1]++line comment++> ,Lex postgresDialect "-- this is a comment\n" [LineComment "-- this is a comment\n"]+> -- check eof with no trailing newline+> ,Lex postgresDialect "-- this is a comment" [LineComment "-- this is a comment"]++block comment++> ,Lex postgresDialect "/* block\ncomment */" [BlockComment "/* block\ncomment */"]+> ,Lex postgresDialect "/* nested /*block*/ comment */" [BlockComment "/* nested /*block*/ comment */"]++splice++> ,Lex postgresDialect "$c(splice)" [Splice 'c' "splice"]++> ,Lex postgresDialect "1 .. 2"+> [SqlNumber "1", Whitespace " ", Symbol ".."+> ,Whitespace " ", SqlNumber "2"]++> ,Lex postgresDialect "1..2"+> [SqlNumber "1", Symbol "..", SqlNumber "2"]+++> ]
+ tests/Database/HsSqlPpp/Tests/Parsing/Misc.lhs view
@@ -0,0 +1,63 @@++The automated tests, uses hunit to check a bunch of text expressions+and sql statements parse to the correct tree, and then checks pretty+printing and then reparsing gives the same tree. The code was mostly+written almost in tdd style, which the order/ coverage of these tests+reflects.++There are no tests for invalid syntax at the moment.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.Misc (misc) where+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> misc :: Item+> misc =+> Group "miscParserTests"+> [Group "multiple statements"+> [s "select 1;\nselect 2;"+> [QueryStatement ea $ makeSelect {selSelectList = sl [si $ num "1"]}+> ,QueryStatement ea $ makeSelect {selSelectList = sl [si $ num "2"]}]+> ]+> ,Group "comments"+> [s "" []+> ,s "-- this is a test" []+> ,s "/* this is\n\+> \a test*/" []+> ,s "select 1;\n\+> \-- this is a test\n\+> \select -- this is a test\n\+> \2;"+> [QueryStatement ea $ makeSelect {selSelectList = sl [si $ num "1"]}+> ,QueryStatement ea $ makeSelect {selSelectList = sl [si $ num "2"]}]+> ,s "select 1;\n\+> \/* this is\n\+> \a test*/\n\+> \select /* this is a test*/2;"+> [QueryStatement ea $ makeSelect {selSelectList = sl [si $ num "1"]}+> ,QueryStatement ea $ makeSelect {selSelectList = sl [si $ num "2"]}]+> ]++--------------------------------------------------------------------------------++ddl statements+++> ,Group "misc"+> [s "SET search_path TO my_schema, public;"+> [Set ea "search_path" [SetId ea "my_schema"+> ,SetId ea "public"]]+> ,s "SET t1 = 3;"+> [Set ea "t1" [SetNum ea 3]]+> ,s "SET t1 = 'stuff';"+> [Set ea "t1" [SetStr ea "stuff"]]+> ,s "create language plpgsql;"+> [CreateLanguage ea "plpgsql"]+> ]+> ]+> where+> s = ParseStmts defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/MiscDdl.lhs view
@@ -0,0 +1,114 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.MiscDdl (miscDdl) where+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> miscDdl:: Item+> miscDdl =+> Group "misc ddl" [+> Group "misc create/alter" [+> s "create database dbname;"+> [CreateDatabase ea (name "dbname")]+> ,s "alter database dbname rename to otherdb;"+> [AlterDatabase ea (name "dbname") (RenameDatabase ea (name "otherdb"))]+> ,s "create view v1 as\n\+> \select a,b from t;"+> [CreateView ea+> (name "v1") Nothing+> (makeSelect+> {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]+> ,selTref = [tref "t"]})]+> ,s "alter view v1 as\n\+> \select a,b from t;"+> [AlterView ea+> (name "v1") Nothing+> (makeSelect+> {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]+> ,selTref = [tref "t"]})]+> ,s "create view v1(c,d) as\n\+> \select a,b from t;"+> [CreateView ea+> (name "v1") (Just [Nmc "c",Nmc "d"])+> (makeSelect+> {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]+> ,selTref = [tref "t"]})]+> ,s "alter view v1(c,d) as\n\+> \select a,b from t;"+> [AlterView ea+> (name "v1") (Just [Nmc "c",Nmc "d"])+> (makeSelect+> {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]+> ,selTref = [tref "t"]})]+> ,s "create domain td as text check (value in ('t1', 't2'));"+> [CreateDomain ea (name "td") (st "text") ""+> (Just (InPredicate ea (ei "value") True+> (InList ea [stringQ "t1" ,stringQ "t2"])))]+> ,s "create type tp1 as (\n\+> \ f1 text,\n\+> \ f2 text\n\+> \);"+> [CreateType ea (name "tp1") [TypeAttDef ea (Nmc "f1") (st "text")+> ,TypeAttDef ea (Nmc "f2") (st "text")]]+>+> ,s "create sequence s start with 5 increment by 4 no maxvalue no minvalue cache 1;"+> [CreateSequence ea (name "s") 4 Nothing Nothing 5 1]+>+> ,s "alter sequence s owned by a.b;"+> [AlterSequence ea (name "s") $ AlterSequenceOwned ea $ qn "a" "b"]+> ,s "alter sequence s rename to s2;"+> [AlterSequence ea (name "s") $ AlterSequenceRename ea $ name "s2"]+> ,s "alter sequence s increment by 2 start with 3;"+> [AlterSequence ea (name "s") $ AlterSequenceActions ea+> $ [AlterSequenceIncrement ea 2,AlterSequenceStart ea 3]]+> ,s "alter sequence s no maxvalue minvalue 1;"+> [AlterSequence ea (name "s") $ AlterSequenceActions ea+> $ [AlterSequenceMax ea Nothing,AlterSequenceMin ea $ Just 1]]+> ,s "alter sequence s cache 2;"+> [AlterSequence ea (name "s") $ AlterSequenceActions ea [AlterSequenceCache ea 2]]+> ,s "alter sequence s restart;"+> [AlterSequence ea (name "s") $ AlterSequenceActions ea [AlterSequenceRestart ea Nothing]]+> ,s "alter sequence s restart with 1;"+> [AlterSequence ea (name "s") $ AlterSequenceActions ea [AlterSequenceRestart ea $ Just 1]]+>+> ,s "create trigger tr\n\+> \after insert or delete on tb\n\+> \for each statement\n\+> \execute procedure fb();"+> [CreateTrigger ea (Nmc "tr") TriggerAfter [TInsert,TDelete]+> (name "tb") EachStatement (name "fb") []]+> ,s "drop trigger\n\+> \if exists tr\n\+> \on tb cascade;"+> [DropTrigger ea IfExists (Nmc "tr") (name "tb") Cascade] +> ,s "drop trigger tr\n\+> \on tb restrict;"+> [DropTrigger ea Require (Nmc "tr") (name "tb") Restrict] +> ]+>+> ,Group "drops" [+> s "drop domain t;"+> [DropSomething ea Domain Require [name "t"] Restrict]+> ,s "drop domain if exists t,u cascade;"+> [DropSomething ea Domain IfExists [name "t", name "u"] Cascade]+> ,s "drop domain t restrict;"+> [DropSomething ea Domain Require [name "t"] Restrict]+>+> ,s "drop type t;"+> [DropSomething ea Type Require [name "t"] Restrict]+> ,s "drop table t;"+> [DropSomething ea Table Require [name "t"] Restrict]+> ,s "drop view t;"+> [DropSomething ea View Require [name "t"] Restrict]+> ,s "drop database dbname;"+> [DropSomething ea Database Require [name "dbname"] Restrict]+> ]]+> where+> s = ParseStmts defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/MiscQueryExprs.lhs view
@@ -0,0 +1,91 @@+++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.MiscQueryExprs (miscQueryExprs) where+>+> --import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax+> import Database.HsSqlPpp.Dialect++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> miscQueryExprs:: Item+> miscQueryExprs =+> Group "misc select statements"+> [s "select 1;"+> $ makeSelect {selSelectList = sl [si $ num "1"]}+> ,s "select a from t;" $ tblat+> ,s "select distinct a from t;" $ tblat {selDistinct = Distinct}+> ,s "select a from t where b=2;"+> $ tblat {selWhere = Just $ binop "=" (ei "b") (num "2")}+> ,s "select a from t where b=2 and c=3;"+> $ tblat {selWhere = Just $ binop "and"+> (binop "=" (ei "b") (num "2"))+> (binop "=" (ei "c") (num "3"))}+> ,s "SELECT T.A::INT FROM TBL AS T;"+> $ makeSelect+> {selSelectList = sl [si $ Cast ea (eqi "T" "A")+> (st "INT")]+> ,selTref = [trefa "TBL" "T"]}+> ,s "select a from t order by a;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsDefault)]}+> ,s "select a from t order by a asc;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsDefault)]}+> ,s "select a from t order by a desc;"+> $ tblat {selOrderBy = [(ei "a",Desc, NullsDefault)]}+> ,s "select a from t order by a,b;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsDefault)+> ,(ei "b",Asc, NullsDefault)]}+> ,s "select a from t order by a asc,b;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsDefault)+> ,(ei "b",Asc, NullsDefault)]}+> ,s "select a from t order by a desc,b;"+> $ tblat {selOrderBy = [(ei "a",Desc, NullsDefault)+> ,(ei "b",Asc, NullsDefault)]}+> ,s "select a from t order by a desc,b desc;"+> $ tblat {selOrderBy = [(ei "a",Desc, NullsDefault)+> ,(ei "b",Desc, NullsDefault)]}+> ,s "select a from t order by a nulls first;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsFirst)]}+> ,s "select a from t order by a nulls last;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsLast)]}+> ,s "select a from t order by a asc nulls first;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsFirst)]}+> ,s "select a from t order by a asc nulls last;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsLast)]}+> ,s "select a from t order by a desc nulls first;"+> $ tblat {selOrderBy = [(ei "a",Desc, NullsFirst)]}+> ,s "select a from t order by a desc nulls last;"+> $ tblat {selOrderBy = [(ei "a",Desc, NullsLast)]}+> ,s "select a from t limit 1;"+> $ tblat {selLimit = Just $ num "1"}+> ,s "select a from t offset 1;"+> $ tblat {selOffset = Just $ num "1"}+> ,s "select a from t order by a limit 1 offset 1;"+> $ tblat {selOrderBy = [(ei "a",Asc, NullsDefault)]+> ,selLimit = Just $ num "1"+> ,selOffset = Just $ num "1"}+> ,s "select (p).x, (p).y from pos;"+> $ makeSelect+> {selSelectList = sl [si $ parenQual (ei "p") (ei "x")+> ,si $ parenQual (ei "p") (ei "y")]+> ,selTref = [tref "pos"]}+> ,s "select ($1).x, ($1).y from pos;"+> $ makeSelect+> {selSelectList = sl+> [si $ member (Parens ea $ PositionalArg ea 1) (ei "x")+> ,si $ member (Parens ea $ PositionalArg ea 1) (ei "y")]+> ,selTref = [tref "pos"]}+> ,s "select right ('test string',5) from t;"+> $ makeSelect+> {selSelectList = sl [si $ App ea (name "right") [stringQ "test string",num "5"]]+> ,selTref = [tref "t"]}+> ]+> where+> s = ParseQueryExpr defaultParseFlags {pfDialect = postgresDialect}+> tblat = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "t"]}
+ tests/Database/HsSqlPpp/Tests/Parsing/OdbcParsing.lhs view
@@ -0,0 +1,178 @@++Odbc comes with some small 'extensions' to sql syntax. The basic idea+is to wrap a few places in SQL where you write ansi standard sql, and+delimit it with a {} pair, and then some simple parser in the odbc+driver can convert this into the dialect specific sql for your+non-ansi-sql supporting product circa 1989. In this way, you can+achieve a little bit of SQL DBMS dialect independence.++I think it is sensible to support the odbc syntax directly in your+main SQL parser instead of in the driver, so here it is.++Summary of ODBC syntax extensions:++Here is microsoft's docs which are OK:++https://msdn.microsoft.com/en-us/library/ms715364(v=vs.85).aspx++1. date, time, and timestamp literals+2. scalar function calls+3. escapes for like strings+4. outer joins+5. calling a procedure++= date, time and timestamp literals++These abstract out the particular formats (because everyone has to put+the years and months in different places, and use slashes or dashes or+dots or whatever).++{d 'yyyy-mm-dd'}+{t 'HH:MM:ss[.f...]}+{ts 'yyyy-mm-dd HH:MM:ss[.f...]'}++The point of this is to have a fixed format for dates/times which the+vendor specific driver vendor can convert into the format expected by+the vendor's sql dbms.++One thing that isn't clear to me is is whitespace allowed between {+and d, or ' and } for instance, and is different whitespace other than+a single space between the d and the ' for instance allowed?++= scalar function calls++{fn scalar-function-call}++e.g.+{fn curdate())}++Note: these can nest, e.g.:++INSERT INTO Orders (OrderID, CustID, OpenDate, SalesPerson, Status)+ VALUES (?, ?, {fn CONVERT({fn CURDATE()}, SQL_DATE)}, ?, ?)++The purpose of these is to take the ansi standard functions, and sql+server/access functions, and the extract operator, which isn't quite a+normal function, and then allow the driver to convert the function+names and arguments into the database specific alternative (e.g. with+a different function name, or the argument order changed).++= escape for a like string++this is the ansi standard:++[ NOT ] LIKE <character pattern> [ ESCAPE <escape character> ]++The odbc syntax to abstract this is:++[ NOT ] LIKE <character pattern> {escape 'escape-character'}++e.g.+like '[[' {escape '['}+->+like '[[' escape [++This isn't currently supported in hssqlppp.++= outer join++This is basically a weird wrapper which allows the driver to replace+'ansi' outer join syntax with the old oracle outer join syntax if this+is what the sql dbms supports. You write something like:++select * from {oj t1 left outer join t1 on t1.a = t2.b}++and then in theory, an older dbms which doesn't support this syntax+can conver this to:++select * from t1,t2 where t1.a(+) = t2.b++I may have got the (+) in the wrong place. In hssqlppp, the {oj ... }+is treated like trefparens:++select * from {oj t1 left outer join t1 on t1.a = t2.b}+is basically the same as+select * from (t1 left outer join t1 on t1.a = t2.b)++= calling a procedure++{[?=]call procedure-name[([parameter][,[parameter]]...)]}++this isn't currently supported in hssqlppp.++There is additional stuff in the typechecking, see the odbc+typechecking tests for more info. The type checker doesn't test the+date/time literals inside the literal like other literals in hssqlppp,+and these are treated as sugar, and oj does nothing, but there is a+bit of work to deal with the functions.++The odbc syntax is currently available in all dialects.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.OdbcParsing (odbcParsing) where+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Dialect++> odbcParsing:: Item+> odbcParsing =+> Group "odbcParsing" [+> Group "datetime" [+> e "{d '2000-01-01'}" (OdbcLiteral ea OLDate "2000-01-01")+> ,e "{t '12:00:01.1'}" (OdbcLiteral ea OLTime "12:00:01.1")+> ,e "{ts '2000-01-01 12:00:01.1'}"+> (OdbcLiteral ea OLTimestamp "2000-01-01 12:00:01.1")+> ]+> ,Group "functions" [+> e "{fn CHARACTER_LENGTH(string_exp)}"+> $ OdbcFunc ea (App ea (name "CHARACTER_LENGTH")+> [ei "string_exp"])+> ,e "{fn EXTRACT(year from my_date)}"+> $ OdbcFunc ea (Extract ea ExtractYear $ ei "my_date")+> ,e "{fn now()}"+> $ OdbcFunc ea (App ea (name "now") [])+> ,e "{fn CONVERT('2000-01-01', SQL_DATE)}"+> $ OdbcFunc ea (App ea (name "CONVERT")+> [StringLit ea "2000-01-01"+> ,ei "SQL_DATE"])+> ,e "{fn CONVERT({fn CURDATE()}, SQL_DATE)}"+> $ OdbcFunc ea (App ea (name "CONVERT")+> [OdbcFunc ea (App ea (name "CURDATE") [])+> ,ei "SQL_DATE"])+> ]+> ,Group "outer join" [+> ParseQueryExpr defaultParseFlags+> "select * from {oj t1 left outer join t2 on true}"+> $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [OdbcTableRef ea (JoinTref ea (tref "t1") Unnatural LeftOuter Nothing+> (tref "t2") (Just $ JoinOn ea (BooleanLit ea True)))]}]+> ,Group "check parsing bugs" [+> ParseQueryExpr defaultParseFlags+> "select {fn CONVERT(cint,SQL_BIGINT)} from t;"+> $ makeSelect+> {selSelectList = sl [si $ OdbcFunc ea (App ea (name "CONVERT")+> [ei "cint"+> ,ei "SQL_BIGINT"])]+> ,selTref = [tref "t"]}]+> ,Group "outer join" [+> tsql "select * from {oj t1 left outer join t2 on true}"+> [QueryStatement ea $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [OdbcTableRef ea (JoinTref ea (tref "t1") Unnatural LeftOuter Nothing+> (tref "t2") (Just $ JoinOn ea (BooleanLit ea True)))]}]]+> ,Group "check parsing bugs" [+> tsql "select {fn CONVERT(cint,SQL_BIGINT)} from t;"+> [QueryStatement ea $ makeSelect+> {selSelectList = sl [si $ OdbcFunc ea (App ea (name "convert")+> [ei "cint"+> ,ei "SQL_BIGINT"])]+> ,selTref = [tref "t"]}]]++> ]+> where+> e = ParseScalarExpr defaultParseFlags+> tsql = ParseProcSql defaultParseFlags {pfDialect=sqlServerDialect}
+ tests/Database/HsSqlPpp/Tests/Parsing/Oracle.lhs view
@@ -0,0 +1,45 @@++Tests for oracle syntax variations++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.Oracle (oracle) where+>+> --import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Dialect++> oracle :: Item+> oracle =+> Group "parse oracle"+> [ora "select unique a from t;"+> [qs $ makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selDistinct = Distinct+> ,selTref = [tref "t"]}]+> ,ora "select count(unique a) from t;"+> [qs $ makeSelect+> {selSelectList =+> sl [si $ AggregateApp ea Distinct (app "count" [ei "a"]) []]+> ,selTref = [tref "t"]}]++TODO: can't turn this into a regular outer join until type checking+since we need to know where the fields come from, so add a new scalar+expression syntax which represents a (+) suffix.++> {-,ora "select a,b from t,u where a=b(+);"+> [qs $ makeSelect+> {selSelectList = sl [sia (eqi "r" "dn") $ QNmc "rg"]+> ,selTref = [tref "tbl"]}]+> ,ora "select a,b from t,u where a(+)=b;"+> [qs $ makeSelect+> {selSelectList = sl [sia (eqi "r" "dn") $ QNmc "rg"]+> ,selTref = [tref "tbl"]}]-}+> ]+> where+> qs = QueryStatement ea+> ora = ParseStmts defaultParseFlags {pfDialect=oracleDialect}
+ tests/Database/HsSqlPpp/Tests/Parsing/ParserTests.lhs view
@@ -0,0 +1,77 @@++The automated tests, uses hunit to check a bunch of text expressions+and sql statements parse to the correct tree, and then checks pretty+printing and then reparsing gives the same tree. The code was mostly+written almost in tdd style, which the order/ coverage of these tests+reflects.++There are no tests for invalid syntax at the moment.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.ParserTests+> (parserTestData+> ,Item(..)+> ) where+>+> --import Data.Generics+> --import Control.Monad+> --import Database.HsSqlPpp.Syntax+> --import Database.HsSqlPpp.Annotation+> --import Database.HsSqlPpp.Parse+> --import Database.HsSqlPpp.Pretty+> --import Database.HsSqlPpp.Utility+>++> --import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.Parsing.ScalarExprs+> import Database.HsSqlPpp.Tests.Parsing.MiscQueryExprs+> import Database.HsSqlPpp.Tests.Parsing.CombineQueryExprs+> import Database.HsSqlPpp.Tests.Parsing.SelectLists+> import Database.HsSqlPpp.Tests.Parsing.TableRefs+> import Database.HsSqlPpp.Tests.Parsing.Joins+> import Database.HsSqlPpp.Tests.Parsing.Schemas++> import Database.HsSqlPpp.Tests.Parsing.Dml+> import Database.HsSqlPpp.Tests.Parsing.Misc++> import Database.HsSqlPpp.Tests.Parsing.CreateTable+> import Database.HsSqlPpp.Tests.Parsing.MiscDdl+> import Database.HsSqlPpp.Tests.Parsing.FunctionsDdl+> import Database.HsSqlPpp.Tests.Parsing.Plpgsql++> import Database.HsSqlPpp.Tests.Parsing.SqlServer+> import Database.HsSqlPpp.Tests.Parsing.Oracle+> import Database.HsSqlPpp.Tests.Parsing.LexerTests+> import Database.HsSqlPpp.Tests.Parsing.OdbcParsing++> --import Control.Applicative+> import Database.HsSqlPpp.Tests.TestTypes+++> --import Database.HsSqlPpp.Tests.TestUtils+> --import Data.Text.Lazy (Text)+> --import qualified Data.Text as T+> --import qualified Data.Text.Lazy as L++> parserTestData :: Item+> parserTestData =+> Group "parserTests" [+> lexerTests+> ,scalarExprs+> ,miscQueryExprs+> ,combineQueryExprs+> ,selectLists+> ,tableRefs+> ,joins+> ,dml+> ,Group "ddl" [createTableTests+> ,miscDdl+> ,functionsDdl]+> ,schemas+> ,pgplsql+> ,misc+> ,sqlServer+> ,oracle+> ,odbcParsing+> ]+
+ tests/Database/HsSqlPpp/Tests/Parsing/Plpgsql.lhs view
@@ -0,0 +1,161 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.Plpgsql (pgplsql) where+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Dialect++> pgplsql :: Item+> pgplsql =+> Group "plpgsql" [+> Group "simple plpgsql statements" [+> f "success := true;"+> [Assignment ea (name "success") lTrue]+> ,f "success = true;"+> [Assignment ea (name "success") lTrue]+> ,f "return true;"+> [Return ea $ Just lTrue]+> ,f "return;"+> [Return ea Nothing]+> ,f "return next 1;"+> [ReturnNext ea $ num "1"]+> ,f "return query select a from b;"+> [ReturnQuery ea $ makeSelect {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "b"]}]+> ,f "raise notice 'stuff %', 1;"+> [Raise ea RNotice "stuff %" [num "1"]]+> ,f "perform test();"+> [Perform ea $ app "test" []]+> ,f "perform test(a,b);"+> [Perform ea $ app "test" [ei "a", ei "b"]]+> ,f "perform test(r.relvar_name || '_and_stuff');"+> [Perform ea $ app "test" [+> binop "||" (eqi "r" "relvar_name")+> (stringQ "_and_stuff")]]+> ,f "select into a,b c,d from e;"+> [Into ea False [name "a", name "b"]+> $ QueryStatement ea+> $ makeSelect {selSelectList = sl [si $ ei "c", si $ ei "d"]+> ,selTref = [tref "e"]}]+> ,f "select c,d into a,b from e;"+> [Into ea False [name "a", name "b"]+> $ QueryStatement ea+> $ makeSelect {selSelectList = sl [si $ ei "c", si $ ei "d"]+> ,selTref = [tref "e"]}]+> ,f "delete from pieces where x = 1 and y = 1 returning tag into r.tag;"+> [Into ea False [qn "r" "tag"]+> $ Delete ea (name "pieces") []+> (Just $ binop "and" (binop "=" (ei "x") (num "1"))+> (binop "=" (ei "y") (num "1")))+> (Just $ sl [si $ ei "tag"])]+> ,f "update pieces\n\+> \set a=b returning tag into r.tag;"+> [Into ea False [qn "r" "tag"]+> $ Update ea (name "pieces")+> [SetClause ea (Nmc "a") $ ei "b"]+> []+> Nothing+> (Just $ sl $ [si $ ei "tag"])]+> ,f "insert into t(a) values (1) returning id into x;"+> [Into ea False [Name ea [Nmc "x"]]+> $ Insert ea+> (name "t")+> [Nmc "a"]+> (Values ea [[num "1"]])+> (Just $ sl [si $ ei "id"])]++> ,f "update t\n\+> \ set x = 1 returning id into z;"+> [Into ea False [Name ea [Nmc "z"]]+> $ Update ea (name "t") [SetClause ea (Nmc "x") $ num "1"]+> [] Nothing (Just $ sl [si $ ei "id"])]++> ,f "execute s;"+> [Execute ea (ei "s")]+> ,f "execute s into r;"+> [Into ea False [Name ea [Nmc "r"]] (Execute ea (ei "s"))]+> ,f "continue;" [ContinueStatement ea Nothing]+> ]+>+> ,Group "other plpgsql statements" [+> f "for r in select a from tbl loop\n\+> \null;\n\+> \end loop;"+> [ForQueryStatement ea Nothing (Nmc "r")+> (makeSelect {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl"]})+> [NullStatement ea]]+> ,f "for r in select a from tbl where true loop\n\+> \null;\n\+> \end loop;"+> [ForQueryStatement ea Nothing (Nmc "r")+> (makeSelect {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl"]+> ,selWhere = Just lTrue})+> [NullStatement ea]]+> ,f "for r in 1 .. 10 loop\n\+> \null;\n\+> \end loop;"+> [ForIntegerStatement ea Nothing (Nmc "r")+> (num "1") (num "10")+> [NullStatement ea]]+> -- catch a bug in lexing where 1..10 is parsed as+> -- num "1.", num ".10", instead of num 1, symbol "..", num 10+> ,f "for r in 1..10 loop\n\+> \null;\n\+> \end loop;"+> [ForIntegerStatement ea Nothing (Nmc "r")+> (num "1") (num "10")+> [NullStatement ea]]+>+> ,f "if a=b then\n\+> \ update c set d = e;\n\+> \end if;"+> [If ea [(binop "=" (ei "a") (ei "b")+> ,[Update ea (name "c") [SetClause ea (Nmc "d")+> $ ei "e"] [] Nothing Nothing])]+> []]+> ,f "if true then\n\+> \ null;\n\+> \else\n\+> \ null;\n\+> \end if;"+> [If ea [(lTrue,[NullStatement ea])]+> [NullStatement ea]]+> ,f "if true then\n\+> \ null;\n\+> \elseif false then\n\+> \ return;\n\+> \end if;"+> [If ea [(lTrue, [NullStatement ea])+> ,(lFalse, [Return ea Nothing])]+> []]+> ,f "if true then\n\+> \ null;\n\+> \elseif false then\n\+> \ return;\n\+> \elsif false then\n\+> \ return;\n\+> \else\n\+> \ return;\n\+> \end if;"+> [If ea [(lTrue, [NullStatement ea])+> ,(lFalse, [Return ea Nothing])+> ,(lFalse, [Return ea Nothing])]+> [Return ea Nothing]]+> ,f "case a\n\+> \ when b then null;\n\+> \ when c,d then null;\n\+> \ else null;\n\+> \end case;"+> [CaseStatementSimple ea (ei "a")+> [([ei "b"], [NullStatement ea])+> ,([ei "c", ei "d"], [NullStatement ea])]+> [NullStatement ea]]+> ]]+> where+> f = ParseProcSql defaultParseFlags {pfDialect=postgresDialect}
+ tests/Database/HsSqlPpp/Tests/Parsing/ScalarExprs.lhs view
@@ -0,0 +1,262 @@++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.ScalarExprs (scalarExprs) where+>+> import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax+> import Database.HsSqlPpp.Dialect++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> scalarExprs:: Item+> scalarExprs =+> Group "parse expressions" [+> Group "numbers" [+> e "42" (num "42")+> ,e "3.5" (num "3.5")+> ,e "4." (num "4.")+> ,e ".001" (num ".001")+> ,e "5e2" (num "5e2")+> ,e "1.925e-3" (num "1.925e-3")++> ]+> ,Group "basic expressions" [+> e "1" (num "1")+> ,e "-1" (prefop "-" $ num "1")+> ,e "1.1" (num "1.1")+> ,e "-1.1" (prefop "-" $ num "1.1")+> ,e " 1 + 1 " (binop "+" (num "1")+> (num "1"))+> ,e "1+1+1" (binop "+" (binop "+" (num "1")+> (num "1"))+> (num "1"))+> ]+> ,Group "parens" [++check some basic parens use wrt naked values and row constructors+these tests reflect how pg seems to interpret the variants.++> e "(1)" (Parens ea (num "1"))+> ,e "row ()" (specop "rowctor" [])+> ,e "row (1)" (specop "rowctor" [num "1"])+> ,e "row (1,2)" (specop "rowctor" [num "1",num "2"])+> ,e "(1,2)" (specop "rowctor" [num "1",num "2"])+> ]+> ,Group "more basic expressions" [++test some more really basic expressions++> e "'test'" (stringQ "test")+> ,e "''" (stringQ "")+> ,e "hello" (ei "hello")+> ,e "helloTest" (ei "helloTest")+> ,e "hello_test" (ei "hello_test")+> ,e "\"this is an identifier\""+> (Identifier ea (Name ea [QNmc "this is an identifier"]))+> ,e "hello1234" (ei "hello1234")+> ,e "true" lTrue+> ,e "false" lFalse+> ,e "null" lNull+> ]+> ,Group "array ctor and selector" [+> e "array[1,2]" (specop "arrayctor" [num "1", num "2"])+> ,e "a[1]" (specop "arraysub" [ei "a", num "1"])+> ]+> ,Group "simple operators" [+> e "1 + tst1" (binop "+" (num "1")+> (ei "tst1"))+> ,e "tst1 + 1" (binop "+" (ei "tst1")+> (num "1"))+> ,e "tst + tst1" (binop "+" (ei "tst")+> (ei "tst1"))+> ,e "'a' || 'b'" (binop "||" (stringQ "a")+> (stringQ "b"))+> ,e "tst | tst1" (binop "|" (ei "tst")+> (ei "tst1"))+> ,e "tst & tst1" (binop "&" (ei "tst")+> (ei "tst1"))+> ,e "tst # tst1" (binop "#" (ei "tst")+> (ei "tst1"))+> ,e "tst << tst1" (binop "<<" (ei "tst")+> (ei "tst1"))+> ,e "tst >> tst1" (binop ">>" (ei "tst")+> (ei "tst1"))+> ,e "~tst" (prefop "~" (ei "tst"))+> ,e "~tst + tst1" (prefop "~" $ binop "+" (ei "tst")+> (ei "tst1"))+> ,e "2 + 1 << 3" (binop "<<" (binop "+" (num "2") (num "1"))+> (num "3"))+> ,e "'stuff'::text"+> (Cast ea (stringQ "stuff") (st "text"))+> ,e "245::float(24)" (Cast ea (num "245") (PrecTypeName ea (name "float") 24))+> ,e "245.1::numeric(5,3)"+> (Cast ea (num "245.1") (Prec2TypeName ea (name "numeric") 5 3))+> ,e "245::double precision"+> (Cast ea (num "245") (st "double precision"))+> ,e "'test'::character varying(6)"+> (Cast ea (StringLit ea "test") (PrecTypeName ea (name "character varying") 6))+> ,e "date '1998-12-01'"+> (TypedStringLit ea (st "date") "1998-12-01")+> ,e "interval '63' day" (Interval ea "63" IntervalDay Nothing)+> ,e "interval '63' day (3)" (Interval ea "63" IntervalDay $ Just 3)+> ,e "interval '63' minute" (Interval ea "63" IntervalMinute Nothing)+> ,e "EXTRACT(year from a)" (Extract ea ExtractYear $ ei "a")+> ,e "a between 1 and 3"+> (specop "between" [ei "a", num "1", num "3"])+> ,e "a between 7 - 1 and 7 + 1"+> (specop "between" [ei "a"+> ,binop "-" (num "7")+> (num "1")+> ,binop "+" (num "7")+> (num "1")])+> ,e "cast(a as text)"+> (Cast ea (ei "a") (st "text"))+> ,e "@ a"+> (prefop "@" (ei "a"))+> ,e "substring(a from 0 for 3)"+> (specop "substring" [ei "a", num "0", num "3"])+> ,e "substring(a from 0 for (5 - 3))"+> (specop "substring" [ei "a"+> ,num "0"+> ,Parens ea (binop "-" (num "5") (num "3"))])+> ,e "substring(a,b,c)"+> (app "substring" [ei "a"+> ,ei "b"+> ,ei "c"])+> ,e "a like b"+> (binop "like" (ei "a") (ei "b"))+> ,e "a rlike b"+> (binop "rlike" (ei "a") (ei "b"))+> ,e "a not like b"+> (binop "notlike" (ei "a") (ei "b"))+> , e "a and b and c and d"+> (binop "and"+> (binop "and"+> (binop "and" (ei "a")+> (ei "b"))+> (ei "c"))+> (ei "d"))+> ]+> ,Group "function calls" [+> e "fn()" (app "fn" [])+> ,e "fn(1)" (app "fn" [num "1"])+> ,e "fn('test')" (app "fn" [stringQ "test"])+> ,e "fn(1,'test')" (app "fn" [num "1", stringQ "test"])+> ,e "fn('test')" (app "fn" [stringQ "test"])+> --- qualified names, check that the . is binding+> -- more tightly than the ()+> ,e "g.f()" $ (App ea (Name ea [Nmc "g", Nmc "f"]) [])+> ,e "h.g.f()" (App ea (Name ea [Nmc "h", Nmc "g", Nmc "f"]) [])+> ]+> ,Group "simple whitespace sanity checks" [+> e "fn (1)" (app "fn" [num "1"])+> ,e "fn( 1)" (app "fn" [num "1"])+> ,e "fn(1 )" (app "fn" [num "1"])+> ,e "fn(1) " (app "fn" [num "1"])+> ]+> ,Group "null stuff" [+> e "not null" (prefop "not" lNull)+> ,e "a is null" (postop "isnull" (ei "a"))+> ,e "a is not null" (postop "isnotnull" (ei "a"))+> ,e "not not true" (prefop "not" $ prefop "not" lTrue)+> ]++> ,Group "case expressions" [+> e [here|+> case when a,b then 3+> when c then 4+> else 5+> end+> |]+> (Case ea [([ei "a", ei "b"], num "3")+> ,([ei "c"], num "4")]+> (Just $ num "5"))+> ,e "case 1 when 2 then 3 else 4 end"+> (CaseSimple ea (num "1")+> [([num "2"], num "3")]+> (Just $ num "4"))+> ]+> ,Group "positional args" [+> e "$1" (PositionalArg ea 1)+> ,e "?" (Placeholder ea)+> ,e "a = ?" (binop "=" (ei "a") (Placeholder ea))+> ]+> ,Group "exists" [+> e "exists (select 1 from a)"+> (Exists ea (makeSelect+> {selSelectList = sl [si $ num "1"]+> ,selTref = [tref "a"]}))++selectFrom [SelExp ea (num "1")]+ (Tref ea (i "a") (NoAlias ea))))++> ]+> ,Group "in variants" [+> e "t in (1,2)"+> (InPredicate ea (ei "t") True (InList ea [num "1",num "2"]))+> ,e "t not in (1,2)"+> (InPredicate ea (ei "t") False (InList ea [num "1",num "2"]))+> ,e "(t,u) in (1,2)"+> (InPredicate ea (specop "rowctor" [ei "t",ei "u"]) True+> (InList ea [num "1",num "2"]))+> ,e "3 = any (array[1,2])"+> (LiftApp ea (name "=")+> LiftAny [num "3"+> ,specop "arrayctor" [num "1"+> ,num "2"]])+> ,e "3 = all (array[1,2,4])"+> (LiftApp ea (name "=")+> LiftAll [num "3"+> ,specop "arrayctor" [num "1"+> ,num "2"+> ,num "4"]])+> ]+> ,Group "comparison operators" [+> e "a < b"+> (binop "<" (ei "a") (ei "b"))+> ,e "a <> b"+> (binop "<>" (ei "a") (ei "b"))+> ,e "a != b"+> (binop "<>" (ei "a") (ei "b"))+> ]++test some string parsing, want to check single quote behaviour,+and dollar quoting, including nesting.++> ,Group "string parsing" [+> e "''" (stringQ "")+> ,e "''''" (stringQ "'")+> ,e "'test'''" (stringQ "test'")+> ,e "'''test'" (stringQ "'test")+> ,e "'te''st'" (stringQ "te'st")+> ,e "$$test$$" (str "test")+> ,e "$$te'st$$" (str "te'st")+> ,e "$st$test$st$" (str "test")+> ,e "$outer$te$$yup$$st$outer$" (str "te$$yup$$st")+> ,e "'spl$$it'" (stringQ "spl$$it")+> ]+> ,Group "bracketed things" [+> e "(p).x" $ parenQual (ei "p") (ei "x")+> ,e "(select f(((a).x, y)::z))"+> (ScalarSubQuery ea+> (makeSelect+> {selSelectList =+> sl [si $ app "f" [Cast ea+> (specop "rowctor"+> [parenQual (ei "a") (ei "x")+> ,ei "y"])+> (st "z")]]}))+> ]+> ,Group "tricky operator parsing" [+> e "2 <>-1"+> $ binop "<>" (num "2") (prefop "-" (num "1"))+> ,e "a <-> b"+> $ binop "<->" (ei "a") (ei "b")+> ]++> ]+> where+> e = ParseScalarExpr defaultParseFlags {pfDialect=postgresDialect}
+ tests/Database/HsSqlPpp/Tests/Parsing/Schemas.lhs view
@@ -0,0 +1,91 @@+> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.Schemas (schemas) where++> import qualified Data.Text as T++> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> schemas :: Item+> schemas =+> Group "schema" [+> Group "ddl - schemas" [+> s "create schema test;"+> [CreateSchema ea+> (name "test")+> Nothing]+> ,s "create schema test authorization owner;"+> [CreateSchema ea+> (name "test")+> (Just $ name "owner")+> ]+> ,Group "drop schema" [ +> s "drop schema test;"+> [DropSomething ea Schema Require [name "test"] Restrict]+> ,s "drop schema if exists test restrict;"+> [DropSomething ea Schema IfExists [name "test"] Restrict]+> ,s "drop schema test cascade;"+> [DropSomething ea Schema Require [name "test"] Cascade]+> ]++> ,Group "alter schema" [ +> s "alter schema test rename to test2;"+> [AlterSchema ea (name "test") $ AlterSchemaName ea (name "test2")]+> ,s "alter schema test owner to new_owner;"+> [AlterSchema ea (name "test") $ AlterSchemaOwner ea (name "new_owner")]+> ]+> ]+> ,Group "ddl - schema-explicit tables" [+> s "create table s.test (\n\+> \ fielda text,\n\+> \ fieldb int\n\+> \);"+> [CreateTable ea+> (nameWithSchema "s" "test")+> [att "fielda" "text"+> ,att "fieldb" "int"+> ]+> []+> Nothing+> NoReplace []]+> ,s "alter table s.a rename to b;"+> [AlterTable ea (nameWithSchema "s" "a") $ RenameTable ea (name "b")]+> ,s "drop table s.t;"+> [DropSomething ea Table Require [nameWithSchema "s" "t"] Restrict]+> ]+> ,Group "ddl - schema-explicit views" [+> s "create view s1.v1 as\n\+> \select a,b from s2.t;"+> [CreateView ea+> (nameWithSchema "s1" "v1") Nothing+> (makeSelect+> {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]+> ,selTref = [trefWithSchema "s2" "t"]})]+> ,s "alter view s1.v1 as\n\+> \select a,b from s2.t;"+> [AlterView ea+> (nameWithSchema "s1" "v1") Nothing+> (makeSelect+> {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]+> ,selTref = [trefWithSchema "s2" "t"]})]+> ,s "drop view s.v;"+> [DropSomething ea View Require [nameWithSchema "s" "v"] Restrict]+> ]+> ,Group "dml - schemas" [+> q "select a from s.t" stbl{selTref = [trefWithSchema "s" "t"]}+> ,q "select a from s1.t1 natural inner join t2"+> stbl {selTref = [naturalInnerJoin (trefWithSchema "s1" "t1") (tref "t2") ]}+> ]+> ]+> where+> s = ParseStmts defaultParseFlags+> stbl = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = []}+> q = ParseQueryExpr defaultParseFlags+> nameWithSchema sc n = Name ea $ [Nmc $ T.unpack sc, Nmc $ T.unpack n]+> trefWithSchema sc t = Tref ea (nameWithSchema sc t)
+ tests/Database/HsSqlPpp/Tests/Parsing/SelectLists.lhs view
@@ -0,0 +1,117 @@+> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.SelectLists (selectLists) where+>+> --import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> selectLists :: Item+> selectLists =+> Group "selectLists"+> [q "select a from tbl" stbl+> ,q "select a,b from tbl"+> $ stbl {selSelectList = sl [si $ ei "a"+> ,si $ ei "b"]}+> ,q "select a as b from tbl"+> $ stbl {selSelectList = sl [sia (ei "a") $ Nmc "b"]}+> ,q "select * from tbl"+> $ stbl {selSelectList = sl [si $ Star ea]}+> ,q "select tbl.* from tbl"+> $ stbl {selSelectList = sl [si $ QStar ea (Nmc "tbl")]}+> ,q "select a + b as b from tbl;"+> $ stbl {selSelectList = sl [sia (binop "+" (ei "a") (ei "b")) $ Nmc "b"]}++> -- window stuff+> ,q "select row_number() over(order by a) as place from tbl;"+> $ stbl+> {selSelectList =+> sl [sia (WindowApp ea+> (app "row_number" [])+> []+> [(ei "a", Asc, NullsDefault)] Nothing)+> $ Nmc "place"]}+> ,q "select row_number() over(order by a asc) as place from tbl;"+> $ stbl+> {selSelectList =+> sl [sia (WindowApp ea+> (app "row_number" [])+> []+> [(ei "a", Asc, NullsDefault)] Nothing)+> $ Nmc "place"]}+> ,q "select row_number() over(order by a desc) as place from tbl;"+> $ stbl+> {selSelectList =+> sl [sia (WindowApp ea+> (app "row_number" [])+> []+> [(ei "a", Desc, NullsDefault)] Nothing)+> $ Nmc "place"]}+> ,q "select row_number()\n\+> \over(partition by a,b order by c) as place\n\+> \from tbl;"+> $ stbl+> {selSelectList = sl [sia (WindowApp ea+> (app "row_number" [])+> [ei "a", ei "b"]+> [(ei "c", Asc, NullsDefault)]+> Nothing)+> (Nmc "place")]}+> ,q "select row_number() over(), x from tbl;"+> $ stbl+> {selSelectList = sl [si $ WindowApp ea+> (app "row_number" [])+> [] [] Nothing+> ,si $ ei "x"]}++aggregates, group by, having++> ,q "select count(distinct b) from tbl;"+> $ stbl {selSelectList =+> sl [si $ AggregateApp ea Distinct (app "count" [ei "b"]) []]}+> ,q "select count(all b) from tbl;"+> $ stbl {selSelectList =+> sl [si $ AggregateApp ea All (app "count" [ei "b"]) []]}+> ,q "select string_agg(distinct relname,',' order by relname1) from tbl;"+> $ stbl {selSelectList =+> sl [si $ AggregateApp ea Distinct+> (app "string_agg" [ei "relname",str ","])+> [(ei "relname1", Asc, NullsDefault)]]}+> ,q "select a, count(b) from tbl group by a;"+> $ stbl {selSelectList =+> sl [si $ ei "a"+> ,si $ app "count" [ei "b"]]+> ,selGroupBy = [ei "a"]}+> ,q "select a, count(b) as cnt from tbl group by a having cnt > 4;"+> $ stbl {selSelectList =+> sl [si $ ei "a"+> ,sia (app "count" [ei "b"]) $ Nmc "cnt"]+> ,selGroupBy = [ei "a"]+> ,selHaving = Just $ binop ">" (ei "cnt") (num "4")}+> ,q "select a from tbl option (partition group);"+> $ stbl {selOption = [QueryHintPartitionGroup]}+> ,q "select a from tbl option (partition group,columnar host group);"+> $ stbl {selOption = [QueryHintPartitionGroup,QueryHintColumnarHostGroup]}+> ,q "select a b from tbl;"+> $ stbl { selSelectList = sl [sia (ei "a") (Nmc "b")] }+> ,q "select a b, b c, c d from tbl;"+> $ stbl { selSelectList = sl [sia (ei "a") (Nmc "b"), sia (ei "b") (Nmc "c"), sia (ei "c") (Nmc "d")] }+> ,q "select a + b b from tbl;"+> $ stbl {selSelectList = sl [sia (binop "+" (ei "a") (ei "b")) $ Nmc "b"]}+> ,q "select row_number() over(order by a) place from tbl;"+> $ stbl+> {selSelectList =+> sl [sia (WindowApp ea+> (app "row_number" [])+> []+> [(ei "a", Asc, NullsDefault)] Nothing)+> $ Nmc "place"]}+> ]+> where+> stbl = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl"]}+> q = ParseQueryExpr defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/SqlServer.lhs view
@@ -0,0 +1,195 @@+++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.SqlServer (sqlServer) where+>+> --import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Dialect++> sqlServer :: Item+> sqlServer =+> Group "parse sql server"+> [s "select top 3 * from a order by c;"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [tref "a"]+> ,selOrderBy = [(ei "c", Asc, NullsDefault)]+> ,selLimit = Just $ num "3"}]+> ,s "select top(3) * from a order by c;"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [tref "a"]+> ,selOrderBy = [(ei "c", Asc, NullsDefault)]+> ,selLimit = Just $ num "3"}]+> ,s "select r.dn as 'rg' from tbl;"+> [qs $ makeSelect+> {selSelectList = sl [sia (eqi "r" "dn") $ QNmc "rg"]+> ,selTref = [tref "tbl"]}]+> ,s "select r.dn as 'check the pretty printing' from tbl;"+> [qs $ makeSelect+> {selSelectList = sl [sia (eqi "r" "dn") $ QNmc "check the pretty printing"]+> ,selTref = [tref "tbl"]}]++syntax for identifiers is:+[[[server.] [database].][schema].] database-object]+so could have+server.db.sc.obj+->+server...obj+=> three dots max++> ,s "select a..b() from t;"+> [qs $ makeSelect+> {selSelectList = sl [SelExp ea (App ea (Name ea [Nmc "a",Nmc "", Nmc "b"])+> [])]+> ,selTref = [tref "t"]}]+> ,s "select a...b() from t;"+> [qs $ makeSelect+> {selSelectList = sl [SelExp ea (App ea (Name ea [Nmc "a",Nmc "", Nmc "", Nmc "b"])+> [])]+> ,selTref = [tref "t"]}]+> ,s "select * from a join x..b;"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [innerJoin (tref "a")+> (Tref ea (Name ea [Nmc "x",Nmc "",Nmc "b"])) Nothing]}]++> ,s "select * from a join x...b;"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [innerJoin (tref "a")+> (Tref ea (Name ea [Nmc "x",Nmc "",Nmc "",Nmc "b"])) Nothing]}]+> ,s "select a from t with(nolock);"+> -- with is just (sort of) recognised, and not parsed to abstract+> -- syntax+> [qs $ makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "t"]}]+> ,s "select a from #tbl;"+> [qs $ makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "#tbl"]}]++> ,s "CREATE TABLE [schema].[table_name](\n\+> \ [fieldname] [typename])"+> $ [CreateTable ea (Name ea [QNmc "schema",QNmc "table_name"])+> [AttributeDef ea (QNmc "fieldname")+> (SimpleTypeName ea (Name ea [QNmc "typename"])) [] []] [] Nothing NoReplace []]++> ,s "select a from t -- no semi colon\n\+> \select b from t"+> $ [qs $ makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "t"]}+> ,qs $ makeSelect+> {selSelectList = sl [si $ ei "b"]+> ,selTref = [tref "t"]}]++> ,s "if 1=1\n\+> \ drop table #temp\n\+> \select b from t"+> $ [If ea [(binop "=" (num "1") (num "1")+> ,[DropSomething ea Table Require [name "#temp"] Restrict])] []+> ,qs $ makeSelect+> {selSelectList = sl [si $ ei "b"]+> ,selTref = [tref "t"]}]++> ,s "declare @nm int"+> $ [DeclareStatement ea [("@nm"+> ,st "int"+> ,Nothing)]]++> ,s "declare @nm int = 3, @nm2 datetime = '1/1/2000'"+> $ [DeclareStatement ea [("@nm"+> ,st "int"+> ,Just (num "3"))+> ,("@nm2"+> ,st "datetime"+> ,Just $ str "1/1/2000")+> ]]++> --,s "set @nm=3"+> -- $ [Assignment ea (name "@nm") (num "3")]+> ,s "select convert (INT,5) from t"+> $ [qs $ makeSelect+> {selSelectList = sl [si $ App ea (name "convert") [ei "INT",num "5"]]+> ,selTref = [tref "t"]}]++todo: add more complex type name++needs to be better: the style is lost, also a bit inconsistent++> ,s "select convert (time,something,108) from t"+> $ [qs $ makeSelect+> {selSelectList = sl [si $ Cast ea (ei "something") (st "time")]+> ,selTref = [tref "t"]}]++> ,s "CREATE NONCLUSTERED INDEX idx ON tbl (col) INCLUDE (Gap)"+> $ [CreateIndexTSQL ea (Nmc "idx") (name "tbl") [Nmc "col"]]++> ,s "CREATE NONCLUSTERED INDEX idx ON [dbo].[#tmp] (col) INCLUDE (Gap)"+> $ [CreateIndexTSQL ea (Nmc "idx")+> (Name ea [QNmc "dbo"+> ,QNmc "#tmp"])+> [Nmc "col"]]+> ,s "select y -@test from t"+> $ [qs $ makeSelect+> {selSelectList = sl [si $ binop "-" (ei "y") (ei "@test")]+> ,selTref = [tref "t"]}]+> ,s "select * from t natural inner hash join u"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [JoinTref ea (tref "t") Natural Inner+> (Just Hash) (tref "u") Nothing]}+> ]+> ,s "select * from t natural inner loop join u"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [JoinTref ea (tref "t") Natural Inner+> (Just Loop) (tref "u") Nothing]}+> ]+> ,s "select * from t natural inner merge join u"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [JoinTref ea (tref "t") Natural Inner+> (Just Merge) (tref "u") Nothing]}+> ]++The following will fail if the words are not marked as keywords+in ParserInternal.lhs++> ,s "select * from t loop join u"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [JoinTref ea (tref "t") Unnatural Inner+> (Just Loop) (tref "u") Nothing]}+> ]++> ,s "select * from t merge join u"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [JoinTref ea (tref "t") Unnatural Inner+> (Just Merge) (tref "u") Nothing]}+> ]++> ,s "select * from t hash join u"+> [qs $ makeSelect+> {selSelectList = sl [si $ Star ea]+> ,selTref = [JoinTref ea (tref "t") Unnatural Inner+> (Just Hash) (tref "u") Nothing]}+> ]++> ]+> where+> s = ParseProcSql defaultParseFlags {pfDialect=sqlServerDialect}+> qs = QueryStatement ea++create index +++parse select into to create table as (do this for postgresql non+ plpgsql also)
+ tests/Database/HsSqlPpp/Tests/Parsing/TableRefs.lhs view
@@ -0,0 +1,46 @@++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}+>+> module Database.HsSqlPpp.Tests.Parsing.TableRefs (tableRefs) where+>+> --import Database.HsSqlPpp.Utils.Here+>+> import Database.HsSqlPpp.Syntax++> import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes++> tableRefs :: Item+> tableRefs =+> Group "tableRefs"+> [q "select a from tbl" stbl+> ,q "select a from sc.tbl"+> stbl {selTref = [qtref "sc" "tbl"]}+> ,q "select a from tbl a"+> stbl {selTref = [trefa "tbl" "a"]}+> ,q "select a from tbl as a"+> stbl {selTref = [trefa "tbl" "a"]}++> ,q "select a from tbl as a(b,c)"+> stbl {selTref = [treffa "tbl" "a" ["b","c"]]}++> ,q "select a from gen();"+> stbl {selTref = [FunTref ea (app "gen" [])]}+> ,q "select a from gen() t;"+> stbl {selTref = [ta $ FunTref ea (app "gen" [])]}+> ,q "select a from gen() as t;"+> stbl {selTref = [ta $ FunTref ea (app "gen" [])]}++> ,q "select a from (select a from tbl) as t;"+> stbl {selTref = [ta $ SubTref ea stbl]}++> ,q "select a from (select a from tbl) t;"+> stbl {selTref = [ta $ SubTref ea stbl]}++> ]+> where+> ta = TableAlias ea (Nmc "t")+> stbl = makeSelect+> {selSelectList = sl [si $ ei "a"]+> ,selTref = [tref "tbl"]}+> q = ParseQueryExpr defaultParseFlags
+ tests/Database/HsSqlPpp/Tests/Parsing/Utils.lhs view
@@ -0,0 +1,163 @@++test item data type++shortcuts for constructing test data and asts++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.Parsing.Utils where++> import Database.HsSqlPpp.Syntax+> --import Database.HsSqlPpp.Lex (Token)+> import Database.HsSqlPpp.Annotation+> import qualified Data.Text as T+> import Data.Text (Text)+> --import qualified Data.Text.Lazy as L+> import Control.Arrow+> --import Database.HsSqlPpp.Internals.Dialect+> --import Database.HsSqlPpp.Tests.TestTypes++> stringQ :: Text -> ScalarExpr+> stringQ = StringLit ea . T.unpack+>+> eqi :: Text -> Text -> ScalarExpr+> eqi c x = Identifier ea $ qn c x++> ei :: Text -> ScalarExpr+> ei j = Identifier ea $ name j+>+> qn :: Text -> Text -> Name+> qn c n = Name ea [Nmc $ T.unpack c, Nmc $ T.unpack n]+>+> sl :: [SelectItem] -> SelectList+> sl = SelectList ea+>+>+> att :: Text -> Text -> AttributeDef+> att n t = AttributeDef ea (Nmc $ T.unpack n) (SimpleTypeName ea $ name t) [] []++> ea :: Annotation+> ea = emptyAnnotation++> name :: Text -> Name+> name n = Name ea [Nmc $ T.unpack n]++> member :: ScalarExpr -> ScalarExpr -> ScalarExpr+> member a b = BinaryOp ea (name ".") a b++> num :: Text -> ScalarExpr+> num n = NumberLit ea $ T.unpack n++> app :: Text -> [ScalarExpr] -> ScalarExpr+> app n as = App ea (name n) as++> specop :: Text -> [ScalarExpr] -> ScalarExpr+> specop n as = SpecialOp ea (name n) as+++> prefop :: Text -> ScalarExpr -> ScalarExpr+> prefop n a = PrefixOp ea (name n) a++> postop :: Text -> ScalarExpr -> ScalarExpr+> postop n a = PostfixOp ea (name n) a++> binop :: Text -> ScalarExpr -> ScalarExpr -> ScalarExpr+> binop n a0 a1 = BinaryOp ea (name n) a0 a1++> lTrue,lFalse,lNull :: ScalarExpr+> lTrue = BooleanLit ea True+> lFalse = BooleanLit ea False+> lNull = NullLit ea++> st :: Text -> TypeName+> st n = SimpleTypeName ea (Name ea [Nmc $ T.unpack n])++> parenQual :: ScalarExpr -> ScalarExpr -> ScalarExpr+> parenQual a b = BinaryOp ea (name ".") (Parens ea a) b++> tref :: Text -> TableRef+> tref s = Tref ea (name s)++> trefa :: Text -> Text -> TableRef+> trefa t a = TableAlias ea (Nmc $ T.unpack a) $ Tref ea (name t)++> treffa :: Text -> Text -> [Text] -> TableRef+> treffa t a cs = FullAlias ea (Nmc $ T.unpack a) (map (Nmc . T.unpack) cs)+> $ Tref ea (name t)+++> qtref :: Text -> Text -> TableRef+> qtref q i = Tref ea (qn q i)++> si :: ScalarExpr -> SelectItem+> si = SelExp ea++> sia :: ScalarExpr -> NameComponent -> SelectItem+> sia e a = SelectItem ea e a+++> str :: Text -> ScalarExpr+> str = StringLit ea . T.unpack++> set :: Text -> ScalarExpr -> SetClause+> set n v = SetClause ea (Nmc $ T.unpack n) v++> varDef :: Text -> TypeName -> VarDef+> varDef nm t = VarDef ea (Nmc $ T.unpack nm) t Nothing++> varDefv :: Text -> TypeName -> ScalarExpr -> VarDef+> varDefv nm t v = VarDef ea (Nmc $ T.unpack nm) t (Just v)++> paramDef :: Text -> TypeName -> ParamDef+> paramDef nm t = ParamDef ea (Nmc $ T.unpack nm) t++> at :: Text -> TypeName+> at = ArrayTypeName ea . st++> innerJoin :: TableRef -> TableRef -> Maybe ScalarExpr -> TableRef+> innerJoin a b o = JoinTref ea a Unnatural Inner Nothing b+> (fmap (JoinOn ea) o)++> naturalInnerJoin :: TableRef -> TableRef -> TableRef+> naturalInnerJoin a b = JoinTref ea a Natural Inner Nothing b Nothing++> usingInnerJoin :: TableRef -> TableRef -> [Text] -> TableRef+> usingInnerJoin a b us = JoinTref ea a Unnatural Inner Nothing b+> (Just $ JoinUsing ea $ map (Nmc . T.unpack) us)++> tjoin :: TableRef -> JoinType -> TableRef -> Maybe ScalarExpr -> TableRef+> tjoin a b c o = JoinTref ea a Unnatural b Nothing c (fmap (JoinOn ea) o)++> with :: [(Text,QueryExpr)] -> QueryExpr -> QueryExpr+> with ws e =+> WithQueryExpr ea+> (map (\(n,ne) -> WithQuery ea (Nmc n) Nothing ne) $ map (first T.unpack) ws)+> e++> tfp :: TableRef -> TableRef+> tfp = TableRefParens ea++new create table stuff++> createTable :: Text -> [AttributeDef] -> Statement+> createTable nm atts = CreateTable ea (name nm) atts [] Nothing NoReplace []++> setTableCons :: Statement -> [Constraint] -> Statement+> setTableCons (CreateTable a nm atts _ p r os) cs = CreateTable a nm atts cs p r os+> setTableCons x _ = error $ "setTableCons called on wrong ctor " ++ show x++> setTablePartition :: Statement -> Maybe TablePartitionDef -> Statement+> setTablePartition (CreateTable a nm atts cs _ r os) p = CreateTable a nm atts cs p r os+> setTablePartition x _ = error $ "setTablePartition called on wrong ctor " ++ show x++> setTableReplace :: Statement -> Replace -> Statement+> setTableReplace (CreateTable a nm atts cs p _ os) r = CreateTable a nm atts cs p r os+> setTableReplace x _ = error $ "setTableReplace called on wrong ctor " ++ show x++> setAttOpts :: AttributeDef -> [TableOption] -> AttributeDef+> setAttOpts (AttributeDef a nm ty cs _) opts = AttributeDef a nm ty cs opts++> setTableOpts :: Statement -> [TableOption] -> Statement+> setTableOpts (CreateTable a nm atts cs p r _) opts = CreateTable a nm atts cs p r opts+> setTableOpts x _ = error $ "settableopts called on wrong ctor " ++ show x++ > setAttributeOpts :: Statement ->
+ tests/Database/HsSqlPpp/Tests/TestTypes.lhs view
@@ -0,0 +1,83 @@+> module Database.HsSqlPpp.Tests.TestTypes (+> defaultParseFlags+> ,defaultTypeCheckFlags+> ,Dialect(..)+> ,ParseFlags(..)+> ,TypeCheckFlags(..)+> ,Item(..)+> --,defaultTemplate1Catalog+> --,ansiCatalog+> ,emptyEnvironment+> ,makeCatalog+> ,hackCanonicalizeEnvTypeNames+> ) where++> import Database.HsSqlPpp.Syntax+> import Database.HsSqlPpp.Lex (Token)+> --import Database.HsSqlPpp.Annotation+> --import qualified Data.Text as T+> --import Data.Text (Text)+> import qualified Data.Text.Lazy as L+> --import Control.Arrow+> --import Test.HUnit+> --import Test.Framework.Providers.HUnit+> --import Test.Framework+> --import Data.List+> import Data.Generics.Uniplate.Data+> import Database.HsSqlPpp.Parse+> import Database.HsSqlPpp.TypeCheck+> --import Database.HsSqlPpp.Annotation+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.Ast hiding (App)+> import Database.HsSqlPpp.Types+> --import Database.HsSqlPpp.Pretty+> -- import Database.HsSqlPpp.Utility+> --import Database.HsSqlPpp.Internals.TypeChecking.Environment+> --import Text.Show.Pretty+> --import Debug.Trace+> --import Database.HsSqlPpp.Tests.TestUtils+> --import Control.Monad++> --import Database.HsSqlPpp.Utils.GroomUtils+> --import qualified Data.Text.Lazy as L+> import Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion2+> import Data.Data+++> data Item = Group String [Item]+> | ParseScalarExpr ParseFlags L.Text ScalarExpr+> | ParseStmts ParseFlags L.Text [Statement]+> | ParseProcSql ParseFlags L.Text [Statement]+> | ParseQueryExpr ParseFlags L.Text QueryExpr+> | Lex Dialect L.Text [Token]+> | TCScalExpr Catalog Environment TypeCheckFlags+> L.Text (Either [TypeError] Type)+> | TCQueryExpr Catalog TypeCheckFlags+> L.Text (Either [TypeError] Type)+> | TCStatements Catalog TypeCheckFlags+> L.Text (Maybe [TypeError])+> | InsertQueryExpr [CatalogUpdate] L.Text (Either [TypeError] Type)+> | RewriteQueryExpr TypeCheckFlags [CatalogUpdate] L.Text L.Text++> | ImpCastsScalar TypeCheckFlags L.Text L.Text+> -- todo: combine this with tcscalexpr+> | ScalarExprExtra Dialect Catalog Environment L.Text (Either [TypeError] TypeExtra)+> | MatchApp Dialect Catalog [NameComponent]+> [(TypeExtra, Maybe LitArg)]+> (Either [TypeError] ([TypeExtra],TypeExtra))+> | Custom String (IO ())++> makeCatalog :: Dialect -> [CatalogUpdate] -> Catalog+> makeCatalog d cus =+> either (error . show) id+> $ updateCatalog (hackCanonicalizeEnvTypeNames d cus) $ diDefaultCatalog d++This takes a type name and canonicalizes it, first by trying to see if+it is the ansi type name and the dialect uses a different name for+that type, and then checks to see if this is a built in alias of a+type for that dialect and gets the canonical name instead.++> hackCanonicalizeEnvTypeNames :: Data a => Dialect -> a -> a+> hackCanonicalizeEnvTypeNames d = transformBi $ \a -> case a of+> s -> maybe (canonicalizeTypeName d s) id $ ansiTypeNameToDialect d s
+ tests/Database/HsSqlPpp/Tests/TestUtils.lhs view
@@ -0,0 +1,426 @@++> module Database.HsSqlPpp.Tests.TestUtils+> (assertTrace,itemToTft) where+>+> import qualified Test.Tasty as T+> import qualified Test.Tasty.HUnit as H+> --import Data.List+> import Data.Generics.Uniplate.Data+> import Data.Data++> import Debug.Trace+> import Control.Monad++> --import Database.HsSqlPpp.Utils.Here+> import Database.HsSqlPpp.Parse+> import Database.HsSqlPpp.Syntax+> import Database.HsSqlPpp.Pretty+> import Database.HsSqlPpp.TypeCheck+> import Database.HsSqlPpp.Annotation+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Utils.GroomUtils+> import Database.HsSqlPpp.Utility+> --import Database.HsSqlPpp.SqlTypes+> --import Database.HsSqlPpp.Utils.PPExpr+> --import Data.Text.Lazy (Text)+> import qualified Data.Text.Lazy as L+> --import qualified Data.Text as T+> import Database.HsSqlPpp.Lex (lexTokens,prettyToken,Token)+> --import Text.Parsec.Text (runParser)+> --import Control.Applicative+> --import Data.Generics.Uniplate.Data+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Internals.TypeChecking.TypeConversion.TypeConversion2++> --import Test.HUnit+> --import Test.Framework.Providers.HUnit+> --import Test.Framework+> --import Data.List+> --import Data.Generics.Uniplate.Data+> --import Database.HsSqlPpp.Parser+> --import Database.HsSqlPpp.TypeChecker+> --import Database.HsSqlPpp.Annotation+> --import Database.HsSqlPpp.Catalog+> --import Database.HsSqlPpp.Ast hiding (App)+> import Database.HsSqlPpp.Types+> --import Database.HsSqlPpp.Pretty+> --import Database.HsSqlPpp.Utility+> --import Database.HsSqlPpp.Internals.TypeChecking.Environment+> --import Text.Show.Pretty+> --import Debug.Trace+> --import Database.HsSqlPpp.Tests.TestUtils+> --import Control.Monad++> --import Database.HsSqlPpp.Utils.GroomUtils++> --import qualified Data.Text.Lazy as L+> import Database.HsSqlPpp.Dialect++> assertTrace :: (Show a,Eq a) => String -> String -> a -> a -> IO ()+> assertTrace nem s a1 a2 = do+> when (a1 /= a2) $ trace nem $ return ()+> H.assertEqual s a1 a2++> itemToTft :: Item -> T.TestTree+> itemToTft (ParseScalarExpr f a b) = testParseScalarExpr f a b+> itemToTft (ParseQueryExpr f a b) = testParseQueryExpr f a b+> --itemToTft (ParseProcSql f a b) = testParseProcSql f a b+> itemToTft (ParseStmts f a b) = testParseStatements f a b+> itemToTft (ParseProcSql f a b) = testParseProcSql f a b+> {-itemToTft (TSQL a b) =+> testParsePlpgsqlStatements (if True+> then SQLServer+> else PostgreSQL) a b-}+> {-itemToTft (OracleX a b) =+> testParsePlpgsqlStatements Oracle a b -}+> --itemToTft (MSStmt a b) = testParseStatements a b+> itemToTft (Group s is) = T.testGroup s $ map itemToTft is+> itemToTft (Lex d a b) = testLex d a b++> itemToTft (TCScalExpr c e f s r) = testTCScalarExpr c e f s r+> itemToTft (TCQueryExpr cat f s r) = testQueryExprType cat f s r+> itemToTft (TCStatements cat f s r) = testStatementsTypecheck cat f s r+> itemToTft (InsertQueryExpr cus s r) = testInsertQueryExprType sqlServerDialect {-PostgreSQL-} cus s r+> --itemToTft (TSQLQueryExpr cus s r) = undefined --testQueryExprType SQLServer cus s r+> --itemToTft (OracleQueryExpr cus s r) = undefined --testQueryExprType Oracle cus s r+> itemToTft (RewriteQueryExpr f cus s s') = testRewrite f cus s s'++> itemToTft (ImpCastsScalar f s s') = testImpCastsScalar f s s'+> itemToTft (ScalarExprExtra d cat env s r) = testScalarExprTypeExtra d cat env s r+> itemToTft (MatchApp d cat f as r) = testMatchApp d cat f as r+> itemToTft (Custom nm f) = H.testCase nm f++> testParseScalarExpr :: ParseFlags -> L.Text -> ScalarExpr -> T.TestTree+> testParseScalarExpr f src ast =+> parseUtil src ast (parseScalarExpr f "" Nothing)+> (parseScalarExpr f "" Nothing)+> (prettyScalarExpr+> defaultPrettyFlags {ppDialect = pfDialect f} )+> testParseQueryExpr :: ParseFlags -> L.Text -> QueryExpr -> T.TestTree+> testParseQueryExpr f src ast =+> parseUtil src ast (parseQueryExpr f "" Nothing)+> (parseQueryExpr f "" Nothing)+> (prettyQueryExpr defaultPrettyFlags {ppDialect = pfDialect f})++>+> testParseStatements :: ParseFlags -> L.Text -> [Statement] -> T.TestTree+> testParseStatements flg src ast =+> let parse = parseStatements flg "" Nothing+> pp = prettyStatements defaultPrettyFlags {ppDialect=pfDialect flg}+> in parseUtil src ast parse parse pp++> testParseProcSql :: ParseFlags -> L.Text -> [Statement] -> T.TestTree+> testParseProcSql flg src ast =+> let parse = parseProcSQL flg "" Nothing+> pp = prettyStatements defaultPrettyFlags {ppDialect=pfDialect flg}+> in parseUtil src ast parse parse pp++>+>+> parseUtil :: (Show t, Eq b, Show b, Data b) =>+> L.Text+> -> b+> -> (L.Text -> Either t b)+> -> (L.Text -> Either t b)+> -> (b -> L.Text)+> -> T.TestTree+> parseUtil src ast parser reparser printer = H.testCase ("parse " ++ L.unpack src) $+> case parser src of+> Left er -> H.assertFailure $ show er+> Right ast' -> do+> when (ast /= resetAnnotations ast') $ do+> putStrLn $ groomNoAnns ast+> putStrLn $ groomNoAnns $ resetAnnotations ast'+> H.assertEqual ("parse " ++ L.unpack src) ast $ resetAnnotations ast'+> case reparser (printer ast) of+> Left er -> H.assertFailure $ "reparse\n" ++ (L.unpack $ printer ast) ++ "\n" ++ show er ++ "\n" -- ++ pp ++ "\n"+> Right ast'' -> H.assertEqual ("reparse: " ++ L.unpack (printer ast)) ast $ resetAnnotations ast''++> testLex :: Dialect -> L.Text -> [Token] -> T.TestTree+> testLex d t r = H.testCase ("lex "++ L.unpack t) $ do+> let x = lexTokens d "" Nothing t+> y = either (error . show) id x+> H.assertEqual "lex" r (map snd y)+> let t' = L.concat $ map (L.pack . prettyToken d) r+> H.assertEqual "lex . pretty" t t'++> testTCScalarExpr :: Catalog -> Environment -> TypeCheckFlags+> -> L.Text -> Either [TypeError] Type -> T.TestTree+> testTCScalarExpr cat env f src et =+> H.testCase ("typecheck " ++ L.unpack src) $ do+> let ast = case parseScalarExpr defaultParseFlags {pfDialect = tcfDialect f} "" Nothing src of+> Left e -> error $ show e+> Right l -> l+> aast = typeCheckScalarExpr f cat+> (canonicalizeEnvTypes (tcfDialect f) env)+> $ canonicalizeTypes (tcfDialect f) ast+> (ty,errs,noTypeQEs,noTypeSEs) = tcTreeInfo aast+> er = concatMap fst errs+> got = case () of+> _ | null er -> maybe (Left []) (Right . teType) ty+> | otherwise -> Left er+> allTyped = case et of+> Left _ -> True -- don't check if everything is typed+> -- if expecting a type error+> Right _ -> null noTypeSEs && null noTypeQEs+> unless allTyped $+> trace ("MISSING TYPES: " ++ groomTypes aast)+> $ H.assertBool "" allTyped+> unless (et == got) $ trace (groomTypes aast) $ return ()+> H.assertEqual "" et got++> testScalarExprTypeExtra:: Dialect -> Catalog -> Environment -> L.Text+> -> Either [TypeError] TypeExtra+> -> T.TestTree+> testScalarExprTypeExtra d cat env src ete = H.testCase ("typecheck " ++ L.unpack src) $ do+> let ast = case parseScalarExpr defaultParseFlags {pfDialect = d} "" Nothing src of+> Left e -> error $ show e+> Right l -> l+> aast = typeCheckScalarExpr defaultTypeCheckFlags {tcfDialect = d} cat+> (canonicalizeEnvTypes d env)+> $ canonicalizeTypes d ast+> (ty,errs,noTypeQEs,noTypeSEs) = tcTreeInfo aast+> er = concatMap fst errs+> got = case () of+> _ | null er -> maybe (Left []) Right ty+> | otherwise -> Left er+> allTyped = case ete of+> Left _ -> True -- don't check if everything is typed+> -- if expecting a type error+> Right _ -> null noTypeSEs && null noTypeQEs+> unless allTyped $+> trace ("MISSING TYPES: " ++ groomTypes aast)+> $ H.assertBool "" allTyped+> unless (ete == got) $ trace (groomTypes aast) $ return ()+> H.assertEqual "" ete got++> testImpCastsScalar :: TypeCheckFlags -> L.Text -> L.Text -> T.TestTree+> testImpCastsScalar f src wsrc = H.testCase ("typecheck " ++ L.unpack src) $+> let ast = case parseScalarExpr defaultParseFlags {pfDialect = tcfDialect f} "" Nothing src of+> Left e -> error $ show e+> Right l -> l+> aast = typeCheckScalarExpr f (diDefaultCatalog postgresDialect) emptyEnvironment+> $ canonicalizeTypes (tcfDialect f) ast+> aast' = addExplicitCasts aast+> wast = case parseScalarExpr defaultParseFlags {pfDialect = tcfDialect f} "" Nothing wsrc of+> Left e -> error $ show e+> Right l -> l+> in (if (resetAnnotations aast') /= (resetAnnotations wast)+> then trace ("\n***************** got: \n"+> ++ L.unpack (prettyScalarExpr defaultPrettyFlags aast')+> ++ "\nwanted:\n" ++ L.unpack (prettyScalarExpr defaultPrettyFlags wast)+> ++ "\n*****************\n"+> ++ "\n***************** got: \n"+> ++ groomNoAnns aast'+> ++ "\nwanted:\n" ++ groomNoAnns wast+> ++ "\n*****************\n"+> )+> else id) $ H.assertEqual "" (resetAnnotations aast') (resetAnnotations wast)+++> testQueryExprType :: Catalog -> TypeCheckFlags+> -> L.Text -> Either [TypeError] Type -> T.TestTree+> testQueryExprType cat f src et =+> H.testCase ("typecheck " ++ L.unpack src) $ do+> let ast = case parseQueryExpr+> defaultParseFlags {pfDialect = tcfDialect f}+> "" Nothing src of+> Left e -> error $ show e+> Right l -> l+> {-Right cat = updateCatalog cus $ case dl of+> PostgreSQL -> defaultTemplate1Catalog+> SQLServer -> defaultTSQLCatalog+> Oracle -> defaultTSQLCatalog-}+> {-flg = case dl of+> PostgreSQL -> defaultTypeCheckFlags+> SQLServer -> defaultTypeCheckFlags {tcfDialect = SQLServer}+> Oracle -> defaultTypeCheckFlags {tcfDialect = Oracle}-}+> aast = typeCheckQueryExpr f cat+> $ canonicalizeTypes (tcfDialect f) ast+> (ty,errs,noTypeQEs,noTypeSEs) = tcTreeInfo aast+> er = concatMap fst errs+> got :: Either [TypeError] Type+> got = case () of+> _ | null er -> maybe (Left []) (Right . teType) ty+> | otherwise -> Left er+> allTyped = case et of+> Left _ -> True -- don't check if everything is typed+> -- if expecting a type error+> Right _ -> null noTypeSEs && null noTypeQEs+> unless allTyped $+> trace ("MISSING TYPES: " ++ groomTypes aast)+> $ H.assertBool "" allTyped+> unless (et == got) $ trace (groomTypes aast) $ return ()+> H.assertEqual "" et got+> --queryExprRewrites cus src et++> testStatementsTypecheck :: Catalog -> TypeCheckFlags -> L.Text -> Maybe [TypeError] -> T.TestTree+> testStatementsTypecheck cat f src et =+> H.testCase ("typecheck " ++ L.unpack src) $ do+> let ast = case parseStatements defaultParseFlags {pfDialect = tcfDialect f} "" Nothing src of+> Left e -> error $ show e+> Right l -> l+> {-Right cat = updateCatalog cus $ case dl of+> PostgreSQL -> defaultTemplate1Catalog+> SQLServer -> defaultTSQLCatalog+> Oracle -> defaultTSQLCatalog+> flg = case dl of+> PostgreSQL -> defaultTypeCheckFlags+> SQLServer -> defaultTypeCheckFlags {tcfDialect = SQLServer}+> Oracle -> defaultTypeCheckFlags {tcfDialect = Oracle}-}+> (_,aast) = typeCheckStatements f cat+> $ canonicalizeTypes (tcfDialect f) ast+> (_,errs,noTypeQEs,noTypeSEs) = tcTreeInfo aast+> er = concatMap fst errs+> got :: Maybe [TypeError]+> got = case () of+> _ | null er -> Nothing+> | otherwise -> Just er+> allTyped = case et of+> Just _ -> True -- don't check if everything is typed+> -- if expecting a type error+> Nothing -> null noTypeSEs && null noTypeQEs+> unless allTyped $+> trace ("MISSING TYPES: " ++ groomTypes aast)+> $ H.assertBool "" allTyped+> unless (et == got) $ trace (groomTypes aast) $ return ()+> H.assertEqual "" et got+> --queryExprRewrites cus src et+++> testInsertQueryExprType :: Dialect -> [CatalogUpdate] -> L.Text -> Either [TypeError] Type -> T.TestTree+> testInsertQueryExprType dl cus src et = H.testCase ("typecheck " ++ L.unpack src) $ do+> let cat = makeCatalog dl cus+> flg = defaultTypeCheckFlags {tcfDialect = dl}+> asts = either (error . show) id $ parseStatements defaultParseFlags "" Nothing src+> Insert _ _ _ q _ = extractInsert $ snd $ typeCheckStatements flg cat+> $ canonicalizeTypes (tcfDialect flg) asts+> q' = addImplicitCasts cat q+> q'' = typeCheckQueryExpr flg cat q'+> (ty,errs,noTypeQEs,noTypeSEs) = tcTreeInfo q''+> er = concatMap fst errs+> got :: Either [TypeError] Type+> got = case () of+> _ | null er -> maybe (Left []) (Right . teType) ty+> | otherwise -> Left er+> allTyped = case et of+> Left _ -> True -- don't check if everything is typed+> -- if expecting a type error+> Right _ -> null noTypeSEs && null noTypeQEs+> unless allTyped $+> trace ("MISSING TYPES: " ++ groomTypes q'')+> $ H.assertBool "" allTyped+> unless (et == got) $ trace (groomTypes q'') $ return ()+> H.assertEqual "" et got+> where+> extractInsert [i@Insert{}] = i+> extractInsert x = error $ "expected a single insert statement, got " ++ groomTypes x++rewrite the queryexpr with all the options true++pretty print, then check that the resultant sql parses the same, and+type checks properly and produces the same type++> _queryExprRewrites :: [CatalogUpdate] -> L.Text -> Either [TypeError] Type -> IO () --Test.Framework.Test+> _queryExprRewrites cus src et = {-testCase ("rewrite expanded " ++ src) $-} do+> let ast = case parseQueryExpr defaultParseFlags "" Nothing src of+> Left e -> error $ "parse: " ++ L.unpack src ++ "\n" ++ show e+> Right l -> l+> let cat = makeCatalog postgresDialect cus+> aast = typeCheckQueryExpr+> defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfAddSelectItemAliases = True+> ,tcfExpandStars = True+> ,tcfAddFullTablerefAliases = True}+> cat $ canonicalizeTypes+> (tcfDialect defaultTypeCheckFlags) ast+> ty = anType $ getAnnotation aast+> -- print with rewritten tree+> pp = prettyQueryExpr defaultPrettyFlags aast+> astrw = case parseQueryExpr defaultParseFlags "" Nothing pp of+> Left e -> error $ "parse: " ++ L.unpack pp ++ "\n" ++ show e+> Right l -> l+> aastrw = typeCheckQueryExpr+> defaultTypeCheckFlags+> cat $ canonicalizeTypes+> (tcfDialect defaultTypeCheckFlags) astrw+> tyrw = anType $ getAnnotation aast+> H.assertEqual "rewrite pp . parse" (resetAnnotations aast) (resetAnnotations aastrw)+> H.assertEqual "rewrite ty" ty tyrw+> let (_,errs,noTypeQEs,noTypeSEs) = tcTreeInfo aast+> er = concatMap fst errs+> allTyped = case et of+> Left _ -> True -- don't check if everything is typed+> -- if expecting a type error+> Right _ -> null noTypeSEs && null noTypeQEs+> unless (null er) $+> trace ("errors in tree: " ++ groomTypes aastrw)+> $ H.assertBool "" (null er)+> unless allTyped $+> trace ("MISSING TYPES: " ++ groomTypes aastrw)+> $ H.assertBool "" allTyped+++++> testRewrite :: TypeCheckFlags -> [CatalogUpdate] -> L.Text -> L.Text+> -> T.TestTree+> testRewrite f cus src src' = H.testCase ("rewrite " ++ L.unpack src) $ do+> let ast = case parseQueryExpr defaultParseFlags {pfDialect = tcfDialect f}+> "" Nothing src of+> Left e -> error $ show e+> Right l -> l+> cat = makeCatalog (tcfDialect f) cus+> aast = typeCheckQueryExpr f cat ast+> astrw = resetAnnotations aast+> ast' = case parseQueryExpr defaultParseFlags "" Nothing src' of+> Left e -> error $ show e+> Right l -> resetAnnotations l+> (if astrw /= ast'+> then trace ("\n***************** expected\n" +++> L.unpack (prettyQueryExpr defaultPrettyFlags ast')+> ++ "\n" ++ L.unpack (prettyQueryExpr defaultPrettyFlags astrw)+> ++ "\n\n" ++ groomTypes ast'+> ++ "\n\n" ++ groomTypes astrw+> ++ "\n***************** got\n")+> else id) $ H.assertEqual "" ast' astrw+> -- check second rewrite is idempotent+> {-let astrw2 = resetAnnotations $ typeCheckQueryExpr f cat astrw+> (if astrw /= astrw2+> then trace ("\nSECOND REWRITE\n***************** expected\n" +++> prettyQueryExpr defaultPrettyFlags astrw+> ++ "\n" ++ prettyQueryExpr defaultPrettyFlags astrw2+> ++ "\n\n" ++ groomTypes astrw+> ++ "\n\n" ++ groomTypes astrw2+> ++ "\n***************** got\n")+> else id) $ assertEqual "second rewrite" astrw astrw2-}+++> testMatchApp :: Dialect -> Catalog -> [NameComponent]+> -> [(TypeExtra, Maybe LitArg)]+> -> (Either [TypeError] ([TypeExtra],TypeExtra))+> -> T.TestTree+> testMatchApp d cat f as r = H.testCase (show f ++ show as) $+> H.assertEqual "" r $ matchApp d cat f as+++> canonicalizeTypes :: Data a => Dialect -> a -> a+> canonicalizeTypes d = transformBi $ \x -> case x of+> ScalarType t -> ScalarType $ canonicalizeTypeName d t+> _ -> x++> canonicalizeEnvTypes :: Data a => Dialect -> a -> a+> canonicalizeEnvTypes d = transformBi $ \x -> case x of+> TypeExtra (ScalarType t) p s n ->+> TypeExtra (ScalarType $ canonicalizeTypeName d t) p s n+> _ -> x++~~~~+TODO+new idea for testing:+parsesql -> ast1+parse, pretty print, parse -> ast2+load into pg, pg_dump, parse -> ast3+parse, pretty print, load into pg, pg_dump, parse -> ast4+check all these asts are the same+~~~~
+ tests/Database/HsSqlPpp/Tests/Tests.lhs view
@@ -0,0 +1,15 @@++> module Database.HsSqlPpp.Tests.Tests (allTests) where+>+> import Test.Tasty+>+> import Database.HsSqlPpp.Tests.Parsing.ParserTests++> import Database.HsSqlPpp.Tests.TypeChecking.TypeCheckTests++> import Database.HsSqlPpp.Tests.TestUtils++> allTests :: [TestTree]+> allTests = map itemToTft+> [parserTestData+> ,typeCheckTestData]
+ tests/Database/HsSqlPpp/Tests/TpchData.lhs view
@@ -0,0 +1,975 @@++> {-# LANGUAGE QuasiQuotes,OverloadedStrings #-}++> module Database.HsSqlPpp.Tests.TpchData+> (tpchQueries+> ,tpchCatalog) where+>++> import Database.HsSqlPpp.Utils.Here+> import Database.HsSqlPpp.Catalog+> --import Database.HsSqlPpp.Types++> tpchQueries :: [(String,String)]+> tpchQueries =+> [("Q1",[here|+\begin{code}+select+ l_returnflag,+ l_linestatus,+ sum(l_quantity) as sum_qty,+ sum(l_extendedprice) as sum_base_price,+ sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,+ sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,+ avg(l_quantity) as avg_qty,+ avg(l_extendedprice) as avg_price,+ avg(l_discount) as avg_disc,+ count(*) as count_order+from+ lineitem+where+ l_shipdate <= date '1998-12-01' - interval '63' day (3)+group by+ l_returnflag,+ l_linestatus+order by+ l_returnflag,+ l_linestatus;+--set rowcount -1+--go+\end{code}+> |])+> ,("Q2",[here|+\begin{code}++select+ s_acctbal,+ s_name,+ n_name,+ p_partkey,+ p_mfgr,+ s_address,+ s_phone,+ s_comment+from+ part,+ supplier,+ partsupp,+ nation,+ region+where+ p_partkey = ps_partkey+ and s_suppkey = ps_suppkey+ and p_size = 15+ and p_type like '%BRASS'+ and s_nationkey = n_nationkey+ and n_regionkey = r_regionkey+ and r_name = 'EUROPE'+ and ps_supplycost = (+ select+ min(ps_supplycost)+ from+ partsupp,+ supplier,+ nation,+ region+ where+ p_partkey = ps_partkey+ and s_suppkey = ps_suppkey+ and s_nationkey = n_nationkey+ and n_regionkey = r_regionkey+ and r_name = 'EUROPE'+ )+order by+ s_acctbal desc,+ n_name,+ s_name,+ p_partkey;+--set rowcount 100+--go+\end{code}+> |])+> ,("Q3",[here|+\begin{code}+select+ l_orderkey,+ sum(l_extendedprice * (1 - l_discount)) as revenue,+ o_orderdate,+ o_shippriority+from+ customer,+ orders,+ lineitem+where+ c_mktsegment = 'MACHINERY'+ and c_custkey = o_custkey+ and l_orderkey = o_orderkey+ and o_orderdate < date '1995-03-21'+ and l_shipdate > date '1995-03-21'+group by+ l_orderkey,+ o_orderdate,+ o_shippriority+order by+ revenue desc,+ o_orderdate;+--set rowcount 10+--go+\end{code}+> |])+> ,("Q4",[here|+\begin{code}+select+ o_orderpriority,+ count(*) as order_count+from+ orders+where+ o_orderdate >= date '1996-03-01'+ and o_orderdate < date '1996-03-01' + interval '3' month+ and exists (+ select+ *+ from+ lineitem+ where+ l_orderkey = o_orderkey+ and l_commitdate < l_receiptdate+ )+group by+ o_orderpriority+order by+ o_orderpriority;+--set rowcount -1+--go+\end{code}+> |])+> ,("Q5",[here|+\begin{code}+select+ n_name,+ sum(l_extendedprice * (1 - l_discount)) as revenue+from+ customer,+ orders,+ lineitem,+ supplier,+ nation,+ region+where+ c_custkey = o_custkey+ and l_orderkey = o_orderkey+ and l_suppkey = s_suppkey+ and c_nationkey = s_nationkey+ and s_nationkey = n_nationkey+ and n_regionkey = r_regionkey+ and r_name = 'EUROPE'+ and o_orderdate >= date '1997-01-01'+ and o_orderdate < date '1997-01-01' + interval '1' year+group by+ n_name+order by+ revenue desc;+--set rowcount -1+--go+\end{code}+> |])+> ,("Q6",[here|+\begin{code}+select+ sum(l_extendedprice * l_discount) as revenue+from+ lineitem+where+ l_shipdate >= date '1997-01-01'+ and l_shipdate < date '1997-01-01' + interval '1' year+ and l_discount between 0.07 - 0.01 and 0.07 + 0.01+ and l_quantity < 24;+--set rowcount -1+--go+\end{code}+> |])+> ,("Q7",[here|+\begin{code}+select+ supp_nation,+ cust_nation,+ l_year,+ sum(volume) as revenue+from+ (+ select+ n1.n_name as supp_nation,+ n2.n_name as cust_nation,+ extract(year from l_shipdate) as l_year,+ l_extendedprice * (1 - l_discount) as volume+ from+ supplier,+ lineitem,+ orders,+ customer,+ nation n1,+ nation n2+ where+ s_suppkey = l_suppkey+ and o_orderkey = l_orderkey+ and c_custkey = o_custkey+ and s_nationkey = n1.n_nationkey+ and c_nationkey = n2.n_nationkey+ and (+ (n1.n_name = 'PERU' and n2.n_name = 'IRAQ')+ or (n1.n_name = 'IRAQ' and n2.n_name = 'PERU')+ )+ and l_shipdate between date '1995-01-01' and date '1996-12-31'+ ) as shipping+group by+ supp_nation,+ cust_nation,+ l_year+order by+ supp_nation,+ cust_nation,+ l_year;+--set rowcount -1+--go+\end{code}+> |])+> ,("Q8",[here|+\begin{code}+select+ o_year,+ sum(case+ when nation = 'IRAQ' then volume+ else 0+ end) / sum(volume) as mkt_share+from+ (+ select+ extract(year from o_orderdate) as o_year,+ l_extendedprice * (1 - l_discount) as volume,+ n2.n_name as nation+ from+ part,+ supplier,+ lineitem,+ orders,+ customer,+ nation n1,+ nation n2,+ region+ where+ p_partkey = l_partkey+ and s_suppkey = l_suppkey+ and l_orderkey = o_orderkey+ and o_custkey = c_custkey+ and c_nationkey = n1.n_nationkey+ and n1.n_regionkey = r_regionkey+ and r_name = 'MIDDLE EAST'+ and s_nationkey = n2.n_nationkey+ and o_orderdate between date '1995-01-01' and date '1996-12-31'+ and p_type = 'STANDARD ANODIZED BRASS'+ ) as all_nations+group by+ o_year+order by+ o_year;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q9",[here|+\begin{code}+++select+ nation,+ o_year,+ sum(amount) as sum_profit+from+ (+ select+ n_name as nation,+ extract(year from o_orderdate) as o_year,+ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount+ from+ part,+ supplier,+ lineitem,+ partsupp,+ orders,+ nation+ where+ s_suppkey = l_suppkey+ and ps_suppkey = l_suppkey+ and ps_partkey = l_partkey+ and p_partkey = l_partkey+ and o_orderkey = l_orderkey+ and s_nationkey = n_nationkey+ and p_name like '%antique%'+ ) as profit+group by+ nation,+ o_year+order by+ nation,+ o_year desc;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q10",[here|+\begin{code}+++select+ c_custkey,+ c_name,+ sum(l_extendedprice * (1 - l_discount)) as revenue,+ c_acctbal,+ n_name,+ c_address,+ c_phone,+ c_comment+from+ customer,+ orders,+ lineitem,+ nation+where+ c_custkey = o_custkey+ and l_orderkey = o_orderkey+ and o_orderdate >= date '1993-12-01'+ and o_orderdate < date '1993-12-01' + interval '3' month+ and l_returnflag = 'R'+ and c_nationkey = n_nationkey+group by+ c_custkey,+ c_name,+ c_acctbal,+ c_phone,+ n_name,+ c_address,+ c_comment+order by+ revenue desc;+--set rowcount 20+--go++\end{code}+> |])+> ,("Q11",[here|+\begin{code}+++select+ ps_partkey,+ sum(ps_supplycost * ps_availqty) as value+from+ partsupp,+ supplier,+ nation+where+ ps_suppkey = s_suppkey+ and s_nationkey = n_nationkey+ and n_name = 'CHINA'+group by+ ps_partkey having+ sum(ps_supplycost * ps_availqty) > (+ select+ sum(ps_supplycost * ps_availqty) * 0.0001000000+ from+ partsupp,+ supplier,+ nation+ where+ ps_suppkey = s_suppkey+ and s_nationkey = n_nationkey+ and n_name = 'CHINA'+ )+order by+ value desc;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q12",[here|+\begin{code}+++select+ l_shipmode,+ sum(case+ when o_orderpriority = '1-URGENT'+ or o_orderpriority = '2-HIGH'+ then 1+ else 0+ end) as high_line_count,+ sum(case+ when o_orderpriority <> '1-URGENT'+ and o_orderpriority <> '2-HIGH'+ then 1+ else 0+ end) as low_line_count+from+ orders,+ lineitem+where+ o_orderkey = l_orderkey+ and l_shipmode in ('AIR', 'RAIL')+ and l_commitdate < l_receiptdate+ and l_shipdate < l_commitdate+ and l_receiptdate >= date '1994-01-01'+ and l_receiptdate < date '1994-01-01' + interval '1' year+group by+ l_shipmode+order by+ l_shipmode;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q13",[here|+\begin{code}+++select+ c_count,+ count(*) as custdist+from+ (+ select+ c_custkey,+ count(o_orderkey)+ from+ customer left outer join orders on+ c_custkey = o_custkey+ and o_comment not like '%pending%requests%'+ group by+ c_custkey+ ) as c_orders (c_custkey, c_count)+group by+ c_count+order by+ custdist desc,+ c_count desc;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q14",[here|+\begin{code}++select+ 100.00 * sum(case+ when p_type like 'PROMO%'+ then l_extendedprice * (1 - l_discount)+ else 0+ end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue+from+ lineitem,+ part+where+ l_partkey = p_partkey+ and l_shipdate >= date '1994-12-01'+ and l_shipdate < date '1994-12-01' + interval '1' month;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q15",[here|+\begin{code}++/*create view revenue0 (supplier_no, total_revenue) as+ select+ l_suppkey,+ sum(l_extendedprice * (1 - l_discount))+ from+ lineitem+ where+ l_shipdate >= date '1995-06-01'+ and l_shipdate < date '1995-06-01' + interval '3' month+ group by+ l_suppkey;*/++with+revenue0 as+ (select+ l_suppkey as supplier_no,+ sum(l_extendedprice * (1 - l_discount)) as total_revenue+ from+ lineitem+ where+ l_shipdate >= date '1995-06-01'+ and l_shipdate < date '1995-06-01' + interval '3' month+ group by+ l_suppkey)+select+ s_suppkey,+ s_name,+ s_address,+ s_phone,+ total_revenue+from+ supplier,+ revenue0+where+ s_suppkey = supplier_no+ and total_revenue = (+ select+ max(total_revenue)+ from+ revenue0+ )+order by+ s_suppkey;++--drop view revenue0;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q16",[here|+\begin{code}+++select+ p_brand,+ p_type,+ p_size,+ count(distinct ps_suppkey) as supplier_cnt+from+ partsupp,+ part+where+ p_partkey = ps_partkey+ and p_brand <> 'Brand#15'+ and p_type not like 'MEDIUM BURNISHED%'+ and p_size in (39, 26, 18, 45, 19, 1, 3, 9)+ and ps_suppkey not in (+ select+ s_suppkey+ from+ supplier+ where+ s_comment like '%Customer%Complaints%'+ )+group by+ p_brand,+ p_type,+ p_size+order by+ supplier_cnt desc,+ p_brand,+ p_type,+ p_size;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q17",[here|+\begin{code}+++select+ sum(l_extendedprice) / 7.0 as avg_yearly+from+ lineitem,+ part+where+ p_partkey = l_partkey+ and p_brand = 'Brand#52'+ and p_container = 'JUMBO CAN'+ and l_quantity < (+ select+ 0.2 * avg(l_quantity)+ from+ lineitem+ where+ l_partkey = p_partkey+ );+--set rowcount -1+--go++\end{code}+> |])+> ,("Q18",[here|+\begin{code}+++select+ c_name,+ c_custkey,+ o_orderkey,+ o_orderdate,+ o_totalprice,+ sum(l_quantity)+from+ customer,+ orders,+ lineitem+where+ o_orderkey in (+ select+ l_orderkey+ from+ lineitem+ group by+ l_orderkey having+ sum(l_quantity) > 313+ )+ and c_custkey = o_custkey+ and o_orderkey = l_orderkey+group by+ c_name,+ c_custkey,+ o_orderkey,+ o_orderdate,+ o_totalprice+order by+ o_totalprice desc,+ o_orderdate;+--set rowcount 100+--go++\end{code}+> |])+> ,("Q19",[here|+\begin{code}+++select+ sum(l_extendedprice* (1 - l_discount)) as revenue+from+ lineitem,+ part+where+ (+ p_partkey = l_partkey+ and p_brand = 'Brand#43'+ and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')+ and l_quantity >= 3 and l_quantity <= 3 + 10+ and p_size between 1 and 5+ and l_shipmode in ('AIR', 'AIR REG')+ and l_shipinstruct = 'DELIVER IN PERSON'+ )+ or+ (+ p_partkey = l_partkey+ and p_brand = 'Brand#25'+ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')+ and l_quantity >= 10 and l_quantity <= 10 + 10+ and p_size between 1 and 10+ and l_shipmode in ('AIR', 'AIR REG')+ and l_shipinstruct = 'DELIVER IN PERSON'+ )+ or+ (+ p_partkey = l_partkey+ and p_brand = 'Brand#24'+ and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')+ and l_quantity >= 22 and l_quantity <= 22 + 10+ and p_size between 1 and 15+ and l_shipmode in ('AIR', 'AIR REG')+ and l_shipinstruct = 'DELIVER IN PERSON'+ );+--set rowcount -1+--go++\end{code}+> |])+> ,("Q20",[here|+\begin{code}+++select+ s_name,+ s_address+from+ supplier,+ nation+where+ s_suppkey in (+ select+ ps_suppkey+ from+ partsupp+ where+ ps_partkey in (+ select+ p_partkey+ from+ part+ where+ p_name like 'lime%'+ )+ and ps_availqty > (+ select+ 0.5 * sum(l_quantity)+ from+ lineitem+ where+ l_partkey = ps_partkey+ and l_suppkey = ps_suppkey+ and l_shipdate >= date '1994-01-01'+ and l_shipdate < date '1994-01-01' + interval '1' year+ )+ )+ and s_nationkey = n_nationkey+ and n_name = 'VIETNAM'+order by+ s_name;+--set rowcount -1+--go++\end{code}+> |])+> ,("Q21",[here|+\begin{code}+++select+ s_name,+ count(*) as numwait+from+ supplier,+ lineitem l1,+ orders,+ nation+where+ s_suppkey = l1.l_suppkey+ and o_orderkey = l1.l_orderkey+ and o_orderstatus = 'F'+ and l1.l_receiptdate > l1.l_commitdate+ and exists (+ select+ *+ from+ lineitem l2+ where+ l2.l_orderkey = l1.l_orderkey+ and l2.l_suppkey <> l1.l_suppkey+ )+ and not exists (+ select+ *+ from+ lineitem l3+ where+ l3.l_orderkey = l1.l_orderkey+ and l3.l_suppkey <> l1.l_suppkey+ and l3.l_receiptdate > l3.l_commitdate+ )+ and s_nationkey = n_nationkey+ and n_name = 'INDIA'+group by+ s_name+order by+ numwait desc,+ s_name;+--set rowcount 100+--go++\end{code}+> |])+> ,("Q22",[here|+\begin{code}+++select+ cntrycode,+ count(*) as numcust,+ sum(c_acctbal) as totacctbal+from+ (+ select+ substring(c_phone from 1 for 2) as cntrycode,+ c_acctbal+ from+ customer+ where+ substring(c_phone from 1 for 2) in+ ('41', '28', '39', '21', '24', '29', '44')+ and c_acctbal > (+ select+ avg(c_acctbal)+ from+ customer+ where+ c_acctbal > 0.00+ and substring(c_phone from 1 for 2) in+ ('41', '28', '39', '21', '24', '29', '44')+ )+ and not exists (+ select+ *+ from+ orders+ where+ o_custkey = c_custkey+ )+ ) as custsale+group by+ cntrycode+order by+ cntrycode;+--set rowcount -1+--go++\end{code}+> |])+> ]+++> tpchCatalog :: [CatalogUpdate]+> tpchCatalog =++CREATE TABLE NATION ( N_NATIONKEY INTEGER NOT NULL,+ N_NAME CHAR(25) NOT NULL,+ N_REGIONKEY INTEGER NOT NULL,+ N_COMMENT VARCHAR(152));++> [CatCreateTable ("public","nation") [("n_nationkey", mkCatNameExtra "integer")+> ,("n_name", mkCatNameExtra "char")+> ,("n_regionkey", mkCatNameExtra "integer")+> ,("n_comment", mkCatNameExtra "varchar")]++CREATE TABLE REGION ( R_REGIONKEY INTEGER NOT NULL,+ R_NAME CHAR(25) NOT NULL,+ R_COMMENT VARCHAR(152));++> ,CatCreateTable ("public","region") [("r_regionkey", mkCatNameExtra "integer")+> ,("r_name", mkCatNameExtra "char")+> ,("r_comment", mkCatNameExtra "varchar")]++CREATE TABLE PART ( P_PARTKEY INTEGER NOT NULL,+ P_NAME VARCHAR(55) NOT NULL,+ P_MFGR CHAR(25) NOT NULL,+ P_BRAND CHAR(10) NOT NULL,+ P_TYPE VARCHAR(25) NOT NULL,+ P_SIZE INTEGER NOT NULL,+ P_CONTAINER CHAR(10) NOT NULL,+ P_RETAILPRICE DECIMAL(15,2) NOT NULL,+ P_COMMENT VARCHAR(23) NOT NULL );++> ,CatCreateTable ("public","part") [("p_partkey", mkCatNameExtra "integer")+> ,("p_name", mkCatNameExtra "varchar")+> ,("p_mfgr", mkCatNameExtra "char")+> ,("p_brand", mkCatNameExtra "char")+> ,("p_type", mkCatNameExtra "varchar")+> ,("p_size", mkCatNameExtra "integer")+> ,("p_container", mkCatNameExtra "char")+> ,("p_retailprice", mkCatNameExtra "numeric")+> ,("p_comment", mkCatNameExtra "varchar")]++CREATE TABLE SUPPLIER ( S_SUPPKEY INTEGER NOT NULL,+ S_NAME CHAR(25) NOT NULL,+ S_ADDRESS VARCHAR(40) NOT NULL,+ S_NATIONKEY INTEGER NOT NULL,+ S_PHONE CHAR(15) NOT NULL,+ S_ACCTBAL DECIMAL(15,2) NOT NULL,+ S_COMMENT VARCHAR(101) NOT NULL);++> ,CatCreateTable ("public","supplier") [("s_suppkey", mkCatNameExtra "integer")+> ,("s_name", mkCatNameExtra "char")+> ,("s_address", mkCatNameExtra "varchar")+> ,("s_nationkey", mkCatNameExtra "integer")+> ,("s_phone", mkCatNameExtra "char")+> ,("s_acctbal", mkCatNameExtra "numeric")+> ,("s_comment", mkCatNameExtra "varchar")]+++CREATE TABLE PARTSUPP ( PS_PARTKEY INTEGER NOT NULL,+ PS_SUPPKEY INTEGER NOT NULL,+ PS_AVAILQTY INTEGER NOT NULL,+ PS_SUPPLYCOST DECIMAL(15,2) NOT NULL,+ PS_COMMENT VARCHAR(199) NOT NULL );++> ,CatCreateTable ("public","partsupp") [("ps_partkey", mkCatNameExtra "integer")+> ,("ps_suppkey", mkCatNameExtra "integer")+> ,("ps_availqty", mkCatNameExtra "integer")+> ,("ps_supplycost", mkCatNameExtra "numeric")+> ,("ps_comment", mkCatNameExtra "varchar")]++CREATE TABLE CUSTOMER ( C_CUSTKEY INTEGER NOT NULL,+ C_NAME VARCHAR(25) NOT NULL,+ C_ADDRESS VARCHAR(40) NOT NULL,+ C_NATIONKEY INTEGER NOT NULL,+ C_PHONE CHAR(15) NOT NULL,+ C_ACCTBAL DECIMAL(15,2) NOT NULL,+ C_MKTSEGMENT CHAR(10) NOT NULL,+ C_COMMENT VARCHAR(117) NOT NULL);++> ,CatCreateTable ("public","customer") [("c_custkey", mkCatNameExtra "integer")+> ,("c_name", mkCatNameExtra "char")+> ,("c_address", mkCatNameExtra "varchar")+> ,("c_nationkey", mkCatNameExtra "integer")+> ,("c_phone", mkCatNameExtra "char")+> ,("c_acctbal", mkCatNameExtra "numeric")+> ,("c_mktsegment", mkCatNameExtra "char")+> ,("c_comment", mkCatNameExtra "varchar")]+++CREATE TABLE ORDERS ( O_ORDERKEY INTEGER NOT NULL,+ O_CUSTKEY INTEGER NOT NULL,+ O_ORDERSTATUS CHAR(1) NOT NULL,+ O_TOTALPRICE DECIMAL(15,2) NOT NULL,+ O_ORDERDATE DATE NOT NULL,+ O_ORDERPRIORITY CHAR(15) NOT NULL, + O_CLERK CHAR(15) NOT NULL, + O_SHIPPRIORITY INTEGER NOT NULL,+ O_COMMENT VARCHAR(79) NOT NULL);++> ,CatCreateTable ("public","orders") [("o_orderkey", mkCatNameExtra "integer")+> ,("o_custkey", mkCatNameExtra "integer")+> ,("o_orderstatus", mkCatNameExtra "char")+> ,("o_totalprice", mkCatNameExtra "numeric")+> ,("o_orderdate", mkCatNameExtra "date")+> ,("o_orderpriority", mkCatNameExtra "char")+> ,("o_clerk", mkCatNameExtra "char")+> ,("o_shippriority", mkCatNameExtra "integer")+> ,("o_comment", mkCatNameExtra "varchar")]+++CREATE TABLE LINEITEM ( L_ORDERKEY INTEGER NOT NULL,+ L_PARTKEY INTEGER NOT NULL,+ L_SUPPKEY INTEGER NOT NULL,+ L_LINENUMBER INTEGER NOT NULL,+ L_QUANTITY DECIMAL(15,2) NOT NULL,+ L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL,+ L_DISCOUNT DECIMAL(15,2) NOT NULL,+ L_TAX DECIMAL(15,2) NOT NULL,+ L_RETURNFLAG CHAR(1) NOT NULL,+ L_LINESTATUS CHAR(1) NOT NULL,+ L_SHIPDATE DATE NOT NULL,+ L_COMMITDATE DATE NOT NULL,+ L_RECEIPTDATE DATE NOT NULL,+ L_SHIPINSTRUCT CHAR(25) NOT NULL,+ L_SHIPMODE CHAR(10) NOT NULL,+ L_COMMENT VARCHAR(44) NOT NULL);++> ,CatCreateTable ("public","lineitem") [("l_orderkey", mkCatNameExtra "integer")+> ,("l_partkey", mkCatNameExtra "integer")+> ,("l_suppkey", mkCatNameExtra "integer")+> ,("l_linenumber", mkCatNameExtra "integer")+> ,("l_quantity", mkCatNameExtra "numeric")+> ,("l_extendedprice", mkCatNameExtra "numeric")+> ,("l_discount", mkCatNameExtra "numeric")+> ,("l_tax", mkCatNameExtra "numeric")+> ,("l_returnflag", mkCatNameExtra "char")+> ,("l_linestatus", mkCatNameExtra "char")+> ,("l_shipdate", mkCatNameExtra "date")+> ,("l_commitdate", mkCatNameExtra "date")+> ,("l_receiptdate", mkCatNameExtra "date")+> ,("l_shipinstruct", mkCatNameExtra "char")+> ,("l_shipmode", mkCatNameExtra "char")+> ,("l_comment", mkCatNameExtra "varchar")]++> ]
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Aggregates.lhs view
@@ -0,0 +1,51 @@+> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Aggregates+> (aggregates) where++> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.TypeChecker+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++dodgy hack to support cube:+special case the cube++only support case where the group by consists of a single cube or+ordinary groups+no nested groups in the cube+type check+group by cube(a,b,...)+as if it was written+group by a,b,...++TODO: deal with types, null, rollup,cube, grouping sets, nested groups+and flexible combinations++> aggregates :: Item+> aggregates =+> Group "aggregates"+> [tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "int4")+> ,("c", mkCatNameExtra "int4")]]+> "select a,b,count(c) as c from t group by a,b"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra typeInt)+> ,("c", mkTypeExtraNN typeBigInt)]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "int4")+> ,("c", mkCatNameExtra "int4")]]+> "select a,b,count(c) as c from t group by cube(a,b)"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra typeInt)+> ,("c", mkTypeExtraNN typeBigInt)]+> ]+> where+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect=postgresDialect}+> typeInt = ScalarType "int4"+> typeBigInt = ScalarType "int8"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/AnsiScalarExprs.lhs view
@@ -0,0 +1,365 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.AnsiScalarExprs+> (ansiScalarExprs) where++> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.Internals.TypeChecking.Environment+> --import Database.HsSqlPpp.Tests.TypeChecking.Utils+> import qualified Data.Text.Lazy as T++> ansiScalarExprs :: Item+> ansiScalarExprs =+> Group "ansiScalarExprs"+> [Group "sanity"+> [+> -- todo: these should be unknown+> se "1" $ Right $ ScalarType "int" -- Right UnknownType+> ,se "1.1" $ Right $ ScalarType "numeric" -- Right UnknownType+> ,se "'test'" $ Right UnknownType+> ,se "null" $ Right UnknownType+> ,se "true" $ Right $ ScalarType "boolean"+> ,se "false" $ Right $ ScalarType "boolean"++> ,se "null" $ Right UnknownType+++typedstringlit++> ,se "int '3'" $ Right $ ScalarType "int"++interval++> ,se "interval '3' day" $ Right $ ScalarType "interval"++identifier++> ,see [("a", mkTypeExtra $ ScalarType "int")]+> "a" $ Right $ ScalarType "int"++star: not here+qstar: not here++positional arg: not supported in this dialect+placeholder,hostparameter++> ,se "?" $ Right UnknownType++> -- not sure how this should work+> -- todo: not currently supported in the parser+> --,se ":test" $ Right UnknownType+++cast+++> ,see [("a", mkTypeExtra $ ScalarType "float")]+> "cast(a as real)" $ Right $ ScalarType "real"++implicit cast: not here++case x 2++> ,see [("a", mkTypeExtra $ ScalarType "int")+> ,("b", mkTypeExtra $ ScalarType "int")+> ,("c", mkTypeExtra $ ScalarType "int")]+> "case a when 1 then b else c end" $ Right $ ScalarType "int"++> ,see [("a", mkTypeExtra $ ScalarType "int")+> ,("b", mkTypeExtra $ ScalarType "int")+> ,("c", mkTypeExtra $ ScalarType "int")]+> "case when a=1 then b else c end" $ Right $ ScalarType "int"+++parens++> ,see [("a", mkTypeExtra $ ScalarType "int")]+> "(a)" $ Right $ ScalarType "int"+++in predicate: just the list version here+ query version tested elsewhere+++> ,see [("a", mkTypeExtra $ ScalarType "int")]+> "a in (1,2,3)" $ Right $ ScalarType "boolean"++> ]++subqueries: test these elsewhere+quantified comparison: test these elsewhere+match: test this elsewhere++TODO: arrays+how should these work, want something better than the idiosyncratic+postgres way of supporting arrays+array select+array ctor++TODO: collate, needs some typechecking on collations, which needs more+catalog stuff++todo: multiset ops++>+>++todo: 6.9 grouping++todo: 6.10 window function stuff++todo: 6.11 nested window?++6.12 case++todo: these should be 'polymorphic' and work with non built in types+also++> ,Group "case abbreviation simple" $+> [see [("a", mkTypeExtra $ ScalarType t)+> ,("b", mkTypeExtra $ ScalarType t)]+> "nullif(a,b)"+> $ Right $ ScalarType t+> | t <- allTypes]+> +++> [see [("a", mkTypeExtra $ ScalarType t)+> ,("b", mkTypeExtra $ ScalarType t)+> ,("c", mkTypeExtra $ ScalarType t)]+> (T.pack $ "coalesce(" ++ args ++ ")") $ Right $ ScalarType t+> | args <- ["a","a,b","a,b,c"]+> , t <- allTypes ]+++todo: normal cases++6.13 cast+++> ,Group "cast simple" $+> [see [("a", mkTypeExtra $ ScalarType "int")+> ,("b", mkTypeExtra $ ScalarType "varchar")]+> "cast(b as int)"+> $ Right $ ScalarType "int"+> ,see [("a", mkTypeExtra $ ScalarType "int")+> ,("b", mkTypeExtra $ ScalarType "varchar")]+> "cast(a as varchar)"+> $ Right $ ScalarType "varchar"+> ,see [("a", mkTypeExtra $ ScalarType "int")+> ,("b", mkTypeExtra $ ScalarType "varchar")]+> "cast(a as character)"+> $ Right $ ScalarType "char"+> ]++todo: 6.14 next value for++todo: 6.15 field reference++todo: 6.24 array element reference++todo: 6.25 multiset element reference++6.27 numeric value expression++> ,Group "numeric value expression simple"+> [see [("a", mkTypeExtra $ ScalarType t)+> ,("b", mkTypeExtra $ ScalarType t)]+> e $ Right $ ScalarType t+> | e <- ["+a","-a","a+b","a-b","a*b","a/b"]+> , t <- numericTypes ]++6.28 numeric value function++todo: position++> ,Group "numeric value function simple" $+> [see [("a", mkTypeExtra $ ScalarType t)]+> e $ Right $ ScalarType "int"+> | e <- ["char_length(a)", "character_length(a)"+> ,"octet_length(a)"]+> , t <- textTypes ]++todo: char_length with using++> +++> [see [("a", mkTypeExtra $ ScalarType t)]+> (T.pack $ "extract(" ++ f ++ " from a)")+> $ Right $ ScalarType "int"+> | f <- ["TIMEZONE_HOUR","TIMEZONE_MINUTE"+> ,"SECOND"+> ,"YEAR"+> ,"MONTH"+> ,"DAY"+> ,"HOUR"+> ,"MINUTE"]+> , t <- datetimeTypes ]++todo: cardinality+todo: array_max_cardinality+++> +++> [see [("a", mkTypeExtra $ ScalarType t)]+> e $ Right $ ScalarType t+> | e <- ["abs(a)"]+> , t <- numericTypes ]++question: what types are supported by mod??+the standard says 'exact numeric with scale 0'+postgres does for all integer + numeric++> +++> [see [("a", mkTypeExtra $ ScalarType t)+> ,("b", mkTypeExtra $ ScalarType t)]+> e $ Right $ ScalarType t+> | e <- ["mod(a,b)"]+> , t <- ["numeric", "smallint", "int", "bigint"] ]++supports ln,exp,pow,sqrt for single and double precision++standard says implementation defined approximate precision, which+could mean float or real, or just one, or something else I think++> +++> [see [("a", mkTypeExtra $ ScalarType t)]+> (T.pack (fn ++ "(a)")) $ Right $ ScalarType t+> | t <- ["float","real"]+> , fn <- ["ln","exp","pow","sqrt"] ]++floor and ceiling, same as ln et al, but with numeric also++> +++> [see [("a", mkTypeExtra $ ScalarType t)]+> (T.pack (fn ++ "(a)")) $ Right $ ScalarType t+> | t <- ["float","real", "numeric"]+> , fn <- ["floor","ceil","ceiling"] ]++todo: width bucket not working - needs a special case in the precision+stuff++> {- +++> [see [("a", mkTypeExtra $ ScalarType t)+> ,("b", mkTypeExtra $ ScalarType t)+> ,("c", mkTypeExtra $ ScalarType t)+> ,("d", mkTypeExtra $ ScalarType "numeric")+> ]+> "width_bucket(a,b,c,d)" $ Right $ ScalarType "numeric"+> | t <- allTypes ] -}++++6.29 string value expression++> ,Group "string value expression simple" $+> [see [("a", (mkTypeExtra (ScalarType t)) {tePrecision = Just 5})+> ,("b", (mkTypeExtra (ScalarType t)) {tePrecision = Just 5})]+> "a || b" $ Right $ ScalarType t+> | t <- textTypes ++ binaryTypes ]++todo: collate++6.30 string value function++> ,Group "string value expression simple" (+> [see [("a", mkTypeExtra $ ScalarType t)+> ,("b", mkTypeExtra $ ScalarType "int")+> ,("c", mkTypeExtra $ ScalarType "int")]+> fn $ Right $ ScalarType t+> | fn <- ["substring(a from b for c)"+> -- todo: support other substring variations+> {-,"substring(a from b)"-}]+> , t <- textTypes ] +++> [see [("a", mkTypeExtra $ ScalarType t)]+> (T.pack (fn ++ "(a)")) $ Right $ ScalarType t+> | fn <- ["upper","lower"]+> , t <- textTypes ])++todo: convert+todo: translate++todo: trim++todo: overlay++todo: normalize++binary: substring, trim, overlay++6.31 <datetime value expression>++> ,Group "numeric value expression simple"+> [see [("a", mkTypeExtra $ ScalarType dt)+> ,("b", mkTypeExtra $ ScalarType "interval")]+> e $ Right $ ScalarType dt+> | e <- ["b+a","a+b","a-b"]+> , dt <- datetimeTypes ]++todo: timezone stuff++todo: 6.32 <datetime value function>++6.33 <interval value expression>++> ,Group "numeric value expression simple"+> [see [("a", mkTypeExtra $ ScalarType "interval")+> ,("b", mkTypeExtra $ ScalarType "interval")+> ,("c", mkTypeExtra $ ScalarType "interval")+> ]+> e $ Right $ ScalarType "interval"+> | e <- ["a+b","a-b", "+a","-a"]]++todo:+ | <left paren> <datetime value expression> <minus sign> <datetime term> <right paren>+ <interval qualifier>+++-----+specialops++special functions++functions++aggs++windows++typealias checking++implicit casting:+case+greatest,least+ops, fns, etc.+in list+how to test these well enough?++anomalies+ bad casts+ interval?+ type match fails in implicit castings++++++> ]+> where+> se = TCScalExpr (diDefaultCatalog ansiDialect) emptyEnvironment+> defaultTypeCheckFlags {tcfDialect=ansiDialect}+> see env = TCScalExpr (diDefaultCatalog ansiDialect) (selListEnv env)+> defaultTypeCheckFlags {tcfDialect=ansiDialect}+> selListEnv env = either (const brokeEnvironment) id+> $ envSelectListEnvironment env+> numericTypes = ["numeric", "decimal", "smallint", "int", "bigint", "float", "real"]+> textTypes = ["char","varchar","clob","nchar","nvarchar","nclob"]+> binaryTypes = ["binary","varbinary","blob"]+> datetimeTypes = ["date","time","timestamp","interval"]+> allTypes = numericTypes+> ++ textTypes+> ++ binaryTypes+> ++ ["boolean"]+> ++ datetimeTypes
+ tests/Database/HsSqlPpp/Tests/TypeChecking/CaseExpressions.lhs view
@@ -0,0 +1,62 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.CaseExpressions+> (caseExpressions) where+>+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)+++> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Dialect+>+>+> caseExpressions :: Item+> caseExpressions =+> Group "case expressions" [+> e "case\n\+> \ when true then 1\n\+> \end" $ Right typeInt+> ,e "case\n\+> \ when 1=2 then 'stuff'\n\+> \ when 2=3 then 'blah'\n\+> \ else 'test'\n\+> \end" $ Right UnknownType+> ,e "case\n\+> \ when 1=2 then 'stuff'\n\+> \ when 2=3 then 'blah'\n\+> \ else 'test'::text\n\+> \end" $ Right $ ScalarType "text"+> ,e "case\n\+> \ when 1=2 then 'stuff'\n\+> \ when true=3 then 'blah'\n\+> \ else 'test'\n\+> \end" $ Left [NoMatchingOperator "=" [typeBool,typeInt]]+> ,e "case\n\+> \ when 1=2 then true\n\+> \ when 2=3 then false\n\+> \ else 1\n\+> \end" $ Left [IncompatibleTypeSet [typeBool+> ,typeBool+> ,typeInt]]+> ,e "case\n\+> \ when 1=2 then false\n\+> \ when 2=3 then 1\n\+> \ else true\n\+> \end" $ Left [IncompatibleTypeSet [typeBool+> ,typeInt+> ,typeBool]]+> ,e "case 1 when 2 then 3 else 4 end" $ Right typeInt+> ,e "case 1 when true then 3 else 4 end"+> $ Left [IncompatibleTypeSet [ScalarType "int4"+> ,ScalarType "bool"]]+> ,e "case 1 when 2 then true else false end" $ Right typeBool+> ,e "case 1 when 2 then 3 else false end"+> $ Left [IncompatibleTypeSet [ScalarType "int4"+> ,ScalarType "bool"]]+> ]+> where+> e = TCScalExpr (diDefaultCatalog postgresDialect) emptyEnvironment+> defaultTypeCheckFlags {tcfDialect = postgresDialect}+> typeInt = ScalarType "int4"+> typeBool = ScalarType "bool"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Catalog.lhs view
@@ -0,0 +1,137 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Catalog+> (catalog) where++> import Database.HsSqlPpp.Internals.Catalog.CatalogNew+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Internals.TypeChecking.Environment+> --import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import qualified Data.Text.Lazy as T+> import qualified Test.Tasty.HUnit as H+> --import qualified Data.Map as M+> import qualified Data.Set as S+> import Control.Monad++> catalog :: Item+> catalog =+> Group "catalog"+> [++create role+query to see it there++> Custom "create role" $ do+> let Right c = updateCatalog (CreateRole "me") emptyCatalog+> let rs = cRoles c+> H.assertEqual "" (S.fromList ["me"]) rs+> let Right c1 = updateCatalog (CreateRole "me2") c+> let rs1 = cRoles c1+> H.assertEqual "" (S.fromList ["me","me2"]) rs1++drop role+query to see it gone++> ,Custom "drop role" $ do+> let Right c = foldM (flip updateCatalog)+> emptyCatalog+> [CreateRole "me"+> ,CreateRole "me2"]+> Right c1 = updateCatalog (DropRole "me" Restrict) c+> let rs = cRoles c1+> H.assertEqual "" (S.fromList ["me2"]) rs+> let Right c2 = updateCatalog (DropRole "me2" Restrict) c+> let rs1 = cRoles c2+> H.assertEqual "" (S.fromList ["me"]) rs1+++rename role+query to see old role gone and new role there++> ,Custom "rename role" $ do+> let Right c = foldM (flip updateCatalog)+> emptyCatalog+> [CreateRole "me"+> ,CreateRole "me2"]+> Right c1 = updateCatalog (RenameRole "me" "anotherme") c+> let rs = cRoles c1+> H.assertEqual "" (S.fromList ["anotherme","me2"]) rs++++todo: check for stuff linked to role++++create role already exists++> ,Custom "create role already exists" $ do+> let Right c = updateCatalog (CreateRole "me") emptyCatalog+> H.assertEqual "" (Left $ RoleAlreadyExists "me") $ updateCatalog (CreateRole "me") c++drop role doesn't exist++> ,Custom "drop role doesn't exist" $ do+> let Right c = updateCatalog (CreateRole "me") emptyCatalog+> H.assertEqual "" (Left $ RoleNotRecognised "me1")+> $ updateCatalog (DropRole "me1" Restrict) c++rename role new already exists++rename role old doesn't exist++rename role old doesn't exist and new exists+++collation and character sets++create character set+check it is there+check the default collation exists and is binary++create character set+create a collation+check collation is there++create character set+create a collation+set it as default+delete the binary collation+check collation is there and is default and binary isn't there++create two collations and check++create two collations and drop one++drop a character set with cascade+ with restrict++rename character set++rename collation - default+rename collation - non-default++renames with schema change only++set character set owner+set collation owner++anomalies for above...++schemas+sequences+typeids+type categories+external types+casts+functions, operators+windows, aggregates?+tables+ a table with a implicitly declared sequence must create a separate+ sequence in a desugaring process+views+domain types+composite type+enums++> ]
+ tests/Database/HsSqlPpp/Tests/TypeChecking/DDL.lhs view
@@ -0,0 +1,40 @@++This file does basic typechecking for DDL. It only covers some ddl at+the moment.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.DDL+> (ddl) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> --import Database.HsSqlPpp.Catalog+> --import Database.HsSqlPpp.TypeChecker+> --import Database.HsSqlPpp.Types++> --import Database.HsSqlPpp.Tests.TypeChecking.Utils++> ddl :: Item+> ddl =+> Group "ddl" []+++create schema+alter schema+drop schema++++create table+alter table+drop table++create sequence+alter sequence+drop sequence++create view+drop view+alter view+
+ tests/Database/HsSqlPpp/Tests/TypeChecking/ImplicitCasts.lhs view
@@ -0,0 +1,27 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.ImplicitCasts+> (impCasts) where++> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.TypeCheck+> import Data.Text.Lazy ()+++> impCasts :: Item+> impCasts =+> Group "impCasts"+> [e p "'1' + 2" "'1' :: int4 + 2"+> ,e p "1.5 :: numeric between 1.1 and 2"+> "1.5 :: numeric between 1.1 and 2 :: numeric"+> ,e p "'aa'::text = 'bb'"+> "'aa'::text = 'bb'::text"+> ,e s "cast(1 as int4) + cast('2' as varchar)"+> "cast(1 as int4) + cast(cast('2' as varchar) as int4)"+> ]+> where+> e = ImpCastsScalar+> p = defaultTypeCheckFlags {tcfDialect=postgresDialect}+> s = defaultTypeCheckFlags {tcfDialect=sqlServerDialect}
+ tests/Database/HsSqlPpp/Tests/TypeChecking/InsertQueryExprs.lhs view
@@ -0,0 +1,84 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.InsertQueryExprs+> (insertQueryExprs) where++> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> --import Database.HsSqlPpp.TypeChecker+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)+++> insertQueryExprs :: Item+> insertQueryExprs =+> Group "insertQueryExpr"+> [+> -- int to bigint+> InsertQueryExpr+> [CatCreateTable ("public","t1") [("a", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","t2") [("b", mkCatNameExtra "int8")]]+> "insert into t2(b) select a from t1;"+> $ Right $ CompositeType [("a", mkTypeExtra typeBigInt)]+> -- null to not null +> ,InsertQueryExpr+> [CatCreateTable ("public","t1") [("a", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","t2") [("b", mkCatNameExtraNN "int4")]]+> "insert into t2(b) select a from t1;"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)]+> -- not null to null+> ,InsertQueryExpr+> [CatCreateTable ("public","t1") [("a", mkCatNameExtraNN "int4")]+> ,CatCreateTable ("public","t2") [("b", mkCatNameExtra "int4")]]+> "insert into t2(b) select a from t1;"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> -- implicit column list+> ,InsertQueryExpr+> [CatCreateTable ("public","t1") [("a", mkCatNameExtraNN "int4")]+> ,CatCreateTable ("public","t2") [("b", mkCatNameExtra "int4")]]+> "insert into t2 select a from t1;"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++insert + star - fails, commented out for now++ -- star expansion+ -- one column - todo: why '?column?'?+ ,InsertQueryExpr+ [CatCreateTable ("public","t1") [("a", mkCatNameExtraNN "int4")]+ ,CatCreateTable ("public","t2") [("b", mkCatNameExtraNN "int8")]]+ "insert into t2 select * from t1;"+ $ Right $ CompositeType [("a", mkTypeExtraNN typeBigInt)]+ -- two columns (not sure what that correct type is)+ ,InsertQueryExpr+ [CatCreateTable ("public","t1") [("a", mkCatNameExtraNN "int4"),("b", mkCatNameExtraNN "int4")]+ ,CatCreateTable ("public","t2") [("c", mkCatNameExtraNN "int8"),("d", mkCatNameExtraNN "int8")]]+ "insert into t2 select * from t1;"+ $ Right $ CompositeType [("a", mkTypeExtraNN typeBigInt),("b", mkTypeExtraNN typeBigInt)]++> -- where (uses outerDownEnv)+> ,InsertQueryExpr+> [CatCreateTable ("public","t1") [("a", mkCatNameExtraNN "int4")]+> ,CatCreateTable ("public","t2") [("b", mkCatNameExtraNN "int4")]]+> "insert into t2 select a from t1 where a>0;"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)]++> -- int to bigint - values+> ,InsertQueryExpr+> [CatCreateTable ("public","t2") [("b", mkCatNameExtra "int8")]]+> "insert into t2(b) values (1);"+> $ Right $ CompositeType [("values%0", mkTypeExtra typeBigInt)]+> -- not null to null - values+> ,InsertQueryExpr+> [CatCreateTable ("public","t2") [("b", mkCatNameExtra "int4")]]+> "insert into t2(b) values (1);"+> $ Right $ CompositeType [("values%0", mkTypeExtra typeInt)]+> ,InsertQueryExpr+> [CatCreateTable ("public","tt") [("b", mkCatNameExtraNN "int4")]+> ,CatCreateTable ("public","t") [("d", mkCatNameExtraNN "date")]]+> "insert into tt select datepart(day,d) from t;"+> $ Right $ CompositeType [("datepart",mkTypeExtraNN typeInt)]+> ]+> where+> typeInt = ScalarType "int4"+> typeBigInt = ScalarType "int8"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Issues.lhs view
@@ -0,0 +1,63 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Issues+> (issues) where+>+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.TypeCheck+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect++> --import Database.HsSqlPpp.Types++todo: make sure type checking twice doesn't change the tree at all the+second time - including rewrite versions+issue with select t.x from tbl t, typecheck is mangling to+select tbl.x from tbl t.+++>+>+> issues :: Item+> issues =+> Group "issues"+> [+> -- check that quoted select list aliases don't lose their quotes+> let s = "select t.a as \"Quoted\" from t as t(a,b);"+> in RewriteQueryExpr defaultTypeCheckFlags {tcfDialect = postgresDialect}+> {tcfAddQualifiers = True+> ,tcfAddSelectItemAliases = True+> ,tcfExpandStars = True+> ,tcfAddFullTablerefAliases = True} cat s s+> -- check bug with some uuagc code not adding the+> -- qualifiers for an identifier properly when+> -- the identifier appears on its own at the top level of a select list item+> ,r "select a from t as t(a,b);"+> "select t.a as a from t as t(a,b);"+> -- avoid some gratuitous case changes+> ,r "select A from t as t(a,b);"+> "select t.A as A from t as t(a,b);"+> ,r "select T.A from t as t(a,b);"+> "select T.A as A from t as t(a,b);"+> -- check not using the alias correctly when qualifying ids+> ,r "select tbl.a as a from t as tbl(a,b);"+> "select tbl.a as a from t as tbl(a,b);"++> --,r "select * from t u inner join t1 u1 on u.a=u1.c;"+> -- "select * from t u inner join t1 u1 on u.a=u1.c;"+> ]+> where+> r = RewriteQueryExpr defaultTypeCheckFlags {tcfDialect = postgresDialect}+> {tcfAddQualifiers = True+> ,tcfAddSelectItemAliases = True+> ,tcfExpandStars = True+> ,tcfAddFullTablerefAliases = True}+> cat+> cat =+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","t1") [("c", mkCatNameExtra "int4")+> ,("d", mkCatNameExtra "int4")]]++
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Joins.lhs view
@@ -0,0 +1,103 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Joins+> (joins) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)+++> joins :: Item+> joins =+> Group "joins"+> [qe "select * from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+> ,qe "select a from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,qe "select b from t0 cross join t1"+> $ Right $ CompositeType [("b", mkTypeExtra $ ScalarType "text")]+> ,qe "select c from t0 cross join t1"+> $ Right $ CompositeType [("c", mkTypeExtra typeInt)]+> ,qe "select d from t0 cross join t1"+> $ Right $ CompositeType [("d", mkTypeExtra $ ScalarType "text")]+> ,qe "select a,b,c,d from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+>+> ,qe "select * from (select 1 as a, 2 as b) a\n\+> \ cross join (select true as c, 4.5 as d) b;"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)+> ,("b", mkTypeExtraNN typeInt)+> ,("c", mkTypeExtraNN typeBool)+> ,("d", mkTypeExtraNN typeNumeric)]+> ,qe "select * from (select 1 as a, 2 as b) a\n\+> \ inner join (select true as c, 4.5 as d) b on true;"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)+> ,("b", mkTypeExtraNN typeInt)+> ,("c", mkTypeExtraNN typeBool)+> ,("d", mkTypeExtraNN typeNumeric)]+> ,qe "select * from (select 1 as a, 2 as b) a\n\+> \ inner join (select 1 as a, 4.5 as d) b using(a);"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)+> ,("b", mkTypeExtraNN typeInt)+> ,("d", mkTypeExtraNN typeNumeric)]+> ,qe "select * from (select 1 as a, 2 as b) a\n\+> \ natural inner join (select 1 as a, 4.5 as d) b;"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)+> ,("b", mkTypeExtraNN typeInt)+> ,("d", mkTypeExtraNN typeNumeric)]+> --check the attribute order+> ,qe "select * from (select 2 as b, 1 as a) a\n\+> \ natural inner join (select 4.5 as d, 1 as a) b;"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)+> ,("b", mkTypeExtraNN typeInt)+> ,("d", mkTypeExtraNN typeNumeric)]+> -- todo: need to fix this so that the star+> -- expand error doesn't appear: better error+> -- handling in the environment+> ,qe "select * from (select 1 as a1, 2 as b) a\n\+> \ natural inner join (select true as a1, 4.5 as d) b;"+> $ Left [IncompatibleTypeSet [ScalarType "int4"+> ,ScalarType "bool"]]+> ,qe "select * from (select 1 as a1, 2 as b) a\n\+> \ natural inner join (select true as a1, 4.5 as d) b;"+> $ Left [IncompatibleTypeSet [ScalarType "int4"+> ,ScalarType "bool"]]+> ,qe "select * from (select 1 as a1) a, (select 2 as a2) b;"+> $ Right $ CompositeType [("a1", mkTypeExtraNN typeInt)+> ,("a2", mkTypeExtraNN typeInt)]+> -- needs tref aliases in env+> ,qe "select * from (select 1 as a1) a, (select 2 as a1) b;"+> $ Right $ CompositeType [("a1", mkTypeExtraNN typeInt)+> ,("a1", mkTypeExtraNN typeInt)]+> ,qe "select a1 from (select 1 as a1) a, (select 2 as a1) b;"+> $ Left [AmbiguousIdentifier "a1"]++> ,qe "select a from t0 inner join t1 on t0.a = t1.c;"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,qe "select x.a from (select * from t0) x \n\+> \ inner join t1 Y on X.a = Y.C"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++> ]+> where+> qe = tcQueryExpr [CatCreateTable ("public","t0") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]+> ,CatCreateTable ("public","t1") [("c", mkCatNameExtra "int4")+> ,("d", mkCatNameExtra "text")]]+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = postgresDialect}+> typeInt = ScalarType "int4"+> typeNumeric = ScalarType "numeric"+> typeBool = ScalarType "bool"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/OdbcTypechecking.lhs view
@@ -0,0 +1,116 @@++See the odbcparsing for an overview.++1. date, time, and timestamp literals: these are trivially type+checked (and we don't check the format of the literal string+in hssqlppp currently)+2. scalar function calls: see below+3. escapes for like strings: not currently supported+4. outer joins: works like trefparens+5. calling a procedure: not currently supported++scalar functions++if we write:+select _f_(a), {fn _g_(b)} from t++the _f_ function is looked up in the usual catalog+but the _g_ function is looked up in an alternative namespace for+functions. We can't combine these two namespaces because the valid+functions are different in each namespace.++So we have to create a special case in the catalog and type checking+code. Since odbc is old, this is considered a fixed list and is just+implemented as a separate list of function prototypes to check against+when you are directly inside a {fn ... } node.++Here is the 'catalog' for odbc scalar functions:++https://msdn.microsoft.com/en-us/library/ms711813(v=vs.85).aspx++++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.OdbcTypechecking (odbcTypechecking) where+>+> --import Database.HsSqlPpp.Ast+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect++> --import Database.HsSqlPpp.Tests.Parsing.Utils+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> odbcTypechecking:: Item+> odbcTypechecking =+> Group "odbcTypechecking" [+> -- literals+> scalExpr "{d '2000-01-01'}" $ Right typeDate+> ,scalExpr "{t '12:00:01.1'}" $ Right $ ScalarType "time"+> ,scalExpr "{ts '2000-01-01 12:00:01.1'}" $ Right typeTimestamp+> -- scalar functions+> ,scalExpr "{fn ascii('test')}" $ Right typeInt+> ,scalExpr "{fn extract(hour from date 'dt')}" $ Right typeInt+> ,scalExpr "(extract(hour from date 'dt'))" $ Right typeInt+> -- position not supported in the parser+> --,scalExpr "{fn POSITION('aaa' IN 'bbb')}" $ Right typeVarChar+> ,scalExpr "{fn CONVERT(3, SQL_BIGINT)}" $ Right typeBigInt+> ,scalExpr "{fn CONVERT(3, SQL_FLOAT)}" $ Right typeFloat8++> ,scalExpr "{fn timestampadd(SQL_TSI_SECOND,3, {t '12:00:00'})}" $ Right typeTime+> ,scalExpr "{fn timestampadd(SQL_TSI_MINUTE,3, {ts '2001-01-01 12:00:00'})}" $ Right typeTimestamp+> ,scalExpr "{fn timestampadd(SQL_TSI_YEAR,3, {d '2001-01-01'})}" $ Right typeDate++> ,scalExpr "{fn timestampdiff(SQL_TSI_YEAR,{d '2001-01-01'}, {d '2001-01-01'})}" $ Right typeInt++++> ,scalExpr "{fn left('test',3)}" $ Right $ ScalarType "text"++ -- todo: somehow, the generated catalog ended up wrong here+ > ,scalExpr "left(3,'test')" $ Right $ ScalarType "text"++ > ,scalExpr "{fn left(3,'test')}" $ Left [NoMatchingOperator "!odbc-left" [ScalarType "int4",UnknownType]]+ > ,scalExpr "left('test',3)" $ Left [NoMatchingOperator "left" [UnknownType,ScalarType "int4"]]++ > ,scalExpr "{fn left(left(3,'test'),3)}" $ Right $ ScalarType "text"+ > ,scalExpr "left(3,{fn left('test',3)})" $ Right $ ScalarType "text"++++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]]+> "select {fn ascii('test')} as a, a as b, {d '2000-01-01'} as c,\n\+> \ {fn CONVERT('text', SQL_VARCHAR)} || {t '12:00:01.1'} as d from t"+> $ Right $ CompositeType [("a", (mkTypeExtra typeInt) {teNullable=False})+> ,("b", mkTypeExtra typeInt)+> ,("c", mkTypeExtra typeDate)+> ,("d", mkTypeExtra $ ScalarType "text")]++> -- outer join+> ,tcQueryExpr [CatCreateTable ("public","t0") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]+> ,CatCreateTable ("public","t1") [("c", mkCatNameExtra "int4")+> ,("d", mkCatNameExtra "text")]]+> "select * from {oj t0 left outer join t1 on t0.a=t1.c}"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+++> ]+> where+> scalExpr = TCScalExpr (diDefaultCatalog postgresDialect) emptyEnvironment+> defaultTypeCheckFlags {tcfDialect = postgresDialect}+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = postgresDialect}+> typeDate = ScalarType "date"+> typeTimestamp = ScalarType "timestamp"+> typeInt = ScalarType "int4"+> typeBigInt = ScalarType "int8"+> typeTime = ScalarType "time"+> typeFloat8 = ScalarType "float8"+
+ tests/Database/HsSqlPpp/Tests/TypeChecking/PrecisionAndNullable.lhs view
@@ -0,0 +1,209 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.PrecisionAndNullable+> (precisionAndNullable) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.Internals.AstInternal+> --import Database.HsSqlPpp.Internals.TypeChecking.Environment+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import qualified Data.Text.Lazy as L+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> precisionAndNullable :: Item+> precisionAndNullable =+> Group "PrecisionAndNullable" $+> [Group "ScalarExprs"+> [seePg anEnv "an" (Right anType)+> ,seePg aEnv "a" (Right aType)+> ,seePg cnEnv "cn" (Right cnType)+> ,seePg cEnv "c" (Right cType)+> ,seePg vnEnv "vn" (Right vnType)+> ,seePg vEnv "v" (Right vType)+> ,seePg dnEnv "dn" (Right dnType)+> ,seePg dEnv "d" (Right dType)+> ,seePg vConcatEnv vConcatExpr (Right vConcatType)+> ,seePg vConcatEnv "v||'test12'" (Right $ TypeExtra (ScalarType "text") (Just 12) Nothing False)+> ,seePg vEqEnv vEqExpr (Right vEqType)+> ,seeTs a2Env "isnull(an,a)" (Right aType)+> ,seeTs anEnv "isnull(an,an)" (Right anType)+> ,seePg aEnv "a is null" (Right isNType)+> ,seePg aEnv "a is not null" (Right isNType)+> ,seePg anEnv "an is null" (Right isNType)+> ,seePg anEnv "an is not null" (Right isNType)+> ,seePg coalEnv "coalesce(an,dn,a)" (Right coalType)+> -- gives incompatible types+> --,seePg case1Env "case an when v then a when c then an end" (Right case1Type)+> ,seeTs case1Env "case vn when v then a when c then an end" (Right case1Type)+> ,seePg case2Env "case when an is null then a when v is null then an else dn end" (Right case2Type)+> ,seeTs (selListEnv []) "dateadd(year,1,'1997/01/01')" (Right $ mkTypeExtraNN $ ScalarType "timestamp")+> ,seeTs vEnv "len(v)" (Right aType)+> ]+> ]+> ++ [Group "PrecisionAndNullabletcQueryExpr"+> [tcQueryExpr+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", CatNameExtra "varchar" (Just 7) Nothing False)]]+> "select a,b from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", TypeExtra typeVarChar (Just 7) Nothing False)]+>+>+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", CatNameExtra "numeric" (Just 6) (Just 2) False)+> ,("b", CatNameExtra "numeric" (Just 10) (Just 3) False)]]+> "select nullif(a,b) as ni from t"+> $ Right $ CompositeType [("ni", TypeExtra typeNumeric (Just 6) (Just 2) True)]+>+>+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", CatNameExtra "float" (Just 10) (Just 2) False)+> ,("b", CatNameExtra "varchar" (Just 12) Nothing True)]]+> "select * from t"+> $ Right $ CompositeType [("a", TypeExtra typeFloat8 (Just 10) (Just 2) False)+> ,("b", TypeExtra typeVarChar (Just 12) Nothing True)]+> ,tsqlQueryExpr+> [CatCreateTable ("public","t1") [("a", CatNameExtra "int4" Nothing Nothing True)+> ,("b", CatNameExtra "char" (Just 5) Nothing False)]+> ,CatCreateTable ("public","t2") [("c", CatNameExtra "float" (Just 10) (Just 2) False)+> ,("d", CatNameExtra "varchar" (Just 6) Nothing False)]]+> "select * from t1 union all select * from t2"+> $ Right $ CompositeType [("a", TypeExtra typeFloat8 (Just 10) (Just 2) True)+> ,("b", TypeExtra typeVarChar (Just 6) Nothing False)]++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", CatNameExtra "varchar" (Just 13) Nothing False)+> ,("c", CatNameExtra "varchar" (Just 15) Nothing True)]]+> "select case when a is null then b else c end as cs from t u"+> $ Right $ CompositeType [("cs", TypeExtra typeVarChar (Just 15) Nothing True)]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t u(c,d)"+> $ Right $ CompositeType [("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select u.a,u.b from t u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]++>+>+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select count(*) from t"+> $ Right $ CompositeType [("count", mkTypeExtraNN typeBigInt)]+++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","u") [("a", mkCatNameExtra "int4")]]+> "select * from t union select * from u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","u") [("b", mkCatNameExtra "int4")]]+> "select * from t union select * from u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]]+> "select a,count(*) over () as r from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt),+> ("r", mkTypeExtraNN typeBigInt)]+> -- postponed until we decide about implicit casts from numeric to string types+> --,tsqlQueryExpr [CatCreateTable ("public","t") [("a", CatNameExtra "int4" Nothing Nothing False)]]+> -- "select a, lower(a) as l from t"+> -- $ Right $ CompositeType [("a", TypeExtra (ScalarType "int4") Nothing Nothing False),+> -- ("l", TypeExtra (ScalarType "text") Nothing Nothing False)]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("d", CatNameExtra "date" Nothing Nothing False)]]+> "select d from t where d > dateadd(year,1,'1997-01-01')"+> $ Right $ CompositeType [("d", mkTypeExtraNN typeDate)]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a", CatNameExtra "int4" Nothing Nothing False)],+> CatCreateTable ("public","tt") [("v", CatNameExtra "varchar" (Just 6) Nothing False)]]+> "select t.a from t inner join tt on t.a=tt.v"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "select tv from t"+> $ Right $ CompositeType [("tv", mkTe 15 False)]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a",CatNameExtra "int4" Nothing Nothing False)+> ,("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "select * from t"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)+> ,("tv", mkTe 15 False)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "select substring(tv,0,2) from t"+> $ Right $ CompositeType [("substring",TypeExtra typeNvc (Just 15) Nothing False)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "select len(tv) from t"+> $ Right $ CompositeType [("len", mkTypeExtraNN typeInt)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "SELECT tv LIKE '%foo' FROM t"+> $ Right $ CompositeType [("?column?", mkTypeExtraNN typeBool)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("tv1",CatNameExtra "nvarchar" (Just 9) Nothing False)+> ,("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "SELECT tv=tv1 FROM t"+> $ Right $ CompositeType [("?column?", mkTypeExtraNN typeBool)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("tv", CatNameExtra "nvarchar" (Just 15) Nothing False)]]+> "SELECT tv='foo' FROM t"+> $ Right $ CompositeType [("?column?", mkTypeExtraNN typeBool)]+> ]+> ]+> where+> --cat1 = diDefaultCatalog postgresDialect+> --cat2 = diDefaultCatalog sqlServerDialect+> anType = TypeExtra typeInt Nothing Nothing True+> anEnv = selListEnv [("an", anType)]+> aType = mkTypeExtraNN typeInt+> aEnv = selListEnv [("a", aType)]+> a2Env = selListEnv [("a", aType),("an", anType)]+> cnType = TypeExtra typeChar (Just 4) Nothing True+> cnEnv = selListEnv [("cn", cnType)]+> cType = TypeExtra typeChar (Just 3) Nothing False+> cEnv = selListEnv [("c", cType)]+> vnType = TypeExtra typeVarChar (Just 7) Nothing True+> vnEnv = selListEnv [("vn", vnType)]+> vType = TypeExtra typeVarChar (Just 6) Nothing False+> vEnv = selListEnv [("v", vType)]+> dnType = TypeExtra typeNumeric (Just 10) (Just 2) True+> dnEnv = selListEnv [("dn", dnType)]+> dType = TypeExtra typeNumeric (Just 9) (Just 3) False+> dEnv = selListEnv [("d", dType)]+> vConcatType = TypeExtra (ScalarType "text") (Just 13) Nothing True+> vConcatExpr = "v||vn"+> vConcatEnv = selListEnv [("vn", vnType),("v", vType)]+> vEqType = TypeExtra typeBool Nothing Nothing True+> vEqExpr = "v=vn"+> vEqEnv = selListEnv [("vn", vnType),("v", vType)]+> isNType = mkTypeExtraNN typeBool+> coalEnv = selListEnv [("a", aType),("an", anType),("dn", dnType)]+> coalType = TypeExtra typeNumeric (Just 10) (Just 2) False+> case1Env = selListEnv [("vn", vnType),("a", aType),("an", anType),("c", cType),("v", vType)]+> case1Type = anType+> case2Env = selListEnv [("a", aType),("an", anType),("dn", dnType),("v", vType)]+> case2Type = dnType+> --+> selListEnv env = either (const brokeEnvironment) id $ envSelectListEnvironment env+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = postgresDialect}+> tsqlQueryExpr cus =+> let cat = makeCatalog sqlServerDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = sqlServerDialect}+> seePg = ScalarExprExtra postgresDialect (diDefaultCatalog postgresDialect)+> seeTs = ScalarExprExtra sqlServerDialect (diDefaultCatalog sqlServerDialect)+> typeInt = ScalarType "int4"+> typeBigInt = ScalarType "int8"+> typeVarChar = ScalarType "varchar"+> typeNumeric = ScalarType "numeric"+> typeFloat8 = ScalarType "float8"+> typeDate = ScalarType "date"+> typeChar = ScalarType "char"+> typeBool = ScalarType "bool"+> typeNvc = ScalarType "nvarchar"+> mkTe i isNull = TypeExtra (typeNvc) (Just i) Nothing isNull
+ tests/Database/HsSqlPpp/Tests/TypeChecking/QueryExprs.lhs view
@@ -0,0 +1,116 @@++New set of tests for new typechecking. Will catch more issues than the+old typechecker, and the tests are focus on lots of checks for bad+typechecks as well as correct queries compared to the old tests.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.QueryExprs+> (queryExprs) where++> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Internals.AstInternal as A+> --import Database.HsSqlPpp.Tests.Parsing.Utils+> --import qualified Data.Text as T+> import qualified Data.Text.Lazy as L++> queryExprs :: Item+> queryExprs =+> Group "queryExprs" [+> tcQueryExpr simpleTEnv+> (L.concat ["with tbl1(c,d) as (select a,b from tbl), tbl2(e,f) as (select c,d from tbl1)"+> ," select c,d,e,f from tbl1 join tbl2"])+> $ Right $ CompositeType [("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")+> ,("e", mkTypeExtra typeInt)+> ,("f", mkTypeExtra $ ScalarType "text")+> ]+> ]+> where+> simpleTEnv = [CatCreateTable ("public","tbl")+> [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> typeInt = ScalarType "int4"+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect=postgresDialect}++= basic select list++column name+*+aliases+correlation names++can embed in view to check additional stuff like no duplicate or+unnamed columns++= from++tableref+funtableref+subquery tref+join+parens+aliases+lateral++= set valued functions in select list++= aggregates++== simple+== with extra exprs+== in other contexts+== grouping set stuff+== having+= windows++= orderby+= where+= csq+= distinct+= set ops++= limit, offset+++= additional scalar expr syntax tests++where, having, order by, limit, offset++++= errors++what kind of errors can there be with a sql statement?++static errors: these are errors which can be detected with syntax+analysis and static checking without executing anything (and before+any cost based optimiser)++transaction errors: these are errors which occur because of+transactions and concurrency. Some other transaction can commit first+and then your transaction fails and cannot work (e.g. someone drops a+table you are referencing), and you can have serializable errors which+you can just retry and expect it to work.++'dynamic' errors: bad parses, arithmetic overflow, etc. These are+errors which only occur during statement execution. Are they all+related to data type conversion and/or scalar functions (maybe also+aggs and windows?). can other phys ops fail like this?++apparent hanging? is this an error? this means stuff like the cost+based optimiser takes forever (or even some other part of the+statement compiler), or the runtime takes forever (e.g. some+degenerate sort means it does a new io for each row and it never+completes). Real hangs should only occur from programmer errors. We+should have methods to detect and recover from these (cancelling a+statement or connection, and restarting the server process for+instance).++unexpected errors: these can come from programming errors, e.g. assert+or bad memory writes, or running out of memory (this is a programmer+error), or from hardware issues
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Rewrites.lhs view
@@ -0,0 +1,119 @@+test adding qualifiers, tableref aliases, expanding *, adding select+item aliases++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Rewrites+> (rewrites) where++> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.TypeCheck++++> rewrites :: Item+> rewrites =+> Group "rewrites"+> [RewriteQueryExpr defaultTypeCheckFlags {tcfAddSelectItemAliases = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select a,b from t"+> "select a as a,b as b from t"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfExpandStars = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t"+> "select t.a,t.b from t"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select b,count(a) from t group by b"+> "select t.b,count(t.a) from t group by t.b"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t where a > 3"+> "select * from t where t.a > 3"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t u where a > 3"+> "select * from t u where u.a > 3"+++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t order by a"+> "select * from t order by t.a"++++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddFullTablerefAliases = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t"+> "select * from t as t(a,b)"+++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddFullTablerefAliases = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from (select a,b from t) u"+> "select * from (select a,b from t t(a,b)) u(a,b)"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddFullTablerefAliases = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]+> ,CatCreateTable ("public","u") [("c", mkCatNameExtra "int4")+> ,("d", mkCatNameExtra "text")]]+> "select * from t cross join u"+> -- can't add an alias to the join since the qualifiers+> -- aren't all the same+> "select * from t t(a,b) cross join u u(c,d)"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddFullTablerefAliases = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]+> ,CatCreateTable ("public","u") [("c", mkCatNameExtra "int4")+> ,("d", mkCatNameExtra "text")]]+> "select * from t cross join u t"+> "select * from (t t(a,b) cross join u t(c,d)) t(a,b,c,d)"+++++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select a,b from t"+> "select t.a,t.b from t"++> ,RewriteQueryExpr defaultTypeCheckFlags {tcfAddQualifiers = True+> ,tcfAddSelectItemAliases = True+> ,tcfExpandStars = True+> ,tcfAddFullTablerefAliases = True+> ,tcfDialect = postgresDialect}+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "/*thisit*/select * from t"+> "select t.a as a,t.b as b from t as t(a,b)"++> ]
+ tests/Database/HsSqlPpp/Tests/TypeChecking/ScalarExprs.lhs view
@@ -0,0 +1,46 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.ScalarExprs+> (scalarExprs) where++> import Database.HsSqlPpp.Types+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)+> import Database.HsSqlPpp.Dialect++> import Database.HsSqlPpp.Tests.TestTypes++> scalarExprs :: Item+> scalarExprs =+> Group "scalarExprs"+> [Group "simple literals"+> [scalExpr "true" $ Right typeBool+> ,scalExpr "false" $ Right typeBool+> ,scalExpr "41" $ Right typeInt+> ,scalExpr "2147483648" $ Right typeBigInt+> ,scalExpr "9223372036854775808" $ Right typeNumeric+> ,scalExpr "1.6" $ Right typeNumeric+> ,scalExpr "'test'" $ Right UnknownType+> ,scalExpr "null" $ Right UnknownType+> ]+> ,Group "other simple scalexprs"+> [scalExpr "'1'::int" $ Right typeInt+> ,scalExpr "date '2000-01-01'" $ Right $ ScalarType "date"+> ,scalExpr "interval '90' day" $ Right $ ScalarType "interval"+> ,scalExpr "?" $ Right UnknownType+> ]+> ,Group "function application"+> [scalExpr "length('test')" $ Right typeInt+> ,scalExpr "-5" $ Right typeInt+> ]+> ,Group "function application like"+> [scalExpr "extract(year from date '2000-01-01')" $ Right typeInt+> ,scalExpr "extract(year from 3)" $ Left [NoMatchingOperator "extract" [typeInt]]+> ]+> ]+> where+> scalExpr = TCScalExpr (diDefaultCatalog postgresDialect) emptyEnvironment+> defaultTypeCheckFlags {tcfDialect = postgresDialect}+> typeBool = ScalarType "bool"+> typeInt = ScalarType "int4"+> typeBigInt = ScalarType "int8"+> typeNumeric = ScalarType "numeric"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/SimpleQueryExprs.lhs view
@@ -0,0 +1,119 @@++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.SimpleQueryExprs+> (simpleQueryExprs) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.TypeChecker+> import Database.HsSqlPpp.Types+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> import Database.HsSqlPpp.Tests.TypeChecking.Utils++> simpleQueryExprs :: Item+> simpleQueryExprs =+> Group "simpleQueryExpr"+> [tcQueryExpr+> [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select a,b from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+>+>+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select a as c,b as d from t"+> $ Right $ CompositeType [("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+>+>+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select t.a,t.b from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select u.* from t u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select * from t u(c,d)"+> $ Right $ CompositeType [("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select u.a,u.b from t u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]++>+>+> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> "select count(*) from t"+> $ Right $ CompositeType [("count", mkTypeExtraNN typeBigInt)]+++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","u") [("a", mkCatNameExtra "int4")]]+> "select * from t union select * from u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","u") [("b", mkCatNameExtra "int4")]]+> "select * from t union select * from u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4"),("b", mkCatNameExtra "int4")]+> ,CatCreateTable ("public","u") [("a", mkCatNameExtra "int4")]]+> "select a,b from t union select a from u"+> $ Left [IncompatibleUnionTypes (CompositeType [("a", mkTypeExtra typeInt),("b", mkTypeExtra typeInt)])+> (CompositeType [("a", mkTypeExtra typeInt)])]++todo: implicit casts in union++simple window function type++> ,tcQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]]+> "select a,count(*) over () as r from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt), ("r", mkTypeExtraNN typeBigInt)]++values++> ,tcQueryExpr []+> "values (1)"+> $ Right $ CompositeType [("values%0", mkTypeExtraNN typeInt)]++> ,tcQueryExpr []+> "values (1),(2)"+> $ Right $ CompositeType [("values%0", mkTypeExtraNN typeInt)]++> ,tcQueryExpr []+> "values (1,1.5),(2,2.5)"+> $ Right $ CompositeType [("values%0", mkTypeExtraNN typeInt), ("values%1", mkTypeExtraNN $ ScalarType "numeric")]++> ,tcQueryExpr []+> "values (1.5),(1)"+> $ Right $ CompositeType [("values%0", mkTypeExtraNN $ ScalarType "numeric")]+> ]+> where+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = postgresDialect}+> --typeBool = ScalarType "bool"+> typeInt = ScalarType "int4"+> typeBigInt = ScalarType "int8"+> --typeNumeric = ScalarType "numeric"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/TSQL.lhs view
@@ -0,0 +1,138 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.TSQL+> (tsqlQueryExprs) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> --import Database.HsSqlPpp.TypeChecker+> import Data.Text.Lazy (pack)+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Dialect+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> tsqlQueryExprs :: Item+> tsqlQueryExprs =+> Group "tsql" $++datepart, datediff, dateadd++> [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "date")+> ,("b", mkCatNameExtra "date")]]++this doesn't work:+ "select datediff(hour,a,b) a from t"+todo: fix it++> "select datediff(hour,a,b) as a from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "tinyint")+> ,("b", mkCatNameExtra "smallint")]]+> "select a+b as a from t /* junk it */"+> $ Right $ CompositeType [("a", mkTypeExtra typeSmallInt)]]+> ++ [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "date")]]+> (pack $ "select datepart(" ++ dp ++ ",a) as a from t")+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> | dp <- ["day","month","year", "hour"]]++> ++ [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "timestamp")]]+> (pack $ "select datepart(" ++ dp ++ ",a) as a from t")+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> | dp <- ["day","month","year", "hour"]]+++> ++ [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "date")]]+> (pack $ "select dateadd(" ++ dp ++ ",5,a) as a from t")+> $ Right $ CompositeType [("a", mkTypeExtra typeDate)]+> | dp <- ["day","month","year"]]+> ++ [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "date")]]+> (pack $ "select dateadd(" ++ dp ++ ",5,'1992-001-01') as a from t")+> $ Right $ CompositeType [("a", mkTypeExtraNN $ ScalarType "timestamp")]+> | dp <- ["day","month","year"]]+++aggregates: the types of aggregates is different in mssql to+postgresql:++http://msdn.microsoft.com/en-us/library/ms173454.aspx++> ++ [tsqlQueryExpr [CatCreateTable ("public","t") [("a", inty)]]+> (pack $ "select " ++ agg ++ "(a) as a from t")+> $ Right $ CompositeType [("a",resty)]+> | agg <- ["sum","avg"]++avg,sum++tinyint int+smallint int+int int+bigint bigint+money and smallmoney category -> money -> todo+float and real category -> float++> , (inty,resty) <-+> [(mkCatNameExtra "tinyint", mkTypeExtra typeInt)+> ,(mkCatNameExtra "smallint", mkTypeExtra typeInt)+> ,(mkCatNameExtra "int", mkTypeExtra typeInt)+> --,(mkCatNameExtra "int", mkTypeExtra typeInt)+> ,(mkCatNameExtra "bigint", mkTypeExtra typeBigInt)+> ,(mkCatNameExtra "float", mkTypeExtra typeFloat8)+> ,(mkCatNameExtra "real", mkTypeExtra typeFloat8)+> ]]++avg++decimal category (p, s) ->+decimal(38, s) divided by decimal(10, 0)++sum++decimal category (p, s) ->+decimal(38, s)++(todo)+++count returns int+count_big returns bigint++> +++> [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]]+> "select count(*) as a from t"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeInt)]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int4")]]+> "select count_big(*) as a from t"+> $ Right $ CompositeType [("a", mkTypeExtraNN typeBigInt)]]++todo: add new dialect and stuff for oracle++> +++> [tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "timestamp")]]+> "select trunc(a) as a from t"+> $ Right $ CompositeType [("a", mkTypeExtra $ ScalarType "timestamp")]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "date")]]+> "select trunc(a) as a from t"+> $ Right $ CompositeType [("a", mkTypeExtra $ ScalarType "timestamp")]+> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "date")]]+> "select a from t where \+> \ trunc(a) between '2001-01-01 00:00:00' and '2001-04-01 00:00:00'"+> $ Right $ CompositeType [("a", mkTypeExtra typeDate)]++> ,tsqlQueryExpr [CatCreateTable ("public","t") [("a", mkCatNameExtra "int")]]+> "select decode(a,0,0,1,5,2,6,3,7,10) as a from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++> ]+> where+> tsqlQueryExpr cus =+> let cat = makeCatalog sqlServerDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = sqlServerDialect}+> typeInt = ScalarType "int4"+> typeSmallInt = ScalarType "int2"+> typeDate = ScalarType "date"+> typeBigInt = ScalarType "int8"+> typeFloat8 = ScalarType "float8"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Tpch.lhs view
@@ -0,0 +1,136 @@++Tests using the tpch queries. Just tests the result type at the+moment.++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Tpch+> (tpch) where+> --import Database.HsSqlPpp.Internals.TypesInternal+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Tests.TpchData+> import Database.HsSqlPpp.Tests.TestTypes+> import qualified Data.Text.Lazy as L+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Dialect+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> tpch :: Item+> tpch =+> Group "tpch" $+> -- FIXME: 15 has cte which isn't implemented yet+> let (s,e) = splitAt 14 t+> in s ++ drop 1 e+> where+> t = zipWith (\(_n,s) t' -> tcQueryExpr tpchCatalog (L.pack s)+> (Right $ {-Pseudo $ SetOfType $ -}CompositeType t'))+> tpchQueries+> [-- q1+> [("l_returnflag", mkTypeExtra typeChar)+> ,("l_linestatus", mkTypeExtra typeChar)+> ,("sum_qty", mkTypeExtra typeNumeric)+> ,("sum_base_price", mkTypeExtra typeNumeric)+> ,("sum_disc_price", mkTypeExtra typeNumeric)+> ,("sum_charge", mkTypeExtra typeNumeric)+> ,("avg_qty", mkTypeExtra typeNumeric)+> ,("avg_price", mkTypeExtra typeNumeric)+> ,("avg_disc", mkTypeExtra typeNumeric)+> ,("count_order", mkTypeExtraNN typeBigInt)]+> ,--q2+> [("s_acctbal", mkTypeExtra typeNumeric)+> ,("s_name", mkTypeExtra typeChar)+> ,("n_name", mkTypeExtra typeChar)+> ,("p_partkey", mkTypeExtra typeInt)+> ,("p_mfgr", mkTypeExtra typeChar)+> ,("s_address", mkTypeExtra typeVarChar)+> ,("s_phone", mkTypeExtra typeChar)+> ,("s_comment", mkTypeExtra typeVarChar)]+> ,--q3+> [("l_orderkey", mkTypeExtra typeInt)+> ,("revenue", mkTypeExtra typeNumeric)+> ,("o_orderdate", mkTypeExtra typeDate)+> ,("o_shippriority", mkTypeExtra typeInt)]+> ,--q4+> [("o_orderpriority", mkTypeExtra typeChar)+> ,("order_count", mkTypeExtraNN typeBigInt)]+> ,--q5+> [("n_name", mkTypeExtra typeChar)+> ,("revenue", mkTypeExtra typeNumeric)]+> ,--q6+> [("revenue", mkTypeExtra typeNumeric)]+> ,--q7+> [("supp_nation", mkTypeExtra typeChar)+> ,("cust_nation", mkTypeExtra typeChar)+> ,("l_year", mkTypeExtra typeInt)+> ,("revenue", mkTypeExtra typeNumeric)]+> ,--q8+> [("o_year", mkTypeExtra typeInt)+> ,("mkt_share", mkTypeExtra typeNumeric)]+> ,--q9+> [("nation", mkTypeExtra typeChar)+> ,("o_year", mkTypeExtra typeInt)+> ,("sum_profit", mkTypeExtra typeNumeric)]+> ,--q10+> [("c_custkey", mkTypeExtra typeInt)+> ,("c_name", mkTypeExtra typeChar)+> ,("revenue", mkTypeExtra typeNumeric)+> ,("c_acctbal", mkTypeExtra typeNumeric)+> ,("n_name", mkTypeExtra typeChar)+> ,("c_address", mkTypeExtra typeVarChar)+> ,("c_phone", mkTypeExtra typeChar)+> ,("c_comment", mkTypeExtra typeVarChar)]+> ,--q11+> [("ps_partkey", mkTypeExtra typeInt)+> ,("value", mkTypeExtra typeNumeric)]+> ,--q12+> [("l_shipmode", mkTypeExtra typeChar)+> ,("high_line_count", mkTypeExtraNN typeBigInt)+> ,("low_line_count", mkTypeExtraNN typeBigInt)]+> ,--q13+> [("c_count", mkTypeExtraNN typeBigInt)+> ,("custdist", mkTypeExtraNN typeBigInt)]+> ,--q14+> [("promo_revenue", mkTypeExtra typeNumeric)]+> ,--q15+> [("s_suppkey", mkTypeExtra typeInt)+> ,("s_name", mkTypeExtra typeChar)+> ,("s_address", mkTypeExtra typeVarChar)+> ,("s_phone", mkTypeExtra typeChar)+> ,("total_revenue", mkTypeExtra typeNumeric)]+> ,--q16+> [("p_brand", mkTypeExtra typeChar)+> ,("p_type", mkTypeExtra typeVarChar)+> ,("p_size", mkTypeExtra typeInt)+> ,("supplier_cnt", mkTypeExtraNN typeBigInt)]+> ,--q17+> [("avg_yearly", mkTypeExtra typeNumeric)]+> ,--q18+> [("c_name", mkTypeExtra typeChar)+> ,("c_custkey", mkTypeExtra typeInt)+> ,("o_orderkey", mkTypeExtra typeInt)+> ,("o_orderdate", mkTypeExtra typeDate)+> ,("o_totalprice", mkTypeExtra typeNumeric)+> ,("sum", mkTypeExtra typeNumeric)]+> ,--q19+> [("revenue", mkTypeExtra typeNumeric)]+> ,--q20+> [("s_name", mkTypeExtra typeChar)+> ,("s_address", mkTypeExtra typeVarChar)]+> ,--q21+> [("s_name", mkTypeExtra typeChar)+> ,("numwait", mkTypeExtraNN typeBigInt)]+> ,--q22+> [("cntrycode", mkTypeExtra $ ScalarType "char")+> ,("numcust", mkTypeExtraNN typeBigInt)+> ,("totacctbal", mkTypeExtra typeNumeric)]+> ]+> tcQueryExpr cus =+> let cat = makeCatalog ansiDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags+> typeChar = ScalarType "char"+> typeNumeric = ScalarType "numeric"+> typeBigInt = ScalarType "bigint"+> typeVarChar = ScalarType "varchar"+> typeInt = ScalarType "int"+> typeDate = ScalarType "date"+
+ tests/Database/HsSqlPpp/Tests/TypeChecking/TrefIdentifiers.lhs view
@@ -0,0 +1,114 @@+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.TrefIdentifiers+> (trefIdentifiers) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)+++> trefIdentifiers :: Item+> trefIdentifiers =+> Group "trefIdentifiers"+> [qenc "select * from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+> ,qenc "select t0.* from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,qenc "select t1.* from t0 cross join t1"+> $ Right $ CompositeType [("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]+> ,qenc "select *, t0.*, t1.* from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra typeInt)+> ,("d", mkTypeExtra $ ScalarType "text")]++> ,qec "select * from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("c", mkTypeExtra $ ScalarType "text")]+> ,qec "select t0.* from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,qec "select t1.* from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("c", mkTypeExtra $ ScalarType "text")]+> ,qec "select *, t0.*, t1.* from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("c", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("c", mkTypeExtra $ ScalarType "text")]+> ,qec "select t0.a from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,qec "select t1.a from t0 cross join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,qec "select a from t0 cross join t1"+> $ Left [AmbiguousIdentifier "a"]++> ,qec "select * from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra $ ScalarType "text")]+> ,qec "select t0.* from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,qec "select t1.* from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("c", mkTypeExtra $ ScalarType "text")]+> ,qec "select *, t0.*, t1.* from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("c", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")+> ,("a", mkTypeExtra typeInt)+> ,("c", mkTypeExtra $ ScalarType "text")]+> ,qec "select t0.a from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,qec "select t1.a from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]+> ,qec "select a from t0 natural inner join t1"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)]++++> ]+> where+> qenc = tcQueryExpr [CatCreateTable ("public","t0") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]+> ,CatCreateTable ("public","t1") [("c", mkCatNameExtra "int4")+> ,("d", mkCatNameExtra "text")]]+> qec = tcQueryExpr [CatCreateTable ("public","t0") [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]+> ,CatCreateTable ("public","t1") [("a", mkCatNameExtra "int4")+> ,("c", mkCatNameExtra "text")]]+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect = postgresDialect}+> typeInt = ScalarType "int4"++++todo:+unrecognised id+bogus qualifier for real id
+ tests/Database/HsSqlPpp/Tests/TypeChecking/TrefSchemas.lhs view
@@ -0,0 +1,61 @@++Testing schemas in trefs in simple queries++default schema is public - no schema search path+check explicit schemas match+check rewrite to add schemas to syntax if missing++schemas affect typechecking of views and tables only currently++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.TrefSchemas+> (trefSchemas) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.TypeChecker+> import Database.HsSqlPpp.Types++> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> trefSchemas :: Item+> trefSchemas =+> Group "trefSchemas"+> [tcQueryExpr simpleTEnv+> "select a,b from public.t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,tcQueryExpr simpleTEnv+> "select a,b from t"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ,tcQueryExpr simpleTEnv+> "select a,b from something.t"+> $ Left $ [UnrecognisedRelation ("something", "t")]++> ,tcQueryExpr anotherUEnv+> "select a,b from public.u"+> $ Left [UnrecognisedRelation ("public", "u")]+> ,tcQueryExpr anotherUEnv+> "select a,b from u"+> $ Left [UnrecognisedRelation ("public", "u")]+> ,tcQueryExpr anotherUEnv+> "select a,b from something.u"+> $ Right $ CompositeType [("a", mkTypeExtra typeInt)+> ,("b", mkTypeExtra $ ScalarType "text")]+> ]+> where+> simpleTEnv = [CatCreateTable ("public","t")+> [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> anotherUEnv = [CatCreateTable ("something","u")+> [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> tcQueryExpr cus =+> let cat = makeCatalog postgresDialect cus+> in TCQueryExpr cat defaultTypeCheckFlags {tcfDialect=postgresDialect}+> typeInt = ScalarType "int4"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/TypeCheckTests.lhs view
@@ -0,0 +1,56 @@+++> module Database.HsSqlPpp.Tests.TypeChecking.TypeCheckTests+> (typeCheckTestData+> ,Item(..)) where++> --import Test.Framework+++> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Tests.TypeChecking.AnsiScalarExprs+> import Database.HsSqlPpp.Tests.TypeChecking.ScalarExprs+> import Database.HsSqlPpp.Tests.TypeChecking.SimpleQueryExprs+> import Database.HsSqlPpp.Tests.TypeChecking.Rewrites+> import Database.HsSqlPpp.Tests.TypeChecking.Joins+> import Database.HsSqlPpp.Tests.TypeChecking.Tpch+> import Database.HsSqlPpp.Tests.TypeChecking.TrefIdentifiers+> import Database.HsSqlPpp.Tests.TypeChecking.CaseExpressions+> import Database.HsSqlPpp.Tests.TypeChecking.ImplicitCasts+> import Database.HsSqlPpp.Tests.TypeChecking.TSQL+> import Database.HsSqlPpp.Tests.TypeChecking.Issues+> import Database.HsSqlPpp.Tests.TypeChecking.Aggregates+> import Database.HsSqlPpp.Tests.TypeChecking.PrecisionAndNullable+> import Database.HsSqlPpp.Tests.TypeChecking.InsertQueryExprs+> import Database.HsSqlPpp.Tests.TypeChecking.TypeConversion+> import Database.HsSqlPpp.Tests.TypeChecking.OdbcTypechecking+> import Database.HsSqlPpp.Tests.TypeChecking.TrefSchemas+> import Database.HsSqlPpp.Tests.TypeChecking.QueryExprs+> import Database.HsSqlPpp.Tests.TypeChecking.Updates+> import Database.HsSqlPpp.Tests.TypeChecking.DDL+> import Database.HsSqlPpp.Tests.TypeChecking.Catalog++> typeCheckTestData :: Item+> typeCheckTestData =+> Group "typeCheckTests"+> [catalog+> ,scalarExprs+> ,simpleQueryExprs+> ,joins+> ,trefIdentifiers+> ,rewrites+> ,caseExpressions+> ,tpch+> ,impCasts+> ,tsqlQueryExprs+> ,issues+> ,aggregates+> ,precisionAndNullable+> ,insertQueryExprs+> ,typeConversionTests+> ,odbcTypechecking+> ,trefSchemas+> ,ddl+> ,queryExprs+> ,updates+> ]
+ tests/Database/HsSqlPpp/Tests/TypeChecking/TypeConversion.lhs view
@@ -0,0 +1,114 @@++> {-# LANGUAGE OverloadedStrings,LambdaCase #-}+> module Database.HsSqlPpp.Tests.TypeChecking.TypeConversion+> (typeConversionTests) where++> import Data.Text ()+> --import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Types+> --import Database.HsSqlPpp.Ast+> --import Database.HsSqlPpp.Dialect+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)+++tests:+numeric operators simulator+ choose each pair of number types with the plus operator+ and check the return type+ choose one type with unknown and plus op+ two unknowns and plus -> error++> typeConversionTests :: Item+> typeConversionTests = Group "typeConversionTests"+> [binaryOperators]+++> binaryOperators :: Item+> binaryOperators = Group "binaryOperators"+> [{-MatchApp PostgreSQLDialect defaultTemplate1Catalog+> [Nmc "+"] [(intNotNull,Nothing),(intNotNull, Nothing)]+> (Right ([intNotNull,intNotNull],intNotNull))+> ,MatchApp PostgreSQLDialect defaultTemplate1Catalog+> [Nmc "+"] [(intNotNull,Nothing),(unk, Nothing)]+> (Right ([intNotNull,intNotNull],intNotNull))+> ,MatchApp PostgreSQLDialect defaultTemplate1Catalog+> [Nmc "+"] [(unk,Nothing),(unk, Nothing)]+> (Left [NoMatchingOperator "+" [UnknownType,UnknownType]])-}++different types with implicit casts++> {-,MatchApp PostgreSQLDialect defaultTemplate1Catalog+> [Nmc "+"] [(intNotNull,Nothing),(te typeNumeric, Nothing)]+> (Right ([te typeNumeric,te typeNumeric],te typeNumeric))+++nullability++> ,MatchApp PostgreSQLDialect defaultTemplate1Catalog+> [Nmc "+"] [(intNull,Nothing),(intNotNull, Nothing)]+> (Right ([intNull,intNotNull],intNull))-}+++precision and scale+not quite right++> {-,MatchApp PostgreSQLDialect defaultTemplate1Catalog+> [Nmc "+"] [(numeric,Nothing),(numeric, Nothing)]+> (Right ([numeric,numeric],numeric))-}+++> ]+> where+> _intNotNull = TypeExtra typeInt Nothing Nothing False+> _intNull = TypeExtra typeInt Nothing Nothing True+> _unk = TypeExtra UnknownType Nothing Nothing False+> _te s = TypeExtra s Nothing Nothing False+> _numeric = TypeExtra typeNumeric (Just 15) (Just 2) False+> typeInt = ScalarType "int4"+> typeNumeric = ScalarType "numeric"++text conversions+ do something similar to numeric with pairs of string types+ and the || op+domains+ do a simple test for these+function style cast: test some success and fails+time types+ can do something similar to numeric ops?+binary strings+ don't have these right now++review each branch in the matchapp and fix it++precision tests+nullability tests++what are all the special cases currently:+special cases for precision+special cases for result null+in OldTypeConverion.findCallMatch:+ between, not between, greatest, least+ rowctor+ .+ comparisons for composite/set types+more stuff in TypeConversion.matchApp+ sql server date stuff+ decode+ something to do with datetimes?+ string precisions?:+ ||, substring, replace+ some nullability special cases?+ more stuff+SqlTypeConversions: special case for implicit casts from text types to+ numeric (see if can handle in rule system)+ScalarExprs.ag+ needs implicit cast+ implicit cast type+ check the types (e.g. cast syntax should use this typeconversion+ machinery)+ tcAppLike: more mssql date stuff++ getmaybeintsfromliterals: also suggests only need to support int+ literals in the matchapp function here+
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Updates.lhs view
@@ -0,0 +1,241 @@++This file tests the basic typechecking for non query dml (aka updates).++insert+update+delete+copy from+copy to+truncate+++> {-# LANGUAGE OverloadedStrings #-}+> module Database.HsSqlPpp.Tests.TypeChecking.Updates+> (updates) where++> --import Database.HsSqlPpp.Internals.TypesInternal+> import Database.HsSqlPpp.Tests.TestTypes+> --import Database.HsSqlPpp.Types+> import Database.HsSqlPpp.Catalog+> import Database.HsSqlPpp.Dialect+> --import Database.HsSqlPpp.TypeChecker+> import Database.HsSqlPpp.Types++> import Database.HsSqlPpp.Tests.TypeChecking.Utils+> --import Database.HsSqlPpp.Internals.TypesInternal hiding (mkTypeExtra,mkTypeExtraNN)++> updates :: Item+> updates =+> Group "updates"+> [Group "tcinsert"+> [++simplest insert++> tcStatements simpleTEnv+> "insert into t values (1,'2');"+> $ Nothing++too many values++> ,tcStatements simpleTEnv+> "insert into t values (1,'2',3);"+> $ Just [TooManyColumnsInInsert]++too few values: this is ok, not currently statically checked++> ,tcStatements simpleTEnv+> "insert into t values (1);"+> $ Nothing+++bad types in one row of multi values+todo: I'm not sure this is correct.++For an insert, I think you should see if there is an assignment cast+available on a row by row basis, not use the resolve result set on+each value row. For values in every other context, I think you should+use the resolve result set. This will change the error message when it+fails, and probably give different results in some unusual scenarios.++> ,tcStatements simpleTEnv+> "insert into t values (1,'2'), ('1'::text,2);"+> $ Just [IncompatibleUnionTypes+> -- todo: how should the column names work?+> -- todo: check nullability+> -- why does the unknown type string literal already have a precision of 1?+> (CompositeType [("", (mkTypeExtra typeInt) {teNullable=False})+> ,("", (mkTypeExtra UnknownType) {teNullable=False,tePrecision=Just 1})])+> (CompositeType [("values%0", (mkTypeExtra $ ScalarType "text") {teNullable=False})+> ,("values%1", (mkTypeExtra typeInt) {teNullable=False})])]++> ,tcStatements simpleTEnv+> "insert into t values ('1'::text,2), (1,'2');"+> $ Just [IncompatibleUnionTypes+> (CompositeType [("", (mkTypeExtra $ ScalarType "text") {teNullable=False})+> ,("", (mkTypeExtra typeInt) {teNullable=False})])+> (CompositeType [("values%0", (mkTypeExtra typeInt) {teNullable=False})+> ,("values%1", (mkTypeExtra UnknownType) {teNullable=False,tePrecision=Just 1})])]++non existent table++> ,tcStatements simpleTEnv+> "insert into zt values (1,'2');"+> $ Just [UnrecognisedRelation ("public","zt")]++table with explicit schema++> ,tcStatements simpleTEnv+> "insert into public.t values (1,'2');"+> $ Nothing++table with wrong explicit schema++> ,tcStatements simpleTEnv+> "insert into something.t values (1,'2');"+> $ Just [UnrecognisedRelation ("something","t")]++name all columns++> ,tcStatements simpleTEnv+> "insert into t(a,b) values (1,'2');"+> $ Nothing++name columns in different order++> ,tcStatements simpleTEnv+> "insert into t(b,a) values ('2'::text,1);"+> $ Nothing++too many values for the named columns++> ,tcStatements simpleTEnv+> "insert into t(a) values (1,'2');"+> $ Just [TooManyColumnsInInsert]++> ,tcStatements simpleTEnv+> "insert into t(a,b) values (1,'2',3);"+> $ Just [TooManyColumnsInInsert]++The typechecker will never catch this issue for now, even if it is+statically determinable that the insert will fail because of defaults/+not null.++> ,tcStatements simpleTEnv+> "insert into t(a) values (1);"+> $ Nothing++name wrong column++> ,tcStatements simpleTEnv+> "insert into t(a,c) values (1,'2');"+> $ Just [UnrecognisedIdentifier "c"]++duplicate columns++> ,tcStatements simpleTEnv+> "insert into t(a,b,a) values (1,'2',1);"+> $ Just [DuplicateColumnName "a"]++***todo: implicit casts+make sure to check casts which are assignment and not implicit+also works with no column names given++1. implicit casts from literals: already tested++2. implicit casts from typed expressions++> --,tcStatements simpleTEnv+> -- "insert into t(a,b) values (1::int8,'2');"+> -- $ Nothing++3. casts which are only available explicitly: for now treated no+different to casts which aren't possible at all, in future could give+a nicer error message++> --,tcStatements simpleTEnv+> -- "insert into t(a,b) values ('1'::text,'2');"+> -- $ Just []++4. casts which aren't possible at all++> --,tcStatements simpleTEnv+> -- "insert into t(a,b) values ('2005-01-01'::interval,'2');"+> -- $ Just []+++*** todo: repeat tests above with all the other queryexpr ctors:+select, with, setops++*** todo: check multiple values rows use resolve result set algo+outside of insert, and use row by row assignment casts in an insert++todo: more checking with presence of defaults/nulls?++todo: returning++see also InsertQueryExprs.lhs for some typechecking tests for insert++= update++regular update+row style update+wrong table name+explicit schema+qualified assignment targets, good and bad+wrong column name+simple where+where with wrong col+other type check fail in where++TODO: from list, returning++= delete++simple delete+with schema+bad table name+bad schema+simple where+where with wrong col+where with non bool++todo: using and returning++= copy from++can't check the copy from source, but can check the columns++simple copy from+with column names+different order column names+missing columns+non existent columns+repeated column+schema table name+bad table name+bad schema++= copy to++check table name and column names++check simple good and bad queries++= truncate++check table names + schema options++> ]+> ]+> where+> simpleTEnv = [CatCreateTable ("public","t")+> [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> _anotherUEnv = [CatCreateTable ("something","u")+> [("a", mkCatNameExtra "int4")+> ,("b", mkCatNameExtra "text")]]+> tcStatements cus =+> let cat = makeCatalog postgresDialect cus+> in TCStatements cat defaultTypeCheckFlags {tcfDialect=postgresDialect}+> typeInt = ScalarType "int4"
+ tests/Database/HsSqlPpp/Tests/TypeChecking/Utils.lhs view
@@ -0,0 +1,11 @@+++> module Database.HsSqlPpp.Tests.TypeChecking.Utils where++> import Database.HsSqlPpp.Types++> mkTypeExtra :: Type -> TypeExtra+> mkTypeExtra t = TypeExtra t Nothing Nothing True++> mkTypeExtraNN :: Type -> TypeExtra+> mkTypeExtraNN t = TypeExtra t Nothing Nothing False
+ tests/Database/HsSqlPpp/Utils/GroomUtils.lhs view
@@ -0,0 +1,48 @@++Utilities to show asts more nicely++groomAAnns: show anns as A+groomTypes: show anns as Type|TypeErrors+++> module Database.HsSqlPpp.Utils.GroomUtils+> (groomNoAnns+> --,groomAAnns+> ,groomTypes) where+>+> --import qualified Text.Groom as G+> import Language.Haskell.Exts+> import Data.Generics.Uniplate.Data++> --groomAAnns = undefined++> groomNoAnns :: Show a => a -> String+> groomNoAnns = groomF $ const $ Con noSrcSpan $ UnQual noSrcSpan $ Ident noSrcSpan "A"++> groomF :: Show a => (Exp SrcSpanInfo -> Exp SrcSpanInfo) -> a -> String+> groomF f s =+> case parseExp (show s) of+> ParseOk ast -> prettyPrint (g ast)+> x -> error $ show x+> where+> g = transformBi $ \x ->+> case x of+> RecConstr _ (UnQual _ (Ident _ "Annotation")) _ ->+> f x+> x' -> x'+++> groomTypes :: Show a => a -> String+> groomTypes = groomF $ \x -> case x of+> RecConstr _ (UnQual _ (Ident _ "Annotation"))+> [FieldUpdate _ _ _,+> FieldUpdate _ (UnQual _ (Ident _ "anType")) t,+> FieldUpdate _ (UnQual _ (Ident _ "anErrs")) (List _ errs),+> FieldUpdate _ _ _,+> FieldUpdate _ _ _] -> case (t,errs) of+> (Con _ (UnQual _ (Ident _ "Nothing")),[]) ->+> Con noSrcSpan (UnQual noSrcSpan (Ident noSrcSpan "A"))+> (y,[]) -> y+> (_,z) -> List noSrcSpan z+> x' -> x'+
+ tests/Database/HsSqlPpp/Utils/Here.lhs view
@@ -0,0 +1,12 @@+Simple support for multiline strings++> {-# LANGUAGE TemplateHaskell #-}+> module Database.HsSqlPpp.Utils.Here where+> import Language.Haskell.TH.Quote+> import Language.Haskell.TH.Lib++> here :: QuasiQuoter+> here = QuasiQuoter {quoteExp = litE . stringL+> ,quotePat = litP . stringL+> ,quoteType = error "no quoteType for here"+> ,quoteDec = error "no quoteDec for here"}
+ tests/Tests.lhs view
@@ -0,0 +1,28 @@+test files todo:++create new test hierarchy, move test code here, add new exe to run+ them++disable failing tests++get website generating again++start new test pages + renderer+++extensions tests++local bindings tests++parameterized statement tests+parsertests+quasiquote tests+roundtrip tests+type check tests+type inference tests++> import Database.HsSqlPpp.Tests.Tests+> import Test.Tasty++> main :: IO ()+> main = defaultMain $ testGroup "Tests" $ allTests