hssqlppp 0.0.5 → 0.0.6
raw patch · 56 files changed
+21762/−15693 lines, 56 files
Files
- Database/HsSqlPpp/Ast.ag +0/−676
- Database/HsSqlPpp/Ast.hs +0/−7767
- Database/HsSqlPpp/AstCheckTests.lhs +0/−654
- Database/HsSqlPpp/AstUtils.lhs +0/−396
- Database/HsSqlPpp/DBAccess.lhs +0/−57
- Database/HsSqlPpp/DatabaseLoader.lhs +0/−202
- Database/HsSqlPpp/DatabaseLoaderTests.lhs +0/−34
- Database/HsSqlPpp/Dbms/DBAccess.lhs +59/−0
- Database/HsSqlPpp/Dbms/DatabaseLoader.lhs +212/−0
- Database/HsSqlPpp/DefaultScope.hs +0/−5
- Database/HsSqlPpp/DefaultScopeEmpty.hs +0/−47
- Database/HsSqlPpp/Lexer.lhs +0/−290
- Database/HsSqlPpp/ParseErrors.lhs +0/−49
- Database/HsSqlPpp/Parser.lhs +0/−1260
- Database/HsSqlPpp/ParserTests.lhs +0/−1121
- Database/HsSqlPpp/Parsing/Lexer.lhs +292/−0
- Database/HsSqlPpp/Parsing/ParseErrors.lhs +51/−0
- Database/HsSqlPpp/Parsing/Parser.lhs +1290/−0
- Database/HsSqlPpp/PrettyPrinter.lhs +0/−538
- Database/HsSqlPpp/PrettyPrinter/PrettyPrinter.lhs +593/−0
- Database/HsSqlPpp/Scope.lhs +0/−135
- Database/HsSqlPpp/ScopeReader.lhs +0/−230
- Database/HsSqlPpp/Tests/AstCheckTests.lhs +643/−0
- Database/HsSqlPpp/Tests/DatabaseLoaderTests.lhs +33/−0
- Database/HsSqlPpp/Tests/ParserTests.lhs +1112/−0
- Database/HsSqlPpp/TypeChecking.ag +0/−1091
- Database/HsSqlPpp/TypeChecking/Ast.lhs +85/−0
- Database/HsSqlPpp/TypeChecking/AstAnnotation.lhs +149/−0
- Database/HsSqlPpp/TypeChecking/AstInternal.ag +961/−0
- Database/HsSqlPpp/TypeChecking/AstInternal.hs +5468/−0
- Database/HsSqlPpp/TypeChecking/AstUtils.lhs +343/−0
- Database/HsSqlPpp/TypeChecking/DefaultScope.hs +7/−0
- Database/HsSqlPpp/TypeChecking/DefaultScopeEmpty.hs +23/−0
- Database/HsSqlPpp/TypeChecking/Scope.lhs +37/−0
- Database/HsSqlPpp/TypeChecking/ScopeData.lhs +148/−0
- Database/HsSqlPpp/TypeChecking/ScopeReader.lhs +233/−0
- Database/HsSqlPpp/TypeChecking/TypeChecker.lhs +61/−0
- Database/HsSqlPpp/TypeChecking/TypeChecking.ag +1086/−0
- Database/HsSqlPpp/TypeChecking/TypeCheckingH.lhs +231/−0
- Database/HsSqlPpp/TypeChecking/TypeConversion.lhs +513/−0
- Database/HsSqlPpp/TypeChecking/TypeType.lhs +136/−0
- Database/HsSqlPpp/TypeCheckingH.lhs +0/−158
- Database/HsSqlPpp/TypeConversion.lhs +0/−513
- Database/HsSqlPpp/TypeType.lhs +0/−149
- HsSqlPppTests.lhs +4/−4
- HsSqlSystem.lhs +52/−117
- README +25/−18
- TODO +53/−47
- changelog +33/−0
- development +36/−30
- hssqlppp.cabal +93/−47
- questions +7/−6
- sqltestfiles/client.sql +1720/−0
- sqltestfiles/server.sql +4645/−0
- sqltestfiles/system.sql +1308/−0
- usage +20/−52
− Database/HsSqlPpp/Ast.ag
@@ -1,676 +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 pretty printer.--= compiling--use--uuagc -dcfws Ast.ag--to generate a new Ast.hs from this file--(install uuagc with-cabal install uuagc-)---}--MODULE {Database.HsSqlPpp.Ast}-{- -- exports- MySourcePos-- --ast nodes- ,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 (..)- ,OperatorType (..)- ,getOperatorType- ,InList (..)- ,StatementList- --checking stuff- ,Message (..)- ,MessageStuff (..)- --types- ,Type (..)- ,PseudoType (..)- ,TypeErrorInfo (..)- ,StatementInfo (..)- --scope- ,Scope(..)- ,defaultScope- ,emptyScope- --fns- ,checkAst- ,getExpressionType- ,getStatementsType- ,getStatementsTypeScope- ,getStatementsInfo- ,getStatementsInfoScope- ,resetSps- ,resetSp- ,resetSp'- ,resetSps'- ,nsp- --forward some defs- ,typeSmallInt- ,typeBigInt- ,typeInt- ,typeNumeric- ,typeFloat4- ,typeFloat8- ,typeVarChar- ,typeChar- ,typeBool--}-{-import Data.Maybe-import Data.List-import Debug.Trace-import Control.Monad.Error-import Control.Arrow--import Database.HsSqlPpp.TypeType-import Database.HsSqlPpp.AstUtils-import Database.HsSqlPpp.TypeConversion-import Database.HsSqlPpp.TypeCheckingH-import Database.HsSqlPpp.Scope-import Database.HsSqlPpp.DefaultScope-}--{--================================================================================--SQL top level statements--everything is chucked in here: dml, ddl, plpgsql statements---}--DATA Statement----queries-- | SelectStatement ex:SelectExpression---- dml-- --table targetcolumns insertdata(values or select statement) returning- | Insert table : String- targetCols : StringList- insData : SelectExpression- returning : (Maybe SelectList)- --tablename setitems where returning- | Update table : String- assigns : SetClauseList- whr : Where- returning : (Maybe SelectList)- --tablename, where, returning- | Delete table : String- whr : Where- returning : (Maybe SelectList)- --tablename column names, from- | Copy table : String- targetCols : StringList- source : CopySource- --represents inline data for copy statement- | CopyData insData : String- | Truncate tables: StringList- restartIdentity : RestartIdentity- cascade : Cascade---- ddl-- | CreateTable name : String- atts : AttributeDefList- cons : ConstraintList- | CreateTableAs name : String- expr : SelectExpression- | CreateView name : String- expr : SelectExpression- | CreateType name : String- atts : TypeAttributeDefList- -- language name args rettype bodyquoteused body vol- | CreateFunction lang : Language- name : String- params : ParamDefList- rettype : TypeName- bodyQuote : String- body : FnBody- vol : Volatility- -- name type checkexpression- | CreateDomain name : String- typ : TypeName- check : (Maybe Expression)- -- ifexists (name,argtypes)* cascadeorrestrict- | DropFunction ifE : IfExists- sigs : StringStringListPairList- cascade : Cascade- -- ifexists names cascadeorrestrict- | DropSomething dropType : DropType- ifE : IfExists- names : StringList- cascade : Cascade- | Assignment target : String- value : Expression- | Return value : (Maybe Expression)- | ReturnNext expr : Expression- | ReturnQuery sel : SelectExpression- | Raise level : RaiseType- message : String- args : ExpressionList- | NullStatement- | Perform expr : Expression- | Execute expr : Expression- | ExecuteInto expr : Expression- targets : StringList- | ForSelectStatement var : String- sel : SelectExpression- sts : StatementList- | ForIntegerStatement var : String- from : Expression- to : Expression- sts : StatementList- | WhileStatement expr : Expression- sts : StatementList- | ContinueStatement- --variable, list of when parts, else part- | CaseStatement val : Expression- cases : ExpressionListStatementListPairList- els : StatementList- --list is- --first if (condition, statements):elseifs(condition, statements)- --last bit is else statements- | If cases : ExpressionStatementListPairList- els : StatementList---- =============================================================================----Statement components---- maybe this should be called relation valued expression?-DATA SelectExpression- | Select selDistinct : Distinct- selSelectList : SelectList- selTref : MTableRef- selWhere : Where- selGroupBy : ExpressionList- selHaving : (Maybe Expression)- selOrderBy : ExpressionList- selDir : Direction- selLimit : (Maybe Expression)- selOffset : (Maybe Expression)- | CombineSelect ctype : CombineType- sel1 : SelectExpression- sel2 : SelectExpression- | Values vll:ExpressionListList--TYPE MTableRef = MAYBE TableRef-TYPE Where = MAYBE Expression--DATA FnBody | SqlFnBody sts : StatementList- | PlpgsqlFnBody VarDefList sts : StatementList--DATA SetClause | SetClause att:String val:Expression- | RowSetClause atts:StringList vals:ExpressionList--DATA TableRef | Tref tbl:String- | TrefAlias tbl : String- alias : String- | JoinedTref tbl : TableRef- nat : Natural- joinType : JoinType- tbl1 : TableRef- onExpr : OnExpr- | SubTref sel : SelectExpression alias : String- | TrefFun fn:Expression- | TrefFunAlias fn:Expression alias:String--TYPE OnExpr = MAYBE JoinExpression--DATA JoinExpression | JoinOn Expression | JoinUsing StringList--DATA JoinType | Inner | LeftOuter| RightOuter | FullOuter | Cross---- select columns, into columns--DATA SelectList | SelectList items:SelectItemList StringList--DATA SelectItem | SelExp ex:Expression- | SelectItem ex:Expression name:String--DATA CopySource | CopyFilename String | Stdin----name type default null constraint--DATA AttributeDef | AttributeDef name : String- typ : TypeName- check : (Maybe Expression)- cons : RowConstraintList----Constraints which appear attached to an individual field--DATA RowConstraint | NullConstraint- | NotNullConstraint- | RowCheckConstraint Expression- | RowUniqueConstraint- | RowPrimaryKeyConstraint- | RowReferenceConstraint table : String- att : (Maybe String)- onUpdate : Cascade- onDelete : Cascade----constraints which appear on a separate row in the create table--DATA Constraint | UniqueConstraint StringList- | PrimaryKeyConstraint StringList- | CheckConstraint Expression- -- sourcecols targettable targetcols ondelete onupdate- | ReferenceConstraint atts : StringList- table : String- tableAtts : StringList- onUpdate : Cascade- onDelete : Cascade--DATA TypeAttributeDef | TypeAttDef name : String- typ : TypeName--DATA ParamDef | ParamDef name:String typ:TypeName- | ParamDefTp typ:TypeName--DATA VarDef | VarDef 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 tn:String- | PrecTypeName tn:String prec:Integer- | ArrayTypeName typ:TypeName- | SetOfTypeName 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 Integer- | FloatLit Double- | StringLit quote : String- value : String- | NullLit- | BooleanLit Bool- | PositionalArg Integer- | Cast expr:Expression tn:TypeName- | Identifier i:String- | Case cases : CaseExpressionListExpressionPairList- els : MaybeExpression- | CaseSimple value : Expression- cases : CaseExpressionListExpressionPairList- els : MaybeExpression- | Exists sel : SelectExpression- | FunCall funName:String args:ExpressionList- | InPredicate expr:Expression i:Bool list:InList- -- windowfn selectitem partitionby orderby orderbyasc?- | WindowFn fn : Expression- partitionBy : ExpressionList- orderBy : ExpressionList- dir : Direction- | ScalarSubQuery sel : SelectExpression--TYPE MaybeExpression = MAYBE Expression--{---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.---}----DATA InList | InList exprs : ExpressionList- | InSelect sel : SelectExpression---- 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 StringStringListPair = (String,StringList)-TYPE StringStringListPairList = [StringStringListPair]-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]--{---slightly hacky, add the source positions only in statement lists this-includes top level statements, and statements inside createfunction,-and nested inside if, while, case statements, and the like, but-unfortunately not select expressions inside other-expressions/statements, so we get particularly crap source positions-for big select statements.--Was done like this for expediency.--This will be changed back to StatementList = [Statement] when all the-nodes have sourcepositioning information added to them, doing which-has been put off for no good reason.---}--TYPE SourcePosStatement = (MySourcePos, Statement)-TYPE StatementList = [SourcePosStatement]------ 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- ExpressionList ExpressionListList StringList SetClauseList- AttributeDefList ConstraintList TypeAttributeDefList- ParamDefList StringStringListPair StringStringListPairList- StatementList ExpressionListStatementListPair- ExpressionListStatementListPairList ExpressionStatementListPair- ExpressionStatementListPairList VarDefList SelectItemList- RowConstraintList CaseExpressionListExpressionPair- CaseExpressionListExpressionPairList CaseExpressionList- SourcePosStatement MTableRef TableRef OnExpr Where---SET NonListNodes = Statement SelectExpression FnBody SetClause TableRef- JoinExpression JoinType- SelectItem CopySource AttributeDef RowConstraint- Constraint TypeAttributeDef ParamDef VarDef RaiseType- CombineType Volatility Language TypeName DropType Cascade- Direction Distinct Natural IfExists RestartIdentity- Expression InList MaybeExpression- StringStringListPair ExpressionListStatementListPair- ExpressionStatementListPair- SourcePosStatement MTableRef OnExpr Where---SET ListNodes = SelectList ExpressionList ExpressionListList StringList- SetClauseList- AttributeDefList ConstraintList TypeAttributeDefList- ParamDefList StringStringListPairList- StatementList- ExpressionListStatementListPairList- ExpressionStatementListPairList VarDefList SelectItemList- RowConstraintList- CaseExpressionListExpressionPairList CaseExpressionList- CaseExpressionListExpressionPair--DERIVING AllNodes: Show,Eq--INCLUDE "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---================================================================================--= checkAst--test function to run on asts, returns a list of errors, warnings, etc.-bit stale---}-{-checkAst :: StatementList -> [Message]-checkAst sts = let t = sem_Root (Root sts)- in (messages_Syn_Root (wrap_Root t Inh_Root {scope_Inh_Root = defaultScope}))-{--================================================================================--= Types--These are the utility functions which clients use to typecheck sql.---}--getExpressionType :: Scope -> Expression -> Type-getExpressionType scope ex =- let t = sem_ExpressionRoot (ExpressionRoot ex)- in (nodeType_Syn_ExpressionRoot- (wrap_ExpressionRoot t Inh_ExpressionRoot {scope_Inh_ExpressionRoot = combineScopes defaultScope scope}))---getStatementsType :: StatementList -> [Type]-getStatementsType = getStatementsTypeScope emptyScope--getStatementsTypeScope :: Scope -> StatementList -> [Type]-getStatementsTypeScope scope st =- let t = sem_Root (Root st)- ta = wrap_Root t Inh_Root {scope_Inh_Root = combineScopes defaultScope scope}- tl = nodeType_Syn_Root ta- in (unwrapTypeList tl)--getStatementsInfo :: StatementList -> [StatementInfo]-getStatementsInfo = getStatementsInfoScope emptyScope--getStatementsInfoScope :: Scope -> StatementList -> [StatementInfo]-getStatementsInfoScope scope st =- let t = sem_Root (Root st)- ta = wrap_Root t Inh_Root {scope_Inh_Root = combineScopes defaultScope scope}- t2 = statementInfo_Syn_Root ta- in t2-----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.--resetSps :: [Statement] -> [Statement]-resetSps = map resetSp--resetSp :: Statement -> Statement-resetSp (CreateFunction l n p r bq b v) = CreateFunction l n p r bq- (case b of- SqlFnBody stss -> SqlFnBody (map resetSp' stss)- PlpgsqlFnBody vd stss -> PlpgsqlFnBody vd (map resetSp' stss))- v-resetSp (ForSelectStatement v s stss) = ForSelectStatement v s (map resetSp' stss)-resetSp (ForIntegerStatement v f t stss) = ForIntegerStatement v f t (map resetSp' stss)-resetSp (CaseStatement v cs els) = CaseStatement v (map (second (map resetSp')) cs) (map resetSp' els)-resetSp (If cs els) = If (map (second (map resetSp')) cs) (map resetSp' els)-resetSp a = a--resetSp' :: SourcePosStatement -> SourcePosStatement-resetSp' (_,st) = (nsp,resetSp st)--resetSps' :: StatementList -> StatementList-resetSps' = map resetSp'--nsp :: MySourcePos-nsp = ("", 0,0)-}--{---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.--Would like to turn this back into regular Haskell file, maybe could-use AspectAG instead of uuagc to make this happen?----}
− Database/HsSqlPpp/Ast.hs
@@ -1,7767 +0,0 @@----- UUAGC 0.9.10 (Ast.ag)-module Database.HsSqlPpp.Ast(- -- exports- MySourcePos-- --ast nodes- ,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 (..)- ,OperatorType (..)- ,getOperatorType- ,InList (..)- ,StatementList- --checking stuff- ,Message (..)- ,MessageStuff (..)- --types- ,Type (..)- ,PseudoType (..)- ,TypeErrorInfo (..)- ,StatementInfo (..)- --scope- ,Scope(..)- ,defaultScope- ,emptyScope- --fns- ,checkAst- ,getExpressionType- ,getStatementsType- ,getStatementsTypeScope- ,getStatementsInfo- ,getStatementsInfoScope- ,resetSps- ,resetSp- ,resetSp'- ,resetSps'- ,nsp- --forward some defs- ,typeSmallInt- ,typeBigInt- ,typeInt- ,typeNumeric- ,typeFloat4- ,typeFloat8- ,typeVarChar- ,typeChar- ,typeBool--) where--import Data.Maybe-import Data.List-import Debug.Trace-import Control.Monad.Error-import Control.Arrow--import Database.HsSqlPpp.TypeType-import Database.HsSqlPpp.AstUtils-import Database.HsSqlPpp.TypeConversion-import Database.HsSqlPpp.TypeCheckingH-import Database.HsSqlPpp.Scope-import Database.HsSqlPpp.DefaultScope---checkAst :: StatementList -> [Message]-checkAst sts = let t = sem_Root (Root sts)- in (messages_Syn_Root (wrap_Root t Inh_Root {scope_Inh_Root = defaultScope}))-{--================================================================================--= Types--These are the utility functions which clients use to typecheck sql.---}--getExpressionType :: Scope -> Expression -> Type-getExpressionType scope ex =- let t = sem_ExpressionRoot (ExpressionRoot ex)- in (nodeType_Syn_ExpressionRoot- (wrap_ExpressionRoot t Inh_ExpressionRoot {scope_Inh_ExpressionRoot = combineScopes defaultScope scope}))---getStatementsType :: StatementList -> [Type]-getStatementsType = getStatementsTypeScope emptyScope--getStatementsTypeScope :: Scope -> StatementList -> [Type]-getStatementsTypeScope scope st =- let t = sem_Root (Root st)- ta = wrap_Root t Inh_Root {scope_Inh_Root = combineScopes defaultScope scope}- tl = nodeType_Syn_Root ta- in (unwrapTypeList tl)--getStatementsInfo :: StatementList -> [StatementInfo]-getStatementsInfo = getStatementsInfoScope emptyScope--getStatementsInfoScope :: Scope -> StatementList -> [StatementInfo]-getStatementsInfoScope scope st =- let t = sem_Root (Root st)- ta = wrap_Root t Inh_Root {scope_Inh_Root = combineScopes defaultScope scope}- t2 = statementInfo_Syn_Root ta- in t2-----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.--resetSps :: [Statement] -> [Statement]-resetSps = map resetSp--resetSp :: Statement -> Statement-resetSp (CreateFunction l n p r bq b v) = CreateFunction l n p r bq- (case b of- SqlFnBody stss -> SqlFnBody (map resetSp' stss)- PlpgsqlFnBody vd stss -> PlpgsqlFnBody vd (map resetSp' stss))- v-resetSp (ForSelectStatement v s stss) = ForSelectStatement v s (map resetSp' stss)-resetSp (ForIntegerStatement v f t stss) = ForIntegerStatement v f t (map resetSp' stss)-resetSp (CaseStatement v cs els) = CaseStatement v (map (second (map resetSp')) cs) (map resetSp' els)-resetSp (If cs els) = If (map (second (map resetSp')) cs) (map resetSp' els)-resetSp a = a--resetSp' :: SourcePosStatement -> SourcePosStatement-resetSp' (_,st) = (nsp,resetSp st)--resetSps' :: StatementList -> StatementList-resetSps' = map resetSp'--nsp :: MySourcePos-nsp = ("", 0,0)---setUnknown :: Type -> Type -> Type-setUnknown _ _ = UnknownType--appendTypeList :: Type -> Type -> Type-appendTypeList t1 (TypeList ts) = TypeList (t1:ts)-appendTypeList t1 t2 = TypeList [t1,t2]---data StatementInfo = DefaultStatementInfo Type- | RelvarInfo CompositeDef- | CreateFunctionInfo FunctionPrototype- | SelectInfo Type- | InsertInfo String Type- | UpdateInfo String Type- | DeleteInfo String- | CreateDomainInfo String Type- | DropInfo [(String,String)]- | DropFunctionInfo [(String,[Type])]- deriving (Eq,Show)-----use this to make sure type errors are propagated into the statement---infos, temporary--makeStatementInfo :: Type -> StatementInfo -> StatementInfo-makeStatementInfo ty st =- if isError ty- then DefaultStatementInfo ty- else st- where- isError t = case t of- TypeError _ _ -> True- TypeList ts -> any isError ts- _ -> False----- 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)-----returns the type of the relation, and the system columns also-getRelationType :: Scope -> MySourcePos -> String -> (Type,Type)-getRelationType scope sp tbl =- case getAttrs scope [TableComposite, ViewComposite] tbl of- Just ((_,_,a@(UnnamedCompositeType _))- ,(_,_,s@(UnnamedCompositeType _)) ) -> (a,s)- _ -> (TypeError sp (UnrecognisedRelation tbl), TypeList [])--getFnType :: Scope -> MySourcePos -> String -> Expression -> Type -> Type-getFnType scope sp alias fnVal fnType =- checkErrors [fnType] $ snd $ getFunIdens scope sp alias fnVal fnType--getFunIdens :: Scope -> MySourcePos -> String -> Expression -> Type -> (String, Type)-getFunIdens scope sp alias fnVal fnType =- case fnVal of- FunCall f _ ->- let correlationName = if alias /= ""- then alias- else f- in (correlationName, case fnType of- SetOfType (CompositeType t) -> getCompositeType t- SetOfType x -> UnnamedCompositeType [(correlationName,x)]- y -> UnnamedCompositeType [(correlationName,y)])- x -> ("", TypeError sp (ContextError "FunCall"))- where- getCompositeType t =- case getAttrs scope [Composite- ,TableComposite- ,ViewComposite] t of- Just ((_,_,a@(UnnamedCompositeType _)), _) -> a- _ -> UnnamedCompositeType []--commonFieldNames t1 t2 =- intersect (fn t1) (fn t2)- where- fn (UnnamedCompositeType s) = map fst s- fn _ = []--both :: (a->b) -> (a,a) -> (b,b)-both fn (x,y) = (fn x, fn y)----fixedValue :: a -> a -> a -> a-fixedValue a _ _ = a---checkTableExists :: Scope -> MySourcePos -> String -> Type-checkTableExists scope sp tbl =- case getAttrs scope [TableComposite, ViewComposite] tbl of- Just _ -> TypeList []- _ -> TypeError sp (UnrecognisedRelation tbl)--checkColumnConsistency :: Scope -> MySourcePos -> String -> [String] -> [(String,Type)] -> Type-checkColumnConsistency scope sp tbl cols' insNameTypePairs =- let --todo: check the cols have no duplicates- --todo: check the missing target cols have defaults- targetTableType = fst $ getRelationType scope sp tbl- targetTableCols = unwrapComposite targetTableType- --check the num cols in the insdata match the number of cols- cols = if null cols'- then map fst targetTableCols- else cols'- wrongLengthError = if length insNameTypePairs /= length cols- then TypeError sp WrongNumberOfColumns- else TypeList []- --check the target cols appear in the target table and get their types- nonMatchingColumns = cols \\ map fst targetTableCols- nonMatchingErrors = case length nonMatchingColumns of- 0 -> TypeList []- 1 -> makeUnknownColumnError $ head nonMatchingColumns- _ -> TypeList $ map makeUnknownColumnError nonMatchingColumns- targetNameTypePairs = map (\l -> (l, fromJust $ lookup l targetTableCols)) 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- matchingTypeErrors = map (\(_,b,c) -> checkAssignmentValid scope sp c b) typeTriples- in checkErrors [targetTableType- ,wrongLengthError- ,nonMatchingErrors- ,TypeList matchingTypeErrors] $ TypeList []- where- makeUnknownColumnError = TypeError sp . UnrecognisedIdentifier--getColumnTypes :: Scope -> MySourcePos -> String -> [String] -> [(String,Type)]-getColumnTypes scope sp tbl cols' =- let targetTableType = fst $ getRelationType scope sp tbl- targetTableCols = unwrapComposite targetTableType- cols = if null cols'- then map fst targetTableCols- else cols'- nonMatchingColumns = cols \\ map fst targetTableCols- nonMatchingErrors = case length nonMatchingColumns of- 0 -> TypeList []- 1 -> makeUnknownColumnError $ head nonMatchingColumns- _ -> TypeList $ map makeUnknownColumnError nonMatchingColumns- in map (\l -> (l, fromJust $ lookup l targetTableCols)) cols- where- makeUnknownColumnError = TypeError sp . UnrecognisedIdentifier---getRowTypes :: Type -> [Type]-getRowTypes (TypeList [(RowCtor ts)]) = ts-getRowTypes (TypeList ts) = ts-getRowTypes x = error $ "cannot get row types from " ++ show x--- AttributeDef -------------------------------------------------data AttributeDef = AttributeDef (String) (TypeName) (Maybe Expression) (RowConstraintList) - deriving ( Eq,Show)--- cata-sem_AttributeDef :: AttributeDef ->- T_AttributeDef -sem_AttributeDef (AttributeDef _name _typ _check _cons ) =- (sem_AttributeDef_AttributeDef _name (sem_TypeName _typ ) _check (sem_RowConstraintList _cons ) )--- semantic domain-type T_AttributeDef = Bool ->- Scope ->- MySourcePos ->- ( AttributeDef,String,([Message]),Type)-data Inh_AttributeDef = Inh_AttributeDef {inLoop_Inh_AttributeDef :: Bool,scope_Inh_AttributeDef :: Scope,sourcePos_Inh_AttributeDef :: MySourcePos}-data Syn_AttributeDef = Syn_AttributeDef {actualValue_Syn_AttributeDef :: AttributeDef,attrName_Syn_AttributeDef :: String,messages_Syn_AttributeDef :: [Message],nodeType_Syn_AttributeDef :: Type}-wrap_AttributeDef :: T_AttributeDef ->- Inh_AttributeDef ->- Syn_AttributeDef -wrap_AttributeDef sem (Inh_AttributeDef _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOattrName,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_AttributeDef _lhsOactualValue _lhsOattrName _lhsOmessages _lhsOnodeType ))-sem_AttributeDef_AttributeDef :: String ->- T_TypeName ->- (Maybe Expression) ->- T_RowConstraintList ->- T_AttributeDef -sem_AttributeDef_AttributeDef name_ typ_ check_ cons_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOattrName :: String- _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: AttributeDef- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _consOinLoop :: Bool- _consOscope :: Scope- _consOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _consIactualValue :: RowConstraintList- _consImessages :: ([Message])- _consInodeType :: Type- _lhsOattrName =- name_- _lhsOnodeType =- _typInodeType- _lhsOmessages =- _typImessages ++ _consImessages- _actualValue =- AttributeDef name_ _typIactualValue check_ _consIactualValue- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- _consOinLoop =- _lhsIinLoop- _consOscope =- _lhsIscope- _consOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- ( _consIactualValue,_consImessages,_consInodeType) =- (cons_ _consOinLoop _consOscope _consOsourcePos )- in ( _lhsOactualValue,_lhsOattrName,_lhsOmessages,_lhsOnodeType)))--- AttributeDefList ---------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( AttributeDefList,([Message]),Type)-data Inh_AttributeDefList = Inh_AttributeDefList {inLoop_Inh_AttributeDefList :: Bool,scope_Inh_AttributeDefList :: Scope,sourcePos_Inh_AttributeDefList :: MySourcePos}-data Syn_AttributeDefList = Syn_AttributeDefList {actualValue_Syn_AttributeDefList :: AttributeDefList,messages_Syn_AttributeDefList :: [Message],nodeType_Syn_AttributeDefList :: Type}-wrap_AttributeDefList :: T_AttributeDefList ->- Inh_AttributeDefList ->- Syn_AttributeDefList -wrap_AttributeDefList sem (Inh_AttributeDefList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_AttributeDefList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_AttributeDefList_Cons :: T_AttributeDef ->- T_AttributeDefList ->- T_AttributeDefList -sem_AttributeDefList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: AttributeDefList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: AttributeDef- _hdIattrName :: String- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: AttributeDefList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOnodeType =- checkErrors [_tlInodeType, _hdInodeType] $- consComposite (_hdIattrName, _hdInodeType) _tlInodeType- _lhsOmessages =- _hdImessages ++ _tlImessages- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdIattrName,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_AttributeDefList_Nil :: T_AttributeDefList -sem_AttributeDefList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: AttributeDefList- _lhsOnodeType =- UnnamedCompositeType []- _lhsOmessages =- []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Cascade ------------------------------------------------------data Cascade = Cascade - | Restrict - deriving ( Eq,Show)--- cata-sem_Cascade :: Cascade ->- T_Cascade -sem_Cascade (Cascade ) =- (sem_Cascade_Cascade )-sem_Cascade (Restrict ) =- (sem_Cascade_Restrict )--- semantic domain-type T_Cascade = Bool ->- Scope ->- MySourcePos ->- ( Cascade,([Message]),Type)-data Inh_Cascade = Inh_Cascade {inLoop_Inh_Cascade :: Bool,scope_Inh_Cascade :: Scope,sourcePos_Inh_Cascade :: MySourcePos}-data Syn_Cascade = Syn_Cascade {actualValue_Syn_Cascade :: Cascade,messages_Syn_Cascade :: [Message],nodeType_Syn_Cascade :: Type}-wrap_Cascade :: T_Cascade ->- Inh_Cascade ->- Syn_Cascade -wrap_Cascade sem (Inh_Cascade _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Cascade _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Cascade_Cascade :: T_Cascade -sem_Cascade_Cascade =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Cascade- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Cascade- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Cascade_Restrict :: T_Cascade -sem_Cascade_Restrict =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Cascade- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Restrict- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- CaseExpressionList -------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( CaseExpressionList,([Message]),Type)-data Inh_CaseExpressionList = Inh_CaseExpressionList {inLoop_Inh_CaseExpressionList :: Bool,scope_Inh_CaseExpressionList :: Scope,sourcePos_Inh_CaseExpressionList :: MySourcePos}-data Syn_CaseExpressionList = Syn_CaseExpressionList {actualValue_Syn_CaseExpressionList :: CaseExpressionList,messages_Syn_CaseExpressionList :: [Message],nodeType_Syn_CaseExpressionList :: Type}-wrap_CaseExpressionList :: T_CaseExpressionList ->- Inh_CaseExpressionList ->- Syn_CaseExpressionList -wrap_CaseExpressionList sem (Inh_CaseExpressionList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_CaseExpressionList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_CaseExpressionList_Cons :: T_Expression ->- T_CaseExpressionList ->- T_CaseExpressionList -sem_CaseExpressionList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CaseExpressionList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: Expression- _hdIliftedColumnName :: String- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: CaseExpressionList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdIliftedColumnName,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_CaseExpressionList_Nil :: T_CaseExpressionList -sem_CaseExpressionList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CaseExpressionList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- CaseExpressionListExpressionPair -----------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( CaseExpressionListExpressionPair,([Message]),Type)-data Inh_CaseExpressionListExpressionPair = Inh_CaseExpressionListExpressionPair {inLoop_Inh_CaseExpressionListExpressionPair :: Bool,scope_Inh_CaseExpressionListExpressionPair :: Scope,sourcePos_Inh_CaseExpressionListExpressionPair :: MySourcePos}-data Syn_CaseExpressionListExpressionPair = Syn_CaseExpressionListExpressionPair {actualValue_Syn_CaseExpressionListExpressionPair :: CaseExpressionListExpressionPair,messages_Syn_CaseExpressionListExpressionPair :: [Message],nodeType_Syn_CaseExpressionListExpressionPair :: Type}-wrap_CaseExpressionListExpressionPair :: T_CaseExpressionListExpressionPair ->- Inh_CaseExpressionListExpressionPair ->- Syn_CaseExpressionListExpressionPair -wrap_CaseExpressionListExpressionPair sem (Inh_CaseExpressionListExpressionPair _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_CaseExpressionListExpressionPair _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_CaseExpressionListExpressionPair_Tuple :: T_CaseExpressionList ->- T_Expression ->- T_CaseExpressionListExpressionPair -sem_CaseExpressionListExpressionPair_Tuple x1_ x2_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CaseExpressionListExpressionPair- _x1OinLoop :: Bool- _x1Oscope :: Scope- _x1OsourcePos :: MySourcePos- _x2OinLoop :: Bool- _x2Oscope :: Scope- _x2OsourcePos :: MySourcePos- _x1IactualValue :: CaseExpressionList- _x1Imessages :: ([Message])- _x1InodeType :: Type- _x2IactualValue :: Expression- _x2IliftedColumnName :: String- _x2Imessages :: ([Message])- _x2InodeType :: Type- _lhsOmessages =- _x1Imessages ++ _x2Imessages- _lhsOnodeType =- _x1InodeType `appendTypeList` _x2InodeType- _actualValue =- (_x1IactualValue,_x2IactualValue)- _lhsOactualValue =- _actualValue- _x1OinLoop =- _lhsIinLoop- _x1Oscope =- _lhsIscope- _x1OsourcePos =- _lhsIsourcePos- _x2OinLoop =- _lhsIinLoop- _x2Oscope =- _lhsIscope- _x2OsourcePos =- _lhsIsourcePos- ( _x1IactualValue,_x1Imessages,_x1InodeType) =- (x1_ _x1OinLoop _x1Oscope _x1OsourcePos )- ( _x2IactualValue,_x2IliftedColumnName,_x2Imessages,_x2InodeType) =- (x2_ _x2OinLoop _x2Oscope _x2OsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- CaseExpressionListExpressionPairList -------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( CaseExpressionListExpressionPairList,([Message]),Type)-data Inh_CaseExpressionListExpressionPairList = Inh_CaseExpressionListExpressionPairList {inLoop_Inh_CaseExpressionListExpressionPairList :: Bool,scope_Inh_CaseExpressionListExpressionPairList :: Scope,sourcePos_Inh_CaseExpressionListExpressionPairList :: MySourcePos}-data Syn_CaseExpressionListExpressionPairList = Syn_CaseExpressionListExpressionPairList {actualValue_Syn_CaseExpressionListExpressionPairList :: CaseExpressionListExpressionPairList,messages_Syn_CaseExpressionListExpressionPairList :: [Message],nodeType_Syn_CaseExpressionListExpressionPairList :: Type}-wrap_CaseExpressionListExpressionPairList :: T_CaseExpressionListExpressionPairList ->- Inh_CaseExpressionListExpressionPairList ->- Syn_CaseExpressionListExpressionPairList -wrap_CaseExpressionListExpressionPairList sem (Inh_CaseExpressionListExpressionPairList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_CaseExpressionListExpressionPairList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_CaseExpressionListExpressionPairList_Cons :: T_CaseExpressionListExpressionPair ->- T_CaseExpressionListExpressionPairList ->- T_CaseExpressionListExpressionPairList -sem_CaseExpressionListExpressionPairList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CaseExpressionListExpressionPairList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: CaseExpressionListExpressionPair- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: CaseExpressionListExpressionPairList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_CaseExpressionListExpressionPairList_Nil :: T_CaseExpressionListExpressionPairList -sem_CaseExpressionListExpressionPairList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CaseExpressionListExpressionPairList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- CombineType --------------------------------------------------data CombineType = Except - | Intersect - | Union - | UnionAll - deriving ( Eq,Show)--- 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 = Bool ->- Scope ->- MySourcePos ->- ( CombineType,([Message]),Type)-data Inh_CombineType = Inh_CombineType {inLoop_Inh_CombineType :: Bool,scope_Inh_CombineType :: Scope,sourcePos_Inh_CombineType :: MySourcePos}-data Syn_CombineType = Syn_CombineType {actualValue_Syn_CombineType :: CombineType,messages_Syn_CombineType :: [Message],nodeType_Syn_CombineType :: Type}-wrap_CombineType :: T_CombineType ->- Inh_CombineType ->- Syn_CombineType -wrap_CombineType sem (Inh_CombineType _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_CombineType _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_CombineType_Except :: T_CombineType -sem_CombineType_Except =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CombineType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Except- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_CombineType_Intersect :: T_CombineType -sem_CombineType_Intersect =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CombineType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Intersect- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_CombineType_Union :: T_CombineType -sem_CombineType_Union =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CombineType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Union- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_CombineType_UnionAll :: T_CombineType -sem_CombineType_UnionAll =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CombineType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- UnionAll- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Constraint ---------------------------------------------------data Constraint = CheckConstraint (Expression) - | PrimaryKeyConstraint (StringList) - | ReferenceConstraint (StringList) (String) (StringList) (Cascade) (Cascade) - | UniqueConstraint (StringList) - deriving ( Eq,Show)--- cata-sem_Constraint :: Constraint ->- T_Constraint -sem_Constraint (CheckConstraint _expression ) =- (sem_Constraint_CheckConstraint (sem_Expression _expression ) )-sem_Constraint (PrimaryKeyConstraint _stringList ) =- (sem_Constraint_PrimaryKeyConstraint (sem_StringList _stringList ) )-sem_Constraint (ReferenceConstraint _atts _table _tableAtts _onUpdate _onDelete ) =- (sem_Constraint_ReferenceConstraint (sem_StringList _atts ) _table (sem_StringList _tableAtts ) (sem_Cascade _onUpdate ) (sem_Cascade _onDelete ) )-sem_Constraint (UniqueConstraint _stringList ) =- (sem_Constraint_UniqueConstraint (sem_StringList _stringList ) )--- semantic domain-type T_Constraint = Bool ->- Scope ->- MySourcePos ->- ( Constraint,([Message]),Type)-data Inh_Constraint = Inh_Constraint {inLoop_Inh_Constraint :: Bool,scope_Inh_Constraint :: Scope,sourcePos_Inh_Constraint :: MySourcePos}-data Syn_Constraint = Syn_Constraint {actualValue_Syn_Constraint :: Constraint,messages_Syn_Constraint :: [Message],nodeType_Syn_Constraint :: Type}-wrap_Constraint :: T_Constraint ->- Inh_Constraint ->- Syn_Constraint -wrap_Constraint sem (Inh_Constraint _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Constraint _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Constraint_CheckConstraint :: T_Expression ->- T_Constraint -sem_Constraint_CheckConstraint expression_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Constraint- _expressionOinLoop :: Bool- _expressionOscope :: Scope- _expressionOsourcePos :: MySourcePos- _expressionIactualValue :: Expression- _expressionIliftedColumnName :: String- _expressionImessages :: ([Message])- _expressionInodeType :: Type- _lhsOmessages =- _expressionImessages- _lhsOnodeType =- _expressionInodeType- _actualValue =- CheckConstraint _expressionIactualValue- _lhsOactualValue =- _actualValue- _expressionOinLoop =- _lhsIinLoop- _expressionOscope =- _lhsIscope- _expressionOsourcePos =- _lhsIsourcePos- ( _expressionIactualValue,_expressionIliftedColumnName,_expressionImessages,_expressionInodeType) =- (expression_ _expressionOinLoop _expressionOscope _expressionOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Constraint_PrimaryKeyConstraint :: T_StringList ->- T_Constraint -sem_Constraint_PrimaryKeyConstraint stringList_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Constraint- _stringListOinLoop :: Bool- _stringListOscope :: Scope- _stringListOsourcePos :: MySourcePos- _stringListIactualValue :: StringList- _stringListImessages :: ([Message])- _stringListInodeType :: Type- _stringListIstrings :: ([String])- _lhsOmessages =- _stringListImessages- _lhsOnodeType =- _stringListInodeType- _actualValue =- PrimaryKeyConstraint _stringListIactualValue- _lhsOactualValue =- _actualValue- _stringListOinLoop =- _lhsIinLoop- _stringListOscope =- _lhsIscope- _stringListOsourcePos =- _lhsIsourcePos- ( _stringListIactualValue,_stringListImessages,_stringListInodeType,_stringListIstrings) =- (stringList_ _stringListOinLoop _stringListOscope _stringListOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Constraint_ReferenceConstraint :: T_StringList ->- String ->- T_StringList ->- T_Cascade ->- T_Cascade ->- T_Constraint -sem_Constraint_ReferenceConstraint atts_ table_ tableAtts_ onUpdate_ onDelete_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Constraint- _attsOinLoop :: Bool- _attsOscope :: Scope- _attsOsourcePos :: MySourcePos- _tableAttsOinLoop :: Bool- _tableAttsOscope :: Scope- _tableAttsOsourcePos :: MySourcePos- _onUpdateOinLoop :: Bool- _onUpdateOscope :: Scope- _onUpdateOsourcePos :: MySourcePos- _onDeleteOinLoop :: Bool- _onDeleteOscope :: Scope- _onDeleteOsourcePos :: MySourcePos- _attsIactualValue :: StringList- _attsImessages :: ([Message])- _attsInodeType :: Type- _attsIstrings :: ([String])- _tableAttsIactualValue :: StringList- _tableAttsImessages :: ([Message])- _tableAttsInodeType :: Type- _tableAttsIstrings :: ([String])- _onUpdateIactualValue :: Cascade- _onUpdateImessages :: ([Message])- _onUpdateInodeType :: Type- _onDeleteIactualValue :: Cascade- _onDeleteImessages :: ([Message])- _onDeleteInodeType :: Type- _lhsOmessages =- _attsImessages ++ _tableAttsImessages ++ _onUpdateImessages ++ _onDeleteImessages- _lhsOnodeType =- _attsInodeType `setUnknown` _tableAttsInodeType `setUnknown` _onUpdateInodeType `setUnknown` _onDeleteInodeType- _actualValue =- ReferenceConstraint _attsIactualValue table_ _tableAttsIactualValue _onUpdateIactualValue _onDeleteIactualValue- _lhsOactualValue =- _actualValue- _attsOinLoop =- _lhsIinLoop- _attsOscope =- _lhsIscope- _attsOsourcePos =- _lhsIsourcePos- _tableAttsOinLoop =- _lhsIinLoop- _tableAttsOscope =- _lhsIscope- _tableAttsOsourcePos =- _lhsIsourcePos- _onUpdateOinLoop =- _lhsIinLoop- _onUpdateOscope =- _lhsIscope- _onUpdateOsourcePos =- _lhsIsourcePos- _onDeleteOinLoop =- _lhsIinLoop- _onDeleteOscope =- _lhsIscope- _onDeleteOsourcePos =- _lhsIsourcePos- ( _attsIactualValue,_attsImessages,_attsInodeType,_attsIstrings) =- (atts_ _attsOinLoop _attsOscope _attsOsourcePos )- ( _tableAttsIactualValue,_tableAttsImessages,_tableAttsInodeType,_tableAttsIstrings) =- (tableAtts_ _tableAttsOinLoop _tableAttsOscope _tableAttsOsourcePos )- ( _onUpdateIactualValue,_onUpdateImessages,_onUpdateInodeType) =- (onUpdate_ _onUpdateOinLoop _onUpdateOscope _onUpdateOsourcePos )- ( _onDeleteIactualValue,_onDeleteImessages,_onDeleteInodeType) =- (onDelete_ _onDeleteOinLoop _onDeleteOscope _onDeleteOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Constraint_UniqueConstraint :: T_StringList ->- T_Constraint -sem_Constraint_UniqueConstraint stringList_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Constraint- _stringListOinLoop :: Bool- _stringListOscope :: Scope- _stringListOsourcePos :: MySourcePos- _stringListIactualValue :: StringList- _stringListImessages :: ([Message])- _stringListInodeType :: Type- _stringListIstrings :: ([String])- _lhsOmessages =- _stringListImessages- _lhsOnodeType =- _stringListInodeType- _actualValue =- UniqueConstraint _stringListIactualValue- _lhsOactualValue =- _actualValue- _stringListOinLoop =- _lhsIinLoop- _stringListOscope =- _lhsIscope- _stringListOsourcePos =- _lhsIsourcePos- ( _stringListIactualValue,_stringListImessages,_stringListInodeType,_stringListIstrings) =- (stringList_ _stringListOinLoop _stringListOscope _stringListOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ConstraintList -----------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ConstraintList,([Message]),Type)-data Inh_ConstraintList = Inh_ConstraintList {inLoop_Inh_ConstraintList :: Bool,scope_Inh_ConstraintList :: Scope,sourcePos_Inh_ConstraintList :: MySourcePos}-data Syn_ConstraintList = Syn_ConstraintList {actualValue_Syn_ConstraintList :: ConstraintList,messages_Syn_ConstraintList :: [Message],nodeType_Syn_ConstraintList :: Type}-wrap_ConstraintList :: T_ConstraintList ->- Inh_ConstraintList ->- Syn_ConstraintList -wrap_ConstraintList sem (Inh_ConstraintList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ConstraintList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ConstraintList_Cons :: T_Constraint ->- T_ConstraintList ->- T_ConstraintList -sem_ConstraintList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ConstraintList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: Constraint- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: ConstraintList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_ConstraintList_Nil :: T_ConstraintList -sem_ConstraintList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ConstraintList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- CopySource ---------------------------------------------------data CopySource = CopyFilename (String) - | Stdin - deriving ( Eq,Show)--- 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 = Bool ->- Scope ->- MySourcePos ->- ( CopySource,([Message]),Type)-data Inh_CopySource = Inh_CopySource {inLoop_Inh_CopySource :: Bool,scope_Inh_CopySource :: Scope,sourcePos_Inh_CopySource :: MySourcePos}-data Syn_CopySource = Syn_CopySource {actualValue_Syn_CopySource :: CopySource,messages_Syn_CopySource :: [Message],nodeType_Syn_CopySource :: Type}-wrap_CopySource :: T_CopySource ->- Inh_CopySource ->- Syn_CopySource -wrap_CopySource sem (Inh_CopySource _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_CopySource _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_CopySource_CopyFilename :: String ->- T_CopySource -sem_CopySource_CopyFilename string_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CopySource- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- CopyFilename string_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_CopySource_Stdin :: T_CopySource -sem_CopySource_Stdin =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: CopySource- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Stdin- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Direction ----------------------------------------------------data Direction = Asc - | Desc - deriving ( Eq,Show)--- cata-sem_Direction :: Direction ->- T_Direction -sem_Direction (Asc ) =- (sem_Direction_Asc )-sem_Direction (Desc ) =- (sem_Direction_Desc )--- semantic domain-type T_Direction = Bool ->- Scope ->- MySourcePos ->- ( Direction,([Message]),Type)-data Inh_Direction = Inh_Direction {inLoop_Inh_Direction :: Bool,scope_Inh_Direction :: Scope,sourcePos_Inh_Direction :: MySourcePos}-data Syn_Direction = Syn_Direction {actualValue_Syn_Direction :: Direction,messages_Syn_Direction :: [Message],nodeType_Syn_Direction :: Type}-wrap_Direction :: T_Direction ->- Inh_Direction ->- Syn_Direction -wrap_Direction sem (Inh_Direction _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Direction _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Direction_Asc :: T_Direction -sem_Direction_Asc =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Direction- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Asc- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Direction_Desc :: T_Direction -sem_Direction_Desc =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Direction- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Desc- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Distinct -----------------------------------------------------data Distinct = Distinct - | Dupes - deriving ( Eq,Show)--- cata-sem_Distinct :: Distinct ->- T_Distinct -sem_Distinct (Distinct ) =- (sem_Distinct_Distinct )-sem_Distinct (Dupes ) =- (sem_Distinct_Dupes )--- semantic domain-type T_Distinct = Bool ->- Scope ->- MySourcePos ->- ( Distinct,([Message]),Type)-data Inh_Distinct = Inh_Distinct {inLoop_Inh_Distinct :: Bool,scope_Inh_Distinct :: Scope,sourcePos_Inh_Distinct :: MySourcePos}-data Syn_Distinct = Syn_Distinct {actualValue_Syn_Distinct :: Distinct,messages_Syn_Distinct :: [Message],nodeType_Syn_Distinct :: Type}-wrap_Distinct :: T_Distinct ->- Inh_Distinct ->- Syn_Distinct -wrap_Distinct sem (Inh_Distinct _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Distinct _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Distinct_Distinct :: T_Distinct -sem_Distinct_Distinct =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Distinct- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Distinct- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Distinct_Dupes :: T_Distinct -sem_Distinct_Dupes =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Distinct- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Dupes- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- DropType -----------------------------------------------------data DropType = Domain - | Table - | Type - | View - deriving ( Eq,Show)--- 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 = Bool ->- Scope ->- MySourcePos ->- ( DropType,([Message]),Type)-data Inh_DropType = Inh_DropType {inLoop_Inh_DropType :: Bool,scope_Inh_DropType :: Scope,sourcePos_Inh_DropType :: MySourcePos}-data Syn_DropType = Syn_DropType {actualValue_Syn_DropType :: DropType,messages_Syn_DropType :: [Message],nodeType_Syn_DropType :: Type}-wrap_DropType :: T_DropType ->- Inh_DropType ->- Syn_DropType -wrap_DropType sem (Inh_DropType _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_DropType _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_DropType_Domain :: T_DropType -sem_DropType_Domain =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: DropType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Domain- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_DropType_Table :: T_DropType -sem_DropType_Table =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: DropType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Table- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_DropType_Type :: T_DropType -sem_DropType_Type =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: DropType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Type- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_DropType_View :: T_DropType -sem_DropType_View =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: DropType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- View- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Expression ---------------------------------------------------data Expression = BooleanLit (Bool) - | Case (CaseExpressionListExpressionPairList) (MaybeExpression) - | CaseSimple (Expression) (CaseExpressionListExpressionPairList) (MaybeExpression) - | Cast (Expression) (TypeName) - | Exists (SelectExpression) - | FloatLit (Double) - | FunCall (String) (ExpressionList) - | Identifier (String) - | InPredicate (Expression) (Bool) (InList) - | IntegerLit (Integer) - | NullLit - | PositionalArg (Integer) - | ScalarSubQuery (SelectExpression) - | StringLit (String) (String) - | WindowFn (Expression) (ExpressionList) (ExpressionList) (Direction) - deriving ( Eq,Show)--- cata-sem_Expression :: Expression ->- T_Expression -sem_Expression (BooleanLit _bool ) =- (sem_Expression_BooleanLit _bool )-sem_Expression (Case _cases _els ) =- (sem_Expression_Case (sem_CaseExpressionListExpressionPairList _cases ) (sem_MaybeExpression _els ) )-sem_Expression (CaseSimple _value _cases _els ) =- (sem_Expression_CaseSimple (sem_Expression _value ) (sem_CaseExpressionListExpressionPairList _cases ) (sem_MaybeExpression _els ) )-sem_Expression (Cast _expr _tn ) =- (sem_Expression_Cast (sem_Expression _expr ) (sem_TypeName _tn ) )-sem_Expression (Exists _sel ) =- (sem_Expression_Exists (sem_SelectExpression _sel ) )-sem_Expression (FloatLit _double ) =- (sem_Expression_FloatLit _double )-sem_Expression (FunCall _funName _args ) =- (sem_Expression_FunCall _funName (sem_ExpressionList _args ) )-sem_Expression (Identifier _i ) =- (sem_Expression_Identifier _i )-sem_Expression (InPredicate _expr _i _list ) =- (sem_Expression_InPredicate (sem_Expression _expr ) _i (sem_InList _list ) )-sem_Expression (IntegerLit _integer ) =- (sem_Expression_IntegerLit _integer )-sem_Expression (NullLit ) =- (sem_Expression_NullLit )-sem_Expression (PositionalArg _integer ) =- (sem_Expression_PositionalArg _integer )-sem_Expression (ScalarSubQuery _sel ) =- (sem_Expression_ScalarSubQuery (sem_SelectExpression _sel ) )-sem_Expression (StringLit _quote _value ) =- (sem_Expression_StringLit _quote _value )-sem_Expression (WindowFn _fn _partitionBy _orderBy _dir ) =- (sem_Expression_WindowFn (sem_Expression _fn ) (sem_ExpressionList _partitionBy ) (sem_ExpressionList _orderBy ) (sem_Direction _dir ) )--- semantic domain-type T_Expression = Bool ->- Scope ->- MySourcePos ->- ( Expression,String,([Message]),Type)-data Inh_Expression = Inh_Expression {inLoop_Inh_Expression :: Bool,scope_Inh_Expression :: Scope,sourcePos_Inh_Expression :: MySourcePos}-data Syn_Expression = Syn_Expression {actualValue_Syn_Expression :: Expression,liftedColumnName_Syn_Expression :: String,messages_Syn_Expression :: [Message],nodeType_Syn_Expression :: Type}-wrap_Expression :: T_Expression ->- Inh_Expression ->- Syn_Expression -wrap_Expression sem (Inh_Expression _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Expression _lhsOactualValue _lhsOliftedColumnName _lhsOmessages _lhsOnodeType ))-sem_Expression_BooleanLit :: Bool ->- T_Expression -sem_Expression_BooleanLit bool_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _lhsOnodeType =- typeBool- _lhsOliftedColumnName =- ""- _lhsOmessages =- []- _actualValue =- BooleanLit bool_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_Case :: T_CaseExpressionListExpressionPairList ->- T_MaybeExpression ->- T_Expression -sem_Expression_Case cases_ els_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _casesOinLoop :: Bool- _casesOscope :: Scope- _casesOsourcePos :: MySourcePos- _elsOinLoop :: Bool- _elsOscope :: Scope- _elsOsourcePos :: MySourcePos- _casesIactualValue :: CaseExpressionListExpressionPairList- _casesImessages :: ([Message])- _casesInodeType :: Type- _elsIactualValue :: MaybeExpression- _elsImessages :: ([Message])- _elsInodeType :: Type- _lhsOnodeType =- let elseThen =- case _elsInodeType of- TypeList [] -> []- t -> [t]- unwrappedLists = map unwrapTypeList $ unwrapTypeList _casesInodeType- whenTypes :: [Type]- whenTypes = concat $ map unwrapTypeList $ map head unwrappedLists- thenTypes :: [Type]- thenTypes = map (head . tail) unwrappedLists ++ elseThen- whensAllBool :: Type- whensAllBool = if any (/= typeBool) whenTypes- then TypeError _lhsIsourcePos- (WrongTypes typeBool whenTypes)- else TypeList []- in checkErrors (whenTypes ++ thenTypes ++ [whensAllBool]) $- resolveResultSetType- _lhsIscope- _lhsIsourcePos- thenTypes- _lhsOliftedColumnName =- ""- _lhsOmessages =- _casesImessages ++ _elsImessages- _actualValue =- Case _casesIactualValue _elsIactualValue- _lhsOactualValue =- _actualValue- _casesOinLoop =- _lhsIinLoop- _casesOscope =- _lhsIscope- _casesOsourcePos =- _lhsIsourcePos- _elsOinLoop =- _lhsIinLoop- _elsOscope =- _lhsIscope- _elsOsourcePos =- _lhsIsourcePos- ( _casesIactualValue,_casesImessages,_casesInodeType) =- (cases_ _casesOinLoop _casesOscope _casesOsourcePos )- ( _elsIactualValue,_elsImessages,_elsInodeType) =- (els_ _elsOinLoop _elsOscope _elsOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_CaseSimple :: T_Expression ->- T_CaseExpressionListExpressionPairList ->- T_MaybeExpression ->- T_Expression -sem_Expression_CaseSimple value_ cases_ els_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _valueOinLoop :: Bool- _valueOscope :: Scope- _valueOsourcePos :: MySourcePos- _casesOinLoop :: Bool- _casesOscope :: Scope- _casesOsourcePos :: MySourcePos- _elsOinLoop :: Bool- _elsOscope :: Scope- _elsOsourcePos :: MySourcePos- _valueIactualValue :: Expression- _valueIliftedColumnName :: String- _valueImessages :: ([Message])- _valueInodeType :: Type- _casesIactualValue :: CaseExpressionListExpressionPairList- _casesImessages :: ([Message])- _casesInodeType :: Type- _elsIactualValue :: MaybeExpression- _elsImessages :: ([Message])- _elsInodeType :: Type- _lhsOnodeType =- let elseThen =- case _elsInodeType of- TypeList [] -> []- t -> [t]- unwrappedLists = map unwrapTypeList $ unwrapTypeList _casesInodeType- whenTypes :: [Type]- whenTypes = concat $ map unwrapTypeList $ map head unwrappedLists- thenTypes :: [Type]- thenTypes = map (head . tail) unwrappedLists ++ elseThen- checkWhenTypes = resolveResultSetType- _lhsIscope- _lhsIsourcePos- (_valueInodeType:whenTypes)- in checkErrors (whenTypes ++ thenTypes ++ [checkWhenTypes]) $- resolveResultSetType- _lhsIscope- _lhsIsourcePos- thenTypes- _lhsOliftedColumnName =- _valueIliftedColumnName- _lhsOmessages =- _valueImessages ++ _casesImessages ++ _elsImessages- _actualValue =- CaseSimple _valueIactualValue _casesIactualValue _elsIactualValue- _lhsOactualValue =- _actualValue- _valueOinLoop =- _lhsIinLoop- _valueOscope =- _lhsIscope- _valueOsourcePos =- _lhsIsourcePos- _casesOinLoop =- _lhsIinLoop- _casesOscope =- _lhsIscope- _casesOsourcePos =- _lhsIsourcePos- _elsOinLoop =- _lhsIinLoop- _elsOscope =- _lhsIscope- _elsOsourcePos =- _lhsIsourcePos- ( _valueIactualValue,_valueIliftedColumnName,_valueImessages,_valueInodeType) =- (value_ _valueOinLoop _valueOscope _valueOsourcePos )- ( _casesIactualValue,_casesImessages,_casesInodeType) =- (cases_ _casesOinLoop _casesOscope _casesOsourcePos )- ( _elsIactualValue,_elsImessages,_elsInodeType) =- (els_ _elsOinLoop _elsOscope _elsOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_Cast :: T_Expression ->- T_TypeName ->- T_Expression -sem_Expression_Cast expr_ tn_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _tnOinLoop :: Bool- _tnOscope :: Scope- _tnOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _tnIactualValue :: TypeName- _tnImessages :: ([Message])- _tnInodeType :: Type- _lhsOnodeType =- checkErrors [_exprInodeType]- _tnInodeType- _lhsOliftedColumnName =- case _tnIactualValue of- SimpleTypeName tn -> tn- _ -> ""- _lhsOmessages =- _exprImessages ++ _tnImessages- _actualValue =- Cast _exprIactualValue _tnIactualValue- _lhsOactualValue =- _actualValue- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- _tnOinLoop =- _lhsIinLoop- _tnOscope =- _lhsIscope- _tnOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- ( _tnIactualValue,_tnImessages,_tnInodeType) =- (tn_ _tnOinLoop _tnOscope _tnOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_Exists :: T_SelectExpression ->- T_Expression -sem_Expression_Exists sel_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _selOinLoop :: Bool- _selOscope :: Scope- _selOsourcePos :: MySourcePos- _selIactualValue :: SelectExpression- _selImessages :: ([Message])- _selInodeType :: Type- _lhsOnodeType =- checkErrors [_selInodeType] typeBool- _lhsOliftedColumnName =- ""- _lhsOmessages =- _selImessages- _actualValue =- Exists _selIactualValue- _lhsOactualValue =- _actualValue- _selOinLoop =- _lhsIinLoop- _selOscope =- _lhsIscope- _selOsourcePos =- _lhsIsourcePos- ( _selIactualValue,_selImessages,_selInodeType) =- (sel_ _selOinLoop _selOscope _selOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_FloatLit :: Double ->- T_Expression -sem_Expression_FloatLit double_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _lhsOnodeType =- typeNumeric- _lhsOliftedColumnName =- ""- _lhsOmessages =- []- _actualValue =- FloatLit double_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_FunCall :: String ->- T_ExpressionList ->- T_Expression -sem_Expression_FunCall funName_ args_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _argsOinLoop :: Bool- _argsOscope :: Scope- _argsOsourcePos :: MySourcePos- _argsIactualValue :: ExpressionList- _argsImessages :: ([Message])- _argsInodeType :: Type- _lhsOnodeType =- checkErrors [_argsInodeType] $- typeCheckFunCall- _lhsIscope- _lhsIsourcePos- funName_- _argsInodeType- _lhsOliftedColumnName =- if isOperator funName_- then ""- else funName_- _lhsOmessages =- _argsImessages- _actualValue =- FunCall funName_ _argsIactualValue- _lhsOactualValue =- _actualValue- _argsOinLoop =- _lhsIinLoop- _argsOscope =- _lhsIscope- _argsOsourcePos =- _lhsIsourcePos- ( _argsIactualValue,_argsImessages,_argsInodeType) =- (args_ _argsOinLoop _argsOscope _argsOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_Identifier :: String ->- T_Expression -sem_Expression_Identifier i_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _lhsOnodeType =- let (correlationName,iden) = splitIdentifier i_- in scopeLookupID _lhsIscope _lhsIsourcePos correlationName iden- _lhsOliftedColumnName =- i_- _lhsOmessages =- []- _actualValue =- Identifier i_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_InPredicate :: T_Expression ->- Bool ->- T_InList ->- T_Expression -sem_Expression_InPredicate expr_ i_ list_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _listOinLoop :: Bool- _listOscope :: Scope- _listOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _listIactualValue :: InList- _listImessages :: ([Message])- _listInodeType :: Type- _lhsOnodeType =- let er = resolveResultSetType- _lhsIscope- _lhsIsourcePos- [_exprInodeType, _listInodeType]- in checkErrors [er] typeBool- _lhsOliftedColumnName =- _exprIliftedColumnName- _lhsOmessages =- _exprImessages ++ _listImessages- _actualValue =- InPredicate _exprIactualValue i_ _listIactualValue- _lhsOactualValue =- _actualValue- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- _listOinLoop =- _lhsIinLoop- _listOscope =- _lhsIscope- _listOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- ( _listIactualValue,_listImessages,_listInodeType) =- (list_ _listOinLoop _listOscope _listOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_IntegerLit :: Integer ->- T_Expression -sem_Expression_IntegerLit integer_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _lhsOnodeType =- typeInt- _lhsOliftedColumnName =- ""- _lhsOmessages =- []- _actualValue =- IntegerLit integer_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_NullLit :: T_Expression -sem_Expression_NullLit =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _lhsOnodeType =- UnknownStringLit- _lhsOliftedColumnName =- ""- _lhsOmessages =- []- _actualValue =- NullLit- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_PositionalArg :: Integer ->- T_Expression -sem_Expression_PositionalArg integer_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Expression- _lhsOliftedColumnName =- ""- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- PositionalArg integer_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_ScalarSubQuery :: T_SelectExpression ->- T_Expression -sem_Expression_ScalarSubQuery sel_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _selOinLoop :: Bool- _selOscope :: Scope- _selOsourcePos :: MySourcePos- _selIactualValue :: SelectExpression- _selImessages :: ([Message])- _selInodeType :: Type- _lhsOnodeType =- let f = map snd $ unwrapComposite $ unwrapSetOf _selInodeType- in checkErrors [_selInodeType] $- case length f of- 0 -> error "internal error: no columns in scalar subquery?"- 1 -> head f- _ -> RowCtor f- _lhsOliftedColumnName =- ""- _lhsOmessages =- _selImessages- _actualValue =- ScalarSubQuery _selIactualValue- _lhsOactualValue =- _actualValue- _selOinLoop =- _lhsIinLoop- _selOscope =- _lhsIscope- _selOsourcePos =- _lhsIsourcePos- ( _selIactualValue,_selImessages,_selInodeType) =- (sel_ _selOinLoop _selOscope _selOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_StringLit :: String ->- String ->- T_Expression -sem_Expression_StringLit quote_ value_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: Expression- _lhsOnodeType =- UnknownStringLit- _lhsOliftedColumnName =- ""- _lhsOmessages =- []- _actualValue =- StringLit quote_ value_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))-sem_Expression_WindowFn :: T_Expression ->- T_ExpressionList ->- T_ExpressionList ->- T_Direction ->- T_Expression -sem_Expression_WindowFn fn_ partitionBy_ orderBy_ dir_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOliftedColumnName :: String- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Expression- _fnOinLoop :: Bool- _fnOscope :: Scope- _fnOsourcePos :: MySourcePos- _partitionByOinLoop :: Bool- _partitionByOscope :: Scope- _partitionByOsourcePos :: MySourcePos- _orderByOinLoop :: Bool- _orderByOscope :: Scope- _orderByOsourcePos :: MySourcePos- _dirOinLoop :: Bool- _dirOscope :: Scope- _dirOsourcePos :: MySourcePos- _fnIactualValue :: Expression- _fnIliftedColumnName :: String- _fnImessages :: ([Message])- _fnInodeType :: Type- _partitionByIactualValue :: ExpressionList- _partitionByImessages :: ([Message])- _partitionByInodeType :: Type- _orderByIactualValue :: ExpressionList- _orderByImessages :: ([Message])- _orderByInodeType :: Type- _dirIactualValue :: Direction- _dirImessages :: ([Message])- _dirInodeType :: Type- _lhsOliftedColumnName =- _fnIliftedColumnName- _lhsOmessages =- _fnImessages ++ _partitionByImessages ++ _orderByImessages ++ _dirImessages- _lhsOnodeType =- _fnInodeType `setUnknown` _partitionByInodeType `setUnknown` _orderByInodeType `setUnknown` _dirInodeType- _actualValue =- WindowFn _fnIactualValue _partitionByIactualValue _orderByIactualValue _dirIactualValue- _lhsOactualValue =- _actualValue- _fnOinLoop =- _lhsIinLoop- _fnOscope =- _lhsIscope- _fnOsourcePos =- _lhsIsourcePos- _partitionByOinLoop =- _lhsIinLoop- _partitionByOscope =- _lhsIscope- _partitionByOsourcePos =- _lhsIsourcePos- _orderByOinLoop =- _lhsIinLoop- _orderByOscope =- _lhsIscope- _orderByOsourcePos =- _lhsIsourcePos- _dirOinLoop =- _lhsIinLoop- _dirOscope =- _lhsIscope- _dirOsourcePos =- _lhsIsourcePos- ( _fnIactualValue,_fnIliftedColumnName,_fnImessages,_fnInodeType) =- (fn_ _fnOinLoop _fnOscope _fnOsourcePos )- ( _partitionByIactualValue,_partitionByImessages,_partitionByInodeType) =- (partitionBy_ _partitionByOinLoop _partitionByOscope _partitionByOsourcePos )- ( _orderByIactualValue,_orderByImessages,_orderByInodeType) =- (orderBy_ _orderByOinLoop _orderByOscope _orderByOsourcePos )- ( _dirIactualValue,_dirImessages,_dirInodeType) =- (dir_ _dirOinLoop _dirOscope _dirOsourcePos )- in ( _lhsOactualValue,_lhsOliftedColumnName,_lhsOmessages,_lhsOnodeType)))--- ExpressionList -----------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ExpressionList,([Message]),Type)-data Inh_ExpressionList = Inh_ExpressionList {inLoop_Inh_ExpressionList :: Bool,scope_Inh_ExpressionList :: Scope,sourcePos_Inh_ExpressionList :: MySourcePos}-data Syn_ExpressionList = Syn_ExpressionList {actualValue_Syn_ExpressionList :: ExpressionList,messages_Syn_ExpressionList :: [Message],nodeType_Syn_ExpressionList :: Type}-wrap_ExpressionList :: T_ExpressionList ->- Inh_ExpressionList ->- Syn_ExpressionList -wrap_ExpressionList sem (Inh_ExpressionList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ExpressionList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionList_Cons :: T_Expression ->- T_ExpressionList ->- T_ExpressionList -sem_ExpressionList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: Expression- _hdIliftedColumnName :: String- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: ExpressionList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdIliftedColumnName,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_ExpressionList_Nil :: T_ExpressionList -sem_ExpressionList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ExpressionListList -------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ExpressionListList,([Message]),Type)-data Inh_ExpressionListList = Inh_ExpressionListList {inLoop_Inh_ExpressionListList :: Bool,scope_Inh_ExpressionListList :: Scope,sourcePos_Inh_ExpressionListList :: MySourcePos}-data Syn_ExpressionListList = Syn_ExpressionListList {actualValue_Syn_ExpressionListList :: ExpressionListList,messages_Syn_ExpressionListList :: [Message],nodeType_Syn_ExpressionListList :: Type}-wrap_ExpressionListList :: T_ExpressionListList ->- Inh_ExpressionListList ->- Syn_ExpressionListList -wrap_ExpressionListList sem (Inh_ExpressionListList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ExpressionListList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionListList_Cons :: T_ExpressionList ->- T_ExpressionListList ->- T_ExpressionListList -sem_ExpressionListList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionListList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: ExpressionList- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: ExpressionListList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_ExpressionListList_Nil :: T_ExpressionListList -sem_ExpressionListList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionListList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ExpressionListStatementListPair ------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ExpressionListStatementListPair,([Message]),Type)-data Inh_ExpressionListStatementListPair = Inh_ExpressionListStatementListPair {inLoop_Inh_ExpressionListStatementListPair :: Bool,scope_Inh_ExpressionListStatementListPair :: Scope,sourcePos_Inh_ExpressionListStatementListPair :: MySourcePos}-data Syn_ExpressionListStatementListPair = Syn_ExpressionListStatementListPair {actualValue_Syn_ExpressionListStatementListPair :: ExpressionListStatementListPair,messages_Syn_ExpressionListStatementListPair :: [Message],nodeType_Syn_ExpressionListStatementListPair :: Type}-wrap_ExpressionListStatementListPair :: T_ExpressionListStatementListPair ->- Inh_ExpressionListStatementListPair ->- Syn_ExpressionListStatementListPair -wrap_ExpressionListStatementListPair sem (Inh_ExpressionListStatementListPair _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ExpressionListStatementListPair _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionListStatementListPair_Tuple :: T_ExpressionList ->- T_StatementList ->- T_ExpressionListStatementListPair -sem_ExpressionListStatementListPair_Tuple x1_ x2_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionListStatementListPair- _x1OinLoop :: Bool- _x1Oscope :: Scope- _x1OsourcePos :: MySourcePos- _x2OinLoop :: Bool- _x2Oscope :: Scope- _x2OsourcePos :: MySourcePos- _x1IactualValue :: ExpressionList- _x1Imessages :: ([Message])- _x1InodeType :: Type- _x2IactualValue :: StatementList- _x2Imessages :: ([Message])- _x2InodeType :: Type- _x2IstatementInfo :: ([StatementInfo])- _lhsOmessages =- _x1Imessages ++ _x2Imessages- _lhsOnodeType =- _x1InodeType `setUnknown` _x2InodeType- _actualValue =- (_x1IactualValue,_x2IactualValue)- _lhsOactualValue =- _actualValue- _x1OinLoop =- _lhsIinLoop- _x1Oscope =- _lhsIscope- _x1OsourcePos =- _lhsIsourcePos- _x2OinLoop =- _lhsIinLoop- _x2Oscope =- _lhsIscope- _x2OsourcePos =- _lhsIsourcePos- ( _x1IactualValue,_x1Imessages,_x1InodeType) =- (x1_ _x1OinLoop _x1Oscope _x1OsourcePos )- ( _x2IactualValue,_x2Imessages,_x2InodeType,_x2IstatementInfo) =- (x2_ _x2OinLoop _x2Oscope _x2OsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ExpressionListStatementListPairList --------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ExpressionListStatementListPairList,([Message]),Type)-data Inh_ExpressionListStatementListPairList = Inh_ExpressionListStatementListPairList {inLoop_Inh_ExpressionListStatementListPairList :: Bool,scope_Inh_ExpressionListStatementListPairList :: Scope,sourcePos_Inh_ExpressionListStatementListPairList :: MySourcePos}-data Syn_ExpressionListStatementListPairList = Syn_ExpressionListStatementListPairList {actualValue_Syn_ExpressionListStatementListPairList :: ExpressionListStatementListPairList,messages_Syn_ExpressionListStatementListPairList :: [Message],nodeType_Syn_ExpressionListStatementListPairList :: Type}-wrap_ExpressionListStatementListPairList :: T_ExpressionListStatementListPairList ->- Inh_ExpressionListStatementListPairList ->- Syn_ExpressionListStatementListPairList -wrap_ExpressionListStatementListPairList sem (Inh_ExpressionListStatementListPairList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ExpressionListStatementListPairList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionListStatementListPairList_Cons :: T_ExpressionListStatementListPair ->- T_ExpressionListStatementListPairList ->- T_ExpressionListStatementListPairList -sem_ExpressionListStatementListPairList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionListStatementListPairList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: ExpressionListStatementListPair- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: ExpressionListStatementListPairList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_ExpressionListStatementListPairList_Nil :: T_ExpressionListStatementListPairList -sem_ExpressionListStatementListPairList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionListStatementListPairList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ExpressionRoot -----------------------------------------------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 = Scope ->- ( ExpressionRoot,([Message]),Type)-data Inh_ExpressionRoot = Inh_ExpressionRoot {scope_Inh_ExpressionRoot :: Scope}-data Syn_ExpressionRoot = Syn_ExpressionRoot {actualValue_Syn_ExpressionRoot :: ExpressionRoot,messages_Syn_ExpressionRoot :: [Message],nodeType_Syn_ExpressionRoot :: Type}-wrap_ExpressionRoot :: T_ExpressionRoot ->- Inh_ExpressionRoot ->- Syn_ExpressionRoot -wrap_ExpressionRoot sem (Inh_ExpressionRoot _lhsIscope ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIscope )- in (Syn_ExpressionRoot _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionRoot_ExpressionRoot :: T_Expression ->- T_ExpressionRoot -sem_ExpressionRoot_ExpressionRoot expr_ =- (\ _lhsIscope ->- (let _exprOsourcePos :: MySourcePos- _exprOinLoop :: Bool- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionRoot- _exprOscope :: Scope- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _exprOsourcePos =- ("",0,0)- _exprOinLoop =- False- _lhsOmessages =- _exprImessages- _lhsOnodeType =- _exprInodeType- _actualValue =- ExpressionRoot _exprIactualValue- _lhsOactualValue =- _actualValue- _exprOscope =- _lhsIscope- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ExpressionStatementListPair ----------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ExpressionStatementListPair,([Message]),Type)-data Inh_ExpressionStatementListPair = Inh_ExpressionStatementListPair {inLoop_Inh_ExpressionStatementListPair :: Bool,scope_Inh_ExpressionStatementListPair :: Scope,sourcePos_Inh_ExpressionStatementListPair :: MySourcePos}-data Syn_ExpressionStatementListPair = Syn_ExpressionStatementListPair {actualValue_Syn_ExpressionStatementListPair :: ExpressionStatementListPair,messages_Syn_ExpressionStatementListPair :: [Message],nodeType_Syn_ExpressionStatementListPair :: Type}-wrap_ExpressionStatementListPair :: T_ExpressionStatementListPair ->- Inh_ExpressionStatementListPair ->- Syn_ExpressionStatementListPair -wrap_ExpressionStatementListPair sem (Inh_ExpressionStatementListPair _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ExpressionStatementListPair _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionStatementListPair_Tuple :: T_Expression ->- T_StatementList ->- T_ExpressionStatementListPair -sem_ExpressionStatementListPair_Tuple x1_ x2_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionStatementListPair- _x1OinLoop :: Bool- _x1Oscope :: Scope- _x1OsourcePos :: MySourcePos- _x2OinLoop :: Bool- _x2Oscope :: Scope- _x2OsourcePos :: MySourcePos- _x1IactualValue :: Expression- _x1IliftedColumnName :: String- _x1Imessages :: ([Message])- _x1InodeType :: Type- _x2IactualValue :: StatementList- _x2Imessages :: ([Message])- _x2InodeType :: Type- _x2IstatementInfo :: ([StatementInfo])- _lhsOmessages =- _x1Imessages ++ _x2Imessages- _lhsOnodeType =- _x1InodeType `setUnknown` _x2InodeType- _actualValue =- (_x1IactualValue,_x2IactualValue)- _lhsOactualValue =- _actualValue- _x1OinLoop =- _lhsIinLoop- _x1Oscope =- _lhsIscope- _x1OsourcePos =- _lhsIsourcePos- _x2OinLoop =- _lhsIinLoop- _x2Oscope =- _lhsIscope- _x2OsourcePos =- _lhsIsourcePos- ( _x1IactualValue,_x1IliftedColumnName,_x1Imessages,_x1InodeType) =- (x1_ _x1OinLoop _x1Oscope _x1OsourcePos )- ( _x2IactualValue,_x2Imessages,_x2InodeType,_x2IstatementInfo) =- (x2_ _x2OinLoop _x2Oscope _x2OsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ExpressionStatementListPairList ------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ExpressionStatementListPairList,([Message]),Type)-data Inh_ExpressionStatementListPairList = Inh_ExpressionStatementListPairList {inLoop_Inh_ExpressionStatementListPairList :: Bool,scope_Inh_ExpressionStatementListPairList :: Scope,sourcePos_Inh_ExpressionStatementListPairList :: MySourcePos}-data Syn_ExpressionStatementListPairList = Syn_ExpressionStatementListPairList {actualValue_Syn_ExpressionStatementListPairList :: ExpressionStatementListPairList,messages_Syn_ExpressionStatementListPairList :: [Message],nodeType_Syn_ExpressionStatementListPairList :: Type}-wrap_ExpressionStatementListPairList :: T_ExpressionStatementListPairList ->- Inh_ExpressionStatementListPairList ->- Syn_ExpressionStatementListPairList -wrap_ExpressionStatementListPairList sem (Inh_ExpressionStatementListPairList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ExpressionStatementListPairList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_ExpressionStatementListPairList_Cons :: T_ExpressionStatementListPair ->- T_ExpressionStatementListPairList ->- T_ExpressionStatementListPairList -sem_ExpressionStatementListPairList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionStatementListPairList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: ExpressionStatementListPair- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: ExpressionStatementListPairList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_ExpressionStatementListPairList_Nil :: T_ExpressionStatementListPairList -sem_ExpressionStatementListPairList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ExpressionStatementListPairList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- FnBody -------------------------------------------------------data FnBody = PlpgsqlFnBody (VarDefList) (StatementList) - | SqlFnBody (StatementList) - deriving ( Eq,Show)--- cata-sem_FnBody :: FnBody ->- T_FnBody -sem_FnBody (PlpgsqlFnBody _varDefList _sts ) =- (sem_FnBody_PlpgsqlFnBody (sem_VarDefList _varDefList ) (sem_StatementList _sts ) )-sem_FnBody (SqlFnBody _sts ) =- (sem_FnBody_SqlFnBody (sem_StatementList _sts ) )--- semantic domain-type T_FnBody = Bool ->- Scope ->- MySourcePos ->- ( FnBody,([Message]),Type)-data Inh_FnBody = Inh_FnBody {inLoop_Inh_FnBody :: Bool,scope_Inh_FnBody :: Scope,sourcePos_Inh_FnBody :: MySourcePos}-data Syn_FnBody = Syn_FnBody {actualValue_Syn_FnBody :: FnBody,messages_Syn_FnBody :: [Message],nodeType_Syn_FnBody :: Type}-wrap_FnBody :: T_FnBody ->- Inh_FnBody ->- Syn_FnBody -wrap_FnBody sem (Inh_FnBody _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_FnBody _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_FnBody_PlpgsqlFnBody :: T_VarDefList ->- T_StatementList ->- T_FnBody -sem_FnBody_PlpgsqlFnBody varDefList_ sts_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: FnBody- _varDefListOinLoop :: Bool- _varDefListOscope :: Scope- _varDefListOsourcePos :: MySourcePos- _stsOinLoop :: Bool- _stsOscope :: Scope- _stsOsourcePos :: MySourcePos- _varDefListIactualValue :: VarDefList- _varDefListImessages :: ([Message])- _varDefListInodeType :: Type- _stsIactualValue :: StatementList- _stsImessages :: ([Message])- _stsInodeType :: Type- _stsIstatementInfo :: ([StatementInfo])- _lhsOmessages =- _varDefListImessages ++ _stsImessages- _lhsOnodeType =- _varDefListInodeType `setUnknown` _stsInodeType- _actualValue =- PlpgsqlFnBody _varDefListIactualValue _stsIactualValue- _lhsOactualValue =- _actualValue- _varDefListOinLoop =- _lhsIinLoop- _varDefListOscope =- _lhsIscope- _varDefListOsourcePos =- _lhsIsourcePos- _stsOinLoop =- _lhsIinLoop- _stsOscope =- _lhsIscope- _stsOsourcePos =- _lhsIsourcePos- ( _varDefListIactualValue,_varDefListImessages,_varDefListInodeType) =- (varDefList_ _varDefListOinLoop _varDefListOscope _varDefListOsourcePos )- ( _stsIactualValue,_stsImessages,_stsInodeType,_stsIstatementInfo) =- (sts_ _stsOinLoop _stsOscope _stsOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_FnBody_SqlFnBody :: T_StatementList ->- T_FnBody -sem_FnBody_SqlFnBody sts_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: FnBody- _stsOinLoop :: Bool- _stsOscope :: Scope- _stsOsourcePos :: MySourcePos- _stsIactualValue :: StatementList- _stsImessages :: ([Message])- _stsInodeType :: Type- _stsIstatementInfo :: ([StatementInfo])- _lhsOmessages =- _stsImessages- _lhsOnodeType =- _stsInodeType- _actualValue =- SqlFnBody _stsIactualValue- _lhsOactualValue =- _actualValue- _stsOinLoop =- _lhsIinLoop- _stsOscope =- _lhsIscope- _stsOsourcePos =- _lhsIsourcePos- ( _stsIactualValue,_stsImessages,_stsInodeType,_stsIstatementInfo) =- (sts_ _stsOinLoop _stsOscope _stsOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- IfExists -----------------------------------------------------data IfExists = IfExists - | Require - deriving ( Eq,Show)--- cata-sem_IfExists :: IfExists ->- T_IfExists -sem_IfExists (IfExists ) =- (sem_IfExists_IfExists )-sem_IfExists (Require ) =- (sem_IfExists_Require )--- semantic domain-type T_IfExists = Bool ->- Scope ->- MySourcePos ->- ( IfExists,([Message]),Type)-data Inh_IfExists = Inh_IfExists {inLoop_Inh_IfExists :: Bool,scope_Inh_IfExists :: Scope,sourcePos_Inh_IfExists :: MySourcePos}-data Syn_IfExists = Syn_IfExists {actualValue_Syn_IfExists :: IfExists,messages_Syn_IfExists :: [Message],nodeType_Syn_IfExists :: Type}-wrap_IfExists :: T_IfExists ->- Inh_IfExists ->- Syn_IfExists -wrap_IfExists sem (Inh_IfExists _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_IfExists _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_IfExists_IfExists :: T_IfExists -sem_IfExists_IfExists =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: IfExists- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- IfExists- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_IfExists_Require :: T_IfExists -sem_IfExists_Require =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: IfExists- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Require- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- InList -------------------------------------------------------data InList = InList (ExpressionList) - | InSelect (SelectExpression) - deriving ( Eq,Show)--- cata-sem_InList :: InList ->- T_InList -sem_InList (InList _exprs ) =- (sem_InList_InList (sem_ExpressionList _exprs ) )-sem_InList (InSelect _sel ) =- (sem_InList_InSelect (sem_SelectExpression _sel ) )--- semantic domain-type T_InList = Bool ->- Scope ->- MySourcePos ->- ( InList,([Message]),Type)-data Inh_InList = Inh_InList {inLoop_Inh_InList :: Bool,scope_Inh_InList :: Scope,sourcePos_Inh_InList :: MySourcePos}-data Syn_InList = Syn_InList {actualValue_Syn_InList :: InList,messages_Syn_InList :: [Message],nodeType_Syn_InList :: Type}-wrap_InList :: T_InList ->- Inh_InList ->- Syn_InList -wrap_InList sem (Inh_InList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_InList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_InList_InList :: T_ExpressionList ->- T_InList -sem_InList_InList exprs_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: InList- _exprsOinLoop :: Bool- _exprsOscope :: Scope- _exprsOsourcePos :: MySourcePos- _exprsIactualValue :: ExpressionList- _exprsImessages :: ([Message])- _exprsInodeType :: Type- _lhsOnodeType =- resolveResultSetType- _lhsIscope- _lhsIsourcePos- $ unwrapTypeList _exprsInodeType- _lhsOmessages =- _exprsImessages- _actualValue =- InList _exprsIactualValue- _lhsOactualValue =- _actualValue- _exprsOinLoop =- _lhsIinLoop- _exprsOscope =- _lhsIscope- _exprsOsourcePos =- _lhsIsourcePos- ( _exprsIactualValue,_exprsImessages,_exprsInodeType) =- (exprs_ _exprsOinLoop _exprsOscope _exprsOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_InList_InSelect :: T_SelectExpression ->- T_InList -sem_InList_InSelect sel_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: InList- _selOinLoop :: Bool- _selOscope :: Scope- _selOsourcePos :: MySourcePos- _selIactualValue :: SelectExpression- _selImessages :: ([Message])- _selInodeType :: Type- _lhsOnodeType =- let attrs = map snd $ unwrapComposite $ unwrapSetOf $ _selInodeType- in case length attrs of- 0 -> error "internal error - got subquery with no columns? in inselect"- 1 -> head attrs- _ -> RowCtor attrs- _lhsOmessages =- _selImessages- _actualValue =- InSelect _selIactualValue- _lhsOactualValue =- _actualValue- _selOinLoop =- _lhsIinLoop- _selOscope =- _lhsIscope- _selOsourcePos =- _lhsIsourcePos- ( _selIactualValue,_selImessages,_selInodeType) =- (sel_ _selOinLoop _selOscope _selOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- JoinExpression -----------------------------------------------data JoinExpression = JoinOn (Expression) - | JoinUsing (StringList) - deriving ( Eq,Show)--- cata-sem_JoinExpression :: JoinExpression ->- T_JoinExpression -sem_JoinExpression (JoinOn _expression ) =- (sem_JoinExpression_JoinOn (sem_Expression _expression ) )-sem_JoinExpression (JoinUsing _stringList ) =- (sem_JoinExpression_JoinUsing (sem_StringList _stringList ) )--- semantic domain-type T_JoinExpression = Bool ->- Scope ->- MySourcePos ->- ( JoinExpression,([Message]),Type)-data Inh_JoinExpression = Inh_JoinExpression {inLoop_Inh_JoinExpression :: Bool,scope_Inh_JoinExpression :: Scope,sourcePos_Inh_JoinExpression :: MySourcePos}-data Syn_JoinExpression = Syn_JoinExpression {actualValue_Syn_JoinExpression :: JoinExpression,messages_Syn_JoinExpression :: [Message],nodeType_Syn_JoinExpression :: Type}-wrap_JoinExpression :: T_JoinExpression ->- Inh_JoinExpression ->- Syn_JoinExpression -wrap_JoinExpression sem (Inh_JoinExpression _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_JoinExpression _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_JoinExpression_JoinOn :: T_Expression ->- T_JoinExpression -sem_JoinExpression_JoinOn expression_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinExpression- _expressionOinLoop :: Bool- _expressionOscope :: Scope- _expressionOsourcePos :: MySourcePos- _expressionIactualValue :: Expression- _expressionIliftedColumnName :: String- _expressionImessages :: ([Message])- _expressionInodeType :: Type- _lhsOmessages =- _expressionImessages- _lhsOnodeType =- _expressionInodeType- _actualValue =- JoinOn _expressionIactualValue- _lhsOactualValue =- _actualValue- _expressionOinLoop =- _lhsIinLoop- _expressionOscope =- _lhsIscope- _expressionOsourcePos =- _lhsIsourcePos- ( _expressionIactualValue,_expressionIliftedColumnName,_expressionImessages,_expressionInodeType) =- (expression_ _expressionOinLoop _expressionOscope _expressionOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_JoinExpression_JoinUsing :: T_StringList ->- T_JoinExpression -sem_JoinExpression_JoinUsing stringList_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinExpression- _stringListOinLoop :: Bool- _stringListOscope :: Scope- _stringListOsourcePos :: MySourcePos- _stringListIactualValue :: StringList- _stringListImessages :: ([Message])- _stringListInodeType :: Type- _stringListIstrings :: ([String])- _lhsOmessages =- _stringListImessages- _lhsOnodeType =- _stringListInodeType- _actualValue =- JoinUsing _stringListIactualValue- _lhsOactualValue =- _actualValue- _stringListOinLoop =- _lhsIinLoop- _stringListOscope =- _lhsIscope- _stringListOsourcePos =- _lhsIsourcePos- ( _stringListIactualValue,_stringListImessages,_stringListInodeType,_stringListIstrings) =- (stringList_ _stringListOinLoop _stringListOscope _stringListOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- JoinType -----------------------------------------------------data JoinType = Cross - | FullOuter - | Inner - | LeftOuter - | RightOuter - deriving ( Eq,Show)--- 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 = Bool ->- Scope ->- MySourcePos ->- ( JoinType,([Message]),Type)-data Inh_JoinType = Inh_JoinType {inLoop_Inh_JoinType :: Bool,scope_Inh_JoinType :: Scope,sourcePos_Inh_JoinType :: MySourcePos}-data Syn_JoinType = Syn_JoinType {actualValue_Syn_JoinType :: JoinType,messages_Syn_JoinType :: [Message],nodeType_Syn_JoinType :: Type}-wrap_JoinType :: T_JoinType ->- Inh_JoinType ->- Syn_JoinType -wrap_JoinType sem (Inh_JoinType _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_JoinType _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_JoinType_Cross :: T_JoinType -sem_JoinType_Cross =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Cross- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_JoinType_FullOuter :: T_JoinType -sem_JoinType_FullOuter =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- FullOuter- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_JoinType_Inner :: T_JoinType -sem_JoinType_Inner =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Inner- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_JoinType_LeftOuter :: T_JoinType -sem_JoinType_LeftOuter =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- LeftOuter- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_JoinType_RightOuter :: T_JoinType -sem_JoinType_RightOuter =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: JoinType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RightOuter- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Language -----------------------------------------------------data Language = Plpgsql - | Sql - deriving ( Eq,Show)--- cata-sem_Language :: Language ->- T_Language -sem_Language (Plpgsql ) =- (sem_Language_Plpgsql )-sem_Language (Sql ) =- (sem_Language_Sql )--- semantic domain-type T_Language = Bool ->- Scope ->- MySourcePos ->- ( Language,([Message]),Type)-data Inh_Language = Inh_Language {inLoop_Inh_Language :: Bool,scope_Inh_Language :: Scope,sourcePos_Inh_Language :: MySourcePos}-data Syn_Language = Syn_Language {actualValue_Syn_Language :: Language,messages_Syn_Language :: [Message],nodeType_Syn_Language :: Type}-wrap_Language :: T_Language ->- Inh_Language ->- Syn_Language -wrap_Language sem (Inh_Language _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Language _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Language_Plpgsql :: T_Language -sem_Language_Plpgsql =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Language- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Plpgsql- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Language_Sql :: T_Language -sem_Language_Sql =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Language- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Sql- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- MTableRef ----------------------------------------------------type MTableRef = (Maybe (TableRef))--- cata-sem_MTableRef :: MTableRef ->- T_MTableRef -sem_MTableRef (Prelude.Just x ) =- (sem_MTableRef_Just (sem_TableRef x ) )-sem_MTableRef Prelude.Nothing =- sem_MTableRef_Nothing--- semantic domain-type T_MTableRef = Bool ->- Scope ->- MySourcePos ->- ( MTableRef,([QualifiedScope]),([String]),([Message]),Type)-data Inh_MTableRef = Inh_MTableRef {inLoop_Inh_MTableRef :: Bool,scope_Inh_MTableRef :: Scope,sourcePos_Inh_MTableRef :: MySourcePos}-data Syn_MTableRef = Syn_MTableRef {actualValue_Syn_MTableRef :: MTableRef,idens_Syn_MTableRef :: [QualifiedScope],joinIdens_Syn_MTableRef :: [String],messages_Syn_MTableRef :: [Message],nodeType_Syn_MTableRef :: Type}-wrap_MTableRef :: T_MTableRef ->- Inh_MTableRef ->- Syn_MTableRef -wrap_MTableRef sem (Inh_MTableRef _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_MTableRef _lhsOactualValue _lhsOidens _lhsOjoinIdens _lhsOmessages _lhsOnodeType ))-sem_MTableRef_Just :: T_TableRef ->- T_MTableRef -sem_MTableRef_Just just_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: MTableRef- _lhsOidens :: ([QualifiedScope])- _lhsOjoinIdens :: ([String])- _justOinLoop :: Bool- _justOscope :: Scope- _justOsourcePos :: MySourcePos- _justIactualValue :: TableRef- _justIidens :: ([QualifiedScope])- _justIjoinIdens :: ([String])- _justImessages :: ([Message])- _justInodeType :: Type- _lhsOnodeType =- _justInodeType- _lhsOmessages =- _justImessages- _actualValue =- Just _justIactualValue- _lhsOactualValue =- _actualValue- _lhsOidens =- _justIidens- _lhsOjoinIdens =- _justIjoinIdens- _justOinLoop =- _lhsIinLoop- _justOscope =- _lhsIscope- _justOsourcePos =- _lhsIsourcePos- ( _justIactualValue,_justIidens,_justIjoinIdens,_justImessages,_justInodeType) =- (just_ _justOinLoop _justOscope _justOsourcePos )- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))-sem_MTableRef_Nothing :: T_MTableRef -sem_MTableRef_Nothing =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOidens :: ([QualifiedScope])- _lhsOjoinIdens :: ([String])- _lhsOmessages :: ([Message])- _lhsOactualValue :: MTableRef- _lhsOnodeType =- TypeList []- _lhsOidens =- []- _lhsOjoinIdens =- []- _lhsOmessages =- []- _actualValue =- Nothing- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))--- MaybeExpression ----------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( MaybeExpression,([Message]),Type)-data Inh_MaybeExpression = Inh_MaybeExpression {inLoop_Inh_MaybeExpression :: Bool,scope_Inh_MaybeExpression :: Scope,sourcePos_Inh_MaybeExpression :: MySourcePos}-data Syn_MaybeExpression = Syn_MaybeExpression {actualValue_Syn_MaybeExpression :: MaybeExpression,messages_Syn_MaybeExpression :: [Message],nodeType_Syn_MaybeExpression :: Type}-wrap_MaybeExpression :: T_MaybeExpression ->- Inh_MaybeExpression ->- Syn_MaybeExpression -wrap_MaybeExpression sem (Inh_MaybeExpression _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_MaybeExpression _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_MaybeExpression_Just :: T_Expression ->- T_MaybeExpression -sem_MaybeExpression_Just just_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: MaybeExpression- _justOinLoop :: Bool- _justOscope :: Scope- _justOsourcePos :: MySourcePos- _justIactualValue :: Expression- _justIliftedColumnName :: String- _justImessages :: ([Message])- _justInodeType :: Type- _lhsOnodeType =- _justInodeType- _lhsOmessages =- _justImessages- _actualValue =- Just _justIactualValue- _lhsOactualValue =- _actualValue- _justOinLoop =- _lhsIinLoop- _justOscope =- _lhsIscope- _justOsourcePos =- _lhsIsourcePos- ( _justIactualValue,_justIliftedColumnName,_justImessages,_justInodeType) =- (just_ _justOinLoop _justOscope _justOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_MaybeExpression_Nothing :: T_MaybeExpression -sem_MaybeExpression_Nothing =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: MaybeExpression- _lhsOnodeType =- TypeList []- _lhsOmessages =- []- _actualValue =- Nothing- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Natural ------------------------------------------------------data Natural = Natural - | Unnatural - deriving ( Eq,Show)--- cata-sem_Natural :: Natural ->- T_Natural -sem_Natural (Natural ) =- (sem_Natural_Natural )-sem_Natural (Unnatural ) =- (sem_Natural_Unnatural )--- semantic domain-type T_Natural = Bool ->- Scope ->- MySourcePos ->- ( Natural,([Message]),Type)-data Inh_Natural = Inh_Natural {inLoop_Inh_Natural :: Bool,scope_Inh_Natural :: Scope,sourcePos_Inh_Natural :: MySourcePos}-data Syn_Natural = Syn_Natural {actualValue_Syn_Natural :: Natural,messages_Syn_Natural :: [Message],nodeType_Syn_Natural :: Type}-wrap_Natural :: T_Natural ->- Inh_Natural ->- Syn_Natural -wrap_Natural sem (Inh_Natural _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Natural _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Natural_Natural :: T_Natural -sem_Natural_Natural =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Natural- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Natural- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Natural_Unnatural :: T_Natural -sem_Natural_Unnatural =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Natural- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Unnatural- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- OnExpr -------------------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( OnExpr,([Message]),Type)-data Inh_OnExpr = Inh_OnExpr {inLoop_Inh_OnExpr :: Bool,scope_Inh_OnExpr :: Scope,sourcePos_Inh_OnExpr :: MySourcePos}-data Syn_OnExpr = Syn_OnExpr {actualValue_Syn_OnExpr :: OnExpr,messages_Syn_OnExpr :: [Message],nodeType_Syn_OnExpr :: Type}-wrap_OnExpr :: T_OnExpr ->- Inh_OnExpr ->- Syn_OnExpr -wrap_OnExpr sem (Inh_OnExpr _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_OnExpr _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_OnExpr_Just :: T_JoinExpression ->- T_OnExpr -sem_OnExpr_Just just_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: OnExpr- _justOinLoop :: Bool- _justOscope :: Scope- _justOsourcePos :: MySourcePos- _justIactualValue :: JoinExpression- _justImessages :: ([Message])- _justInodeType :: Type- _lhsOmessages =- _justImessages- _lhsOnodeType =- _justInodeType- _actualValue =- Just _justIactualValue- _lhsOactualValue =- _actualValue- _justOinLoop =- _lhsIinLoop- _justOscope =- _lhsIscope- _justOsourcePos =- _lhsIsourcePos- ( _justIactualValue,_justImessages,_justInodeType) =- (just_ _justOinLoop _justOscope _justOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_OnExpr_Nothing :: T_OnExpr -sem_OnExpr_Nothing =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: OnExpr- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Nothing- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- ParamDef -----------------------------------------------------data ParamDef = ParamDef (String) (TypeName) - | ParamDefTp (TypeName) - deriving ( Eq,Show)--- cata-sem_ParamDef :: ParamDef ->- T_ParamDef -sem_ParamDef (ParamDef _name _typ ) =- (sem_ParamDef_ParamDef _name (sem_TypeName _typ ) )-sem_ParamDef (ParamDefTp _typ ) =- (sem_ParamDef_ParamDefTp (sem_TypeName _typ ) )--- semantic domain-type T_ParamDef = Bool ->- Scope ->- MySourcePos ->- ( ParamDef,([Message]),Type,String)-data Inh_ParamDef = Inh_ParamDef {inLoop_Inh_ParamDef :: Bool,scope_Inh_ParamDef :: Scope,sourcePos_Inh_ParamDef :: MySourcePos}-data Syn_ParamDef = Syn_ParamDef {actualValue_Syn_ParamDef :: ParamDef,messages_Syn_ParamDef :: [Message],nodeType_Syn_ParamDef :: Type,paramName_Syn_ParamDef :: String}-wrap_ParamDef :: T_ParamDef ->- Inh_ParamDef ->- Syn_ParamDef -wrap_ParamDef sem (Inh_ParamDef _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOparamName) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ParamDef _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOparamName ))-sem_ParamDef_ParamDef :: String ->- T_TypeName ->- T_ParamDef -sem_ParamDef_ParamDef name_ typ_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOparamName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: ParamDef- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOnodeType =- _typInodeType- _lhsOparamName =- name_- _lhsOmessages =- _typImessages- _actualValue =- ParamDef name_ _typIactualValue- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOparamName)))-sem_ParamDef_ParamDefTp :: T_TypeName ->- T_ParamDef -sem_ParamDef_ParamDefTp typ_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOparamName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: ParamDef- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOnodeType =- _typInodeType- _lhsOparamName =- ""- _lhsOmessages =- _typImessages- _actualValue =- ParamDefTp _typIactualValue- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOparamName)))--- ParamDefList -------------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( ParamDefList,([Message]),Type,([(String,Type)]))-data Inh_ParamDefList = Inh_ParamDefList {inLoop_Inh_ParamDefList :: Bool,scope_Inh_ParamDefList :: Scope,sourcePos_Inh_ParamDefList :: MySourcePos}-data Syn_ParamDefList = Syn_ParamDefList {actualValue_Syn_ParamDefList :: ParamDefList,messages_Syn_ParamDefList :: [Message],nodeType_Syn_ParamDefList :: Type,params_Syn_ParamDefList :: [(String,Type)]}-wrap_ParamDefList :: T_ParamDefList ->- Inh_ParamDefList ->- Syn_ParamDefList -wrap_ParamDefList sem (Inh_ParamDefList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOparams) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_ParamDefList _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOparams ))-sem_ParamDefList_Cons :: T_ParamDef ->- T_ParamDefList ->- T_ParamDefList -sem_ParamDefList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOparams :: ([(String,Type)])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ParamDefList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: ParamDef- _hdImessages :: ([Message])- _hdInodeType :: Type- _hdIparamName :: String- _tlIactualValue :: ParamDefList- _tlImessages :: ([Message])- _tlInodeType :: Type- _tlIparams :: ([(String,Type)])- _lhsOparams =- ((_hdIparamName, _hdInodeType) : _tlIparams)- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType,_hdIparamName) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType,_tlIparams) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOparams)))-sem_ParamDefList_Nil :: T_ParamDefList -sem_ParamDefList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOparams :: ([(String,Type)])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: ParamDefList- _lhsOparams =- []- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOparams)))--- RaiseType ----------------------------------------------------data RaiseType = RError - | RException - | RNotice - deriving ( Eq,Show)--- 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 = Bool ->- Scope ->- MySourcePos ->- ( RaiseType,([Message]),Type)-data Inh_RaiseType = Inh_RaiseType {inLoop_Inh_RaiseType :: Bool,scope_Inh_RaiseType :: Scope,sourcePos_Inh_RaiseType :: MySourcePos}-data Syn_RaiseType = Syn_RaiseType {actualValue_Syn_RaiseType :: RaiseType,messages_Syn_RaiseType :: [Message],nodeType_Syn_RaiseType :: Type}-wrap_RaiseType :: T_RaiseType ->- Inh_RaiseType ->- Syn_RaiseType -wrap_RaiseType sem (Inh_RaiseType _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_RaiseType _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_RaiseType_RError :: T_RaiseType -sem_RaiseType_RError =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RaiseType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RError- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RaiseType_RException :: T_RaiseType -sem_RaiseType_RException =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RaiseType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RException- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RaiseType_RNotice :: T_RaiseType -sem_RaiseType_RNotice =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RaiseType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RNotice- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- RestartIdentity ----------------------------------------------data RestartIdentity = ContinueIdentity - | RestartIdentity - deriving ( Eq,Show)--- cata-sem_RestartIdentity :: RestartIdentity ->- T_RestartIdentity -sem_RestartIdentity (ContinueIdentity ) =- (sem_RestartIdentity_ContinueIdentity )-sem_RestartIdentity (RestartIdentity ) =- (sem_RestartIdentity_RestartIdentity )--- semantic domain-type T_RestartIdentity = Bool ->- Scope ->- MySourcePos ->- ( RestartIdentity,([Message]),Type)-data Inh_RestartIdentity = Inh_RestartIdentity {inLoop_Inh_RestartIdentity :: Bool,scope_Inh_RestartIdentity :: Scope,sourcePos_Inh_RestartIdentity :: MySourcePos}-data Syn_RestartIdentity = Syn_RestartIdentity {actualValue_Syn_RestartIdentity :: RestartIdentity,messages_Syn_RestartIdentity :: [Message],nodeType_Syn_RestartIdentity :: Type}-wrap_RestartIdentity :: T_RestartIdentity ->- Inh_RestartIdentity ->- Syn_RestartIdentity -wrap_RestartIdentity sem (Inh_RestartIdentity _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_RestartIdentity _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_RestartIdentity_ContinueIdentity :: T_RestartIdentity -sem_RestartIdentity_ContinueIdentity =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RestartIdentity- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- ContinueIdentity- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RestartIdentity_RestartIdentity :: T_RestartIdentity -sem_RestartIdentity_RestartIdentity =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RestartIdentity- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RestartIdentity- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Root ---------------------------------------------------------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 = Scope ->- ( Root,([Message]),Type,([StatementInfo]))-data Inh_Root = Inh_Root {scope_Inh_Root :: Scope}-data Syn_Root = Syn_Root {actualValue_Syn_Root :: Root,messages_Syn_Root :: [Message],nodeType_Syn_Root :: Type,statementInfo_Syn_Root :: [StatementInfo]}-wrap_Root :: T_Root ->- Inh_Root ->- Syn_Root -wrap_Root sem (Inh_Root _lhsIscope ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo) =- (sem _lhsIscope )- in (Syn_Root _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOstatementInfo ))-sem_Root_Root :: T_StatementList ->- T_Root -sem_Root_Root statements_ =- (\ _lhsIscope ->- (let _statementsOsourcePos :: MySourcePos- _statementsOinLoop :: Bool- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Root- _lhsOstatementInfo :: ([StatementInfo])- _statementsOscope :: Scope- _statementsIactualValue :: StatementList- _statementsImessages :: ([Message])- _statementsInodeType :: Type- _statementsIstatementInfo :: ([StatementInfo])- _statementsOsourcePos =- ("",0,0)- _statementsOinLoop =- False- _lhsOmessages =- _statementsImessages- _lhsOnodeType =- _statementsInodeType- _actualValue =- Root _statementsIactualValue- _lhsOactualValue =- _actualValue- _lhsOstatementInfo =- _statementsIstatementInfo- _statementsOscope =- _lhsIscope- ( _statementsIactualValue,_statementsImessages,_statementsInodeType,_statementsIstatementInfo) =- (statements_ _statementsOinLoop _statementsOscope _statementsOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))--- RowConstraint ------------------------------------------------data RowConstraint = NotNullConstraint - | NullConstraint - | RowCheckConstraint (Expression) - | RowPrimaryKeyConstraint - | RowReferenceConstraint (String) (Maybe String) (Cascade) (Cascade) - | RowUniqueConstraint - deriving ( Eq,Show)--- cata-sem_RowConstraint :: RowConstraint ->- T_RowConstraint -sem_RowConstraint (NotNullConstraint ) =- (sem_RowConstraint_NotNullConstraint )-sem_RowConstraint (NullConstraint ) =- (sem_RowConstraint_NullConstraint )-sem_RowConstraint (RowCheckConstraint _expression ) =- (sem_RowConstraint_RowCheckConstraint (sem_Expression _expression ) )-sem_RowConstraint (RowPrimaryKeyConstraint ) =- (sem_RowConstraint_RowPrimaryKeyConstraint )-sem_RowConstraint (RowReferenceConstraint _table _att _onUpdate _onDelete ) =- (sem_RowConstraint_RowReferenceConstraint _table _att (sem_Cascade _onUpdate ) (sem_Cascade _onDelete ) )-sem_RowConstraint (RowUniqueConstraint ) =- (sem_RowConstraint_RowUniqueConstraint )--- semantic domain-type T_RowConstraint = Bool ->- Scope ->- MySourcePos ->- ( RowConstraint,([Message]),Type)-data Inh_RowConstraint = Inh_RowConstraint {inLoop_Inh_RowConstraint :: Bool,scope_Inh_RowConstraint :: Scope,sourcePos_Inh_RowConstraint :: MySourcePos}-data Syn_RowConstraint = Syn_RowConstraint {actualValue_Syn_RowConstraint :: RowConstraint,messages_Syn_RowConstraint :: [Message],nodeType_Syn_RowConstraint :: Type}-wrap_RowConstraint :: T_RowConstraint ->- Inh_RowConstraint ->- Syn_RowConstraint -wrap_RowConstraint sem (Inh_RowConstraint _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_RowConstraint _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_RowConstraint_NotNullConstraint :: T_RowConstraint -sem_RowConstraint_NotNullConstraint =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraint- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- NotNullConstraint- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RowConstraint_NullConstraint :: T_RowConstraint -sem_RowConstraint_NullConstraint =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraint- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- NullConstraint- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RowConstraint_RowCheckConstraint :: T_Expression ->- T_RowConstraint -sem_RowConstraint_RowCheckConstraint expression_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraint- _expressionOinLoop :: Bool- _expressionOscope :: Scope- _expressionOsourcePos :: MySourcePos- _expressionIactualValue :: Expression- _expressionIliftedColumnName :: String- _expressionImessages :: ([Message])- _expressionInodeType :: Type- _lhsOmessages =- _expressionImessages- _lhsOnodeType =- _expressionInodeType- _actualValue =- RowCheckConstraint _expressionIactualValue- _lhsOactualValue =- _actualValue- _expressionOinLoop =- _lhsIinLoop- _expressionOscope =- _lhsIscope- _expressionOsourcePos =- _lhsIsourcePos- ( _expressionIactualValue,_expressionIliftedColumnName,_expressionImessages,_expressionInodeType) =- (expression_ _expressionOinLoop _expressionOscope _expressionOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RowConstraint_RowPrimaryKeyConstraint :: T_RowConstraint -sem_RowConstraint_RowPrimaryKeyConstraint =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraint- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RowPrimaryKeyConstraint- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RowConstraint_RowReferenceConstraint :: String ->- (Maybe String) ->- T_Cascade ->- T_Cascade ->- T_RowConstraint -sem_RowConstraint_RowReferenceConstraint table_ att_ onUpdate_ onDelete_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraint- _onUpdateOinLoop :: Bool- _onUpdateOscope :: Scope- _onUpdateOsourcePos :: MySourcePos- _onDeleteOinLoop :: Bool- _onDeleteOscope :: Scope- _onDeleteOsourcePos :: MySourcePos- _onUpdateIactualValue :: Cascade- _onUpdateImessages :: ([Message])- _onUpdateInodeType :: Type- _onDeleteIactualValue :: Cascade- _onDeleteImessages :: ([Message])- _onDeleteInodeType :: Type- _lhsOmessages =- _onUpdateImessages ++ _onDeleteImessages- _lhsOnodeType =- _onUpdateInodeType `setUnknown` _onDeleteInodeType- _actualValue =- RowReferenceConstraint table_ att_ _onUpdateIactualValue _onDeleteIactualValue- _lhsOactualValue =- _actualValue- _onUpdateOinLoop =- _lhsIinLoop- _onUpdateOscope =- _lhsIscope- _onUpdateOsourcePos =- _lhsIsourcePos- _onDeleteOinLoop =- _lhsIinLoop- _onDeleteOscope =- _lhsIscope- _onDeleteOsourcePos =- _lhsIsourcePos- ( _onUpdateIactualValue,_onUpdateImessages,_onUpdateInodeType) =- (onUpdate_ _onUpdateOinLoop _onUpdateOscope _onUpdateOsourcePos )- ( _onDeleteIactualValue,_onDeleteImessages,_onDeleteInodeType) =- (onDelete_ _onDeleteOinLoop _onDeleteOscope _onDeleteOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RowConstraint_RowUniqueConstraint :: T_RowConstraint -sem_RowConstraint_RowUniqueConstraint =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraint- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- RowUniqueConstraint- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- RowConstraintList --------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( RowConstraintList,([Message]),Type)-data Inh_RowConstraintList = Inh_RowConstraintList {inLoop_Inh_RowConstraintList :: Bool,scope_Inh_RowConstraintList :: Scope,sourcePos_Inh_RowConstraintList :: MySourcePos}-data Syn_RowConstraintList = Syn_RowConstraintList {actualValue_Syn_RowConstraintList :: RowConstraintList,messages_Syn_RowConstraintList :: [Message],nodeType_Syn_RowConstraintList :: Type}-wrap_RowConstraintList :: T_RowConstraintList ->- Inh_RowConstraintList ->- Syn_RowConstraintList -wrap_RowConstraintList sem (Inh_RowConstraintList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_RowConstraintList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_RowConstraintList_Cons :: T_RowConstraint ->- T_RowConstraintList ->- T_RowConstraintList -sem_RowConstraintList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraintList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: RowConstraint- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: RowConstraintList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_RowConstraintList_Nil :: T_RowConstraintList -sem_RowConstraintList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: RowConstraintList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- SelectExpression ---------------------------------------------data SelectExpression = CombineSelect (CombineType) (SelectExpression) (SelectExpression) - | Select (Distinct) (SelectList) (MTableRef) (Where) (ExpressionList) (Maybe Expression) (ExpressionList) (Direction) (Maybe Expression) (Maybe Expression) - | Values (ExpressionListList) - deriving ( Eq,Show)--- cata-sem_SelectExpression :: SelectExpression ->- T_SelectExpression -sem_SelectExpression (CombineSelect _ctype _sel1 _sel2 ) =- (sem_SelectExpression_CombineSelect (sem_CombineType _ctype ) (sem_SelectExpression _sel1 ) (sem_SelectExpression _sel2 ) )-sem_SelectExpression (Select _selDistinct _selSelectList _selTref _selWhere _selGroupBy _selHaving _selOrderBy _selDir _selLimit _selOffset ) =- (sem_SelectExpression_Select (sem_Distinct _selDistinct ) (sem_SelectList _selSelectList ) (sem_MTableRef _selTref ) (sem_Where _selWhere ) (sem_ExpressionList _selGroupBy ) _selHaving (sem_ExpressionList _selOrderBy ) (sem_Direction _selDir ) _selLimit _selOffset )-sem_SelectExpression (Values _vll ) =- (sem_SelectExpression_Values (sem_ExpressionListList _vll ) )--- semantic domain-type T_SelectExpression = Bool ->- Scope ->- MySourcePos ->- ( SelectExpression,([Message]),Type)-data Inh_SelectExpression = Inh_SelectExpression {inLoop_Inh_SelectExpression :: Bool,scope_Inh_SelectExpression :: Scope,sourcePos_Inh_SelectExpression :: MySourcePos}-data Syn_SelectExpression = Syn_SelectExpression {actualValue_Syn_SelectExpression :: SelectExpression,messages_Syn_SelectExpression :: [Message],nodeType_Syn_SelectExpression :: Type}-wrap_SelectExpression :: T_SelectExpression ->- Inh_SelectExpression ->- Syn_SelectExpression -wrap_SelectExpression sem (Inh_SelectExpression _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SelectExpression _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_SelectExpression_CombineSelect :: T_CombineType ->- T_SelectExpression ->- T_SelectExpression ->- T_SelectExpression -sem_SelectExpression_CombineSelect ctype_ sel1_ sel2_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectExpression- _ctypeOinLoop :: Bool- _ctypeOscope :: Scope- _ctypeOsourcePos :: MySourcePos- _sel1OinLoop :: Bool- _sel1Oscope :: Scope- _sel1OsourcePos :: MySourcePos- _sel2OinLoop :: Bool- _sel2Oscope :: Scope- _sel2OsourcePos :: MySourcePos- _ctypeIactualValue :: CombineType- _ctypeImessages :: ([Message])- _ctypeInodeType :: Type- _sel1IactualValue :: SelectExpression- _sel1Imessages :: ([Message])- _sel1InodeType :: Type- _sel2IactualValue :: SelectExpression- _sel2Imessages :: ([Message])- _sel2InodeType :: Type- _lhsOnodeType =- checkErrors [_sel1InodeType,_sel2InodeType] $- typeCheckCombineSelect- _lhsIscope- _lhsIsourcePos- _sel1InodeType- _sel2InodeType- _lhsOmessages =- _ctypeImessages ++ _sel1Imessages ++ _sel2Imessages- _actualValue =- CombineSelect _ctypeIactualValue _sel1IactualValue _sel2IactualValue- _lhsOactualValue =- _actualValue- _ctypeOinLoop =- _lhsIinLoop- _ctypeOscope =- _lhsIscope- _ctypeOsourcePos =- _lhsIsourcePos- _sel1OinLoop =- _lhsIinLoop- _sel1Oscope =- _lhsIscope- _sel1OsourcePos =- _lhsIsourcePos- _sel2OinLoop =- _lhsIinLoop- _sel2Oscope =- _lhsIscope- _sel2OsourcePos =- _lhsIsourcePos- ( _ctypeIactualValue,_ctypeImessages,_ctypeInodeType) =- (ctype_ _ctypeOinLoop _ctypeOscope _ctypeOsourcePos )- ( _sel1IactualValue,_sel1Imessages,_sel1InodeType) =- (sel1_ _sel1OinLoop _sel1Oscope _sel1OsourcePos )- ( _sel2IactualValue,_sel2Imessages,_sel2InodeType) =- (sel2_ _sel2OinLoop _sel2Oscope _sel2OsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_SelectExpression_Select :: T_Distinct ->- T_SelectList ->- T_MTableRef ->- T_Where ->- T_ExpressionList ->- (Maybe Expression) ->- T_ExpressionList ->- T_Direction ->- (Maybe Expression) ->- (Maybe Expression) ->- T_SelectExpression -sem_SelectExpression_Select selDistinct_ selSelectList_ selTref_ selWhere_ selGroupBy_ selHaving_ selOrderBy_ selDir_ selLimit_ selOffset_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _selSelectListOscope :: Scope- _selWhereOscope :: Scope- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectExpression- _selDistinctOinLoop :: Bool- _selDistinctOscope :: Scope- _selDistinctOsourcePos :: MySourcePos- _selSelectListOinLoop :: Bool- _selSelectListOsourcePos :: MySourcePos- _selTrefOinLoop :: Bool- _selTrefOscope :: Scope- _selTrefOsourcePos :: MySourcePos- _selWhereOinLoop :: Bool- _selWhereOsourcePos :: MySourcePos- _selGroupByOinLoop :: Bool- _selGroupByOscope :: Scope- _selGroupByOsourcePos :: MySourcePos- _selOrderByOinLoop :: Bool- _selOrderByOscope :: Scope- _selOrderByOsourcePos :: MySourcePos- _selDirOinLoop :: Bool- _selDirOscope :: Scope- _selDirOsourcePos :: MySourcePos- _selDistinctIactualValue :: Distinct- _selDistinctImessages :: ([Message])- _selDistinctInodeType :: Type- _selSelectListIactualValue :: SelectList- _selSelectListImessages :: ([Message])- _selSelectListInodeType :: Type- _selTrefIactualValue :: MTableRef- _selTrefIidens :: ([QualifiedScope])- _selTrefIjoinIdens :: ([String])- _selTrefImessages :: ([Message])- _selTrefInodeType :: Type- _selWhereIactualValue :: Where- _selWhereImessages :: ([Message])- _selWhereInodeType :: Type- _selGroupByIactualValue :: ExpressionList- _selGroupByImessages :: ([Message])- _selGroupByInodeType :: Type- _selOrderByIactualValue :: ExpressionList- _selOrderByImessages :: ([Message])- _selOrderByInodeType :: Type- _selDirIactualValue :: Direction- _selDirImessages :: ([Message])- _selDirInodeType :: Type- _lhsOnodeType =- checkErrors- [_selTrefInodeType- ,_selSelectListInodeType- ,_selWhereInodeType]- (let t = _selSelectListInodeType- in case t of- UnnamedCompositeType [(_,Pseudo Void)] -> Pseudo Void- _ -> SetOfType _selSelectListInodeType)- _selSelectListOscope =- scopeReplaceIds _lhsIscope _selTrefIidens _selTrefIjoinIdens- _selWhereOscope =- scopeReplaceIds _lhsIscope _selTrefIidens _selTrefIjoinIdens- _lhsOmessages =- _selDistinctImessages ++ _selSelectListImessages ++ _selTrefImessages ++ _selWhereImessages ++ _selGroupByImessages ++ _selOrderByImessages ++ _selDirImessages- _actualValue =- Select _selDistinctIactualValue _selSelectListIactualValue _selTrefIactualValue _selWhereIactualValue _selGroupByIactualValue selHaving_ _selOrderByIactualValue _selDirIactualValue selLimit_ selOffset_- _lhsOactualValue =- _actualValue- _selDistinctOinLoop =- _lhsIinLoop- _selDistinctOscope =- _lhsIscope- _selDistinctOsourcePos =- _lhsIsourcePos- _selSelectListOinLoop =- _lhsIinLoop- _selSelectListOsourcePos =- _lhsIsourcePos- _selTrefOinLoop =- _lhsIinLoop- _selTrefOscope =- _lhsIscope- _selTrefOsourcePos =- _lhsIsourcePos- _selWhereOinLoop =- _lhsIinLoop- _selWhereOsourcePos =- _lhsIsourcePos- _selGroupByOinLoop =- _lhsIinLoop- _selGroupByOscope =- _lhsIscope- _selGroupByOsourcePos =- _lhsIsourcePos- _selOrderByOinLoop =- _lhsIinLoop- _selOrderByOscope =- _lhsIscope- _selOrderByOsourcePos =- _lhsIsourcePos- _selDirOinLoop =- _lhsIinLoop- _selDirOscope =- _lhsIscope- _selDirOsourcePos =- _lhsIsourcePos- ( _selDistinctIactualValue,_selDistinctImessages,_selDistinctInodeType) =- (selDistinct_ _selDistinctOinLoop _selDistinctOscope _selDistinctOsourcePos )- ( _selSelectListIactualValue,_selSelectListImessages,_selSelectListInodeType) =- (selSelectList_ _selSelectListOinLoop _selSelectListOscope _selSelectListOsourcePos )- ( _selTrefIactualValue,_selTrefIidens,_selTrefIjoinIdens,_selTrefImessages,_selTrefInodeType) =- (selTref_ _selTrefOinLoop _selTrefOscope _selTrefOsourcePos )- ( _selWhereIactualValue,_selWhereImessages,_selWhereInodeType) =- (selWhere_ _selWhereOinLoop _selWhereOscope _selWhereOsourcePos )- ( _selGroupByIactualValue,_selGroupByImessages,_selGroupByInodeType) =- (selGroupBy_ _selGroupByOinLoop _selGroupByOscope _selGroupByOsourcePos )- ( _selOrderByIactualValue,_selOrderByImessages,_selOrderByInodeType) =- (selOrderBy_ _selOrderByOinLoop _selOrderByOscope _selOrderByOsourcePos )- ( _selDirIactualValue,_selDirImessages,_selDirInodeType) =- (selDir_ _selDirOinLoop _selDirOscope _selDirOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_SelectExpression_Values :: T_ExpressionListList ->- T_SelectExpression -sem_SelectExpression_Values vll_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectExpression- _vllOinLoop :: Bool- _vllOscope :: Scope- _vllOsourcePos :: MySourcePos- _vllIactualValue :: ExpressionListList- _vllImessages :: ([Message])- _vllInodeType :: Type- _lhsOnodeType =- checkErrors [_vllInodeType] $- typeCheckValuesExpr- _lhsIscope- _lhsIsourcePos- _vllInodeType- _lhsOmessages =- _vllImessages- _actualValue =- Values _vllIactualValue- _lhsOactualValue =- _actualValue- _vllOinLoop =- _lhsIinLoop- _vllOscope =- _lhsIscope- _vllOsourcePos =- _lhsIsourcePos- ( _vllIactualValue,_vllImessages,_vllInodeType) =- (vll_ _vllOinLoop _vllOscope _vllOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- SelectItem ---------------------------------------------------data SelectItem = SelExp (Expression) - | SelectItem (Expression) (String) - deriving ( Eq,Show)--- cata-sem_SelectItem :: SelectItem ->- T_SelectItem -sem_SelectItem (SelExp _ex ) =- (sem_SelectItem_SelExp (sem_Expression _ex ) )-sem_SelectItem (SelectItem _ex _name ) =- (sem_SelectItem_SelectItem (sem_Expression _ex ) _name )--- semantic domain-type T_SelectItem = Bool ->- Scope ->- MySourcePos ->- ( SelectItem,String,([Message]),Type)-data Inh_SelectItem = Inh_SelectItem {inLoop_Inh_SelectItem :: Bool,scope_Inh_SelectItem :: Scope,sourcePos_Inh_SelectItem :: MySourcePos}-data Syn_SelectItem = Syn_SelectItem {actualValue_Syn_SelectItem :: SelectItem,columnName_Syn_SelectItem :: String,messages_Syn_SelectItem :: [Message],nodeType_Syn_SelectItem :: Type}-wrap_SelectItem :: T_SelectItem ->- Inh_SelectItem ->- Syn_SelectItem -wrap_SelectItem sem (Inh_SelectItem _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOcolumnName,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SelectItem _lhsOactualValue _lhsOcolumnName _lhsOmessages _lhsOnodeType ))-sem_SelectItem_SelExp :: T_Expression ->- T_SelectItem -sem_SelectItem_SelExp ex_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOcolumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectItem- _exOinLoop :: Bool- _exOscope :: Scope- _exOsourcePos :: MySourcePos- _exIactualValue :: Expression- _exIliftedColumnName :: String- _exImessages :: ([Message])- _exInodeType :: Type- _lhsOnodeType =- _exInodeType- _lhsOcolumnName =- case _exIliftedColumnName of- "" -> "?column?"- s -> s- _lhsOmessages =- _exImessages- _actualValue =- SelExp _exIactualValue- _lhsOactualValue =- _actualValue- _exOinLoop =- _lhsIinLoop- _exOscope =- _lhsIscope- _exOsourcePos =- _lhsIsourcePos- ( _exIactualValue,_exIliftedColumnName,_exImessages,_exInodeType) =- (ex_ _exOinLoop _exOscope _exOsourcePos )- in ( _lhsOactualValue,_lhsOcolumnName,_lhsOmessages,_lhsOnodeType)))-sem_SelectItem_SelectItem :: T_Expression ->- String ->- T_SelectItem -sem_SelectItem_SelectItem ex_ name_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOcolumnName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectItem- _exOinLoop :: Bool- _exOscope :: Scope- _exOsourcePos :: MySourcePos- _exIactualValue :: Expression- _exIliftedColumnName :: String- _exImessages :: ([Message])- _exInodeType :: Type- _lhsOnodeType =- _exInodeType- _lhsOcolumnName =- name_- _lhsOmessages =- _exImessages- _actualValue =- SelectItem _exIactualValue name_- _lhsOactualValue =- _actualValue- _exOinLoop =- _lhsIinLoop- _exOscope =- _lhsIscope- _exOsourcePos =- _lhsIsourcePos- ( _exIactualValue,_exIliftedColumnName,_exImessages,_exInodeType) =- (ex_ _exOinLoop _exOscope _exOsourcePos )- in ( _lhsOactualValue,_lhsOcolumnName,_lhsOmessages,_lhsOnodeType)))--- SelectItemList -----------------------------------------------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 ->- Scope ->- MySourcePos ->- ( SelectItemList,([Message]),Type)-data Inh_SelectItemList = Inh_SelectItemList {inLoop_Inh_SelectItemList :: Bool,scope_Inh_SelectItemList :: Scope,sourcePos_Inh_SelectItemList :: MySourcePos}-data Syn_SelectItemList = Syn_SelectItemList {actualValue_Syn_SelectItemList :: SelectItemList,messages_Syn_SelectItemList :: [Message],nodeType_Syn_SelectItemList :: Type}-wrap_SelectItemList :: T_SelectItemList ->- Inh_SelectItemList ->- Syn_SelectItemList -wrap_SelectItemList sem (Inh_SelectItemList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SelectItemList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_SelectItemList_Cons :: T_SelectItem ->- T_SelectItemList ->- T_SelectItemList -sem_SelectItemList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectItemList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: SelectItem- _hdIcolumnName :: String- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: SelectItemList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOnodeType =- foldr consComposite _tlInodeType- (let (correlationName,iden) = splitIdentifier _hdIcolumnName- in if iden == "*"- then scopeExpandStar _lhsIscope _lhsIsourcePos correlationName- else [(iden, _hdInodeType)])- _lhsOmessages =- _hdImessages ++ _tlImessages- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdIcolumnName,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_SelectItemList_Nil :: T_SelectItemList -sem_SelectItemList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectItemList- _lhsOnodeType =- UnnamedCompositeType []- _lhsOmessages =- []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- SelectList ---------------------------------------------------data SelectList = SelectList (SelectItemList) (StringList) - deriving ( Eq,Show)--- cata-sem_SelectList :: SelectList ->- T_SelectList -sem_SelectList (SelectList _items _stringList ) =- (sem_SelectList_SelectList (sem_SelectItemList _items ) (sem_StringList _stringList ) )--- semantic domain-type T_SelectList = Bool ->- Scope ->- MySourcePos ->- ( SelectList,([Message]),Type)-data Inh_SelectList = Inh_SelectList {inLoop_Inh_SelectList :: Bool,scope_Inh_SelectList :: Scope,sourcePos_Inh_SelectList :: MySourcePos}-data Syn_SelectList = Syn_SelectList {actualValue_Syn_SelectList :: SelectList,messages_Syn_SelectList :: [Message],nodeType_Syn_SelectList :: Type}-wrap_SelectList :: T_SelectList ->- Inh_SelectList ->- Syn_SelectList -wrap_SelectList sem (Inh_SelectList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SelectList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_SelectList_SelectList :: T_SelectItemList ->- T_StringList ->- T_SelectList -sem_SelectList_SelectList items_ stringList_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: SelectList- _itemsOinLoop :: Bool- _itemsOscope :: Scope- _itemsOsourcePos :: MySourcePos- _stringListOinLoop :: Bool- _stringListOscope :: Scope- _stringListOsourcePos :: MySourcePos- _itemsIactualValue :: SelectItemList- _itemsImessages :: ([Message])- _itemsInodeType :: Type- _stringListIactualValue :: StringList- _stringListImessages :: ([Message])- _stringListInodeType :: Type- _stringListIstrings :: ([String])- _lhsOnodeType =- _itemsInodeType- _lhsOmessages =- _itemsImessages ++ _stringListImessages- _actualValue =- SelectList _itemsIactualValue _stringListIactualValue- _lhsOactualValue =- _actualValue- _itemsOinLoop =- _lhsIinLoop- _itemsOscope =- _lhsIscope- _itemsOsourcePos =- _lhsIsourcePos- _stringListOinLoop =- _lhsIinLoop- _stringListOscope =- _lhsIscope- _stringListOsourcePos =- _lhsIsourcePos- ( _itemsIactualValue,_itemsImessages,_itemsInodeType) =- (items_ _itemsOinLoop _itemsOscope _itemsOsourcePos )- ( _stringListIactualValue,_stringListImessages,_stringListInodeType,_stringListIstrings) =- (stringList_ _stringListOinLoop _stringListOscope _stringListOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- SetClause ----------------------------------------------------data SetClause = RowSetClause (StringList) (ExpressionList) - | SetClause (String) (Expression) - deriving ( Eq,Show)--- cata-sem_SetClause :: SetClause ->- T_SetClause -sem_SetClause (RowSetClause _atts _vals ) =- (sem_SetClause_RowSetClause (sem_StringList _atts ) (sem_ExpressionList _vals ) )-sem_SetClause (SetClause _att _val ) =- (sem_SetClause_SetClause _att (sem_Expression _val ) )--- semantic domain-type T_SetClause = Bool ->- Scope ->- MySourcePos ->- ( SetClause,([Message]),Type,([(String,Type)]))-data Inh_SetClause = Inh_SetClause {inLoop_Inh_SetClause :: Bool,scope_Inh_SetClause :: Scope,sourcePos_Inh_SetClause :: MySourcePos}-data Syn_SetClause = Syn_SetClause {actualValue_Syn_SetClause :: SetClause,messages_Syn_SetClause :: [Message],nodeType_Syn_SetClause :: Type,pairs_Syn_SetClause :: [(String,Type)]}-wrap_SetClause :: T_SetClause ->- Inh_SetClause ->- Syn_SetClause -wrap_SetClause sem (Inh_SetClause _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOpairs) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SetClause _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOpairs ))-sem_SetClause_RowSetClause :: T_StringList ->- T_ExpressionList ->- T_SetClause -sem_SetClause_RowSetClause atts_ vals_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOpairs :: ([(String,Type)])- _lhsOmessages :: ([Message])- _lhsOactualValue :: SetClause- _attsOinLoop :: Bool- _attsOscope :: Scope- _attsOsourcePos :: MySourcePos- _valsOinLoop :: Bool- _valsOscope :: Scope- _valsOsourcePos :: MySourcePos- _attsIactualValue :: StringList- _attsImessages :: ([Message])- _attsInodeType :: Type- _attsIstrings :: ([String])- _valsIactualValue :: ExpressionList- _valsImessages :: ([Message])- _valsInodeType :: Type- _lhsOnodeType =- let atts = _attsIstrings- types = getRowTypes _valsInodeType- lengthError = if length atts /= length types- then TypeError _lhsIsourcePos WrongNumberOfColumns- else TypeList []- in checkErrors [lengthError] $ TypeList []- _lhsOpairs =- zip _attsIstrings $ getRowTypes _valsInodeType- _lhsOmessages =- _attsImessages ++ _valsImessages- _actualValue =- RowSetClause _attsIactualValue _valsIactualValue- _lhsOactualValue =- _actualValue- _attsOinLoop =- _lhsIinLoop- _attsOscope =- _lhsIscope- _attsOsourcePos =- _lhsIsourcePos- _valsOinLoop =- _lhsIinLoop- _valsOscope =- _lhsIscope- _valsOsourcePos =- _lhsIsourcePos- ( _attsIactualValue,_attsImessages,_attsInodeType,_attsIstrings) =- (atts_ _attsOinLoop _attsOscope _attsOsourcePos )- ( _valsIactualValue,_valsImessages,_valsInodeType) =- (vals_ _valsOinLoop _valsOscope _valsOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOpairs)))-sem_SetClause_SetClause :: String ->- T_Expression ->- T_SetClause -sem_SetClause_SetClause att_ val_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOpairs :: ([(String,Type)])- _lhsOmessages :: ([Message])- _lhsOactualValue :: SetClause- _valOinLoop :: Bool- _valOscope :: Scope- _valOsourcePos :: MySourcePos- _valIactualValue :: Expression- _valIliftedColumnName :: String- _valImessages :: ([Message])- _valInodeType :: Type- _lhsOnodeType =- checkErrors [_valInodeType] $ TypeList []- _lhsOpairs =- [(att_, _valInodeType)]- _lhsOmessages =- _valImessages- _actualValue =- SetClause att_ _valIactualValue- _lhsOactualValue =- _actualValue- _valOinLoop =- _lhsIinLoop- _valOscope =- _lhsIscope- _valOsourcePos =- _lhsIsourcePos- ( _valIactualValue,_valIliftedColumnName,_valImessages,_valInodeType) =- (val_ _valOinLoop _valOscope _valOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOpairs)))--- SetClauseList ------------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( SetClauseList,([Message]),Type,([(String,Type)]))-data Inh_SetClauseList = Inh_SetClauseList {inLoop_Inh_SetClauseList :: Bool,scope_Inh_SetClauseList :: Scope,sourcePos_Inh_SetClauseList :: MySourcePos}-data Syn_SetClauseList = Syn_SetClauseList {actualValue_Syn_SetClauseList :: SetClauseList,messages_Syn_SetClauseList :: [Message],nodeType_Syn_SetClauseList :: Type,pairs_Syn_SetClauseList :: [(String,Type)]}-wrap_SetClauseList :: T_SetClauseList ->- Inh_SetClauseList ->- Syn_SetClauseList -wrap_SetClauseList sem (Inh_SetClauseList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOpairs) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SetClauseList _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOpairs ))-sem_SetClauseList_Cons :: T_SetClause ->- T_SetClauseList ->- T_SetClauseList -sem_SetClauseList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOpairs :: ([(String,Type)])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: SetClauseList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: SetClause- _hdImessages :: ([Message])- _hdInodeType :: Type- _hdIpairs :: ([(String,Type)])- _tlIactualValue :: SetClauseList- _tlImessages :: ([Message])- _tlInodeType :: Type- _tlIpairs :: ([(String,Type)])- _lhsOpairs =- _hdIpairs ++ _tlIpairs- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType,_hdIpairs) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType,_tlIpairs) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOpairs)))-sem_SetClauseList_Nil :: T_SetClauseList -sem_SetClauseList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOpairs :: ([(String,Type)])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: SetClauseList- _lhsOpairs =- []- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOpairs)))--- SourcePosStatement -------------------------------------------type SourcePosStatement = ( (MySourcePos),(Statement))--- cata-sem_SourcePosStatement :: SourcePosStatement ->- T_SourcePosStatement -sem_SourcePosStatement ( x1,x2) =- (sem_SourcePosStatement_Tuple x1 (sem_Statement x2 ) )--- semantic domain-type T_SourcePosStatement = Bool ->- Scope ->- MySourcePos ->- ( SourcePosStatement,([Message]),Type,StatementInfo)-data Inh_SourcePosStatement = Inh_SourcePosStatement {inLoop_Inh_SourcePosStatement :: Bool,scope_Inh_SourcePosStatement :: Scope,sourcePos_Inh_SourcePosStatement :: MySourcePos}-data Syn_SourcePosStatement = Syn_SourcePosStatement {actualValue_Syn_SourcePosStatement :: SourcePosStatement,messages_Syn_SourcePosStatement :: [Message],nodeType_Syn_SourcePosStatement :: Type,statementInfo_Syn_SourcePosStatement :: StatementInfo}-wrap_SourcePosStatement :: T_SourcePosStatement ->- Inh_SourcePosStatement ->- Syn_SourcePosStatement -wrap_SourcePosStatement sem (Inh_SourcePosStatement _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_SourcePosStatement _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOstatementInfo ))-sem_SourcePosStatement_Tuple :: MySourcePos ->- T_Statement ->- T_SourcePosStatement -sem_SourcePosStatement_Tuple x1_ x2_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _x2ObackType :: Type- _x2OsourcePos :: MySourcePos- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: SourcePosStatement- _lhsOstatementInfo :: StatementInfo- _x2OinLoop :: Bool- _x2Oscope :: Scope- _x2IactualValue :: Statement- _x2IbackType :: Type- _x2Imessages :: ([Message])- _x2InodeType :: Type- _x2IstatementInfo :: StatementInfo- _x2ObackType =- _x2InodeType- _x2OsourcePos =- x1_- _lhsOmessages =- _x2Imessages- _lhsOnodeType =- _x2InodeType- _actualValue =- (x1_,_x2IactualValue)- _lhsOactualValue =- _actualValue- _lhsOstatementInfo =- _x2IstatementInfo- _x2OinLoop =- _lhsIinLoop- _x2Oscope =- _lhsIscope- ( _x2IactualValue,_x2IbackType,_x2Imessages,_x2InodeType,_x2IstatementInfo) =- (x2_ _x2ObackType _x2OinLoop _x2Oscope _x2OsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))--- Statement ----------------------------------------------------data Statement = Assignment (String) (Expression) - | CaseStatement (Expression) (ExpressionListStatementListPairList) (StatementList) - | ContinueStatement - | Copy (String) (StringList) (CopySource) - | CopyData (String) - | CreateDomain (String) (TypeName) (Maybe Expression) - | CreateFunction (Language) (String) (ParamDefList) (TypeName) (String) (FnBody) (Volatility) - | CreateTable (String) (AttributeDefList) (ConstraintList) - | CreateTableAs (String) (SelectExpression) - | CreateType (String) (TypeAttributeDefList) - | CreateView (String) (SelectExpression) - | Delete (String) (Where) (Maybe SelectList) - | DropFunction (IfExists) (StringStringListPairList) (Cascade) - | DropSomething (DropType) (IfExists) (StringList) (Cascade) - | Execute (Expression) - | ExecuteInto (Expression) (StringList) - | ForIntegerStatement (String) (Expression) (Expression) (StatementList) - | ForSelectStatement (String) (SelectExpression) (StatementList) - | If (ExpressionStatementListPairList) (StatementList) - | Insert (String) (StringList) (SelectExpression) (Maybe SelectList) - | NullStatement - | Perform (Expression) - | Raise (RaiseType) (String) (ExpressionList) - | Return (Maybe Expression) - | ReturnNext (Expression) - | ReturnQuery (SelectExpression) - | SelectStatement (SelectExpression) - | Truncate (StringList) (RestartIdentity) (Cascade) - | Update (String) (SetClauseList) (Where) (Maybe SelectList) - | WhileStatement (Expression) (StatementList) - deriving ( Eq,Show)--- cata-sem_Statement :: Statement ->- T_Statement -sem_Statement (Assignment _target _value ) =- (sem_Statement_Assignment _target (sem_Expression _value ) )-sem_Statement (CaseStatement _val _cases _els ) =- (sem_Statement_CaseStatement (sem_Expression _val ) (sem_ExpressionListStatementListPairList _cases ) (sem_StatementList _els ) )-sem_Statement (ContinueStatement ) =- (sem_Statement_ContinueStatement )-sem_Statement (Copy _table _targetCols _source ) =- (sem_Statement_Copy _table (sem_StringList _targetCols ) (sem_CopySource _source ) )-sem_Statement (CopyData _insData ) =- (sem_Statement_CopyData _insData )-sem_Statement (CreateDomain _name _typ _check ) =- (sem_Statement_CreateDomain _name (sem_TypeName _typ ) _check )-sem_Statement (CreateFunction _lang _name _params _rettype _bodyQuote _body _vol ) =- (sem_Statement_CreateFunction (sem_Language _lang ) _name (sem_ParamDefList _params ) (sem_TypeName _rettype ) _bodyQuote (sem_FnBody _body ) (sem_Volatility _vol ) )-sem_Statement (CreateTable _name _atts _cons ) =- (sem_Statement_CreateTable _name (sem_AttributeDefList _atts ) (sem_ConstraintList _cons ) )-sem_Statement (CreateTableAs _name _expr ) =- (sem_Statement_CreateTableAs _name (sem_SelectExpression _expr ) )-sem_Statement (CreateType _name _atts ) =- (sem_Statement_CreateType _name (sem_TypeAttributeDefList _atts ) )-sem_Statement (CreateView _name _expr ) =- (sem_Statement_CreateView _name (sem_SelectExpression _expr ) )-sem_Statement (Delete _table _whr _returning ) =- (sem_Statement_Delete _table (sem_Where _whr ) _returning )-sem_Statement (DropFunction _ifE _sigs _cascade ) =- (sem_Statement_DropFunction (sem_IfExists _ifE ) (sem_StringStringListPairList _sigs ) (sem_Cascade _cascade ) )-sem_Statement (DropSomething _dropType _ifE _names _cascade ) =- (sem_Statement_DropSomething (sem_DropType _dropType ) (sem_IfExists _ifE ) (sem_StringList _names ) (sem_Cascade _cascade ) )-sem_Statement (Execute _expr ) =- (sem_Statement_Execute (sem_Expression _expr ) )-sem_Statement (ExecuteInto _expr _targets ) =- (sem_Statement_ExecuteInto (sem_Expression _expr ) (sem_StringList _targets ) )-sem_Statement (ForIntegerStatement _var _from _to _sts ) =- (sem_Statement_ForIntegerStatement _var (sem_Expression _from ) (sem_Expression _to ) (sem_StatementList _sts ) )-sem_Statement (ForSelectStatement _var _sel _sts ) =- (sem_Statement_ForSelectStatement _var (sem_SelectExpression _sel ) (sem_StatementList _sts ) )-sem_Statement (If _cases _els ) =- (sem_Statement_If (sem_ExpressionStatementListPairList _cases ) (sem_StatementList _els ) )-sem_Statement (Insert _table _targetCols _insData _returning ) =- (sem_Statement_Insert _table (sem_StringList _targetCols ) (sem_SelectExpression _insData ) _returning )-sem_Statement (NullStatement ) =- (sem_Statement_NullStatement )-sem_Statement (Perform _expr ) =- (sem_Statement_Perform (sem_Expression _expr ) )-sem_Statement (Raise _level _message _args ) =- (sem_Statement_Raise (sem_RaiseType _level ) _message (sem_ExpressionList _args ) )-sem_Statement (Return _value ) =- (sem_Statement_Return _value )-sem_Statement (ReturnNext _expr ) =- (sem_Statement_ReturnNext (sem_Expression _expr ) )-sem_Statement (ReturnQuery _sel ) =- (sem_Statement_ReturnQuery (sem_SelectExpression _sel ) )-sem_Statement (SelectStatement _ex ) =- (sem_Statement_SelectStatement (sem_SelectExpression _ex ) )-sem_Statement (Truncate _tables _restartIdentity _cascade ) =- (sem_Statement_Truncate (sem_StringList _tables ) (sem_RestartIdentity _restartIdentity ) (sem_Cascade _cascade ) )-sem_Statement (Update _table _assigns _whr _returning ) =- (sem_Statement_Update _table (sem_SetClauseList _assigns ) (sem_Where _whr ) _returning )-sem_Statement (WhileStatement _expr _sts ) =- (sem_Statement_WhileStatement (sem_Expression _expr ) (sem_StatementList _sts ) )--- semantic domain-type T_Statement = Type ->- Bool ->- Scope ->- MySourcePos ->- ( Statement,Type,([Message]),Type,StatementInfo)-data Inh_Statement = Inh_Statement {backType_Inh_Statement :: Type,inLoop_Inh_Statement :: Bool,scope_Inh_Statement :: Scope,sourcePos_Inh_Statement :: MySourcePos}-data Syn_Statement = Syn_Statement {actualValue_Syn_Statement :: Statement,backType_Syn_Statement :: Type,messages_Syn_Statement :: [Message],nodeType_Syn_Statement :: Type,statementInfo_Syn_Statement :: StatementInfo}-wrap_Statement :: T_Statement ->- Inh_Statement ->- Syn_Statement -wrap_Statement sem (Inh_Statement _lhsIbackType _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo) =- (sem _lhsIbackType _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Statement _lhsOactualValue _lhsObackType _lhsOmessages _lhsOnodeType _lhsOstatementInfo ))-sem_Statement_Assignment :: String ->- T_Expression ->- T_Statement -sem_Statement_Assignment target_ value_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _valueOinLoop :: Bool- _valueOscope :: Scope- _valueOsourcePos :: MySourcePos- _valueIactualValue :: Expression- _valueIliftedColumnName :: String- _valueImessages :: ([Message])- _valueInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _valueImessages- _lhsOnodeType =- _valueInodeType- _actualValue =- Assignment target_ _valueIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _valueOinLoop =- _lhsIinLoop- _valueOscope =- _lhsIscope- _valueOsourcePos =- _lhsIsourcePos- ( _valueIactualValue,_valueIliftedColumnName,_valueImessages,_valueInodeType) =- (value_ _valueOinLoop _valueOscope _valueOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CaseStatement :: T_Expression ->- T_ExpressionListStatementListPairList ->- T_StatementList ->- T_Statement -sem_Statement_CaseStatement val_ cases_ els_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _valOinLoop :: Bool- _valOscope :: Scope- _valOsourcePos :: MySourcePos- _casesOinLoop :: Bool- _casesOscope :: Scope- _casesOsourcePos :: MySourcePos- _elsOinLoop :: Bool- _elsOscope :: Scope- _elsOsourcePos :: MySourcePos- _valIactualValue :: Expression- _valIliftedColumnName :: String- _valImessages :: ([Message])- _valInodeType :: Type- _casesIactualValue :: ExpressionListStatementListPairList- _casesImessages :: ([Message])- _casesInodeType :: Type- _elsIactualValue :: StatementList- _elsImessages :: ([Message])- _elsInodeType :: Type- _elsIstatementInfo :: ([StatementInfo])- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _valImessages ++ _casesImessages ++ _elsImessages- _lhsOnodeType =- _valInodeType `setUnknown` _casesInodeType `setUnknown` _elsInodeType- _actualValue =- CaseStatement _valIactualValue _casesIactualValue _elsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _valOinLoop =- _lhsIinLoop- _valOscope =- _lhsIscope- _valOsourcePos =- _lhsIsourcePos- _casesOinLoop =- _lhsIinLoop- _casesOscope =- _lhsIscope- _casesOsourcePos =- _lhsIsourcePos- _elsOinLoop =- _lhsIinLoop- _elsOscope =- _lhsIscope- _elsOsourcePos =- _lhsIsourcePos- ( _valIactualValue,_valIliftedColumnName,_valImessages,_valInodeType) =- (val_ _valOinLoop _valOscope _valOsourcePos )- ( _casesIactualValue,_casesImessages,_casesInodeType) =- (cases_ _casesOinLoop _casesOscope _casesOsourcePos )- ( _elsIactualValue,_elsImessages,_elsInodeType,_elsIstatementInfo) =- (els_ _elsOinLoop _elsOscope _elsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_ContinueStatement :: T_Statement -sem_Statement_ContinueStatement =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- if not _lhsIinLoop- then [Error _lhsIsourcePos ContinueNotInLoop]- else []- _lhsOnodeType =- UnknownType- _actualValue =- ContinueStatement- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Copy :: String ->- T_StringList ->- T_CopySource ->- T_Statement -sem_Statement_Copy table_ targetCols_ source_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _targetColsOinLoop :: Bool- _targetColsOscope :: Scope- _targetColsOsourcePos :: MySourcePos- _sourceOinLoop :: Bool- _sourceOscope :: Scope- _sourceOsourcePos :: MySourcePos- _targetColsIactualValue :: StringList- _targetColsImessages :: ([Message])- _targetColsInodeType :: Type- _targetColsIstrings :: ([String])- _sourceIactualValue :: CopySource- _sourceImessages :: ([Message])- _sourceInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _targetColsImessages ++ _sourceImessages- _lhsOnodeType =- _targetColsInodeType `setUnknown` _sourceInodeType- _actualValue =- Copy table_ _targetColsIactualValue _sourceIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _targetColsOinLoop =- _lhsIinLoop- _targetColsOscope =- _lhsIscope- _targetColsOsourcePos =- _lhsIsourcePos- _sourceOinLoop =- _lhsIinLoop- _sourceOscope =- _lhsIscope- _sourceOsourcePos =- _lhsIsourcePos- ( _targetColsIactualValue,_targetColsImessages,_targetColsInodeType,_targetColsIstrings) =- (targetCols_ _targetColsOinLoop _targetColsOscope _targetColsOsourcePos )- ( _sourceIactualValue,_sourceImessages,_sourceInodeType) =- (source_ _sourceOinLoop _sourceOscope _sourceOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CopyData :: String ->- T_Statement -sem_Statement_CopyData insData_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- CopyData insData_- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CreateDomain :: String ->- T_TypeName ->- (Maybe Expression) ->- T_Statement -sem_Statement_CreateDomain name_ typ_ check_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ CreateDomainInfo name_ _typInodeType- _lhsOmessages =- _typImessages- _lhsOnodeType =- _typInodeType- _actualValue =- CreateDomain name_ _typIactualValue check_- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CreateFunction :: T_Language ->- String ->- T_ParamDefList ->- T_TypeName ->- String ->- T_FnBody ->- T_Volatility ->- T_Statement -sem_Statement_CreateFunction lang_ name_ params_ rettype_ bodyQuote_ body_ vol_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _bodyOinLoop :: Bool- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _langOinLoop :: Bool- _langOscope :: Scope- _langOsourcePos :: MySourcePos- _paramsOinLoop :: Bool- _paramsOscope :: Scope- _paramsOsourcePos :: MySourcePos- _rettypeOinLoop :: Bool- _rettypeOscope :: Scope- _rettypeOsourcePos :: MySourcePos- _bodyOscope :: Scope- _bodyOsourcePos :: MySourcePos- _volOinLoop :: Bool- _volOscope :: Scope- _volOsourcePos :: MySourcePos- _langIactualValue :: Language- _langImessages :: ([Message])- _langInodeType :: Type- _paramsIactualValue :: ParamDefList- _paramsImessages :: ([Message])- _paramsInodeType :: Type- _paramsIparams :: ([(String,Type)])- _rettypeIactualValue :: TypeName- _rettypeImessages :: ([Message])- _rettypeInodeType :: Type- _bodyIactualValue :: FnBody- _bodyImessages :: ([Message])- _bodyInodeType :: Type- _volIactualValue :: Volatility- _volImessages :: ([Message])- _volInodeType :: Type- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ CreateFunctionInfo (name_,map snd _paramsIparams,_rettypeInodeType)- _bodyOinLoop =- False- _lhsOmessages =- _langImessages ++ _paramsImessages ++ _rettypeImessages ++ _bodyImessages ++ _volImessages- _lhsOnodeType =- _langInodeType `setUnknown` _paramsInodeType `setUnknown` _rettypeInodeType `setUnknown` _bodyInodeType `setUnknown` _volInodeType- _actualValue =- CreateFunction _langIactualValue name_ _paramsIactualValue _rettypeIactualValue bodyQuote_ _bodyIactualValue _volIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _langOinLoop =- _lhsIinLoop- _langOscope =- _lhsIscope- _langOsourcePos =- _lhsIsourcePos- _paramsOinLoop =- _lhsIinLoop- _paramsOscope =- _lhsIscope- _paramsOsourcePos =- _lhsIsourcePos- _rettypeOinLoop =- _lhsIinLoop- _rettypeOscope =- _lhsIscope- _rettypeOsourcePos =- _lhsIsourcePos- _bodyOscope =- _lhsIscope- _bodyOsourcePos =- _lhsIsourcePos- _volOinLoop =- _lhsIinLoop- _volOscope =- _lhsIscope- _volOsourcePos =- _lhsIsourcePos- ( _langIactualValue,_langImessages,_langInodeType) =- (lang_ _langOinLoop _langOscope _langOsourcePos )- ( _paramsIactualValue,_paramsImessages,_paramsInodeType,_paramsIparams) =- (params_ _paramsOinLoop _paramsOscope _paramsOsourcePos )- ( _rettypeIactualValue,_rettypeImessages,_rettypeInodeType) =- (rettype_ _rettypeOinLoop _rettypeOscope _rettypeOsourcePos )- ( _bodyIactualValue,_bodyImessages,_bodyInodeType) =- (body_ _bodyOinLoop _bodyOscope _bodyOsourcePos )- ( _volIactualValue,_volImessages,_volInodeType) =- (vol_ _volOinLoop _volOscope _volOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CreateTable :: String ->- T_AttributeDefList ->- T_ConstraintList ->- T_Statement -sem_Statement_CreateTable name_ atts_ cons_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOactualValue :: Statement- _lhsObackType :: Type- _attsOinLoop :: Bool- _attsOscope :: Scope- _attsOsourcePos :: MySourcePos- _consOinLoop :: Bool- _consOscope :: Scope- _consOsourcePos :: MySourcePos- _attsIactualValue :: AttributeDefList- _attsImessages :: ([Message])- _attsInodeType :: Type- _consIactualValue :: ConstraintList- _consImessages :: ([Message])- _consInodeType :: Type- _lhsOnodeType =- _attsInodeType- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ RelvarInfo (name_, TableComposite, _attsInodeType)- _lhsOmessages =- _attsImessages ++ _consImessages- _actualValue =- CreateTable name_ _attsIactualValue _consIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _attsOinLoop =- _lhsIinLoop- _attsOscope =- _lhsIscope- _attsOsourcePos =- _lhsIsourcePos- _consOinLoop =- _lhsIinLoop- _consOscope =- _lhsIscope- _consOsourcePos =- _lhsIsourcePos- ( _attsIactualValue,_attsImessages,_attsInodeType) =- (atts_ _attsOinLoop _attsOscope _attsOsourcePos )- ( _consIactualValue,_consImessages,_consInodeType) =- (cons_ _consOinLoop _consOscope _consOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CreateTableAs :: String ->- T_SelectExpression ->- T_Statement -sem_Statement_CreateTableAs name_ expr_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _exprIactualValue :: SelectExpression- _exprImessages :: ([Message])- _exprInodeType :: Type- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ RelvarInfo (name_, TableComposite, _exprInodeType)- _lhsOmessages =- _exprImessages- _lhsOnodeType =- _exprInodeType- _actualValue =- CreateTableAs name_ _exprIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CreateType :: String ->- T_TypeAttributeDefList ->- T_Statement -sem_Statement_CreateType name_ atts_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _attsOinLoop :: Bool- _attsOscope :: Scope- _attsOsourcePos :: MySourcePos- _attsIactualValue :: TypeAttributeDefList- _attsImessages :: ([Message])- _attsInodeType :: Type- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ RelvarInfo (name_, Composite, _attsInodeType)- _lhsOmessages =- _attsImessages- _lhsOnodeType =- _attsInodeType- _actualValue =- CreateType name_ _attsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _attsOinLoop =- _lhsIinLoop- _attsOscope =- _lhsIscope- _attsOsourcePos =- _lhsIsourcePos- ( _attsIactualValue,_attsImessages,_attsInodeType) =- (atts_ _attsOinLoop _attsOscope _attsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_CreateView :: String ->- T_SelectExpression ->- T_Statement -sem_Statement_CreateView name_ expr_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _exprIactualValue :: SelectExpression- _exprImessages :: ([Message])- _exprInodeType :: Type- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ RelvarInfo (name_, ViewComposite, _exprInodeType)- _lhsOmessages =- _exprImessages- _lhsOnodeType =- _exprInodeType- _actualValue =- CreateView name_ _exprIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Delete :: String ->- T_Where ->- (Maybe SelectList) ->- T_Statement -sem_Statement_Delete table_ whr_ returning_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOactualValue :: Statement- _lhsObackType :: Type- _whrOinLoop :: Bool- _whrOscope :: Scope- _whrOsourcePos :: MySourcePos- _whrIactualValue :: Where- _whrImessages :: ([Message])- _whrInodeType :: Type- _lhsOnodeType =- checkErrors [checkTableExists _lhsIscope _lhsIsourcePos table_- ,_whrInodeType]- $ TypeList []- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ DeleteInfo table_- _lhsOmessages =- _whrImessages- _actualValue =- Delete table_ _whrIactualValue returning_- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _whrOinLoop =- _lhsIinLoop- _whrOscope =- _lhsIscope- _whrOsourcePos =- _lhsIsourcePos- ( _whrIactualValue,_whrImessages,_whrInodeType) =- (whr_ _whrOinLoop _whrOscope _whrOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_DropFunction :: T_IfExists ->- T_StringStringListPairList ->- T_Cascade ->- T_Statement -sem_Statement_DropFunction ifE_ sigs_ cascade_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _ifEOinLoop :: Bool- _ifEOscope :: Scope- _ifEOsourcePos :: MySourcePos- _sigsOinLoop :: Bool- _sigsOscope :: Scope- _sigsOsourcePos :: MySourcePos- _cascadeOinLoop :: Bool- _cascadeOscope :: Scope- _cascadeOsourcePos :: MySourcePos- _ifEIactualValue :: IfExists- _ifEImessages :: ([Message])- _ifEInodeType :: Type- _sigsIactualValue :: StringStringListPairList- _sigsImessages :: ([Message])- _sigsInodeType :: Type- _cascadeIactualValue :: Cascade- _cascadeImessages :: ([Message])- _cascadeInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _ifEImessages ++ _sigsImessages ++ _cascadeImessages- _lhsOnodeType =- _ifEInodeType `setUnknown` _sigsInodeType `setUnknown` _cascadeInodeType- _actualValue =- DropFunction _ifEIactualValue _sigsIactualValue _cascadeIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _ifEOinLoop =- _lhsIinLoop- _ifEOscope =- _lhsIscope- _ifEOsourcePos =- _lhsIsourcePos- _sigsOinLoop =- _lhsIinLoop- _sigsOscope =- _lhsIscope- _sigsOsourcePos =- _lhsIsourcePos- _cascadeOinLoop =- _lhsIinLoop- _cascadeOscope =- _lhsIscope- _cascadeOsourcePos =- _lhsIsourcePos- ( _ifEIactualValue,_ifEImessages,_ifEInodeType) =- (ifE_ _ifEOinLoop _ifEOscope _ifEOsourcePos )- ( _sigsIactualValue,_sigsImessages,_sigsInodeType) =- (sigs_ _sigsOinLoop _sigsOscope _sigsOsourcePos )- ( _cascadeIactualValue,_cascadeImessages,_cascadeInodeType) =- (cascade_ _cascadeOinLoop _cascadeOscope _cascadeOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_DropSomething :: T_DropType ->- T_IfExists ->- T_StringList ->- T_Cascade ->- T_Statement -sem_Statement_DropSomething dropType_ ifE_ names_ cascade_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _dropTypeOinLoop :: Bool- _dropTypeOscope :: Scope- _dropTypeOsourcePos :: MySourcePos- _ifEOinLoop :: Bool- _ifEOscope :: Scope- _ifEOsourcePos :: MySourcePos- _namesOinLoop :: Bool- _namesOscope :: Scope- _namesOsourcePos :: MySourcePos- _cascadeOinLoop :: Bool- _cascadeOscope :: Scope- _cascadeOsourcePos :: MySourcePos- _dropTypeIactualValue :: DropType- _dropTypeImessages :: ([Message])- _dropTypeInodeType :: Type- _ifEIactualValue :: IfExists- _ifEImessages :: ([Message])- _ifEInodeType :: Type- _namesIactualValue :: StringList- _namesImessages :: ([Message])- _namesInodeType :: Type- _namesIstrings :: ([String])- _cascadeIactualValue :: Cascade- _cascadeImessages :: ([Message])- _cascadeInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _dropTypeImessages ++ _ifEImessages ++ _namesImessages ++ _cascadeImessages- _lhsOnodeType =- _dropTypeInodeType `setUnknown` _ifEInodeType `setUnknown` _namesInodeType `setUnknown` _cascadeInodeType- _actualValue =- DropSomething _dropTypeIactualValue _ifEIactualValue _namesIactualValue _cascadeIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _dropTypeOinLoop =- _lhsIinLoop- _dropTypeOscope =- _lhsIscope- _dropTypeOsourcePos =- _lhsIsourcePos- _ifEOinLoop =- _lhsIinLoop- _ifEOscope =- _lhsIscope- _ifEOsourcePos =- _lhsIsourcePos- _namesOinLoop =- _lhsIinLoop- _namesOscope =- _lhsIscope- _namesOsourcePos =- _lhsIsourcePos- _cascadeOinLoop =- _lhsIinLoop- _cascadeOscope =- _lhsIscope- _cascadeOsourcePos =- _lhsIsourcePos- ( _dropTypeIactualValue,_dropTypeImessages,_dropTypeInodeType) =- (dropType_ _dropTypeOinLoop _dropTypeOscope _dropTypeOsourcePos )- ( _ifEIactualValue,_ifEImessages,_ifEInodeType) =- (ifE_ _ifEOinLoop _ifEOscope _ifEOsourcePos )- ( _namesIactualValue,_namesImessages,_namesInodeType,_namesIstrings) =- (names_ _namesOinLoop _namesOscope _namesOsourcePos )- ( _cascadeIactualValue,_cascadeImessages,_cascadeInodeType) =- (cascade_ _cascadeOinLoop _cascadeOscope _cascadeOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Execute :: T_Expression ->- T_Statement -sem_Statement_Execute expr_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _exprImessages- _lhsOnodeType =- _exprInodeType- _actualValue =- Execute _exprIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_ExecuteInto :: T_Expression ->- T_StringList ->- T_Statement -sem_Statement_ExecuteInto expr_ targets_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _targetsOinLoop :: Bool- _targetsOscope :: Scope- _targetsOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _targetsIactualValue :: StringList- _targetsImessages :: ([Message])- _targetsInodeType :: Type- _targetsIstrings :: ([String])- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _exprImessages ++ _targetsImessages- _lhsOnodeType =- _exprInodeType `setUnknown` _targetsInodeType- _actualValue =- ExecuteInto _exprIactualValue _targetsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- _targetsOinLoop =- _lhsIinLoop- _targetsOscope =- _lhsIscope- _targetsOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- ( _targetsIactualValue,_targetsImessages,_targetsInodeType,_targetsIstrings) =- (targets_ _targetsOinLoop _targetsOscope _targetsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_ForIntegerStatement :: String ->- T_Expression ->- T_Expression ->- T_StatementList ->- T_Statement -sem_Statement_ForIntegerStatement var_ from_ to_ sts_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _stsOinLoop :: Bool- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _fromOinLoop :: Bool- _fromOscope :: Scope- _fromOsourcePos :: MySourcePos- _toOinLoop :: Bool- _toOscope :: Scope- _toOsourcePos :: MySourcePos- _stsOscope :: Scope- _stsOsourcePos :: MySourcePos- _fromIactualValue :: Expression- _fromIliftedColumnName :: String- _fromImessages :: ([Message])- _fromInodeType :: Type- _toIactualValue :: Expression- _toIliftedColumnName :: String- _toImessages :: ([Message])- _toInodeType :: Type- _stsIactualValue :: StatementList- _stsImessages :: ([Message])- _stsInodeType :: Type- _stsIstatementInfo :: ([StatementInfo])- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _stsOinLoop =- True- _lhsOmessages =- _fromImessages ++ _toImessages ++ _stsImessages- _lhsOnodeType =- _fromInodeType `setUnknown` _toInodeType `setUnknown` _stsInodeType- _actualValue =- ForIntegerStatement var_ _fromIactualValue _toIactualValue _stsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _fromOinLoop =- _lhsIinLoop- _fromOscope =- _lhsIscope- _fromOsourcePos =- _lhsIsourcePos- _toOinLoop =- _lhsIinLoop- _toOscope =- _lhsIscope- _toOsourcePos =- _lhsIsourcePos- _stsOscope =- _lhsIscope- _stsOsourcePos =- _lhsIsourcePos- ( _fromIactualValue,_fromIliftedColumnName,_fromImessages,_fromInodeType) =- (from_ _fromOinLoop _fromOscope _fromOsourcePos )- ( _toIactualValue,_toIliftedColumnName,_toImessages,_toInodeType) =- (to_ _toOinLoop _toOscope _toOsourcePos )- ( _stsIactualValue,_stsImessages,_stsInodeType,_stsIstatementInfo) =- (sts_ _stsOinLoop _stsOscope _stsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_ForSelectStatement :: String ->- T_SelectExpression ->- T_StatementList ->- T_Statement -sem_Statement_ForSelectStatement var_ sel_ sts_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _stsOinLoop :: Bool- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _selOinLoop :: Bool- _selOscope :: Scope- _selOsourcePos :: MySourcePos- _stsOscope :: Scope- _stsOsourcePos :: MySourcePos- _selIactualValue :: SelectExpression- _selImessages :: ([Message])- _selInodeType :: Type- _stsIactualValue :: StatementList- _stsImessages :: ([Message])- _stsInodeType :: Type- _stsIstatementInfo :: ([StatementInfo])- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _stsOinLoop =- True- _lhsOmessages =- _selImessages ++ _stsImessages- _lhsOnodeType =- _selInodeType `setUnknown` _stsInodeType- _actualValue =- ForSelectStatement var_ _selIactualValue _stsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _selOinLoop =- _lhsIinLoop- _selOscope =- _lhsIscope- _selOsourcePos =- _lhsIsourcePos- _stsOscope =- _lhsIscope- _stsOsourcePos =- _lhsIsourcePos- ( _selIactualValue,_selImessages,_selInodeType) =- (sel_ _selOinLoop _selOscope _selOsourcePos )- ( _stsIactualValue,_stsImessages,_stsInodeType,_stsIstatementInfo) =- (sts_ _stsOinLoop _stsOscope _stsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_If :: T_ExpressionStatementListPairList ->- T_StatementList ->- T_Statement -sem_Statement_If cases_ els_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _casesOinLoop :: Bool- _casesOscope :: Scope- _casesOsourcePos :: MySourcePos- _elsOinLoop :: Bool- _elsOscope :: Scope- _elsOsourcePos :: MySourcePos- _casesIactualValue :: ExpressionStatementListPairList- _casesImessages :: ([Message])- _casesInodeType :: Type- _elsIactualValue :: StatementList- _elsImessages :: ([Message])- _elsInodeType :: Type- _elsIstatementInfo :: ([StatementInfo])- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _casesImessages ++ _elsImessages- _lhsOnodeType =- _casesInodeType `setUnknown` _elsInodeType- _actualValue =- If _casesIactualValue _elsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _casesOinLoop =- _lhsIinLoop- _casesOscope =- _lhsIscope- _casesOsourcePos =- _lhsIsourcePos- _elsOinLoop =- _lhsIinLoop- _elsOscope =- _lhsIscope- _elsOsourcePos =- _lhsIsourcePos- ( _casesIactualValue,_casesImessages,_casesInodeType) =- (cases_ _casesOinLoop _casesOscope _casesOsourcePos )- ( _elsIactualValue,_elsImessages,_elsInodeType,_elsIstatementInfo) =- (els_ _elsOinLoop _elsOscope _elsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Insert :: String ->- T_StringList ->- T_SelectExpression ->- (Maybe SelectList) ->- T_Statement -sem_Statement_Insert table_ targetCols_ insData_ returning_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOactualValue :: Statement- _lhsObackType :: Type- _targetColsOinLoop :: Bool- _targetColsOscope :: Scope- _targetColsOsourcePos :: MySourcePos- _insDataOinLoop :: Bool- _insDataOscope :: Scope- _insDataOsourcePos :: MySourcePos- _targetColsIactualValue :: StringList- _targetColsImessages :: ([Message])- _targetColsInodeType :: Type- _targetColsIstrings :: ([String])- _insDataIactualValue :: SelectExpression- _insDataImessages :: ([Message])- _insDataInodeType :: Type- _lhsOnodeType =- checkErrors [checkTableExists _lhsIscope _lhsIsourcePos table_- ,_insDataInodeType- ,checkColumnConsistency _lhsIscope _lhsIsourcePos table_ _targetColsIstrings (unwrapComposite $ unwrapSetOf _insDataInodeType)]- _insDataInodeType- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ InsertInfo table_ $ UnnamedCompositeType $ getColumnTypes _lhsIscope _lhsIsourcePos table_ _targetColsIstrings- _lhsOmessages =- _targetColsImessages ++ _insDataImessages- _actualValue =- Insert table_ _targetColsIactualValue _insDataIactualValue returning_- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _targetColsOinLoop =- _lhsIinLoop- _targetColsOscope =- _lhsIscope- _targetColsOsourcePos =- _lhsIsourcePos- _insDataOinLoop =- _lhsIinLoop- _insDataOscope =- _lhsIscope- _insDataOsourcePos =- _lhsIsourcePos- ( _targetColsIactualValue,_targetColsImessages,_targetColsInodeType,_targetColsIstrings) =- (targetCols_ _targetColsOinLoop _targetColsOscope _targetColsOsourcePos )- ( _insDataIactualValue,_insDataImessages,_insDataInodeType) =- (insData_ _insDataOinLoop _insDataOscope _insDataOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_NullStatement :: T_Statement -sem_Statement_NullStatement =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- NullStatement- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Perform :: T_Expression ->- T_Statement -sem_Statement_Perform expr_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _exprImessages- _lhsOnodeType =- _exprInodeType- _actualValue =- Perform _exprIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Raise :: T_RaiseType ->- String ->- T_ExpressionList ->- T_Statement -sem_Statement_Raise level_ message_ args_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _levelOinLoop :: Bool- _levelOscope :: Scope- _levelOsourcePos :: MySourcePos- _argsOinLoop :: Bool- _argsOscope :: Scope- _argsOsourcePos :: MySourcePos- _levelIactualValue :: RaiseType- _levelImessages :: ([Message])- _levelInodeType :: Type- _argsIactualValue :: ExpressionList- _argsImessages :: ([Message])- _argsInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _levelImessages ++ _argsImessages- _lhsOnodeType =- _levelInodeType `setUnknown` _argsInodeType- _actualValue =- Raise _levelIactualValue message_ _argsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _levelOinLoop =- _lhsIinLoop- _levelOscope =- _lhsIscope- _levelOsourcePos =- _lhsIsourcePos- _argsOinLoop =- _lhsIinLoop- _argsOscope =- _lhsIscope- _argsOsourcePos =- _lhsIsourcePos- ( _levelIactualValue,_levelImessages,_levelInodeType) =- (level_ _levelOinLoop _levelOscope _levelOsourcePos )- ( _argsIactualValue,_argsImessages,_argsInodeType) =- (args_ _argsOinLoop _argsOscope _argsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Return :: (Maybe Expression) ->- T_Statement -sem_Statement_Return value_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Return value_- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_ReturnNext :: T_Expression ->- T_Statement -sem_Statement_ReturnNext expr_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _exprImessages- _lhsOnodeType =- _exprInodeType- _actualValue =- ReturnNext _exprIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_ReturnQuery :: T_SelectExpression ->- T_Statement -sem_Statement_ReturnQuery sel_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _selOinLoop :: Bool- _selOscope :: Scope- _selOsourcePos :: MySourcePos- _selIactualValue :: SelectExpression- _selImessages :: ([Message])- _selInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _selImessages- _lhsOnodeType =- _selInodeType- _actualValue =- ReturnQuery _selIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _selOinLoop =- _lhsIinLoop- _selOscope =- _lhsIscope- _selOsourcePos =- _lhsIsourcePos- ( _selIactualValue,_selImessages,_selInodeType) =- (sel_ _selOinLoop _selOscope _selOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_SelectStatement :: T_SelectExpression ->- T_Statement -sem_Statement_SelectStatement ex_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exOinLoop :: Bool- _exOscope :: Scope- _exOsourcePos :: MySourcePos- _exIactualValue :: SelectExpression- _exImessages :: ([Message])- _exInodeType :: Type- _lhsOnodeType =- _exInodeType- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ SelectInfo _exInodeType- _lhsOmessages =- _exImessages- _actualValue =- SelectStatement _exIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exOinLoop =- _lhsIinLoop- _exOscope =- _lhsIscope- _exOsourcePos =- _lhsIsourcePos- ( _exIactualValue,_exImessages,_exInodeType) =- (ex_ _exOinLoop _exOscope _exOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Truncate :: T_StringList ->- T_RestartIdentity ->- T_Cascade ->- T_Statement -sem_Statement_Truncate tables_ restartIdentity_ cascade_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _tablesOinLoop :: Bool- _tablesOscope :: Scope- _tablesOsourcePos :: MySourcePos- _restartIdentityOinLoop :: Bool- _restartIdentityOscope :: Scope- _restartIdentityOsourcePos :: MySourcePos- _cascadeOinLoop :: Bool- _cascadeOscope :: Scope- _cascadeOsourcePos :: MySourcePos- _tablesIactualValue :: StringList- _tablesImessages :: ([Message])- _tablesInodeType :: Type- _tablesIstrings :: ([String])- _restartIdentityIactualValue :: RestartIdentity- _restartIdentityImessages :: ([Message])- _restartIdentityInodeType :: Type- _cascadeIactualValue :: Cascade- _cascadeImessages :: ([Message])- _cascadeInodeType :: Type- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _lhsOmessages =- _tablesImessages ++ _restartIdentityImessages ++ _cascadeImessages- _lhsOnodeType =- _tablesInodeType `setUnknown` _restartIdentityInodeType `setUnknown` _cascadeInodeType- _actualValue =- Truncate _tablesIactualValue _restartIdentityIactualValue _cascadeIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _tablesOinLoop =- _lhsIinLoop- _tablesOscope =- _lhsIscope- _tablesOsourcePos =- _lhsIsourcePos- _restartIdentityOinLoop =- _lhsIinLoop- _restartIdentityOscope =- _lhsIscope- _restartIdentityOsourcePos =- _lhsIsourcePos- _cascadeOinLoop =- _lhsIinLoop- _cascadeOscope =- _lhsIscope- _cascadeOsourcePos =- _lhsIsourcePos- ( _tablesIactualValue,_tablesImessages,_tablesInodeType,_tablesIstrings) =- (tables_ _tablesOinLoop _tablesOscope _tablesOsourcePos )- ( _restartIdentityIactualValue,_restartIdentityImessages,_restartIdentityInodeType) =- (restartIdentity_ _restartIdentityOinLoop _restartIdentityOscope _restartIdentityOsourcePos )- ( _cascadeIactualValue,_cascadeImessages,_cascadeInodeType) =- (cascade_ _cascadeOinLoop _cascadeOscope _cascadeOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_Update :: String ->- T_SetClauseList ->- T_Where ->- (Maybe SelectList) ->- T_Statement -sem_Statement_Update table_ assigns_ whr_ returning_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOstatementInfo :: StatementInfo- _lhsOmessages :: ([Message])- _lhsOactualValue :: Statement- _lhsObackType :: Type- _assignsOinLoop :: Bool- _assignsOscope :: Scope- _assignsOsourcePos :: MySourcePos- _whrOinLoop :: Bool- _whrOscope :: Scope- _whrOsourcePos :: MySourcePos- _assignsIactualValue :: SetClauseList- _assignsImessages :: ([Message])- _assignsInodeType :: Type- _assignsIpairs :: ([(String,Type)])- _whrIactualValue :: Where- _whrImessages :: ([Message])- _whrInodeType :: Type- _lhsOnodeType =- checkErrors [checkTableExists _lhsIscope _lhsIsourcePos table_- ,_whrInodeType- ,_assignsInodeType- ,checkColumnConsistency _lhsIscope _lhsIsourcePos- table_ colNames colTypes]- _assignsInodeType- where- colNames = map fst _assignsIpairs- colTypes = _assignsIpairs- _lhsOstatementInfo =- makeStatementInfo _lhsIbackType $ UpdateInfo table_ $- UnnamedCompositeType $ getColumnTypes _lhsIscope _lhsIsourcePos table_ $ map fst _assignsIpairs- _lhsOmessages =- _assignsImessages ++ _whrImessages- _actualValue =- Update table_ _assignsIactualValue _whrIactualValue returning_- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _assignsOinLoop =- _lhsIinLoop- _assignsOscope =- _lhsIscope- _assignsOsourcePos =- _lhsIsourcePos- _whrOinLoop =- _lhsIinLoop- _whrOscope =- _lhsIscope- _whrOsourcePos =- _lhsIsourcePos- ( _assignsIactualValue,_assignsImessages,_assignsInodeType,_assignsIpairs) =- (assigns_ _assignsOinLoop _assignsOscope _assignsOsourcePos )- ( _whrIactualValue,_whrImessages,_whrInodeType) =- (whr_ _whrOinLoop _whrOscope _whrOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_Statement_WhileStatement :: T_Expression ->- T_StatementList ->- T_Statement -sem_Statement_WhileStatement expr_ sts_ =- (\ _lhsIbackType- _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: StatementInfo- _stsOinLoop :: Bool- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Statement- _lhsObackType :: Type- _exprOinLoop :: Bool- _exprOscope :: Scope- _exprOsourcePos :: MySourcePos- _stsOscope :: Scope- _stsOsourcePos :: MySourcePos- _exprIactualValue :: Expression- _exprIliftedColumnName :: String- _exprImessages :: ([Message])- _exprInodeType :: Type- _stsIactualValue :: StatementList- _stsImessages :: ([Message])- _stsInodeType :: Type- _stsIstatementInfo :: ([StatementInfo])- _lhsOstatementInfo =- DefaultStatementInfo _lhsIbackType- _stsOinLoop =- True- _lhsOmessages =- _exprImessages ++ _stsImessages- _lhsOnodeType =- _exprInodeType `setUnknown` _stsInodeType- _actualValue =- WhileStatement _exprIactualValue _stsIactualValue- _lhsOactualValue =- _actualValue- _lhsObackType =- _lhsIbackType- _exprOinLoop =- _lhsIinLoop- _exprOscope =- _lhsIscope- _exprOsourcePos =- _lhsIsourcePos- _stsOscope =- _lhsIscope- _stsOsourcePos =- _lhsIsourcePos- ( _exprIactualValue,_exprIliftedColumnName,_exprImessages,_exprInodeType) =- (expr_ _exprOinLoop _exprOscope _exprOsourcePos )- ( _stsIactualValue,_stsImessages,_stsInodeType,_stsIstatementInfo) =- (sts_ _stsOinLoop _stsOscope _stsOsourcePos )- in ( _lhsOactualValue,_lhsObackType,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))--- StatementList ------------------------------------------------type StatementList = [(SourcePosStatement)]--- cata-sem_StatementList :: StatementList ->- T_StatementList -sem_StatementList list =- (Prelude.foldr sem_StatementList_Cons sem_StatementList_Nil (Prelude.map sem_SourcePosStatement list) )--- semantic domain-type T_StatementList = Bool ->- Scope ->- MySourcePos ->- ( StatementList,([Message]),Type,([StatementInfo]))-data Inh_StatementList = Inh_StatementList {inLoop_Inh_StatementList :: Bool,scope_Inh_StatementList :: Scope,sourcePos_Inh_StatementList :: MySourcePos}-data Syn_StatementList = Syn_StatementList {actualValue_Syn_StatementList :: StatementList,messages_Syn_StatementList :: [Message],nodeType_Syn_StatementList :: Type,statementInfo_Syn_StatementList :: [StatementInfo]}-wrap_StatementList :: T_StatementList ->- Inh_StatementList ->- Syn_StatementList -wrap_StatementList sem (Inh_StatementList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_StatementList _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOstatementInfo ))-sem_StatementList_Cons :: T_SourcePosStatement ->- T_StatementList ->- T_StatementList -sem_StatementList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: ([StatementInfo])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StatementList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: SourcePosStatement- _hdImessages :: ([Message])- _hdInodeType :: Type- _hdIstatementInfo :: StatementInfo- _tlIactualValue :: StatementList- _tlImessages :: ([Message])- _tlInodeType :: Type- _tlIstatementInfo :: ([StatementInfo])- _lhsOstatementInfo =- _hdIstatementInfo : _tlIstatementInfo- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType,_hdIstatementInfo) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType,_tlIstatementInfo) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))-sem_StatementList_Nil :: T_StatementList -sem_StatementList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstatementInfo :: ([StatementInfo])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StatementList- _lhsOstatementInfo =- []- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstatementInfo)))--- StringList ---------------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( StringList,([Message]),Type,([String]))-data Inh_StringList = Inh_StringList {inLoop_Inh_StringList :: Bool,scope_Inh_StringList :: Scope,sourcePos_Inh_StringList :: MySourcePos}-data Syn_StringList = Syn_StringList {actualValue_Syn_StringList :: StringList,messages_Syn_StringList :: [Message],nodeType_Syn_StringList :: Type,strings_Syn_StringList :: [String]}-wrap_StringList :: T_StringList ->- Inh_StringList ->- Syn_StringList -wrap_StringList sem (Inh_StringList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstrings) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_StringList _lhsOactualValue _lhsOmessages _lhsOnodeType _lhsOstrings ))-sem_StringList_Cons :: String ->- T_StringList ->- T_StringList -sem_StringList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstrings :: ([String])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StringList- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _tlIactualValue :: StringList- _tlImessages :: ([Message])- _tlInodeType :: Type- _tlIstrings :: ([String])- _lhsOstrings =- hd_ : _tlIstrings- _lhsOmessages =- _tlImessages- _lhsOnodeType =- _tlInodeType- _actualValue =- (:) hd_ _tlIactualValue- _lhsOactualValue =- _actualValue- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _tlIactualValue,_tlImessages,_tlInodeType,_tlIstrings) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstrings)))-sem_StringList_Nil :: T_StringList -sem_StringList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOstrings :: ([String])- _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StringList- _lhsOstrings =- []- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType,_lhsOstrings)))--- StringStringListPair -----------------------------------------type StringStringListPair = ( (String),(StringList))--- cata-sem_StringStringListPair :: StringStringListPair ->- T_StringStringListPair -sem_StringStringListPair ( x1,x2) =- (sem_StringStringListPair_Tuple x1 (sem_StringList x2 ) )--- semantic domain-type T_StringStringListPair = Bool ->- Scope ->- MySourcePos ->- ( StringStringListPair,([Message]),Type)-data Inh_StringStringListPair = Inh_StringStringListPair {inLoop_Inh_StringStringListPair :: Bool,scope_Inh_StringStringListPair :: Scope,sourcePos_Inh_StringStringListPair :: MySourcePos}-data Syn_StringStringListPair = Syn_StringStringListPair {actualValue_Syn_StringStringListPair :: StringStringListPair,messages_Syn_StringStringListPair :: [Message],nodeType_Syn_StringStringListPair :: Type}-wrap_StringStringListPair :: T_StringStringListPair ->- Inh_StringStringListPair ->- Syn_StringStringListPair -wrap_StringStringListPair sem (Inh_StringStringListPair _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_StringStringListPair _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_StringStringListPair_Tuple :: String ->- T_StringList ->- T_StringStringListPair -sem_StringStringListPair_Tuple x1_ x2_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StringStringListPair- _x2OinLoop :: Bool- _x2Oscope :: Scope- _x2OsourcePos :: MySourcePos- _x2IactualValue :: StringList- _x2Imessages :: ([Message])- _x2InodeType :: Type- _x2Istrings :: ([String])- _lhsOmessages =- _x2Imessages- _lhsOnodeType =- _x2InodeType- _actualValue =- (x1_,_x2IactualValue)- _lhsOactualValue =- _actualValue- _x2OinLoop =- _lhsIinLoop- _x2Oscope =- _lhsIscope- _x2OsourcePos =- _lhsIsourcePos- ( _x2IactualValue,_x2Imessages,_x2InodeType,_x2Istrings) =- (x2_ _x2OinLoop _x2Oscope _x2OsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- StringStringListPairList -------------------------------------type StringStringListPairList = [(StringStringListPair)]--- cata-sem_StringStringListPairList :: StringStringListPairList ->- T_StringStringListPairList -sem_StringStringListPairList list =- (Prelude.foldr sem_StringStringListPairList_Cons sem_StringStringListPairList_Nil (Prelude.map sem_StringStringListPair list) )--- semantic domain-type T_StringStringListPairList = Bool ->- Scope ->- MySourcePos ->- ( StringStringListPairList,([Message]),Type)-data Inh_StringStringListPairList = Inh_StringStringListPairList {inLoop_Inh_StringStringListPairList :: Bool,scope_Inh_StringStringListPairList :: Scope,sourcePos_Inh_StringStringListPairList :: MySourcePos}-data Syn_StringStringListPairList = Syn_StringStringListPairList {actualValue_Syn_StringStringListPairList :: StringStringListPairList,messages_Syn_StringStringListPairList :: [Message],nodeType_Syn_StringStringListPairList :: Type}-wrap_StringStringListPairList :: T_StringStringListPairList ->- Inh_StringStringListPairList ->- Syn_StringStringListPairList -wrap_StringStringListPairList sem (Inh_StringStringListPairList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_StringStringListPairList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_StringStringListPairList_Cons :: T_StringStringListPair ->- T_StringStringListPairList ->- T_StringStringListPairList -sem_StringStringListPairList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StringStringListPairList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: StringStringListPair- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: StringStringListPairList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_StringStringListPairList_Nil :: T_StringStringListPairList -sem_StringStringListPairList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: StringStringListPairList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- TableRef -----------------------------------------------------data TableRef = JoinedTref (TableRef) (Natural) (JoinType) (TableRef) (OnExpr) - | SubTref (SelectExpression) (String) - | Tref (String) - | TrefAlias (String) (String) - | TrefFun (Expression) - | TrefFunAlias (Expression) (String) - deriving ( Eq,Show)--- cata-sem_TableRef :: TableRef ->- T_TableRef -sem_TableRef (JoinedTref _tbl _nat _joinType _tbl1 _onExpr ) =- (sem_TableRef_JoinedTref (sem_TableRef _tbl ) (sem_Natural _nat ) (sem_JoinType _joinType ) (sem_TableRef _tbl1 ) (sem_OnExpr _onExpr ) )-sem_TableRef (SubTref _sel _alias ) =- (sem_TableRef_SubTref (sem_SelectExpression _sel ) _alias )-sem_TableRef (Tref _tbl ) =- (sem_TableRef_Tref _tbl )-sem_TableRef (TrefAlias _tbl _alias ) =- (sem_TableRef_TrefAlias _tbl _alias )-sem_TableRef (TrefFun _fn ) =- (sem_TableRef_TrefFun (sem_Expression _fn ) )-sem_TableRef (TrefFunAlias _fn _alias ) =- (sem_TableRef_TrefFunAlias (sem_Expression _fn ) _alias )--- semantic domain-type T_TableRef = Bool ->- Scope ->- MySourcePos ->- ( TableRef,([QualifiedScope]),([String]),([Message]),Type)-data Inh_TableRef = Inh_TableRef {inLoop_Inh_TableRef :: Bool,scope_Inh_TableRef :: Scope,sourcePos_Inh_TableRef :: MySourcePos}-data Syn_TableRef = Syn_TableRef {actualValue_Syn_TableRef :: TableRef,idens_Syn_TableRef :: [QualifiedScope],joinIdens_Syn_TableRef :: [String],messages_Syn_TableRef :: [Message],nodeType_Syn_TableRef :: Type}-wrap_TableRef :: T_TableRef ->- Inh_TableRef ->- Syn_TableRef -wrap_TableRef sem (Inh_TableRef _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_TableRef _lhsOactualValue _lhsOidens _lhsOjoinIdens _lhsOmessages _lhsOnodeType ))-sem_TableRef_JoinedTref :: T_TableRef ->- T_Natural ->- T_JoinType ->- T_TableRef ->- T_OnExpr ->- T_TableRef -sem_TableRef_JoinedTref tbl_ nat_ joinType_ tbl1_ onExpr_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOidens :: ([QualifiedScope])- _lhsOjoinIdens :: ([String])- _lhsOmessages :: ([Message])- _lhsOactualValue :: TableRef- _tblOinLoop :: Bool- _tblOscope :: Scope- _tblOsourcePos :: MySourcePos- _natOinLoop :: Bool- _natOscope :: Scope- _natOsourcePos :: MySourcePos- _joinTypeOinLoop :: Bool- _joinTypeOscope :: Scope- _joinTypeOsourcePos :: MySourcePos- _tbl1OinLoop :: Bool- _tbl1Oscope :: Scope- _tbl1OsourcePos :: MySourcePos- _onExprOinLoop :: Bool- _onExprOscope :: Scope- _onExprOsourcePos :: MySourcePos- _tblIactualValue :: TableRef- _tblIidens :: ([QualifiedScope])- _tblIjoinIdens :: ([String])- _tblImessages :: ([Message])- _tblInodeType :: Type- _natIactualValue :: Natural- _natImessages :: ([Message])- _natInodeType :: Type- _joinTypeIactualValue :: JoinType- _joinTypeImessages :: ([Message])- _joinTypeInodeType :: Type- _tbl1IactualValue :: TableRef- _tbl1Iidens :: ([QualifiedScope])- _tbl1IjoinIdens :: ([String])- _tbl1Imessages :: ([Message])- _tbl1InodeType :: Type- _onExprIactualValue :: OnExpr- _onExprImessages :: ([Message])- _onExprInodeType :: Type- _lhsOnodeType =- checkErrors [_tblInodeType- ,_tbl1InodeType]- ret- where- ret = case (_natIactualValue, _onExprIactualValue) of- (Natural, _) -> unionJoinList $ commonFieldNames- _tblInodeType- _tbl1InodeType- (_,Just (JoinUsing s)) -> unionJoinList s- _ -> unionJoinList []- unionJoinList s = combineTableTypesWithUsingList- _lhsIscope- _lhsIsourcePos- s- _tblInodeType- _tbl1InodeType- _lhsOidens =- _tblIidens ++ _tbl1Iidens- _lhsOjoinIdens =- commonFieldNames _tblInodeType _tbl1InodeType- _lhsOmessages =- _tblImessages ++ _natImessages ++ _joinTypeImessages ++ _tbl1Imessages ++ _onExprImessages- _actualValue =- JoinedTref _tblIactualValue _natIactualValue _joinTypeIactualValue _tbl1IactualValue _onExprIactualValue- _lhsOactualValue =- _actualValue- _tblOinLoop =- _lhsIinLoop- _tblOscope =- _lhsIscope- _tblOsourcePos =- _lhsIsourcePos- _natOinLoop =- _lhsIinLoop- _natOscope =- _lhsIscope- _natOsourcePos =- _lhsIsourcePos- _joinTypeOinLoop =- _lhsIinLoop- _joinTypeOscope =- _lhsIscope- _joinTypeOsourcePos =- _lhsIsourcePos- _tbl1OinLoop =- _lhsIinLoop- _tbl1Oscope =- _lhsIscope- _tbl1OsourcePos =- _lhsIsourcePos- _onExprOinLoop =- _lhsIinLoop- _onExprOscope =- _lhsIscope- _onExprOsourcePos =- _lhsIsourcePos- ( _tblIactualValue,_tblIidens,_tblIjoinIdens,_tblImessages,_tblInodeType) =- (tbl_ _tblOinLoop _tblOscope _tblOsourcePos )- ( _natIactualValue,_natImessages,_natInodeType) =- (nat_ _natOinLoop _natOscope _natOsourcePos )- ( _joinTypeIactualValue,_joinTypeImessages,_joinTypeInodeType) =- (joinType_ _joinTypeOinLoop _joinTypeOscope _joinTypeOsourcePos )- ( _tbl1IactualValue,_tbl1Iidens,_tbl1IjoinIdens,_tbl1Imessages,_tbl1InodeType) =- (tbl1_ _tbl1OinLoop _tbl1Oscope _tbl1OsourcePos )- ( _onExprIactualValue,_onExprImessages,_onExprInodeType) =- (onExpr_ _onExprOinLoop _onExprOscope _onExprOsourcePos )- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))-sem_TableRef_SubTref :: T_SelectExpression ->- String ->- T_TableRef -sem_TableRef_SubTref sel_ alias_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOidens :: ([QualifiedScope])- _lhsOjoinIdens :: ([String])- _lhsOmessages :: ([Message])- _lhsOactualValue :: TableRef- _selOinLoop :: Bool- _selOscope :: Scope- _selOsourcePos :: MySourcePos- _selIactualValue :: SelectExpression- _selImessages :: ([Message])- _selInodeType :: Type- _lhsOnodeType =- checkErrors [_selInodeType] $ unwrapSetOfComposite _selInodeType- _lhsOidens =- [(alias_, (unwrapComposite $ unwrapSetOf _selInodeType, []))]- _lhsOjoinIdens =- []- _lhsOmessages =- _selImessages- _actualValue =- SubTref _selIactualValue alias_- _lhsOactualValue =- _actualValue- _selOinLoop =- _lhsIinLoop- _selOscope =- _lhsIscope- _selOsourcePos =- _lhsIsourcePos- ( _selIactualValue,_selImessages,_selInodeType) =- (sel_ _selOinLoop _selOscope _selOsourcePos )- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))-sem_TableRef_Tref :: String ->- T_TableRef -sem_TableRef_Tref tbl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOjoinIdens :: ([String])- _lhsOidens :: ([QualifiedScope])- _lhsOmessages :: ([Message])- _lhsOactualValue :: TableRef- _lhsOnodeType =- fst $ getRelationType _lhsIscope _lhsIsourcePos tbl_- _lhsOjoinIdens =- []- _lhsOidens =- [(tbl_, both unwrapComposite $ getRelationType _lhsIscope _lhsIsourcePos tbl_)]- _lhsOmessages =- []- _actualValue =- Tref tbl_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))-sem_TableRef_TrefAlias :: String ->- String ->- T_TableRef -sem_TableRef_TrefAlias tbl_ alias_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOjoinIdens :: ([String])- _lhsOidens :: ([QualifiedScope])- _lhsOmessages :: ([Message])- _lhsOactualValue :: TableRef- _lhsOnodeType =- fst $ getRelationType _lhsIscope _lhsIsourcePos tbl_- _lhsOjoinIdens =- []- _lhsOidens =- [(alias_, both unwrapComposite $ getRelationType _lhsIscope _lhsIsourcePos tbl_)]- _lhsOmessages =- []- _actualValue =- TrefAlias tbl_ alias_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))-sem_TableRef_TrefFun :: T_Expression ->- T_TableRef -sem_TableRef_TrefFun fn_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOjoinIdens :: ([String])- _lhsOidens :: ([QualifiedScope])- _lhsOmessages :: ([Message])- _lhsOactualValue :: TableRef- _fnOinLoop :: Bool- _fnOscope :: Scope- _fnOsourcePos :: MySourcePos- _fnIactualValue :: Expression- _fnIliftedColumnName :: String- _fnImessages :: ([Message])- _fnInodeType :: Type- _lhsOnodeType =- getFnType _lhsIscope _lhsIsourcePos "" _fnIactualValue _fnInodeType- _lhsOjoinIdens =- []- _lhsOidens =- [second (\l -> (unwrapComposite l, [])) $ getFunIdens _lhsIscope _lhsIsourcePos "" _fnIactualValue _fnInodeType]- _lhsOmessages =- _fnImessages- _actualValue =- TrefFun _fnIactualValue- _lhsOactualValue =- _actualValue- _fnOinLoop =- _lhsIinLoop- _fnOscope =- _lhsIscope- _fnOsourcePos =- _lhsIsourcePos- ( _fnIactualValue,_fnIliftedColumnName,_fnImessages,_fnInodeType) =- (fn_ _fnOinLoop _fnOscope _fnOsourcePos )- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))-sem_TableRef_TrefFunAlias :: T_Expression ->- String ->- T_TableRef -sem_TableRef_TrefFunAlias fn_ alias_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOjoinIdens :: ([String])- _lhsOidens :: ([QualifiedScope])- _lhsOmessages :: ([Message])- _lhsOactualValue :: TableRef- _fnOinLoop :: Bool- _fnOscope :: Scope- _fnOsourcePos :: MySourcePos- _fnIactualValue :: Expression- _fnIliftedColumnName :: String- _fnImessages :: ([Message])- _fnInodeType :: Type- _lhsOnodeType =- getFnType _lhsIscope _lhsIsourcePos alias_ _fnIactualValue _fnInodeType- _lhsOjoinIdens =- []- _lhsOidens =- [second (\l -> (unwrapComposite l, [])) $ getFunIdens _lhsIscope _lhsIsourcePos alias_ _fnIactualValue _fnInodeType]- _lhsOmessages =- _fnImessages- _actualValue =- TrefFunAlias _fnIactualValue alias_- _lhsOactualValue =- _actualValue- _fnOinLoop =- _lhsIinLoop- _fnOscope =- _lhsIscope- _fnOsourcePos =- _lhsIsourcePos- ( _fnIactualValue,_fnIliftedColumnName,_fnImessages,_fnInodeType) =- (fn_ _fnOinLoop _fnOscope _fnOsourcePos )- in ( _lhsOactualValue,_lhsOidens,_lhsOjoinIdens,_lhsOmessages,_lhsOnodeType)))--- TypeAttributeDef ---------------------------------------------data TypeAttributeDef = TypeAttDef (String) (TypeName) - deriving ( Eq,Show)--- cata-sem_TypeAttributeDef :: TypeAttributeDef ->- T_TypeAttributeDef -sem_TypeAttributeDef (TypeAttDef _name _typ ) =- (sem_TypeAttributeDef_TypeAttDef _name (sem_TypeName _typ ) )--- semantic domain-type T_TypeAttributeDef = Bool ->- Scope ->- MySourcePos ->- ( TypeAttributeDef,String,([Message]),Type)-data Inh_TypeAttributeDef = Inh_TypeAttributeDef {inLoop_Inh_TypeAttributeDef :: Bool,scope_Inh_TypeAttributeDef :: Scope,sourcePos_Inh_TypeAttributeDef :: MySourcePos}-data Syn_TypeAttributeDef = Syn_TypeAttributeDef {actualValue_Syn_TypeAttributeDef :: TypeAttributeDef,attrName_Syn_TypeAttributeDef :: String,messages_Syn_TypeAttributeDef :: [Message],nodeType_Syn_TypeAttributeDef :: Type}-wrap_TypeAttributeDef :: T_TypeAttributeDef ->- Inh_TypeAttributeDef ->- Syn_TypeAttributeDef -wrap_TypeAttributeDef sem (Inh_TypeAttributeDef _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOattrName,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_TypeAttributeDef _lhsOactualValue _lhsOattrName _lhsOmessages _lhsOnodeType ))-sem_TypeAttributeDef_TypeAttDef :: String ->- T_TypeName ->- T_TypeAttributeDef -sem_TypeAttributeDef_TypeAttDef name_ typ_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOattrName :: String- _lhsOmessages :: ([Message])- _lhsOactualValue :: TypeAttributeDef- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOnodeType =- _typInodeType- _lhsOattrName =- name_- _lhsOmessages =- _typImessages- _actualValue =- TypeAttDef name_ _typIactualValue- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsOattrName,_lhsOmessages,_lhsOnodeType)))--- TypeAttributeDefList -----------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( TypeAttributeDefList,([Message]),Type)-data Inh_TypeAttributeDefList = Inh_TypeAttributeDefList {inLoop_Inh_TypeAttributeDefList :: Bool,scope_Inh_TypeAttributeDefList :: Scope,sourcePos_Inh_TypeAttributeDefList :: MySourcePos}-data Syn_TypeAttributeDefList = Syn_TypeAttributeDefList {actualValue_Syn_TypeAttributeDefList :: TypeAttributeDefList,messages_Syn_TypeAttributeDefList :: [Message],nodeType_Syn_TypeAttributeDefList :: Type}-wrap_TypeAttributeDefList :: T_TypeAttributeDefList ->- Inh_TypeAttributeDefList ->- Syn_TypeAttributeDefList -wrap_TypeAttributeDefList sem (Inh_TypeAttributeDefList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_TypeAttributeDefList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_TypeAttributeDefList_Cons :: T_TypeAttributeDef ->- T_TypeAttributeDefList ->- T_TypeAttributeDefList -sem_TypeAttributeDefList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: TypeAttributeDefList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: TypeAttributeDef- _hdIattrName :: String- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: TypeAttributeDefList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOnodeType =- checkErrors [_tlInodeType, _hdInodeType] $- consComposite (_hdIattrName, _hdInodeType) _tlInodeType- _lhsOmessages =- _hdImessages ++ _tlImessages- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdIattrName,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_TypeAttributeDefList_Nil :: T_TypeAttributeDefList -sem_TypeAttributeDefList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: TypeAttributeDefList- _lhsOnodeType =- UnnamedCompositeType []- _lhsOmessages =- []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- TypeName -----------------------------------------------------data TypeName = ArrayTypeName (TypeName) - | PrecTypeName (String) (Integer) - | SetOfTypeName (TypeName) - | SimpleTypeName (String) - deriving ( Eq,Show)--- cata-sem_TypeName :: TypeName ->- T_TypeName -sem_TypeName (ArrayTypeName _typ ) =- (sem_TypeName_ArrayTypeName (sem_TypeName _typ ) )-sem_TypeName (PrecTypeName _tn _prec ) =- (sem_TypeName_PrecTypeName _tn _prec )-sem_TypeName (SetOfTypeName _typ ) =- (sem_TypeName_SetOfTypeName (sem_TypeName _typ ) )-sem_TypeName (SimpleTypeName _tn ) =- (sem_TypeName_SimpleTypeName _tn )--- semantic domain-type T_TypeName = Bool ->- Scope ->- MySourcePos ->- ( TypeName,([Message]),Type)-data Inh_TypeName = Inh_TypeName {inLoop_Inh_TypeName :: Bool,scope_Inh_TypeName :: Scope,sourcePos_Inh_TypeName :: MySourcePos}-data Syn_TypeName = Syn_TypeName {actualValue_Syn_TypeName :: TypeName,messages_Syn_TypeName :: [Message],nodeType_Syn_TypeName :: Type}-wrap_TypeName :: T_TypeName ->- Inh_TypeName ->- Syn_TypeName -wrap_TypeName sem (Inh_TypeName _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_TypeName _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_TypeName_ArrayTypeName :: T_TypeName ->- T_TypeName -sem_TypeName_ArrayTypeName typ_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: TypeName- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOnodeType =- let t = ArrayType _typInodeType- in checkErrors- [_typInodeType- ,checkTypeExists _lhsIscope _lhsIsourcePos t]- t- _lhsOmessages =- _typImessages- _actualValue =- ArrayTypeName _typIactualValue- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_TypeName_PrecTypeName :: String ->- Integer ->- T_TypeName -sem_TypeName_PrecTypeName tn_ prec_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: TypeName- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- PrecTypeName tn_ prec_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_TypeName_SetOfTypeName :: T_TypeName ->- T_TypeName -sem_TypeName_SetOfTypeName typ_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: TypeName- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOnodeType =- checkErrors [_typInodeType]- (SetOfType _typInodeType)- _lhsOmessages =- _typImessages- _actualValue =- SetOfTypeName _typIactualValue- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_TypeName_SimpleTypeName :: String ->- T_TypeName -sem_TypeName_SimpleTypeName tn_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: TypeName- _lhsOnodeType =- lookupTypeByName _lhsIscope _lhsIsourcePos $ canonicalizeTypeName tn_- _lhsOmessages =- []- _actualValue =- SimpleTypeName tn_- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- VarDef -------------------------------------------------------data VarDef = VarDef (String) (TypeName) (Maybe Expression) - deriving ( Eq,Show)--- cata-sem_VarDef :: VarDef ->- T_VarDef -sem_VarDef (VarDef _name _typ _value ) =- (sem_VarDef_VarDef _name (sem_TypeName _typ ) _value )--- semantic domain-type T_VarDef = Bool ->- Scope ->- MySourcePos ->- ( VarDef,([Message]),Type)-data Inh_VarDef = Inh_VarDef {inLoop_Inh_VarDef :: Bool,scope_Inh_VarDef :: Scope,sourcePos_Inh_VarDef :: MySourcePos}-data Syn_VarDef = Syn_VarDef {actualValue_Syn_VarDef :: VarDef,messages_Syn_VarDef :: [Message],nodeType_Syn_VarDef :: Type}-wrap_VarDef :: T_VarDef ->- Inh_VarDef ->- Syn_VarDef -wrap_VarDef sem (Inh_VarDef _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_VarDef _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_VarDef_VarDef :: String ->- T_TypeName ->- (Maybe Expression) ->- T_VarDef -sem_VarDef_VarDef name_ typ_ value_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: VarDef- _typOinLoop :: Bool- _typOscope :: Scope- _typOsourcePos :: MySourcePos- _typIactualValue :: TypeName- _typImessages :: ([Message])- _typInodeType :: Type- _lhsOmessages =- _typImessages- _lhsOnodeType =- _typInodeType- _actualValue =- VarDef name_ _typIactualValue value_- _lhsOactualValue =- _actualValue- _typOinLoop =- _lhsIinLoop- _typOscope =- _lhsIscope- _typOsourcePos =- _lhsIsourcePos- ( _typIactualValue,_typImessages,_typInodeType) =- (typ_ _typOinLoop _typOscope _typOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- VarDefList ---------------------------------------------------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 = Bool ->- Scope ->- MySourcePos ->- ( VarDefList,([Message]),Type)-data Inh_VarDefList = Inh_VarDefList {inLoop_Inh_VarDefList :: Bool,scope_Inh_VarDefList :: Scope,sourcePos_Inh_VarDefList :: MySourcePos}-data Syn_VarDefList = Syn_VarDefList {actualValue_Syn_VarDefList :: VarDefList,messages_Syn_VarDefList :: [Message],nodeType_Syn_VarDefList :: Type}-wrap_VarDefList :: T_VarDefList ->- Inh_VarDefList ->- Syn_VarDefList -wrap_VarDefList sem (Inh_VarDefList _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_VarDefList _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_VarDefList_Cons :: T_VarDef ->- T_VarDefList ->- T_VarDefList -sem_VarDefList_Cons hd_ tl_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: VarDefList- _hdOinLoop :: Bool- _hdOscope :: Scope- _hdOsourcePos :: MySourcePos- _tlOinLoop :: Bool- _tlOscope :: Scope- _tlOsourcePos :: MySourcePos- _hdIactualValue :: VarDef- _hdImessages :: ([Message])- _hdInodeType :: Type- _tlIactualValue :: VarDefList- _tlImessages :: ([Message])- _tlInodeType :: Type- _lhsOmessages =- _hdImessages ++ _tlImessages- _lhsOnodeType =- _hdInodeType `appendTypeList` _tlInodeType- _actualValue =- (:) _hdIactualValue _tlIactualValue- _lhsOactualValue =- _actualValue- _hdOinLoop =- _lhsIinLoop- _hdOscope =- _lhsIscope- _hdOsourcePos =- _lhsIsourcePos- _tlOinLoop =- _lhsIinLoop- _tlOscope =- _lhsIscope- _tlOsourcePos =- _lhsIsourcePos- ( _hdIactualValue,_hdImessages,_hdInodeType) =- (hd_ _hdOinLoop _hdOscope _hdOsourcePos )- ( _tlIactualValue,_tlImessages,_tlInodeType) =- (tl_ _tlOinLoop _tlOscope _tlOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_VarDefList_Nil :: T_VarDefList -sem_VarDefList_Nil =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: VarDefList- _lhsOmessages =- []- _lhsOnodeType =- TypeList []- _actualValue =- []- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Volatility ---------------------------------------------------data Volatility = Immutable - | Stable - | Volatile - deriving ( Eq,Show)--- 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 = Bool ->- Scope ->- MySourcePos ->- ( Volatility,([Message]),Type)-data Inh_Volatility = Inh_Volatility {inLoop_Inh_Volatility :: Bool,scope_Inh_Volatility :: Scope,sourcePos_Inh_Volatility :: MySourcePos}-data Syn_Volatility = Syn_Volatility {actualValue_Syn_Volatility :: Volatility,messages_Syn_Volatility :: [Message],nodeType_Syn_Volatility :: Type}-wrap_Volatility :: T_Volatility ->- Inh_Volatility ->- Syn_Volatility -wrap_Volatility sem (Inh_Volatility _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Volatility _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Volatility_Immutable :: T_Volatility -sem_Volatility_Immutable =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Volatility- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Immutable- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Volatility_Stable :: T_Volatility -sem_Volatility_Stable =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Volatility- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Stable- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Volatility_Volatile :: T_Volatility -sem_Volatility_Volatile =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOmessages :: ([Message])- _lhsOnodeType :: Type- _lhsOactualValue :: Volatility- _lhsOmessages =- []- _lhsOnodeType =- UnknownType- _actualValue =- Volatile- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))--- Where --------------------------------------------------------type Where = (Maybe (Expression))--- cata-sem_Where :: Where ->- T_Where -sem_Where (Prelude.Just x ) =- (sem_Where_Just (sem_Expression x ) )-sem_Where Prelude.Nothing =- sem_Where_Nothing--- semantic domain-type T_Where = Bool ->- Scope ->- MySourcePos ->- ( Where,([Message]),Type)-data Inh_Where = Inh_Where {inLoop_Inh_Where :: Bool,scope_Inh_Where :: Scope,sourcePos_Inh_Where :: MySourcePos}-data Syn_Where = Syn_Where {actualValue_Syn_Where :: Where,messages_Syn_Where :: [Message],nodeType_Syn_Where :: Type}-wrap_Where :: T_Where ->- Inh_Where ->- Syn_Where -wrap_Where sem (Inh_Where _lhsIinLoop _lhsIscope _lhsIsourcePos ) =- (let ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType) =- (sem _lhsIinLoop _lhsIscope _lhsIsourcePos )- in (Syn_Where _lhsOactualValue _lhsOmessages _lhsOnodeType ))-sem_Where_Just :: T_Expression ->- T_Where -sem_Where_Just just_ =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: Where- _justOinLoop :: Bool- _justOscope :: Scope- _justOsourcePos :: MySourcePos- _justIactualValue :: Expression- _justIliftedColumnName :: String- _justImessages :: ([Message])- _justInodeType :: Type- _lhsOnodeType =- checkErrors- [_justInodeType]- (if _justInodeType /= typeBool- then TypeError _lhsIsourcePos ExpressionMustBeBool- else typeBool)- _lhsOmessages =- _justImessages- _actualValue =- Just _justIactualValue- _lhsOactualValue =- _actualValue- _justOinLoop =- _lhsIinLoop- _justOscope =- _lhsIscope- _justOsourcePos =- _lhsIsourcePos- ( _justIactualValue,_justIliftedColumnName,_justImessages,_justInodeType) =- (just_ _justOinLoop _justOscope _justOsourcePos )- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))-sem_Where_Nothing :: T_Where -sem_Where_Nothing =- (\ _lhsIinLoop- _lhsIscope- _lhsIsourcePos ->- (let _lhsOnodeType :: Type- _lhsOmessages :: ([Message])- _lhsOactualValue :: Where- _lhsOnodeType =- typeBool- _lhsOmessages =- []- _actualValue =- Nothing- _lhsOactualValue =- _actualValue- in ( _lhsOactualValue,_lhsOmessages,_lhsOnodeType)))
− Database/HsSqlPpp/AstCheckTests.lhs
@@ -1,654 +0,0 @@-#!/usr/bin/env runghc--Copyright 2009 Jake Wheat--Set of tests to check the type checking code--> module Database.HsSqlPpp.AstCheckTests (astCheckTests, parseAndGetType) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Data.Char-> import Control.Arrow--> import Database.HsSqlPpp.Ast-> import Database.HsSqlPpp.Parser-> import Database.HsSqlPpp.Scope-> import Database.HsSqlPpp.TypeType--> astCheckTests :: Test.Framework.Test-> astCheckTests = testGroup "astCheckTests" [-> testGroup "test test"-> (mapAttr [-> p "select 1;" []-> ])-> ,testGroup "loop tests"-> (mapAttr [-> p "create function cont_test1() returns void as $$\n\-> \declare\n\-> \ r record;\n\-> \begin\n\-> \ for r in select a from b loop\n\-> \ null;\n\-> \ continue;\n\-> \ end loop;\n\-> \end;\n\-> \$$ language plpgsql volatile;\n" []-> ,p "create function cont_test2() returns void as $$\n\-> \begin\n\-> \ continue;\n\-> \end;\n\-> \$$ language plpgsql volatile;\n" [Error ("",3,5) ContinueNotInLoop]-> ])--> ,testGroup "basic literal types"-> (mapExprType [-> p "1" typeInt-> ,p "1.0" typeNumeric-> ,p "'test'" UnknownStringLit-> ,p "true" typeBool-> ,p "array[1,2,3]" (ArrayType typeInt)-> ,p "array['a','b']" (ArrayType (ScalarType "text"))-> ,p "array[1,'b']" (ArrayType typeInt)-> ,p "array[1,true]" (TypeError ("",0,0)-> (IncompatibleTypeSet [typeInt,typeBool]))-> ])--> ,testGroup "some expressions"-> (mapExprType [-> p "1=1" typeBool-> ,p "1=true" (TypeError ("",0,0)-> (NoMatchingOperator "=" [typeInt,typeBool]))-> ,p "substring('aqbc' from 2 for 2)" (ScalarType "text")--> ,p "substring(3 from 2 for 2)" (TypeError ("",0,0)-> (NoMatchingOperator "!substring"-> [ScalarType "int4"-> ,ScalarType "int4"-> ,ScalarType "int4"]))-> ,p "substring('aqbc' from 2 for true)" (TypeError ("",0,0)-> (NoMatchingOperator "!substring"-> [UnknownStringLit-> ,ScalarType "int4"-> ,ScalarType "bool"]))--> ,p "3 between 2 and 4" typeBool-> ,p "3 between true and 4" (TypeError ("",0,0)-> (NoMatchingOperator ">="-> [typeInt-> ,typeBool]))--> ,p "array[1,2,3][2]" typeInt-> ,p "array['a','b'][1]" (ScalarType "text")-- > ,p "array['a','b'][true]" (TypeError ("",0,0)- > (WrongType- > typeInt- > UnknownStringLit))--> ,p "not true" typeBool-> ,p "not 1" (TypeError ("",0,0)-> (NoMatchingOperator "!not" [typeInt]))--> ,p "@ 3" typeInt-> ,p "@ true" (TypeError ("",0,0)-> (NoMatchingOperator "@" [ScalarType "bool"]))--> ,p "-3" typeInt-> ,p "-'a'" (TypeError ("",0,0)-> (NoMatchingOperator "-" [UnknownStringLit]))--> ,p "4-3" typeInt--> --,p "1 is null" typeBool-> --,p "1 is not null" typeBool--> ,p "1+1" typeInt-> ,p "1+1" typeInt-> ,p "31*511" typeInt-> ,p "5/2" typeInt-> ,p "2^10" typeFloat8-> ,p "17%5" typeInt--> ,p "3 and 4" (TypeError ("",0,0)-> (NoMatchingOperator "!and" [typeInt,typeInt]))--> ,p "True and False" typeBool-> ,p "false or true" typeBool--> ,p "lower('TEST')" (ScalarType "text")-> ,p "lower(1)" (TypeError nsp (NoMatchingOperator "lower" [typeInt]))-> ])--> ,testGroup "special functions"-> (mapExprType [-> p "coalesce(null,1,2,null)" typeInt-> ,p "coalesce('3',1,2,null)" typeInt-> ,p "coalesce('3',1,true,null)"-> (TypeError ("",0,0)-> (IncompatibleTypeSet [UnknownStringLit-> ,ScalarType "int4"-> ,ScalarType "bool"-> ,UnknownStringLit]))-> ,p "nullif('hello','hello')" (ScalarType "text")-> ,p "nullif(3,4)" typeInt-> ,p "nullif(true,3)"-> (TypeError ("",0,0)-> (NoMatchingOperator "nullif" [ScalarType "bool"-> ,ScalarType "int4"]))-> ,p "greatest(3,5,6,4,3)" typeInt-> ,p "least(3,5,6,4,3)" typeInt-> ,p "least(5,true)"-> (TypeError nsp (IncompatibleTypeSet [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--> ,testGroup "some expressions"-> (mapExprType [-> p "3 + '4'" typeInt-> ,p "3.0 + '4'" typeNumeric-> ,p "'3' + '4'" (TypeError ("",0,0)-> (NoMatchingOperator "+" [UnknownStringLit-> ,UnknownStringLit]))-> ])->--> ,testGroup "expressions and scope"-> (mapExprScopeType [-> t "a" (makeScope [("test", [("a", typeInt)])]) typeInt-> ,t "b" (makeScope [("test", [("a", typeInt)])])-> (TypeError nsp (UnrecognisedIdentifier "b"))-> ])--> ,testGroup "random expressions"-> (mapExprType [-> p "exists (select 1 from pg_type)" typeBool-> ,p "exists (select testit from pg_type)"-> (TypeError nsp (UnrecognisedIdentifier "testit"))-> ])--rows different lengths-rows match types pairwise, same and different types-rows implicit cast from unknown-rows don't match types---> ,testGroup "row comparison expressions"-> (mapExprType [-> p "row(1)" (RowCtor [typeInt])-> ,p "row(1,2)" (RowCtor [typeInt,typeInt])-> ,p "row('t1','t2')" (RowCtor [UnknownStringLit,UnknownStringLit])-> ,p "row(true,1,'t3')" (RowCtor [typeBool, typeInt,UnknownStringLit])-> ,p "(true,1,'t3',75.3)" (RowCtor [typeBool,typeInt-> ,UnknownStringLit,typeNumeric])-> ,p "row(1) = row(2)" typeBool-> ,p "row(1,2) = row(2,1)" typeBool-> ,p "(1,2) = (2,1)" typeBool-> ,p "(1,2,3) = (2,1)" (TypeError nsp ValuesListsMustBeSameLength)-> ,p "('1',2) = (2,'1')" typeBool-> ,p "(1,true) = (2,1)" (TypeError nsp (IncompatibleTypeSet [ScalarType "bool",ScalarType "int4"]))-> ,p "(1,2) <> (2,1)" typeBool-> ,p "(1,2) >= (2,1)" typeBool-> ,p "(1,2) <= (2,1)" typeBool-> ,p "(1,2) > (2,1)" typeBool-> ,p "(1,2) < (2,1)" typeBool-> ])----> ,testGroup "case expressions"-> (mapExprType [-> p "case\n\-> \ when true then 1\n\-> \end" typeInt-> ,p "case\n\-> \ when 1=2 then 'stuff'\n\-> \ when 2=3 then 'blah'\n\-> \ else 'test'\n\-> \end" (ScalarType "text")-> ,p "case\n\-> \ when 1=2 then 'stuff'\n\-> \ when true=3 then 'blah'\n\-> \ else 'test'\n\-> \end" (TypeError ("",0,0)-> (NoMatchingOperator "=" [typeBool,typeInt]))-> ,p "case\n\-> \ when 1=2 then true\n\-> \ when 2=3 then false\n\-> \ else 1\n\-> \end" (TypeError ("",0,0)-> (IncompatibleTypeSet [typeBool-> ,typeBool-> ,typeInt]))-> ,p "case\n\-> \ when 1=2 then false\n\-> \ when 2=3 then 1\n\-> \ else true\n\-> \end" (TypeError ("",0,0)-> (IncompatibleTypeSet [typeBool-> ,typeInt-> ,typeBool]))--> ,p "case 1 when 2 then 3 else 4 end" typeInt-> ,p "case 1 when true then 3 else 4 end"-> (TypeError ("",0,0) (IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"]))-> ,p "case 1 when 2 then true else false end" typeBool-> ,p "case 1 when 2 then 3 else false end"-> (TypeError ("",0,0) (IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"]))--> ])--> ,testGroup "polymorphic functions"-> (mapExprType [-> p "array_append(ARRAY[1,2], 3)"-> (ArrayType typeInt)-> ,p "array_append(ARRAY['a','b'], 'c')"-> (ArrayType $ ScalarType "text")-> ,p "array_append(ARRAY['a'::int,'b'], 'c')"-> (ArrayType typeInt)-> ])--todo:----> ,testGroup "cast expressions"-> (mapExprType [-> p "cast ('1' as integer)"-> typeInt-> ,p "cast ('1' as baz)"-> (TypeError nsp (UnknownTypeName "baz"))-> ,p "array[]"-> (TypeError nsp TypelessEmptyArray)-> --todo: figure out how to do this-> --,p "array[] :: text[]"-> -- (ArrayType (ScalarType "text"))--> ])---> ,testGroup "simple selects"-> (mapStatementType [-> p "select 1;" [SetOfType $ UnnamedCompositeType [("?column?", typeInt)]]-> ,p "select 1 as a;" [SetOfType $ UnnamedCompositeType [("a", typeInt)]]-> ,p "select 1,2;" [SetOfType $ UnnamedCompositeType [("?column?", typeInt)-> ,("?column?", typeInt)]]-> ,p "select 1 as a, 2 as b;" [SetOfType $ UnnamedCompositeType [("a", typeInt)-> ,("b", typeInt)]]-> ,p "select 1+2 as a, 'a' || 'b';" [SetOfType $-> UnnamedCompositeType [("a", typeInt)-> ,("?column?", ScalarType "text")]]-> ,p "values (1,2);" [SetOfType $-> UnnamedCompositeType-> [("column1", typeInt)-> ,("column2", typeInt)]]-> ,p "values (1,2),('3', '4');" [SetOfType $-> UnnamedCompositeType-> [("column1", typeInt)-> ,("column2", typeInt)]]-> ,p "values (1,2),('a', true);" [TypeError ("",1,1)-> (IncompatibleTypeSet [typeInt-> ,typeBool])]-> ,p "values ('3', '4'),(1,2);" [SetOfType $-> UnnamedCompositeType-> [("column1", typeInt)-> ,("column2", typeInt)]]-> ,p "values ('a', true),(1,2);" [TypeError ("",1,1)-> (IncompatibleTypeSet [typeBool-> ,typeInt])]-> ,p "values ('a'::text, '2'::int2),('1','2');" [SetOfType $-> UnnamedCompositeType-> [("column1", ScalarType "text")-> ,("column2", typeSmallInt)]]-> ,p "values (1,2,3),(1,2);" [TypeError ("",1,1) ValuesListsMustBeSameLength]-> ])--> ,testGroup "simple combine selects"-> (mapStatementType [-> p "select 1,2 union select '3', '4';" [SetOfType $-> UnnamedCompositeType-> [("?column?", typeInt)-> ,("?column?", typeInt)]]-> ,p "select 1,2 intersect select 'a', true;" [TypeError ("",1,1)-> (IncompatibleTypeSet [typeInt-> ,typeBool])]-> ,p "select '3', '4' except select 1,2;" [SetOfType $-> UnnamedCompositeType-> [("?column?", typeInt)-> ,("?column?", typeInt)]]-> ,p "select 'a', true union select 1,2;" [TypeError ("",1,1)-> (IncompatibleTypeSet [typeBool-> ,typeInt])]-> ,p "select 'a'::text, '2'::int2 intersect select '1','2';" [SetOfType $-> UnnamedCompositeType-> [("text", ScalarType "text")-> ,("int2", typeSmallInt)]]-> ,p "select 1,2,3 except select 1,2;" [TypeError ("",1,1) ValuesListsMustBeSameLength]-> ,p "select '3' as a, '4' as b except select 1,2;" [SetOfType $-> UnnamedCompositeType-> [("a", typeInt)-> ,("b", typeInt)]]-> ])---> ,testGroup "simple selects from"-> (mapStatementType [-> p "select a from (select 1 as a, 2 as b) x;"-> [SetOfType $ UnnamedCompositeType [("a", typeInt)]]-> ,p "select b from (select 1 as a, 2 as b) x;"-> [SetOfType $ UnnamedCompositeType [("b", typeInt)]]-> ,p "select c from (select 1 as a, 2 as b) x;"-> [TypeError ("",1,1) (UnrecognisedIdentifier "c")]-> ,p "select typlen from pg_type;"-> [SetOfType $ UnnamedCompositeType [("typlen", typeSmallInt)]]-> ,p "select oid from pg_type;"-> [SetOfType $ UnnamedCompositeType [("oid", ScalarType "oid")]]-> ,p "select p.oid from pg_type p;"-> [SetOfType $ UnnamedCompositeType [("oid", ScalarType "oid")]]-> ,p "select typlen from nope;"-> [TypeError ("",1,1) (UnrecognisedRelation "nope")]-> ,p "select generate_series from generate_series(1,7);"-> [SetOfType $ UnnamedCompositeType [("generate_series", typeInt)]]--check aliasing--> ,p "select generate_series.generate_series from generate_series(1,7);"-> [SetOfType $ UnnamedCompositeType [("generate_series", typeInt)]]-> ,p "select g from generate_series(1,7) g;"-> [SetOfType $ UnnamedCompositeType [("g", typeInt)]]-> ,p "select g.g from generate_series(1,7) g;"-> [SetOfType $ UnnamedCompositeType [("g", typeInt)]]-> ,p "select generate_series.g from generate_series(1,7) g;"-> [TypeError ("",1,1) (UnrecognisedCorrelationName "generate_series")]-> ,p "select g.generate_series from generate_series(1,7) g;"-> [TypeError ("",1,1) (UnrecognisedIdentifier "g.generate_series")]---> ,p "select * from pg_attrdef;"-> [SetOfType $ UnnamedCompositeType-> [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")]]-> ,p "select abs from abs(3);"-> [SetOfType $ UnnamedCompositeType [("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);-> ])---> ,testGroup "simple selects from 2"-> (mapStatementTypeScope [->-> t "select a,b from testfunc();"-> (let fn = ("testfunc", [], SetOfType $ CompositeType "testType")-> in emptyScope {scopeFunctions = [fn]-> ,scopeAllFns = [fn]-> ,scopeAttrDefs =-> [("testType"-> ,Composite-> ,UnnamedCompositeType-> [("a", ScalarType "text")-> ,("b", typeInt)-> ,("c", typeInt)])]})-> [SetOfType $ UnnamedCompositeType-> [("a",ScalarType "text"),("b",ScalarType "int4")]]--> ,t "select testfunc();"-> (let fn = ("testfunc", [], Pseudo Void)-> in emptyScope {scopeFunctions = [fn]-> ,scopeAllFns = [fn]-> ,scopeAttrDefs =-> []})-> [Pseudo Void]--> ])--> ,testGroup "simple join selects"-> (mapStatementType [-> p "select * from (select 1 as a, 2 as b) a\n\-> \ cross join (select true as c, 4.5 as d) b;"-> [SetOfType $ UnnamedCompositeType [("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;"-> [SetOfType $ UnnamedCompositeType [("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);"-> [SetOfType $ UnnamedCompositeType [("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;"-> [SetOfType $ UnnamedCompositeType [("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;"-> [SetOfType $ UnnamedCompositeType [("a", typeInt)-> ,("b", typeInt)-> ,("d", typeNumeric)]]-> ,p "select * from (select 1 as a, 2 as b) a\n\-> \ natural inner join (select true as a, 4.5 as d) b;"-> [TypeError ("",1,1) (IncompatibleTypeSet [ScalarType "int4"-> ,ScalarType "bool"])]-> ])--> ,testGroup "simple scalar identifier qualification"-> (mapStatementType [-> p "select a.* from \n\-> \(select 1 as a, 2 as b) a \n\-> \cross join (select 3 as c, 4 as d) b;"-> [SetOfType $ UnnamedCompositeType [("a", typeInt)-> ,("b", typeInt)]]-> ,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;"-> [SetOfType $ UnnamedCompositeType [("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;"-> [SetOfType $ UnnamedCompositeType [("a", typeInt)-> ,("a", typeInt)]]--> ,p "select pg_attrdef.adsrc from pg_attrdef;"-> [SetOfType $ UnnamedCompositeType [("adsrc", ScalarType "text")]]--> ,p "select a.adsrc from pg_attrdef a;"-> [SetOfType $ UnnamedCompositeType [("adsrc", ScalarType "text")]]--> ,p "select pg_attrdef.adsrc from pg_attrdef a;"-> [TypeError ("",1,1) (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;"-> [SetOfType $ UnnamedCompositeType [("a", typeInt)]]--select g.fn from fn() g---> ])--> ,testGroup "aggregates"-> (mapStatementType [-> p "select max(prorettype::int) from pg_proc;"-> [SetOfType $ UnnamedCompositeType [("max", typeInt)]]-> ])--> ,testGroup "simple wheres"-> (mapStatementType [-> p "select 1 from pg_type where true;"-> [SetOfType $ UnnamedCompositeType [("?column?", typeInt)]]-> ,p "select 1 from pg_type where 1;"-> [TypeError ("",1,1) ExpressionMustBeBool]-> ,p "select typname from pg_type where typbyval;"-> [SetOfType $ UnnamedCompositeType [("typname", ScalarType "name")]]-> ,p "select typname from pg_type where typtype = 'b';"-> [SetOfType $ UnnamedCompositeType [("typname", ScalarType "name")]]-> ,p "select typname from pg_type where what = 'b';"-> [TypeError ("",1,1) (UnrecognisedIdentifier "what")]-> ])--> ,testGroup "subqueries"-> (mapStatementType [-> 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'));"-> [SetOfType $ UnnamedCompositeType [("relvar_name",ScalarType "name")]]-> ,p "select relname from pg_class where relkind in ('r', 'v');"-> [SetOfType $ UnnamedCompositeType [("relname",ScalarType "name")]]-> ,p "select * from generate_series(1,7) g\n\-> \where g not in (select * from generate_series(3,5));"-> [SetOfType (UnnamedCompositeType [("g",ScalarType "int4")])]-> ])--insert--> ,testGroup "insert"-> (mapStatementInfo [-> p "insert into nope (a,b) values (c,d);"-> [DefaultStatementInfo (TypeError ("",1,1) (UnrecognisedRelation "nope"))]-> ,p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,2, 'a', 'b');"-> [InsertInfo "pg_attrdef"-> (UnnamedCompositeType [("adrelid",ScalarType "oid")-> ,("adnum",ScalarType "int2")-> ,("adbin",ScalarType "text")-> ,("adsrc",ScalarType "text")])]-> ,p "insert into pg_attrdef\n\-> \values (1,2, 'a', 'b');"-> [InsertInfo "pg_attrdef"-> (UnnamedCompositeType [("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');"-> [DefaultStatementInfo (TypeError ("",1,1) (UnrecognisedIdentifier "hello"))]-> ,p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,true, 'a', 'b');"-> [DefaultStatementInfo (TypeError ("",1,1) (IncompatibleTypes (ScalarType "int2") (ScalarType "bool")))]-> ,p "insert into pg_attrdef (adrelid,adnum,adbin,adsrc)\n\-> \values (1,true, 'a', 'b','c');"-> [DefaultStatementInfo (TypeError ("",1,1) WrongNumberOfColumns)]--> ])--> ,testGroup "update"-> (mapStatementInfo [-> p "update nope set a = 1;"-> [DefaultStatementInfo (TypeError ("",1,1) (UnrecognisedRelation "nope"))]-> ,p "update pg_attrdef set adsrc = '' where 1;"-> [DefaultStatementInfo (TypeError ("",1,1) ExpressionMustBeBool)]-> ,p "update pg_attrdef set (adbin,adsrc) = ('a','b','c');"-> [DefaultStatementInfo (TypeError ("",1,1) WrongNumberOfColumns)]-> ,p "update pg_attrdef set (adrelid,adsrc) = (true,'b');"-> [DefaultStatementInfo (TypeError ("",1,1) (IncompatibleTypes (ScalarType "oid") typeBool))]-> ,p "update pg_attrdef set (shmadrelid,adsrc) = ('a','b');"-> [DefaultStatementInfo (TypeError ("",1,1) (UnrecognisedIdentifier "shmadrelid"))]-> ,p "update pg_attrdef set adsrc='';"-> [UpdateInfo "pg_attrdef" (UnnamedCompositeType [("adsrc",ScalarType "text")])]-> ,p "update pg_attrdef set adsrc='' where 1=2;"-> [UpdateInfo "pg_attrdef" (UnnamedCompositeType [("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'));"-> [UpdateInfo "pg_attrdef" (UnnamedCompositeType [("adbin",ScalarType "text"),("adsrc",ScalarType "text")])]-> ])--> ,testGroup "delete"-> (mapStatementInfo [-> p "delete from nope;"-> [DefaultStatementInfo (TypeError ("",1,1) (UnrecognisedRelation "nope"))]-> ,p "delete from pg_attrdef where 1=2;"-> [DeleteInfo "pg_attrdef"]-> ,p "delete from pg_attrdef where 1;"-> [DefaultStatementInfo (TypeError ("",1,1) ExpressionMustBeBool)]-> ])--> ]-> where-> mapAttr = map $ uncurry checkAttrs-> p a b = (a,b)-> t a b c = (a,b,c)-> mapExprType = map $ uncurry $ checkExpressionType emptyScope-> mapStatementType = map $ uncurry checkStatementType-> mapStatementInfo = map $ uncurry checkStatementInfo-> mapExprScopeType = map (\(a,b,c) -> checkExpressionType b a c)-> makeScope l = scopeReplaceIds defaultScope (map (second (\a->(a,[]))) l) []-> mapStatementTypeScope = map (\(a,b,c) -> checkStatementTypeScope b a c)--> checkAttrs :: String -> [Message] -> Test.Framework.Test-> checkAttrs src msgs = testCase ("check " ++ src) $ do-> let ast = case parseSql src of-> Left er -> error $ show er-> Right l -> l-> msgs1 = checkAst ast-> assertEqual ("check " ++ src) msgs msgs1--> checkExpressionType :: Scope -> String -> Type -> Test.Framework.Test-> checkExpressionType scope src typ = testCase ("typecheck " ++ src) $-> assertEqual ("typecheck " ++ src) typ (parseAndGetExpressionType scope src)--> checkStatementType :: String -> [Type] -> Test.Framework.Test-> checkStatementType src typ = testCase ("typecheck " ++ src) $-> assertEqual ("typecheck " ++ src) typ (parseAndGetType src)--> checkStatementTypeScope :: Scope -> String -> [Type] -> Test.Framework.Test-> checkStatementTypeScope scope src typ = testCase ("typecheck " ++ src) $-> assertEqual ("typecheck " ++ src) typ (parseAndGetTypeScope scope src)--> checkStatementInfo :: String -> [StatementInfo] -> Test.Framework.Test-> checkStatementInfo src typ = testCase ("typecheck " ++ src) $-> assertEqual ("typecheck " ++ src) typ (parseAndGetInfo src)--> parseAndGetInfo :: String -> [StatementInfo]-> parseAndGetInfo src =-> let ast = case parseSql src of-> Left er -> error $ show er-> Right l -> l-> in getStatementsInfo ast---> parseAndGetType :: String -> [Type]-> parseAndGetType src =-> let ast = case parseSql src of-> Left er -> error $ show er-> Right l -> l-> in getStatementsType ast--> parseAndGetTypeScope :: Scope -> String -> [Type]-> parseAndGetTypeScope scope src =-> let ast = case parseSql src of-> Left er -> error $ show er-> Right l -> l-> in getStatementsTypeScope scope ast---> parseAndGetExpressionType :: Scope -> String -> Type-> parseAndGetExpressionType scope src =-> let ast = case parseExpression src of-> Left er -> error $ show er-> Right l -> l-> in getExpressionType scope ast
− Database/HsSqlPpp/AstUtils.lhs
@@ -1,396 +0,0 @@-Copyright 2009 Jake Wheat--This file contains a bunch of small low level utilities to help with-type checking.--random implementation note:-If you see one of these: TypeList [] - and don't get it - is used to-represent a variety of different things, like node type checked ok-when the node doesn't produce a type but can produce a type error,-etc.. This is just a hack that will be changed soon.--> module Database.HsSqlPpp.AstUtils where--> import Data.Maybe-> import Data.List-> import Control.Monad.Error--> import Database.HsSqlPpp.TypeType-> import Database.HsSqlPpp.Scope-> import Database.HsSqlPpp.DefaultScope--================================================================================--= 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--this is why binary @ operator isn't currently supported--> data OperatorType = BinaryOp | PrefixOp | PostfixOp-> deriving (Eq,Show)--> getOperatorType :: String -> OperatorType-> getOperatorType s = case () of-> _ | any (\(x,_,_) -> x == s) (scopeBinaryOperators defaultScope) ->-> BinaryOp-> | any (\(x,_,_) -> x == s ||-> (x=="-" && s=="u-"))-> (scopePrefixOperators defaultScope) ->-> PrefixOp-> | any (\(x,_,_) -> x == s) (scopePostfixOperators defaultScope) ->-> PostfixOp-> | s `elem` ["!and", "!or","!like"] -> BinaryOp-> | s `elem` ["!not"] -> PrefixOp-> | s `elem` ["!isNull", "!isNotNull"] -> PostfixOp-> | otherwise ->-> error $ "don't know flavour of operator " ++ s--================================================================================--= type checking utils--The way most of the error handling works is all type errors live as-types and get returned as types, instead of e.g. using exceptions or-Either. All the type checking routines for each node should be in the-following form, or equivalent:--1. Take the node types of the sub nodes (e.g. the args for a function-invocation).--2. Check each type for a type error, pass any errors on as the type for-this node - so type errors filter up to the top level statements in-this way.--3. Check each type for unknown - this represents some type checking-which hasn't been coded. All the type calculations give up completely-when they come across an unknown type and just propagate unknown.--4a. If the node has no nodeType rule, it uses the default one which-just propagates the types of its subnodes. This sometimes results in-them having an uncannily accurate type, and sometimes a really weird-type, rather than returning unknown.--4b. If the node has a nodeType rule, calculate the actual type we want-for this node using the subnode types which we've already checked for-unknowns and errors. Any new type errors become this node's type, or-otherwise it is set to the calculated type.--Using laziness, in code this usually looks something like--thisNodeType = checkErrors [@subnodea.nodeType- ,@subnodeb.nodetype] calcThisNodeType-where- calcThisNodeType = some code referring to @subnodea.nodeType- and @subnodeb.nodetype--The checkErrors function, and its auxiliary unkErr, does the error and-unknown propagation.--Once the annotations are done properly, type errors won't need to rise-up the tree like this.--== checkErrors--runs through the types in the first list looking for type errors or-unknowns, if it finds any, return them, else return the second-argument. See unkErr below for exactly how it finds errors and-unknowns. It will only return errors from the first type containing-errors, which might need looking at when the focus is on good error-messages.--> checkErrors :: [Type] -> Type -> Type-> checkErrors (t:ts) r = case unkErr t of-> Just e -> e-> Nothing -> checkErrors ts r-> checkErrors [] r = r--takes a type and returns any type errors, or if no errors, unknowns,-returns nothing if it doesn't find any type errors or unknowns. Looks-at the immediate type, or inside the first level if passed a type-list or unnamedcompositetype.--> unkErr :: Type -> Maybe Type-> unkErr t =-> case t of-> a@(TypeError _ _) -> Just a-> UnknownType -> Just UnknownType-> TypeList l -> doTypeList l-> UnnamedCompositeType c -> doTypeList (map snd c)-> _ -> Nothing-> where-> -- run through the type list, if there are any errors, collect-> -- them all into a list-> -- otherwise, if there are any unknowns, then the type is-> -- unknown-> -- otherwise, return nothing-> doTypeList ts =-> let unks = filter (\u -> case u of-> UnknownType -> True-> _ -> False) ts-> errs = filter (\u -> case u of-> TypeError _ _ -> True-> _ -> False) ts-> in case () of-> _ | length errs > 0 ->-> Just $ case () of-> _ | length errs == 1 -> head errs-> | otherwise -> TypeList errs-> | length unks > 0 -> Just UnknownType-> | otherwise -> Nothing--================================================================================--= basic types--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.--=== 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"]-> bigIntNames = ["int8", "bigint"]-> numericNames = ["numeric", "decimal"]-> float4Names = ["real", "float4"]-> float8Names = ["double precision", "float"]-> varcharNames = ["character varying", "varchar"]-> charNames = ["character", "char"]-> boolNames = ["boolean", "bool"]--> checkTypeExists :: Scope -> MySourcePos -> Type -> Type-> checkTypeExists scope sp t =-> if t `elem` scopeTypes scope-> then TypeList [] -- this works with the checkErrors function-> else TypeError sp (UnknownTypeError t)--> lookupTypeByName :: Scope -> MySourcePos -> String -> Type-> lookupTypeByName scope sp name =-> case lookup name (scopeTypeNames scope) of-> Just t -> t-> Nothing -> TypeError sp (UnknownTypeName name)---================================================================================--Internal errors--TODO: work out monad transformers and try to use these. Want to throw-an internal error when a programming error is detected (instead of-e.g. letting the haskell runtime throw a pattern match failure), then-catch it in the top level type check routines in ast.ag, convert it to-a regular either style error, all without dropping into IO.--This isn't used at the moment.--> data TInternalError = TInternalError String-> deriving (Eq, Ord, Show)--> instance Error TInternalError where-> noMsg = TInternalError "oh noes!"-> strMsg = TInternalError--================================================================================--types for the keyword operators, for use in findCallMatch. Not sure-where these should live but probably not here.--> keywordOperatorTypes :: [(String,[Type],Type)]-> keywordOperatorTypes = [-> ("!and", [typeBool, typeBool], typeBool)-> ,("!or", [typeBool, typeBool], typeBool)-> ,("!like", [ScalarType "text", ScalarType "text"], typeBool)-> ,("!not", [typeBool], typeBool)-> ,("!isNull", [Pseudo AnyElement], typeBool)-> ,("!isNotNull", [Pseudo AnyElement], typeBool)-> ,("!arrayCtor", [Pseudo AnyElement], Pseudo AnyArray) -- not quite right,-> -- needs variadic support-> -- currently works via a special case-> -- in the type checking code-> ,("!between", [Pseudo AnyElement-> ,Pseudo AnyElement-> ,Pseudo AnyElement], Pseudo AnyElement)-> ,("!substring", [ScalarType "text",typeInt,typeInt], ScalarType "text")-> ,("!arraySub", [Pseudo AnyArray,typeInt], Pseudo AnyElement)-> ]--special functions, stuck in here at random also--> specialFunctionTypes :: [(String,[Type],Type)]-> specialFunctionTypes = [-> ("coalesce", [Pseudo AnyElement],-> Pseudo AnyElement) -- needs variadic support to be correct,-> -- uses special case in type checking-> -- currently-> ,("nullif", [Pseudo AnyElement, Pseudo AnyElement], Pseudo AnyElement)-> ,("greatest", [Pseudo AnyElement], Pseudo AnyElement) --variadic, blah-> ,("least", [Pseudo AnyElement], Pseudo AnyElement) --also-> ]---================================================================================--utilities for working with Types--> isArrayType :: Type -> Bool-> isArrayType (ArrayType _) = True-> isArrayType _ = False--> unwrapTypeList :: Type -> [Type]-> unwrapTypeList (TypeList ts) = ts-> unwrapTypeList x = error $ "internal error: can't get types from list " ++ show x--> unwrapArray :: Type -> Type-> unwrapArray (ArrayType t) = t-> unwrapArray x = error $ "internal error: can't get types from non array " ++ show x--> unwrapSetOfComposite :: Type -> Type-> unwrapSetOfComposite (SetOfType a@(UnnamedCompositeType _)) = a-> unwrapSetOfComposite x = error $ "internal error: tried to unwrapSetOfComposite on " ++ show x--> unwrapSetOf :: Type -> Type-> unwrapSetOf (SetOfType a) = a-> unwrapSetOf x = error $ "internal error: tried to unwrapSetOf on " ++ show x--> unwrapComposite :: Type -> [(String,Type)]-> unwrapComposite (UnnamedCompositeType a) = a-> unwrapComposite x = error $ "internal error: cannot unwrapComposite on " ++ show x--> consComposite :: (String,Type) -> Type -> Type-> consComposite l (UnnamedCompositeType a) =-> UnnamedCompositeType (l:a)-> consComposite a b = error $ "internal error: called consComposite on " ++ show (a,b)--> unwrapRowCtor :: Type -> [Type]-> unwrapRowCtor (RowCtor a) = a-> unwrapRowCtor x = error $ "internal error: cannot unwrapRowCtor on " ++ show x--================================================================================--message stuff, used by the continue in loop checking, will be-repurposed once the type checking is complete and lint-style checking-is introduced.--> data Message = Error MySourcePos MessageStuff-> | Warning MySourcePos MessageStuff-> | Notice MySourcePos MessageStuff-> deriving (Eq)->-> data MessageStuff = ContinueNotInLoop-> | CustomMessage String-> deriving (Eq,Show)->-> instance Show Message where-> show = showMessage->-> showMessage :: Message -> String-> showMessage m = case m of-> Error sp s -> showit "Error" sp s-> Warning sp s -> showit "Warning" sp s-> Notice sp s -> showit "Notice" sp s-> where-> showit lev (fn,l,c) s = lev ++ "\n" ++ fn ++ ":"-> ++ show l ++ ":" ++ show c ++ ":\n"-> ++ show s ++ "\n"->
− Database/HsSqlPpp/DBAccess.lhs
@@ -1,57 +0,0 @@-Copyright 2009 Jake Wheat--This file contains a few (almost pointlessly) lightweight wrappers-around hdbc for running commands and queries.--> module Database.HsSqlPpp.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 {-args-} = do-> run conn query [] {- $ map toSql args-}-> 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 [] -- $ map sToSql args-> 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/DatabaseLoader.lhs
@@ -1,202 +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 start adding token-position information to the ast, Then when error (and notice, etc.)-messages come back from the database when loading the sql, can show-the pretty printed sql with the error pos highlighted, as well as-providing the original position from the sql file.--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 massive mess.--> module Database.HsSqlPpp.DatabaseLoader 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-> import Database.HsSqlPpp.Ast-> import Database.HsSqlPpp.DBAccess--> loadIntoDatabase :: String -> String -> StatementList -> IO ()-> loadIntoDatabase dbName fn ast =-> withConn ("dbname=" ++ dbName) $ \conn -> do-> loadPlpgsqlIntoDatabase conn-> mapM_ (\st ->-> loadStatement conn st-> >> putStr ".") (filterStatements ast)-> where-> loadStatement conn (srcp, st) = case st of-> Skipit -> return ()-> VanillaStatement vs ->-> handleError fn srcp vs (runSqlCommand conn-> (printSql [(srcp,vs)]))-> CopyStdin a b -> runCopy conn a b srcp-> --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 (\((xsrcp, x),(_,y)) ->-> case (x,y) of-> (a@(Copy _ _ Stdin), b@(CopyData _)) -> (xsrcp,CopyStdin a b)-> (CopyData _, _) -> (xsrcp, Skipit)-> (vs,_) -> (xsrcp, VanillaStatement vs))-> statementWithNextStatement-> where-> statementWithNextStatement =-> zip sts (tail sts ++ [(("",0,0), NullStatement)])-> runCopy conn a b srcp = case (a,b) of-> (Copy tb cl Stdin, CopyData s) ->-> withTemporaryFile (\tfn -> do-> writeFile tfn s-> tfn1 <- canonicalizePath tfn-> loadStatement conn-> (srcp, 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 Database.HsSqlPpp.Ast.Statement Database.HsSqlPpp.Ast.Statement-> | Skipit-> | VanillaStatement Database.HsSqlPpp.Ast.Statement--================================================================================--= 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-instantion 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) -> Database.HsSqlPpp.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/DatabaseLoaderTests.lhs
@@ -1,34 +0,0 @@-#!/usr/bin/env runghc--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.DatabaseLoaderTests (databaseLoaderTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Database.HsSqlPpp.DatabaseLoader--> databaseLoaderTests :: Test.Framework.Test-> 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/Dbms/DBAccess.lhs view
@@ -0,0 +1,59 @@+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 view
@@ -0,0 +1,212 @@+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 start adding token+position information to the ast, Then when error (and notice, etc.)+messages come back from the database when loading the sql, can show+the pretty printed sql with the error pos highlighted, as well as+providing the original position from the sql file.++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 massive 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.TypeChecking.Ast as Ast+> import Database.HsSqlPpp.Dbms.DBAccess++> 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 ->+> handleError fn ("",0::Int,0::Int) vs (runSqlCommand conn+> (printSql [vs]))+> CopyStdin a b -> runCopy conn a b ("",0::Int,0::Int)+> --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++================================================================================++= 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/DefaultScope.hs
@@ -1,5 +0,0 @@-module Database.HsSqlPpp.DefaultScope where-import Database.HsSqlPpp.TypeType-import Database.HsSqlPpp.Scope-defaultScope :: Scope-defaultScope = Scope {scopeTypes = [ArrayType (ScalarType "abstime"),ScalarType "abstime",ArrayType (ScalarType "aclitem"),ScalarType "aclitem",Pseudo Any,Pseudo AnyArray,Pseudo AnyElement,Pseudo AnyEnum,Pseudo AnyNonArray,ArrayType (ScalarType "bit"),ScalarType "bit",ArrayType (ScalarType "bool"),ScalarType "bool",ArrayType (ScalarType "box"),ScalarType "box",ArrayType (ScalarType "bpchar"),ScalarType "bpchar",ArrayType (ScalarType "bytea"),ScalarType "bytea",ArrayType (ScalarType "char"),ScalarType "char",ArrayType (ScalarType "cid"),ScalarType "cid",ArrayType (ScalarType "cidr"),ScalarType "cidr",ArrayType (ScalarType "circle"),ScalarType "circle",ArrayType (Pseudo Cstring),Pseudo Cstring,ArrayType (ScalarType "date"),ScalarType "date",ArrayType (ScalarType "float4"),ScalarType "float4",ArrayType (ScalarType "float8"),ScalarType "float8",ArrayType (ScalarType "gtsvector"),ScalarType "gtsvector",ArrayType (ScalarType "inet"),ScalarType "inet",ArrayType (ScalarType "int2"),ScalarType "int2",ArrayType (ScalarType "int2vector"),ScalarType "int2vector",ArrayType (ScalarType "int4"),ScalarType "int4",ArrayType (ScalarType "int8"),ScalarType "int8",Pseudo Internal,ArrayType (ScalarType "interval"),ScalarType "interval",Pseudo LanguageHandler,ArrayType (ScalarType "line"),ScalarType "line",ArrayType (ScalarType "lseg"),ScalarType "lseg",ArrayType (ScalarType "macaddr"),ScalarType "macaddr",ArrayType (ScalarType "money"),ScalarType "money",ArrayType (ScalarType "name"),ScalarType "name",ArrayType (ScalarType "numeric"),ScalarType "numeric",ArrayType (ScalarType "oid"),ScalarType "oid",ArrayType (ScalarType "oidvector"),ScalarType "oidvector",Pseudo Opaque,ArrayType (ScalarType "path"),ScalarType "path",CompositeType "pg_aggregate",CompositeType "pg_am",CompositeType "pg_amop",CompositeType "pg_amproc",CompositeType "pg_attrdef",CompositeType "pg_attribute",CompositeType "pg_auth_members",CompositeType "pg_authid",CompositeType "pg_cast",CompositeType "pg_class",CompositeType "pg_constraint",CompositeType "pg_conversion",CompositeType "pg_cursors",CompositeType "pg_database",CompositeType "pg_depend",CompositeType "pg_description",CompositeType "pg_enum",CompositeType "pg_foreign_data_wrapper",CompositeType "pg_foreign_server",CompositeType "pg_group",CompositeType "pg_index",CompositeType "pg_indexes",CompositeType "pg_inherits",CompositeType "pg_language",CompositeType "pg_largeobject",CompositeType "pg_listener",CompositeType "pg_locks",CompositeType "pg_namespace",CompositeType "pg_opclass",CompositeType "pg_operator",CompositeType "pg_opfamily",CompositeType "pg_pltemplate",CompositeType "pg_prepared_statements",CompositeType "pg_prepared_xacts",CompositeType "pg_proc",CompositeType "pg_rewrite",CompositeType "pg_roles",CompositeType "pg_rules",CompositeType "pg_settings",CompositeType "pg_shadow",CompositeType "pg_shdepend",CompositeType "pg_shdescription",CompositeType "pg_stat_activity",CompositeType "pg_stat_all_indexes",CompositeType "pg_stat_all_tables",CompositeType "pg_stat_bgwriter",CompositeType "pg_stat_database",CompositeType "pg_stat_sys_indexes",CompositeType "pg_stat_sys_tables",CompositeType "pg_stat_user_functions",CompositeType "pg_stat_user_indexes",CompositeType "pg_stat_user_tables",CompositeType "pg_statio_all_indexes",CompositeType "pg_statio_all_sequences",CompositeType "pg_statio_all_tables",CompositeType "pg_statio_sys_indexes",CompositeType "pg_statio_sys_sequences",CompositeType "pg_statio_sys_tables",CompositeType "pg_statio_user_indexes",CompositeType "pg_statio_user_sequences",CompositeType "pg_statio_user_tables",CompositeType "pg_statistic",CompositeType "pg_stats",CompositeType "pg_tables",CompositeType "pg_tablespace",CompositeType "pg_timezone_abbrevs",CompositeType "pg_timezone_names",CompositeType "pg_trigger",CompositeType "pg_ts_config",CompositeType "pg_ts_config_map",CompositeType "pg_ts_dict",CompositeType "pg_ts_parser",CompositeType "pg_ts_template",CompositeType "pg_type",CompositeType "pg_user",CompositeType "pg_user_mapping",CompositeType "pg_user_mappings",CompositeType "pg_views",ArrayType (ScalarType "point"),ScalarType "point",ArrayType (ScalarType "polygon"),ScalarType "polygon",ArrayType (Pseudo Record),Pseudo Record,ArrayType (ScalarType "refcursor"),ScalarType "refcursor",ArrayType (ScalarType "regclass"),ScalarType "regclass",ArrayType (ScalarType "regconfig"),ScalarType "regconfig",ArrayType (ScalarType "regdictionary"),ScalarType "regdictionary",ArrayType (ScalarType "regoper"),ScalarType "regoper",ArrayType (ScalarType "regoperator"),ScalarType "regoperator",ArrayType (ScalarType "regproc"),ScalarType "regproc",ArrayType (ScalarType "regprocedure"),ScalarType "regprocedure",ArrayType (ScalarType "regtype"),ScalarType "regtype",ArrayType (ScalarType "reltime"),ScalarType "reltime",ScalarType "smgr",ArrayType (ScalarType "text"),ScalarType "text",ArrayType (ScalarType "tid"),ScalarType "tid",ArrayType (ScalarType "time"),ScalarType "time",ArrayType (ScalarType "timestamp"),ScalarType "timestamp",ArrayType (ScalarType "timestamptz"),ScalarType "timestamptz",ArrayType (ScalarType "timetz"),ScalarType "timetz",ArrayType (ScalarType "tinterval"),ScalarType "tinterval",Pseudo Trigger,ArrayType (ScalarType "tsquery"),ScalarType "tsquery",ArrayType (ScalarType "tsvector"),ScalarType "tsvector",ArrayType (ScalarType "txid_snapshot"),ScalarType "txid_snapshot",ScalarType "unknown",ArrayType (ScalarType "uuid"),ScalarType "uuid",ArrayType (ScalarType "varbit"),ScalarType "varbit",ArrayType (ScalarType "varchar"),ScalarType "varchar",Pseudo Void,ArrayType (ScalarType "xid"),ScalarType "xid",ArrayType (ScalarType "xml"),ScalarType "xml"], scopeTypeNames = [("_abstime",ArrayType (ScalarType "abstime")),("abstime",ScalarType "abstime"),("_aclitem",ArrayType (ScalarType "aclitem")),("aclitem",ScalarType "aclitem"),("any",Pseudo Any),("anyarray",Pseudo AnyArray),("anyelement",Pseudo AnyElement),("anyenum",Pseudo AnyEnum),("anynonarray",Pseudo AnyNonArray),("_bit",ArrayType (ScalarType "bit")),("bit",ScalarType "bit"),("_bool",ArrayType (ScalarType "bool")),("bool",ScalarType "bool"),("_box",ArrayType (ScalarType "box")),("box",ScalarType "box"),("_bpchar",ArrayType (ScalarType "bpchar")),("bpchar",ScalarType "bpchar"),("_bytea",ArrayType (ScalarType "bytea")),("bytea",ScalarType "bytea"),("_char",ArrayType (ScalarType "char")),("char",ScalarType "char"),("_cid",ArrayType (ScalarType "cid")),("cid",ScalarType "cid"),("_cidr",ArrayType (ScalarType "cidr")),("cidr",ScalarType "cidr"),("_circle",ArrayType (ScalarType "circle")),("circle",ScalarType "circle"),("_cstring",ArrayType (Pseudo Cstring)),("cstring",Pseudo Cstring),("_date",ArrayType (ScalarType "date")),("date",ScalarType "date"),("_float4",ArrayType (ScalarType "float4")),("float4",ScalarType "float4"),("_float8",ArrayType (ScalarType "float8")),("float8",ScalarType "float8"),("_gtsvector",ArrayType (ScalarType "gtsvector")),("gtsvector",ScalarType "gtsvector"),("_inet",ArrayType (ScalarType "inet")),("inet",ScalarType "inet"),("_int2",ArrayType (ScalarType "int2")),("int2",ScalarType "int2"),("_int2vector",ArrayType (ScalarType "int2vector")),("int2vector",ScalarType "int2vector"),("_int4",ArrayType (ScalarType "int4")),("int4",ScalarType "int4"),("_int8",ArrayType (ScalarType "int8")),("int8",ScalarType "int8"),("internal",Pseudo Internal),("_interval",ArrayType (ScalarType "interval")),("interval",ScalarType "interval"),("language_handler",Pseudo LanguageHandler),("_line",ArrayType (ScalarType "line")),("line",ScalarType "line"),("_lseg",ArrayType (ScalarType "lseg")),("lseg",ScalarType "lseg"),("_macaddr",ArrayType (ScalarType "macaddr")),("macaddr",ScalarType "macaddr"),("_money",ArrayType (ScalarType "money")),("money",ScalarType "money"),("_name",ArrayType (ScalarType "name")),("name",ScalarType "name"),("_numeric",ArrayType (ScalarType "numeric")),("numeric",ScalarType "numeric"),("_oid",ArrayType (ScalarType "oid")),("oid",ScalarType "oid"),("_oidvector",ArrayType (ScalarType "oidvector")),("oidvector",ScalarType "oidvector"),("opaque",Pseudo Opaque),("_path",ArrayType (ScalarType "path")),("path",ScalarType "path"),("pg_aggregate",CompositeType "pg_aggregate"),("pg_am",CompositeType "pg_am"),("pg_amop",CompositeType "pg_amop"),("pg_amproc",CompositeType "pg_amproc"),("pg_attrdef",CompositeType "pg_attrdef"),("pg_attribute",CompositeType "pg_attribute"),("pg_auth_members",CompositeType "pg_auth_members"),("pg_authid",CompositeType "pg_authid"),("pg_cast",CompositeType "pg_cast"),("pg_class",CompositeType "pg_class"),("pg_constraint",CompositeType "pg_constraint"),("pg_conversion",CompositeType "pg_conversion"),("pg_cursors",CompositeType "pg_cursors"),("pg_database",CompositeType "pg_database"),("pg_depend",CompositeType "pg_depend"),("pg_description",CompositeType "pg_description"),("pg_enum",CompositeType "pg_enum"),("pg_foreign_data_wrapper",CompositeType "pg_foreign_data_wrapper"),("pg_foreign_server",CompositeType "pg_foreign_server"),("pg_group",CompositeType "pg_group"),("pg_index",CompositeType "pg_index"),("pg_indexes",CompositeType "pg_indexes"),("pg_inherits",CompositeType "pg_inherits"),("pg_language",CompositeType "pg_language"),("pg_largeobject",CompositeType "pg_largeobject"),("pg_listener",CompositeType "pg_listener"),("pg_locks",CompositeType "pg_locks"),("pg_namespace",CompositeType "pg_namespace"),("pg_opclass",CompositeType "pg_opclass"),("pg_operator",CompositeType "pg_operator"),("pg_opfamily",CompositeType "pg_opfamily"),("pg_pltemplate",CompositeType "pg_pltemplate"),("pg_prepared_statements",CompositeType "pg_prepared_statements"),("pg_prepared_xacts",CompositeType "pg_prepared_xacts"),("pg_proc",CompositeType "pg_proc"),("pg_rewrite",CompositeType "pg_rewrite"),("pg_roles",CompositeType "pg_roles"),("pg_rules",CompositeType "pg_rules"),("pg_settings",CompositeType "pg_settings"),("pg_shadow",CompositeType "pg_shadow"),("pg_shdepend",CompositeType "pg_shdepend"),("pg_shdescription",CompositeType "pg_shdescription"),("pg_stat_activity",CompositeType "pg_stat_activity"),("pg_stat_all_indexes",CompositeType "pg_stat_all_indexes"),("pg_stat_all_tables",CompositeType "pg_stat_all_tables"),("pg_stat_bgwriter",CompositeType "pg_stat_bgwriter"),("pg_stat_database",CompositeType "pg_stat_database"),("pg_stat_sys_indexes",CompositeType "pg_stat_sys_indexes"),("pg_stat_sys_tables",CompositeType "pg_stat_sys_tables"),("pg_stat_user_functions",CompositeType "pg_stat_user_functions"),("pg_stat_user_indexes",CompositeType "pg_stat_user_indexes"),("pg_stat_user_tables",CompositeType "pg_stat_user_tables"),("pg_statio_all_indexes",CompositeType "pg_statio_all_indexes"),("pg_statio_all_sequences",CompositeType "pg_statio_all_sequences"),("pg_statio_all_tables",CompositeType "pg_statio_all_tables"),("pg_statio_sys_indexes",CompositeType "pg_statio_sys_indexes"),("pg_statio_sys_sequences",CompositeType "pg_statio_sys_sequences"),("pg_statio_sys_tables",CompositeType "pg_statio_sys_tables"),("pg_statio_user_indexes",CompositeType "pg_statio_user_indexes"),("pg_statio_user_sequences",CompositeType "pg_statio_user_sequences"),("pg_statio_user_tables",CompositeType "pg_statio_user_tables"),("pg_statistic",CompositeType "pg_statistic"),("pg_stats",CompositeType "pg_stats"),("pg_tables",CompositeType "pg_tables"),("pg_tablespace",CompositeType "pg_tablespace"),("pg_timezone_abbrevs",CompositeType "pg_timezone_abbrevs"),("pg_timezone_names",CompositeType "pg_timezone_names"),("pg_trigger",CompositeType "pg_trigger"),("pg_ts_config",CompositeType "pg_ts_config"),("pg_ts_config_map",CompositeType "pg_ts_config_map"),("pg_ts_dict",CompositeType "pg_ts_dict"),("pg_ts_parser",CompositeType "pg_ts_parser"),("pg_ts_template",CompositeType "pg_ts_template"),("pg_type",CompositeType "pg_type"),("pg_user",CompositeType "pg_user"),("pg_user_mapping",CompositeType "pg_user_mapping"),("pg_user_mappings",CompositeType "pg_user_mappings"),("pg_views",CompositeType "pg_views"),("_point",ArrayType (ScalarType "point")),("point",ScalarType "point"),("_polygon",ArrayType (ScalarType "polygon")),("polygon",ScalarType "polygon"),("_record",ArrayType (Pseudo Record)),("record",Pseudo Record),("_refcursor",ArrayType (ScalarType "refcursor")),("refcursor",ScalarType "refcursor"),("_regclass",ArrayType (ScalarType "regclass")),("regclass",ScalarType "regclass"),("_regconfig",ArrayType (ScalarType "regconfig")),("regconfig",ScalarType "regconfig"),("_regdictionary",ArrayType (ScalarType "regdictionary")),("regdictionary",ScalarType "regdictionary"),("_regoper",ArrayType (ScalarType "regoper")),("regoper",ScalarType "regoper"),("_regoperator",ArrayType (ScalarType "regoperator")),("regoperator",ScalarType "regoperator"),("_regproc",ArrayType (ScalarType "regproc")),("regproc",ScalarType "regproc"),("_regprocedure",ArrayType (ScalarType "regprocedure")),("regprocedure",ScalarType "regprocedure"),("_regtype",ArrayType (ScalarType "regtype")),("regtype",ScalarType "regtype"),("_reltime",ArrayType (ScalarType "reltime")),("reltime",ScalarType "reltime"),("smgr",ScalarType "smgr"),("_text",ArrayType (ScalarType "text")),("text",ScalarType "text"),("_tid",ArrayType (ScalarType "tid")),("tid",ScalarType "tid"),("_time",ArrayType (ScalarType "time")),("time",ScalarType "time"),("_timestamp",ArrayType (ScalarType "timestamp")),("timestamp",ScalarType "timestamp"),("_timestamptz",ArrayType (ScalarType "timestamptz")),("timestamptz",ScalarType "timestamptz"),("_timetz",ArrayType (ScalarType "timetz")),("timetz",ScalarType "timetz"),("_tinterval",ArrayType (ScalarType "tinterval")),("tinterval",ScalarType "tinterval"),("trigger",Pseudo Trigger),("_tsquery",ArrayType (ScalarType "tsquery")),("tsquery",ScalarType "tsquery"),("_tsvector",ArrayType (ScalarType "tsvector")),("tsvector",ScalarType "tsvector"),("_txid_snapshot",ArrayType (ScalarType "txid_snapshot")),("txid_snapshot",ScalarType "txid_snapshot"),("unknown",ScalarType "unknown"),("_uuid",ArrayType (ScalarType "uuid")),("uuid",ScalarType "uuid"),("_varbit",ArrayType (ScalarType "varbit")),("varbit",ScalarType "varbit"),("_varchar",ArrayType (ScalarType "varchar")),("varchar",ScalarType "varchar"),("void",Pseudo Void),("_xid",ArrayType (ScalarType "xid")),("xid",ScalarType "xid"),("_xml",ArrayType (ScalarType "xml")),("xml",ScalarType "xml")], scopeDomainDefs = [], scopeCasts = [(ScalarType "int8",ScalarType "int2",AssignmentCastContext),(ScalarType "int8",ScalarType "int4",AssignmentCastContext),(ScalarType "int8",ScalarType "float4",ImplicitCastContext),(ScalarType "int8",ScalarType "float8",ImplicitCastContext),(ScalarType "int8",ScalarType "numeric",ImplicitCastContext),(ScalarType "int2",ScalarType "int8",ImplicitCastContext),(ScalarType "int2",ScalarType "int4",ImplicitCastContext),(ScalarType "int2",ScalarType "float4",ImplicitCastContext),(ScalarType "int2",ScalarType "float8",ImplicitCastContext),(ScalarType "int2",ScalarType "numeric",ImplicitCastContext),(ScalarType "int4",ScalarType "int8",ImplicitCastContext),(ScalarType "int4",ScalarType "int2",AssignmentCastContext),(ScalarType "int4",ScalarType "float4",ImplicitCastContext),(ScalarType "int4",ScalarType "float8",ImplicitCastContext),(ScalarType "int4",ScalarType "numeric",ImplicitCastContext),(ScalarType "float4",ScalarType "int8",AssignmentCastContext),(ScalarType "float4",ScalarType "int2",AssignmentCastContext),(ScalarType "float4",ScalarType "int4",AssignmentCastContext),(ScalarType "float4",ScalarType "float8",ImplicitCastContext),(ScalarType "float4",ScalarType "numeric",AssignmentCastContext),(ScalarType "float8",ScalarType "int8",AssignmentCastContext),(ScalarType "float8",ScalarType "int2",AssignmentCastContext),(ScalarType "float8",ScalarType "int4",AssignmentCastContext),(ScalarType "float8",ScalarType "float4",AssignmentCastContext),(ScalarType "float8",ScalarType "numeric",AssignmentCastContext),(ScalarType "numeric",ScalarType "int8",AssignmentCastContext),(ScalarType "numeric",ScalarType "int2",AssignmentCastContext),(ScalarType "numeric",ScalarType "int4",AssignmentCastContext),(ScalarType "numeric",ScalarType "float4",ImplicitCastContext),(ScalarType "numeric",ScalarType "float8",ImplicitCastContext),(ScalarType "int4",ScalarType "bool",ExplicitCastContext),(ScalarType "bool",ScalarType "int4",ExplicitCastContext),(ScalarType "int8",ScalarType "oid",ImplicitCastContext),(ScalarType "int2",ScalarType "oid",ImplicitCastContext),(ScalarType "int4",ScalarType "oid",ImplicitCastContext),(ScalarType "oid",ScalarType "int8",AssignmentCastContext),(ScalarType "oid",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regproc",ImplicitCastContext),(ScalarType "regproc",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regproc",ImplicitCastContext),(ScalarType "int2",ScalarType "regproc",ImplicitCastContext),(ScalarType "int4",ScalarType "regproc",ImplicitCastContext),(ScalarType "regproc",ScalarType "int8",AssignmentCastContext),(ScalarType "regproc",ScalarType "int4",AssignmentCastContext),(ScalarType "regproc",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "regprocedure",ScalarType "regproc",ImplicitCastContext),(ScalarType "oid",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "regprocedure",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "int2",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "int4",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "regprocedure",ScalarType "int8",AssignmentCastContext),(ScalarType "regprocedure",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regoper",ImplicitCastContext),(ScalarType "regoper",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regoper",ImplicitCastContext),(ScalarType "int2",ScalarType "regoper",ImplicitCastContext),(ScalarType "int4",ScalarType "regoper",ImplicitCastContext),(ScalarType "regoper",ScalarType "int8",AssignmentCastContext),(ScalarType "regoper",ScalarType "int4",AssignmentCastContext),(ScalarType "regoper",ScalarType "regoperator",ImplicitCastContext),(ScalarType "regoperator",ScalarType "regoper",ImplicitCastContext),(ScalarType "oid",ScalarType "regoperator",ImplicitCastContext),(ScalarType "regoperator",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regoperator",ImplicitCastContext),(ScalarType "int2",ScalarType "regoperator",ImplicitCastContext),(ScalarType "int4",ScalarType "regoperator",ImplicitCastContext),(ScalarType "regoperator",ScalarType "int8",AssignmentCastContext),(ScalarType "regoperator",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regclass",ImplicitCastContext),(ScalarType "regclass",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regclass",ImplicitCastContext),(ScalarType "int2",ScalarType "regclass",ImplicitCastContext),(ScalarType "int4",ScalarType "regclass",ImplicitCastContext),(ScalarType "regclass",ScalarType "int8",AssignmentCastContext),(ScalarType "regclass",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regtype",ImplicitCastContext),(ScalarType "regtype",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regtype",ImplicitCastContext),(ScalarType "int2",ScalarType "regtype",ImplicitCastContext),(ScalarType "int4",ScalarType "regtype",ImplicitCastContext),(ScalarType "regtype",ScalarType "int8",AssignmentCastContext),(ScalarType "regtype",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regconfig",ImplicitCastContext),(ScalarType "regconfig",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regconfig",ImplicitCastContext),(ScalarType "int2",ScalarType "regconfig",ImplicitCastContext),(ScalarType "int4",ScalarType "regconfig",ImplicitCastContext),(ScalarType "regconfig",ScalarType "int8",AssignmentCastContext),(ScalarType "regconfig",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "regdictionary",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "int2",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "int4",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "regdictionary",ScalarType "int8",AssignmentCastContext),(ScalarType "regdictionary",ScalarType "int4",AssignmentCastContext),(ScalarType "text",ScalarType "regclass",ImplicitCastContext),(ScalarType "varchar",ScalarType "regclass",ImplicitCastContext),(ScalarType "text",ScalarType "bpchar",ImplicitCastContext),(ScalarType "text",ScalarType "varchar",ImplicitCastContext),(ScalarType "bpchar",ScalarType "text",ImplicitCastContext),(ScalarType "bpchar",ScalarType "varchar",ImplicitCastContext),(ScalarType "varchar",ScalarType "text",ImplicitCastContext),(ScalarType "varchar",ScalarType "bpchar",ImplicitCastContext),(ScalarType "char",ScalarType "text",ImplicitCastContext),(ScalarType "char",ScalarType "bpchar",AssignmentCastContext),(ScalarType "char",ScalarType "varchar",AssignmentCastContext),(ScalarType "name",ScalarType "text",ImplicitCastContext),(ScalarType "name",ScalarType "bpchar",AssignmentCastContext),(ScalarType "name",ScalarType "varchar",AssignmentCastContext),(ScalarType "text",ScalarType "char",AssignmentCastContext),(ScalarType "bpchar",ScalarType "char",AssignmentCastContext),(ScalarType "varchar",ScalarType "char",AssignmentCastContext),(ScalarType "text",ScalarType "name",ImplicitCastContext),(ScalarType "bpchar",ScalarType "name",ImplicitCastContext),(ScalarType "varchar",ScalarType "name",ImplicitCastContext),(ScalarType "char",ScalarType "int4",ExplicitCastContext),(ScalarType "int4",ScalarType "char",ExplicitCastContext),(ScalarType "abstime",ScalarType "date",AssignmentCastContext),(ScalarType "abstime",ScalarType "time",AssignmentCastContext),(ScalarType "abstime",ScalarType "timestamp",ImplicitCastContext),(ScalarType "abstime",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "reltime",ScalarType "interval",ImplicitCastContext),(ScalarType "date",ScalarType "timestamp",ImplicitCastContext),(ScalarType "date",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "time",ScalarType "interval",ImplicitCastContext),(ScalarType "time",ScalarType "timetz",ImplicitCastContext),(ScalarType "timestamp",ScalarType "abstime",AssignmentCastContext),(ScalarType "timestamp",ScalarType "date",AssignmentCastContext),(ScalarType "timestamp",ScalarType "time",AssignmentCastContext),(ScalarType "timestamp",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "timestamptz",ScalarType "abstime",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "date",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "time",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "timestamp",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "timetz",AssignmentCastContext),(ScalarType "interval",ScalarType "reltime",AssignmentCastContext),(ScalarType "interval",ScalarType "time",AssignmentCastContext),(ScalarType "timetz",ScalarType "time",AssignmentCastContext),(ScalarType "int4",ScalarType "abstime",ExplicitCastContext),(ScalarType "abstime",ScalarType "int4",ExplicitCastContext),(ScalarType "int4",ScalarType "reltime",ExplicitCastContext),(ScalarType "reltime",ScalarType "int4",ExplicitCastContext),(ScalarType "lseg",ScalarType "point",ExplicitCastContext),(ScalarType "path",ScalarType "point",ExplicitCastContext),(ScalarType "path",ScalarType "polygon",AssignmentCastContext),(ScalarType "box",ScalarType "point",ExplicitCastContext),(ScalarType "box",ScalarType "lseg",ExplicitCastContext),(ScalarType "box",ScalarType "polygon",AssignmentCastContext),(ScalarType "box",ScalarType "circle",ExplicitCastContext),(ScalarType "polygon",ScalarType "point",ExplicitCastContext),(ScalarType "polygon",ScalarType "path",AssignmentCastContext),(ScalarType "polygon",ScalarType "box",ExplicitCastContext),(ScalarType "polygon",ScalarType "circle",ExplicitCastContext),(ScalarType "circle",ScalarType "point",ExplicitCastContext),(ScalarType "circle",ScalarType "box",ExplicitCastContext),(ScalarType "circle",ScalarType "polygon",ExplicitCastContext),(ScalarType "cidr",ScalarType "inet",ImplicitCastContext),(ScalarType "inet",ScalarType "cidr",AssignmentCastContext),(ScalarType "bit",ScalarType "varbit",ImplicitCastContext),(ScalarType "varbit",ScalarType "bit",ImplicitCastContext),(ScalarType "int8",ScalarType "bit",ExplicitCastContext),(ScalarType "int4",ScalarType "bit",ExplicitCastContext),(ScalarType "bit",ScalarType "int8",ExplicitCastContext),(ScalarType "bit",ScalarType "int4",ExplicitCastContext),(ScalarType "cidr",ScalarType "text",AssignmentCastContext),(ScalarType "inet",ScalarType "text",AssignmentCastContext),(ScalarType "bool",ScalarType "text",AssignmentCastContext),(ScalarType "xml",ScalarType "text",AssignmentCastContext),(ScalarType "text",ScalarType "xml",ExplicitCastContext),(ScalarType "cidr",ScalarType "varchar",AssignmentCastContext),(ScalarType "inet",ScalarType "varchar",AssignmentCastContext),(ScalarType "bool",ScalarType "varchar",AssignmentCastContext),(ScalarType "xml",ScalarType "varchar",AssignmentCastContext),(ScalarType "varchar",ScalarType "xml",ExplicitCastContext),(ScalarType "cidr",ScalarType "bpchar",AssignmentCastContext),(ScalarType "inet",ScalarType "bpchar",AssignmentCastContext),(ScalarType "bool",ScalarType "bpchar",AssignmentCastContext),(ScalarType "xml",ScalarType "bpchar",AssignmentCastContext),(ScalarType "bpchar",ScalarType "xml",ExplicitCastContext),(ScalarType "bpchar",ScalarType "bpchar",ImplicitCastContext),(ScalarType "varchar",ScalarType "varchar",ImplicitCastContext),(ScalarType "time",ScalarType "time",ImplicitCastContext),(ScalarType "timestamp",ScalarType "timestamp",ImplicitCastContext),(ScalarType "timestamptz",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "interval",ScalarType "interval",ImplicitCastContext),(ScalarType "timetz",ScalarType "timetz",ImplicitCastContext),(ScalarType "bit",ScalarType "bit",ImplicitCastContext),(ScalarType "varbit",ScalarType "varbit",ImplicitCastContext),(ScalarType "numeric",ScalarType "numeric",ImplicitCastContext)], scopeTypeCategories = [(ScalarType "bool","B",True),(ScalarType "bytea","U",False),(ScalarType "char","S",False),(ScalarType "name","S",False),(ScalarType "int8","N",False),(ScalarType "int2","N",False),(ScalarType "int2vector","A",False),(ScalarType "int4","N",False),(ScalarType "regproc","N",False),(ScalarType "text","S",True),(ScalarType "oid","N",True),(ScalarType "tid","U",False),(ScalarType "xid","U",False),(ScalarType "cid","U",False),(ScalarType "oidvector","A",False),(CompositeType "pg_type","C",False),(CompositeType "pg_attribute","C",False),(CompositeType "pg_proc","C",False),(CompositeType "pg_class","C",False),(ScalarType "xml","U",False),(ArrayType (ScalarType "xml"),"A",False),(ScalarType "smgr","U",False),(ScalarType "point","G",False),(ScalarType "lseg","G",False),(ScalarType "path","G",False),(ScalarType "box","G",False),(ScalarType "polygon","G",False),(ScalarType "line","G",False),(ArrayType (ScalarType "line"),"A",False),(ScalarType "float4","N",False),(ScalarType "float8","N",True),(ScalarType "abstime","D",False),(ScalarType "reltime","T",False),(ScalarType "tinterval","T",False),(ScalarType "unknown","X",False),(ScalarType "circle","G",False),(ArrayType (ScalarType "circle"),"A",False),(ScalarType "money","N",False),(ArrayType (ScalarType "money"),"A",False),(ScalarType "macaddr","U",False),(ScalarType "inet","I",True),(ScalarType "cidr","I",False),(ArrayType (ScalarType "bool"),"A",False),(ArrayType (ScalarType "bytea"),"A",False),(ArrayType (ScalarType "char"),"A",False),(ArrayType (ScalarType "name"),"A",False),(ArrayType (ScalarType "int2"),"A",False),(ArrayType (ScalarType "int2vector"),"A",False),(ArrayType (ScalarType "int4"),"A",False),(ArrayType (ScalarType "regproc"),"A",False),(ArrayType (ScalarType "text"),"A",False),(ArrayType (ScalarType "oid"),"A",False),(ArrayType (ScalarType "tid"),"A",False),(ArrayType (ScalarType "xid"),"A",False),(ArrayType (ScalarType "cid"),"A",False),(ArrayType (ScalarType "oidvector"),"A",False),(ArrayType (ScalarType "bpchar"),"A",False),(ArrayType (ScalarType "varchar"),"A",False),(ArrayType (ScalarType "int8"),"A",False),(ArrayType (ScalarType "point"),"A",False),(ArrayType (ScalarType "lseg"),"A",False),(ArrayType (ScalarType "path"),"A",False),(ArrayType (ScalarType "box"),"A",False),(ArrayType (ScalarType "float4"),"A",False),(ArrayType (ScalarType "float8"),"A",False),(ArrayType (ScalarType "abstime"),"A",False),(ArrayType (ScalarType "reltime"),"A",False),(ArrayType (ScalarType "tinterval"),"A",False),(ArrayType (ScalarType "polygon"),"A",False),(ScalarType "aclitem","U",False),(ArrayType (ScalarType "aclitem"),"A",False),(ArrayType (ScalarType "macaddr"),"A",False),(ArrayType (ScalarType "inet"),"A",False),(ArrayType (ScalarType "cidr"),"A",False),(ArrayType (Pseudo Cstring),"A",False),(ScalarType "bpchar","S",False),(ScalarType "varchar","S",False),(ScalarType "date","D",False),(ScalarType "time","D",False),(ScalarType "timestamp","D",False),(ArrayType (ScalarType "timestamp"),"A",False),(ArrayType (ScalarType "date"),"A",False),(ArrayType (ScalarType "time"),"A",False),(ScalarType "timestamptz","D",True),(ArrayType (ScalarType "timestamptz"),"A",False),(ScalarType "interval","T",True),(ArrayType (ScalarType "interval"),"A",False),(ArrayType (ScalarType "numeric"),"A",False),(ScalarType "timetz","D",False),(ArrayType (ScalarType "timetz"),"A",False),(ScalarType "bit","V",False),(ArrayType (ScalarType "bit"),"A",False),(ScalarType "varbit","V",True),(ArrayType (ScalarType "varbit"),"A",False),(ScalarType "numeric","N",False),(ScalarType "refcursor","U",False),(ArrayType (ScalarType "refcursor"),"A",False),(ScalarType "regprocedure","N",False),(ScalarType "regoper","N",False),(ScalarType "regoperator","N",False),(ScalarType "regclass","N",False),(ScalarType "regtype","N",False),(ArrayType (ScalarType "regprocedure"),"A",False),(ArrayType (ScalarType "regoper"),"A",False),(ArrayType (ScalarType "regoperator"),"A",False),(ArrayType (ScalarType "regclass"),"A",False),(ArrayType (ScalarType "regtype"),"A",False),(ScalarType "uuid","U",False),(ArrayType (ScalarType "uuid"),"A",False),(ScalarType "tsvector","U",False),(ScalarType "gtsvector","U",False),(ScalarType "tsquery","U",False),(ScalarType "regconfig","N",False),(ScalarType "regdictionary","N",False),(ArrayType (ScalarType "tsvector"),"A",False),(ArrayType (ScalarType "gtsvector"),"A",False),(ArrayType (ScalarType "tsquery"),"A",False),(ArrayType (ScalarType "regconfig"),"A",False),(ArrayType (ScalarType "regdictionary"),"A",False),(ScalarType "txid_snapshot","U",False),(ArrayType (ScalarType "txid_snapshot"),"A",False),(Pseudo Record,"P",False),(ArrayType (Pseudo Record),"P",False),(Pseudo Cstring,"P",False),(Pseudo Any,"P",False),(Pseudo AnyArray,"P",False),(Pseudo Void,"P",False),(Pseudo Trigger,"P",False),(Pseudo LanguageHandler,"P",False),(Pseudo Internal,"P",False),(Pseudo Opaque,"P",False),(Pseudo AnyElement,"P",False),(Pseudo AnyNonArray,"P",False),(Pseudo AnyEnum,"P",False),(CompositeType "pg_attrdef","C",False),(CompositeType "pg_constraint","C",False),(CompositeType "pg_inherits","C",False),(CompositeType "pg_index","C",False),(CompositeType "pg_operator","C",False),(CompositeType "pg_opfamily","C",False),(CompositeType "pg_opclass","C",False),(CompositeType "pg_am","C",False),(CompositeType "pg_amop","C",False),(CompositeType "pg_amproc","C",False),(CompositeType "pg_language","C",False),(CompositeType "pg_largeobject","C",False),(CompositeType "pg_aggregate","C",False),(CompositeType "pg_statistic","C",False),(CompositeType "pg_rewrite","C",False),(CompositeType "pg_trigger","C",False),(CompositeType "pg_listener","C",False),(CompositeType "pg_description","C",False),(CompositeType "pg_cast","C",False),(CompositeType "pg_enum","C",False),(CompositeType "pg_namespace","C",False),(CompositeType "pg_conversion","C",False),(CompositeType "pg_depend","C",False),(CompositeType "pg_database","C",False),(CompositeType "pg_tablespace","C",False),(CompositeType "pg_pltemplate","C",False),(CompositeType "pg_authid","C",False),(CompositeType "pg_auth_members","C",False),(CompositeType "pg_shdepend","C",False),(CompositeType "pg_shdescription","C",False),(CompositeType "pg_ts_config","C",False),(CompositeType "pg_ts_config_map","C",False),(CompositeType "pg_ts_dict","C",False),(CompositeType "pg_ts_parser","C",False),(CompositeType "pg_ts_template","C",False),(CompositeType "pg_foreign_data_wrapper","C",False),(CompositeType "pg_foreign_server","C",False),(CompositeType "pg_user_mapping","C",False),(CompositeType "pg_roles","C",False),(CompositeType "pg_shadow","C",False),(CompositeType "pg_group","C",False),(CompositeType "pg_user","C",False),(CompositeType "pg_rules","C",False),(CompositeType "pg_views","C",False),(CompositeType "pg_tables","C",False),(CompositeType "pg_indexes","C",False),(CompositeType "pg_stats","C",False),(CompositeType "pg_locks","C",False),(CompositeType "pg_cursors","C",False),(CompositeType "pg_prepared_xacts","C",False),(CompositeType "pg_prepared_statements","C",False),(CompositeType "pg_settings","C",False),(CompositeType "pg_timezone_abbrevs","C",False),(CompositeType "pg_timezone_names","C",False),(CompositeType "pg_stat_all_tables","C",False),(CompositeType "pg_stat_sys_tables","C",False),(CompositeType "pg_stat_user_tables","C",False),(CompositeType "pg_statio_all_tables","C",False),(CompositeType "pg_statio_sys_tables","C",False),(CompositeType "pg_statio_user_tables","C",False),(CompositeType "pg_stat_all_indexes","C",False),(CompositeType "pg_stat_sys_indexes","C",False),(CompositeType "pg_stat_user_indexes","C",False),(CompositeType "pg_statio_all_indexes","C",False),(CompositeType "pg_statio_sys_indexes","C",False),(CompositeType "pg_statio_user_indexes","C",False),(CompositeType "pg_statio_all_sequences","C",False),(CompositeType "pg_statio_sys_sequences","C",False),(CompositeType "pg_statio_user_sequences","C",False),(CompositeType "pg_stat_activity","C",False),(CompositeType "pg_stat_database","C",False),(CompositeType "pg_stat_user_functions","C",False),(CompositeType "pg_stat_bgwriter","C",False),(CompositeType "pg_user_mappings","C",False)], scopePrefixOperators = [("~",[ScalarType "int8"],ScalarType "int8"),("~",[ScalarType "int4"],ScalarType "int4"),("~",[ScalarType "int2"],ScalarType "int2"),("~",[ScalarType "bit"],ScalarType "bit"),("~",[ScalarType "inet"],ScalarType "inet"),("||/",[ScalarType "float8"],ScalarType "float8"),("|/",[ScalarType "float8"],ScalarType "float8"),("|",[ScalarType "tinterval"],ScalarType "abstime"),("@@",[ScalarType "circle"],ScalarType "point"),("@@",[ScalarType "lseg"],ScalarType "point"),("@@",[ScalarType "path"],ScalarType "point"),("@@",[ScalarType "polygon"],ScalarType "point"),("@@",[ScalarType "box"],ScalarType "point"),("@-@",[ScalarType "path"],ScalarType "float8"),("@-@",[ScalarType "lseg"],ScalarType "float8"),("@",[ScalarType "int8"],ScalarType "int8"),("@",[ScalarType "int4"],ScalarType "int4"),("@",[ScalarType "int2"],ScalarType "int2"),("@",[ScalarType "float8"],ScalarType "float8"),("@",[ScalarType "float4"],ScalarType "float4"),("@",[ScalarType "numeric"],ScalarType "numeric"),("?|",[ScalarType "line"],ScalarType "bool"),("?|",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "line"],ScalarType "bool"),("-",[ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "path"],ScalarType "int4"),("#",[ScalarType "polygon"],ScalarType "int4"),("!!",[ScalarType "int8"],ScalarType "numeric"),("!!",[ScalarType "tsquery"],ScalarType "tsquery")], scopePostfixOperators = [("!",[ScalarType "int8"],ScalarType "numeric")], scopeBinaryOperators = [("~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("~=",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~=",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("~<~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~<=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("||",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "text",ScalarType "text"],ScalarType "text"),("||",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("||",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("||",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("||",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("||",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("||",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("||",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("|>>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|>>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|>>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("|",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("|",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("|",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("|",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("^",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("^",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("@@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("@>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("@>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("@>",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("@>",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("?||",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?||",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?|",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?-|",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?-|",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?#",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("?#",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "box"],ScalarType "bool"),(">^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),(">>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">>",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),(">>",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),(">>",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),(">>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),(">=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">=",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),(">=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("=",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("=",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("=",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("=",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<@",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("<?>",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<>",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<>",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<>",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<>",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<>",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<>",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<>",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<>",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<>",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<>",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<>",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<>",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<>",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<>",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<>",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<>",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("<<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("<<",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("<<",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("<<",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<->",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("<#>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("<",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("/",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("/",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("/",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("/",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("/",[ScalarType "point",ScalarType "point"],ScalarType "point"),("/",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("/",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("/",[ScalarType "path",ScalarType "point"],ScalarType "path"),("/",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("/",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("/",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("/",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("/",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("/",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("/",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("-",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("-",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("-",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("-",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("-",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("-",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("-",[ScalarType "money",ScalarType "money"],ScalarType "money"),("-",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("-",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("-",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "path",ScalarType "point"],ScalarType "path"),("-",[ScalarType "point",ScalarType "point"],ScalarType "point"),("-",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("-",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("-",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("-",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("-",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("-",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("-",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("+",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("+",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("+",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("+",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("+",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("+",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("+",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("+",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "point",ScalarType "point"],ScalarType "point"),("+",[ScalarType "path",ScalarType "path"],ScalarType "path"),("+",[ScalarType "path",ScalarType "point"],ScalarType "path"),("+",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "box",ScalarType "point"],ScalarType "box"),("+",[ScalarType "money",ScalarType "money"],ScalarType "money"),("+",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("+",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("+",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("+",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("+",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("+",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("+",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("+",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("+",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("+",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("+",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("+",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("*",[ScalarType "point",ScalarType "point"],ScalarType "point"),("*",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("*",[ScalarType "path",ScalarType "point"],ScalarType "path"),("*",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("*",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "box",ScalarType "point"],ScalarType "box"),("*",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("*",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("*",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("*",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("*",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("*",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("*",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("*",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("*",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("*",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("*",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("&&",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("&&",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&&",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&&",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("&",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("&",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("&",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("&",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("&",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("%",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("%",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#>=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("##",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "box"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("##",[ScalarType "line",ScalarType "box"],ScalarType "point"),("##",[ScalarType "point",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("#",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("#",[ScalarType "line",ScalarType "line"],ScalarType "point"),("#",[ScalarType "box",ScalarType "box"],ScalarType "box"),("#",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("#",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("!~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("!~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool")], scopeFunctions = [("RI_FKey_cascade_del",[],Pseudo Trigger),("RI_FKey_cascade_upd",[],Pseudo Trigger),("RI_FKey_check_ins",[],Pseudo Trigger),("RI_FKey_check_upd",[],Pseudo Trigger),("RI_FKey_noaction_del",[],Pseudo Trigger),("RI_FKey_noaction_upd",[],Pseudo Trigger),("RI_FKey_restrict_del",[],Pseudo Trigger),("RI_FKey_restrict_upd",[],Pseudo Trigger),("RI_FKey_setdefault_del",[],Pseudo Trigger),("RI_FKey_setdefault_upd",[],Pseudo Trigger),("RI_FKey_setnull_del",[],Pseudo Trigger),("RI_FKey_setnull_upd",[],Pseudo Trigger),("abbrev",[ScalarType "cidr"],ScalarType "text"),("abbrev",[ScalarType "inet"],ScalarType "text"),("abs",[ScalarType "int8"],ScalarType "int8"),("abs",[ScalarType "int2"],ScalarType "int2"),("abs",[ScalarType "int4"],ScalarType "int4"),("abs",[ScalarType "float4"],ScalarType "float4"),("abs",[ScalarType "float8"],ScalarType "float8"),("abs",[ScalarType "numeric"],ScalarType "numeric"),("abstime",[ScalarType "timestamp"],ScalarType "abstime"),("abstime",[ScalarType "timestamptz"],ScalarType "abstime"),("abstimeeq",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimege",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimegt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimein",[Pseudo Cstring],ScalarType "abstime"),("abstimele",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimelt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimene",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimeout",[ScalarType "abstime"],Pseudo Cstring),("abstimerecv",[Pseudo Internal],ScalarType "abstime"),("abstimesend",[ScalarType "abstime"],ScalarType "bytea"),("aclcontains",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("aclinsert",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("aclitemeq",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("aclitemin",[Pseudo Cstring],ScalarType "aclitem"),("aclitemout",[ScalarType "aclitem"],Pseudo Cstring),("aclremove",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("acos",[ScalarType "float8"],ScalarType "float8"),("age",[ScalarType "xid"],ScalarType "int4"),("age",[ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz"],ScalarType "interval"),("age",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("any_in",[Pseudo Cstring],Pseudo Any),("any_out",[Pseudo Any],Pseudo Cstring),("anyarray_in",[Pseudo Cstring],Pseudo AnyArray),("anyarray_out",[Pseudo AnyArray],Pseudo Cstring),("anyarray_recv",[Pseudo Internal],Pseudo AnyArray),("anyarray_send",[Pseudo AnyArray],ScalarType "bytea"),("anyelement_in",[Pseudo Cstring],Pseudo AnyElement),("anyelement_out",[Pseudo AnyElement],Pseudo Cstring),("anyenum_in",[Pseudo Cstring],Pseudo AnyEnum),("anyenum_out",[Pseudo AnyEnum],Pseudo Cstring),("anynonarray_in",[Pseudo Cstring],Pseudo AnyNonArray),("anynonarray_out",[Pseudo AnyNonArray],Pseudo Cstring),("anytextcat",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("area",[ScalarType "path"],ScalarType "float8"),("area",[ScalarType "box"],ScalarType "float8"),("area",[ScalarType "circle"],ScalarType "float8"),("areajoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("areasel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("array_agg_finalfn",[Pseudo Internal],Pseudo AnyArray),("array_agg_transfn",[Pseudo Internal,Pseudo AnyElement],Pseudo Internal),("array_append",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("array_cat",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_dims",[Pseudo AnyArray],ScalarType "text"),("array_eq",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4"),ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_ge",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_gt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_larger",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_le",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_length",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lower",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_ndims",[Pseudo AnyArray],ScalarType "int4"),("array_ne",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_out",[Pseudo AnyArray],Pseudo Cstring),("array_prepend",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("array_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_send",[Pseudo AnyArray],ScalarType "bytea"),("array_smaller",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_to_string",[Pseudo AnyArray,ScalarType "text"],ScalarType "text"),("array_upper",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("arraycontained",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arraycontains",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arrayoverlap",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("ascii",[ScalarType "text"],ScalarType "int4"),("ascii_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("ascii_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("asin",[ScalarType "float8"],ScalarType "float8"),("atan",[ScalarType "float8"],ScalarType "float8"),("atan2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("big5_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("bit",[ScalarType "int8",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "bit",ScalarType "int4",ScalarType "bool"],ScalarType "bit"),("bit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_length",[ScalarType "bytea"],ScalarType "int4"),("bit_length",[ScalarType "text"],ScalarType "int4"),("bit_length",[ScalarType "bit"],ScalarType "int4"),("bit_out",[ScalarType "bit"],Pseudo Cstring),("bit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_send",[ScalarType "bit"],ScalarType "bytea"),("bitand",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitcat",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("bitcmp",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("biteq",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitge",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitgt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitle",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitlt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitne",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitnot",[ScalarType "bit"],ScalarType "bit"),("bitor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitshiftleft",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bitshiftright",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bittypmodout",[ScalarType "int4"],Pseudo Cstring),("bitxor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bool",[ScalarType "int4"],ScalarType "bool"),("booland_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("booleq",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolge",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolgt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolin",[Pseudo Cstring],ScalarType "bool"),("boolle",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boollt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolne",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolor_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolout",[ScalarType "bool"],Pseudo Cstring),("boolrecv",[Pseudo Internal],ScalarType "bool"),("boolsend",[ScalarType "bool"],ScalarType "bytea"),("box",[ScalarType "polygon"],ScalarType "box"),("box",[ScalarType "circle"],ScalarType "box"),("box",[ScalarType "point",ScalarType "point"],ScalarType "box"),("box_above",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_above_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_add",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_below",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_below_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_center",[ScalarType "box"],ScalarType "point"),("box_contain",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_contained",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_distance",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("box_div",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_ge",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_gt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_in",[Pseudo Cstring],ScalarType "box"),("box_intersect",[ScalarType "box",ScalarType "box"],ScalarType "box"),("box_le",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_left",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_lt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_mul",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_out",[ScalarType "box"],Pseudo Cstring),("box_overabove",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overbelow",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overlap",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overleft",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overright",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_recv",[Pseudo Internal],ScalarType "box"),("box_right",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_same",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_send",[ScalarType "box"],ScalarType "bytea"),("box_sub",[ScalarType "box",ScalarType "point"],ScalarType "box"),("bpchar",[ScalarType "char"],ScalarType "bpchar"),("bpchar",[ScalarType "name"],ScalarType "bpchar"),("bpchar",[ScalarType "bpchar",ScalarType "int4",ScalarType "bool"],ScalarType "bpchar"),("bpchar_larger",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpchar_pattern_ge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_gt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_le",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_lt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_smaller",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpcharcmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("bpchareq",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchargt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchariclike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharle",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharlt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharne",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharout",[ScalarType "bpchar"],Pseudo Cstring),("bpcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharsend",[ScalarType "bpchar"],ScalarType "bytea"),("bpchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bpchartypmodout",[ScalarType "int4"],Pseudo Cstring),("broadcast",[ScalarType "inet"],ScalarType "inet"),("btabstimecmp",[ScalarType "abstime",ScalarType "abstime"],ScalarType "int4"),("btarraycmp",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "int4"),("btbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btboolcmp",[ScalarType "bool",ScalarType "bool"],ScalarType "int4"),("btbpchar_pattern_cmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("btbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btcharcmp",[ScalarType "char",ScalarType "char"],ScalarType "int4"),("btcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("btendscan",[Pseudo Internal],Pseudo Void),("btfloat48cmp",[ScalarType "float4",ScalarType "float8"],ScalarType "int4"),("btfloat4cmp",[ScalarType "float4",ScalarType "float4"],ScalarType "int4"),("btfloat84cmp",[ScalarType "float8",ScalarType "float4"],ScalarType "int4"),("btfloat8cmp",[ScalarType "float8",ScalarType "float8"],ScalarType "int4"),("btgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("btgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btint24cmp",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("btint28cmp",[ScalarType "int2",ScalarType "int8"],ScalarType "int4"),("btint2cmp",[ScalarType "int2",ScalarType "int2"],ScalarType "int4"),("btint42cmp",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("btint48cmp",[ScalarType "int4",ScalarType "int8"],ScalarType "int4"),("btint4cmp",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("btint82cmp",[ScalarType "int8",ScalarType "int2"],ScalarType "int4"),("btint84cmp",[ScalarType "int8",ScalarType "int4"],ScalarType "int4"),("btint8cmp",[ScalarType "int8",ScalarType "int8"],ScalarType "int4"),("btmarkpos",[Pseudo Internal],Pseudo Void),("btnamecmp",[ScalarType "name",ScalarType "name"],ScalarType "int4"),("btoidcmp",[ScalarType "oid",ScalarType "oid"],ScalarType "int4"),("btoidvectorcmp",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "int4"),("btoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("btrecordcmp",[Pseudo Record,Pseudo Record],ScalarType "int4"),("btreltimecmp",[ScalarType "reltime",ScalarType "reltime"],ScalarType "int4"),("btrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("btrestrpos",[Pseudo Internal],Pseudo Void),("btrim",[ScalarType "text"],ScalarType "text"),("btrim",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("btrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("bttext_pattern_cmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttextcmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttidcmp",[ScalarType "tid",ScalarType "tid"],ScalarType "int4"),("bttintervalcmp",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "int4"),("btvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("byteacat",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("byteacmp",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("byteaeq",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteage",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteagt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteain",[Pseudo Cstring],ScalarType "bytea"),("byteale",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteane",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteanlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteaout",[ScalarType "bytea"],Pseudo Cstring),("bytearecv",[Pseudo Internal],ScalarType "bytea"),("byteasend",[ScalarType "bytea"],ScalarType "bytea"),("cash_cmp",[ScalarType "money",ScalarType "money"],ScalarType "int4"),("cash_div_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_div_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_div_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_div_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_eq",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_ge",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_gt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_in",[Pseudo Cstring],ScalarType "money"),("cash_le",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_lt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_mi",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_mul_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_mul_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_mul_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_mul_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_ne",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_out",[ScalarType "money"],Pseudo Cstring),("cash_pl",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_recv",[Pseudo Internal],ScalarType "money"),("cash_send",[ScalarType "money"],ScalarType "bytea"),("cash_words",[ScalarType "money"],ScalarType "text"),("cashlarger",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cashsmaller",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cbrt",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "numeric"],ScalarType "numeric"),("ceiling",[ScalarType "float8"],ScalarType "float8"),("ceiling",[ScalarType "numeric"],ScalarType "numeric"),("center",[ScalarType "box"],ScalarType "point"),("center",[ScalarType "circle"],ScalarType "point"),("char",[ScalarType "int4"],ScalarType "char"),("char",[ScalarType "text"],ScalarType "char"),("char_length",[ScalarType "text"],ScalarType "int4"),("char_length",[ScalarType "bpchar"],ScalarType "int4"),("character_length",[ScalarType "text"],ScalarType "int4"),("character_length",[ScalarType "bpchar"],ScalarType "int4"),("chareq",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charge",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("chargt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charin",[Pseudo Cstring],ScalarType "char"),("charle",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charlt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charne",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charout",[ScalarType "char"],Pseudo Cstring),("charrecv",[Pseudo Internal],ScalarType "char"),("charsend",[ScalarType "char"],ScalarType "bytea"),("chr",[ScalarType "int4"],ScalarType "text"),("cideq",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("cidin",[Pseudo Cstring],ScalarType "cid"),("cidout",[ScalarType "cid"],Pseudo Cstring),("cidr",[ScalarType "inet"],ScalarType "cidr"),("cidr_in",[Pseudo Cstring],ScalarType "cidr"),("cidr_out",[ScalarType "cidr"],Pseudo Cstring),("cidr_recv",[Pseudo Internal],ScalarType "cidr"),("cidr_send",[ScalarType "cidr"],ScalarType "bytea"),("cidrecv",[Pseudo Internal],ScalarType "cid"),("cidsend",[ScalarType "cid"],ScalarType "bytea"),("circle",[ScalarType "box"],ScalarType "circle"),("circle",[ScalarType "polygon"],ScalarType "circle"),("circle",[ScalarType "point",ScalarType "float8"],ScalarType "circle"),("circle_above",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_add_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_below",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_center",[ScalarType "circle"],ScalarType "point"),("circle_contain",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_contain_pt",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("circle_contained",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_distance",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("circle_div_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_eq",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_ge",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_gt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_in",[Pseudo Cstring],ScalarType "circle"),("circle_le",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_left",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_lt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_mul_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_ne",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_out",[ScalarType "circle"],Pseudo Cstring),("circle_overabove",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overbelow",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overlap",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overleft",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overright",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_recv",[Pseudo Internal],ScalarType "circle"),("circle_right",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_same",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_send",[ScalarType "circle"],ScalarType "bytea"),("circle_sub_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("clock_timestamp",[],ScalarType "timestamptz"),("close_lb",[ScalarType "line",ScalarType "box"],ScalarType "point"),("close_ls",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("close_lseg",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("close_pb",[ScalarType "point",ScalarType "box"],ScalarType "point"),("close_pl",[ScalarType "point",ScalarType "line"],ScalarType "point"),("close_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("close_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("close_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("col_description",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("contjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("contsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("convert",[ScalarType "bytea",ScalarType "name",ScalarType "name"],ScalarType "bytea"),("convert_from",[ScalarType "bytea",ScalarType "name"],ScalarType "text"),("convert_to",[ScalarType "text",ScalarType "name"],ScalarType "bytea"),("cos",[ScalarType "float8"],ScalarType "float8"),("cot",[ScalarType "float8"],ScalarType "float8"),("cstring_in",[Pseudo Cstring],Pseudo Cstring),("cstring_out",[Pseudo Cstring],Pseudo Cstring),("cstring_recv",[Pseudo Internal],Pseudo Cstring),("cstring_send",[Pseudo Cstring],ScalarType "bytea"),("current_database",[],ScalarType "name"),("current_query",[],ScalarType "text"),("current_schema",[],ScalarType "name"),("current_schemas",[ScalarType "bool"],ArrayType (ScalarType "name")),("current_setting",[ScalarType "text"],ScalarType "text"),("current_user",[],ScalarType "name"),("currtid",[ScalarType "oid",ScalarType "tid"],ScalarType "tid"),("currtid2",[ScalarType "text",ScalarType "tid"],ScalarType "tid"),("currval",[ScalarType "regclass"],ScalarType "int8"),("cursor_to_xml",[ScalarType "refcursor",ScalarType "int4",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("cursor_to_xmlschema",[ScalarType "refcursor",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml_and_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("date",[ScalarType "abstime"],ScalarType "date"),("date",[ScalarType "timestamp"],ScalarType "date"),("date",[ScalarType "timestamptz"],ScalarType "date"),("date_cmp",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_cmp_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "int4"),("date_cmp_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "int4"),("date_eq",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_eq_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_eq_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_ge",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ge_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ge_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_gt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_gt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_gt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_in",[Pseudo Cstring],ScalarType "date"),("date_larger",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_le",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_le_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_le_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_lt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_lt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_lt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_mi",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_mi_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_mii",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_ne",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ne_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ne_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_out",[ScalarType "date"],Pseudo Cstring),("date_part",[ScalarType "text",ScalarType "abstime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "reltime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "date"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "time"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamp"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamptz"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "interval"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timetz"],ScalarType "float8"),("date_pl_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_pli",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_recv",[Pseudo Internal],ScalarType "date"),("date_send",[ScalarType "date"],ScalarType "bytea"),("date_smaller",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_trunc",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamp"),("date_trunc",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamptz"),("date_trunc",[ScalarType "text",ScalarType "interval"],ScalarType "interval"),("datetime_pl",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("datetimetz_pl",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("dcbrt",[ScalarType "float8"],ScalarType "float8"),("decode",[ScalarType "text",ScalarType "text"],ScalarType "bytea"),("degrees",[ScalarType "float8"],ScalarType "float8"),("dexp",[ScalarType "float8"],ScalarType "float8"),("diagonal",[ScalarType "box"],ScalarType "lseg"),("diameter",[ScalarType "circle"],ScalarType "float8"),("dispell_init",[Pseudo Internal],Pseudo Internal),("dispell_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dist_cpoly",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("dist_lb",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("dist_pb",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("dist_pc",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("dist_pl",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("dist_ppath",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("dist_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("dist_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("dist_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("dlog1",[ScalarType "float8"],ScalarType "float8"),("dlog10",[ScalarType "float8"],ScalarType "float8"),("domain_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Any),("domain_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Any),("dpow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("dround",[ScalarType "float8"],ScalarType "float8"),("dsimple_init",[Pseudo Internal],Pseudo Internal),("dsimple_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsnowball_init",[Pseudo Internal],Pseudo Internal),("dsnowball_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsqrt",[ScalarType "float8"],ScalarType "float8"),("dsynonym_init",[Pseudo Internal],Pseudo Internal),("dsynonym_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dtrunc",[ScalarType "float8"],ScalarType "float8"),("encode",[ScalarType "bytea",ScalarType "text"],ScalarType "text"),("enum_cmp",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "int4"),("enum_eq",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_first",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_ge",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_gt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_in",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_larger",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("enum_last",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_le",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_lt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_ne",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_out",[Pseudo AnyEnum],Pseudo Cstring),("enum_range",[Pseudo AnyEnum],Pseudo AnyArray),("enum_range",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyArray),("enum_recv",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_send",[Pseudo AnyEnum],ScalarType "bytea"),("enum_smaller",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("eqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("eqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("euc_cn_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_cn_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("exp",[ScalarType "float8"],ScalarType "float8"),("exp",[ScalarType "numeric"],ScalarType "numeric"),("factorial",[ScalarType "int8"],ScalarType "numeric"),("family",[ScalarType "inet"],ScalarType "int4"),("flatfile_update_trigger",[],Pseudo Trigger),("float4",[ScalarType "int8"],ScalarType "float4"),("float4",[ScalarType "int2"],ScalarType "float4"),("float4",[ScalarType "int4"],ScalarType "float4"),("float4",[ScalarType "float8"],ScalarType "float4"),("float4",[ScalarType "numeric"],ScalarType "float4"),("float48div",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48eq",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48ge",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48gt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48le",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48lt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48mi",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48mul",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48ne",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48pl",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float4_accum",[ArrayType (ScalarType "float8"),ScalarType "float4"],ArrayType (ScalarType "float8")),("float4abs",[ScalarType "float4"],ScalarType "float4"),("float4div",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4eq",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4ge",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4gt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4in",[Pseudo Cstring],ScalarType "float4"),("float4larger",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4le",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4lt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4mi",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4mul",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4ne",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4out",[ScalarType "float4"],Pseudo Cstring),("float4pl",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4recv",[Pseudo Internal],ScalarType "float4"),("float4send",[ScalarType "float4"],ScalarType "bytea"),("float4smaller",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4um",[ScalarType "float4"],ScalarType "float4"),("float4up",[ScalarType "float4"],ScalarType "float4"),("float8",[ScalarType "int8"],ScalarType "float8"),("float8",[ScalarType "int2"],ScalarType "float8"),("float8",[ScalarType "int4"],ScalarType "float8"),("float8",[ScalarType "float4"],ScalarType "float8"),("float8",[ScalarType "numeric"],ScalarType "float8"),("float84div",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84eq",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84ge",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84gt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84le",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84lt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84mi",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84mul",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84ne",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84pl",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float8_accum",[ArrayType (ScalarType "float8"),ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_avg",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_corr",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_accum",[ArrayType (ScalarType "float8"),ScalarType "float8",ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_regr_avgx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_avgy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_intercept",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_r2",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_slope",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_syy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8abs",[ScalarType "float8"],ScalarType "float8"),("float8div",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8eq",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8ge",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8gt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8in",[Pseudo Cstring],ScalarType "float8"),("float8larger",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8le",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8lt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8mi",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8mul",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8ne",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8out",[ScalarType "float8"],Pseudo Cstring),("float8pl",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8recv",[Pseudo Internal],ScalarType "float8"),("float8send",[ScalarType "float8"],ScalarType "bytea"),("float8smaller",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8um",[ScalarType "float8"],ScalarType "float8"),("float8up",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "numeric"],ScalarType "numeric"),("flt4_mul_cash",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("flt8_mul_cash",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("fmgr_c_validator",[ScalarType "oid"],Pseudo Void),("fmgr_internal_validator",[ScalarType "oid"],Pseudo Void),("fmgr_sql_validator",[ScalarType "oid"],Pseudo Void),("format_type",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("gb18030_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("gbk_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("generate_series",[ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "int8",ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],SetOfType (ScalarType "timestamp")),("generate_series",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],SetOfType (ScalarType "timestamptz")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4",ScalarType "bool"],SetOfType (ScalarType "int4")),("get_bit",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_byte",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_current_ts_config",[],ScalarType "regconfig"),("getdatabaseencoding",[],ScalarType "name"),("getpgusername",[],ScalarType "name"),("gin_cmp_prefix",[ScalarType "text",ScalarType "text",ScalarType "int2",Pseudo Internal],ScalarType "int4"),("gin_cmp_tslexeme",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("gin_extract_tsquery",[ScalarType "tsquery",Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("gin_extract_tsvector",[ScalarType "tsvector",Pseudo Internal],Pseudo Internal),("gin_tsquery_consistent",[Pseudo Internal,ScalarType "int2",ScalarType "tsquery",ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayconsistent",[Pseudo Internal,ScalarType "int2",Pseudo AnyArray,ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayextract",[Pseudo AnyArray,Pseudo Internal],Pseudo Internal),("ginbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gincostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("ginendscan",[Pseudo Internal],Pseudo Void),("gingetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gininsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginmarkpos",[Pseudo Internal],Pseudo Void),("ginoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("ginqueryarrayextract",[Pseudo AnyArray,Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("ginrestrpos",[Pseudo Internal],Pseudo Void),("ginvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_compress",[Pseudo Internal],Pseudo Internal),("gist_box_consistent",[Pseudo Internal,ScalarType "box",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_box_decompress",[Pseudo Internal],Pseudo Internal),("gist_box_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_same",[ScalarType "box",ScalarType "box",Pseudo Internal],Pseudo Internal),("gist_box_union",[Pseudo Internal,Pseudo Internal],ScalarType "box"),("gist_circle_compress",[Pseudo Internal],Pseudo Internal),("gist_circle_consistent",[Pseudo Internal,ScalarType "circle",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_poly_compress",[Pseudo Internal],Pseudo Internal),("gist_poly_consistent",[Pseudo Internal,ScalarType "polygon",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gistbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("gistendscan",[Pseudo Internal],Pseudo Void),("gistgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gistgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistmarkpos",[Pseudo Internal],Pseudo Void),("gistoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("gistrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("gistrestrpos",[Pseudo Internal],Pseudo Void),("gistvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_compress",[Pseudo Internal],Pseudo Internal),("gtsquery_consistent",[Pseudo Internal,Pseudo Internal,ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsquery_decompress",[Pseudo Internal],Pseudo Internal),("gtsquery_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_same",[ScalarType "int8",ScalarType "int8",Pseudo Internal],Pseudo Internal),("gtsquery_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_compress",[Pseudo Internal],Pseudo Internal),("gtsvector_consistent",[Pseudo Internal,ScalarType "gtsvector",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsvector_decompress",[Pseudo Internal],Pseudo Internal),("gtsvector_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_same",[ScalarType "gtsvector",ScalarType "gtsvector",Pseudo Internal],Pseudo Internal),("gtsvector_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvectorin",[Pseudo Cstring],ScalarType "gtsvector"),("gtsvectorout",[ScalarType "gtsvector"],Pseudo Cstring),("has_any_column_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("hash_aclitem",[ScalarType "aclitem"],ScalarType "int4"),("hash_numeric",[ScalarType "numeric"],ScalarType "int4"),("hashbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbpchar",[ScalarType "bpchar"],ScalarType "int4"),("hashbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashchar",[ScalarType "char"],ScalarType "int4"),("hashcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("hashendscan",[Pseudo Internal],Pseudo Void),("hashenum",[Pseudo AnyEnum],ScalarType "int4"),("hashfloat4",[ScalarType "float4"],ScalarType "int4"),("hashfloat8",[ScalarType "float8"],ScalarType "int4"),("hashgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("hashgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashinet",[ScalarType "inet"],ScalarType "int4"),("hashinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashint2",[ScalarType "int2"],ScalarType "int4"),("hashint2vector",[ScalarType "int2vector"],ScalarType "int4"),("hashint4",[ScalarType "int4"],ScalarType "int4"),("hashint8",[ScalarType "int8"],ScalarType "int4"),("hashmacaddr",[ScalarType "macaddr"],ScalarType "int4"),("hashmarkpos",[Pseudo Internal],Pseudo Void),("hashname",[ScalarType "name"],ScalarType "int4"),("hashoid",[ScalarType "oid"],ScalarType "int4"),("hashoidvector",[ScalarType "oidvector"],ScalarType "int4"),("hashoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("hashrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("hashrestrpos",[Pseudo Internal],Pseudo Void),("hashtext",[ScalarType "text"],ScalarType "int4"),("hashvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashvarlena",[Pseudo Internal],ScalarType "int4"),("height",[ScalarType "box"],ScalarType "float8"),("host",[ScalarType "inet"],ScalarType "text"),("hostmask",[ScalarType "inet"],ScalarType "inet"),("iclikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("iclikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icnlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icnlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("inet_client_addr",[],ScalarType "inet"),("inet_client_port",[],ScalarType "int4"),("inet_in",[Pseudo Cstring],ScalarType "inet"),("inet_out",[ScalarType "inet"],Pseudo Cstring),("inet_recv",[Pseudo Internal],ScalarType "inet"),("inet_send",[ScalarType "inet"],ScalarType "bytea"),("inet_server_addr",[],ScalarType "inet"),("inet_server_port",[],ScalarType "int4"),("inetand",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetmi",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("inetmi_int8",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("inetnot",[ScalarType "inet"],ScalarType "inet"),("inetor",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetpl",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("initcap",[ScalarType "text"],ScalarType "text"),("int2",[ScalarType "int8"],ScalarType "int2"),("int2",[ScalarType "int4"],ScalarType "int2"),("int2",[ScalarType "float4"],ScalarType "int2"),("int2",[ScalarType "float8"],ScalarType "int2"),("int2",[ScalarType "numeric"],ScalarType "int2"),("int24div",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24eq",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24ge",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24gt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24le",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24lt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24mi",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24mul",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24ne",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24pl",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int28div",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28eq",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28ge",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28gt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28le",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28lt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28mi",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28mul",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28ne",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28pl",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int2_accum",[ArrayType (ScalarType "numeric"),ScalarType "int2"],ArrayType (ScalarType "numeric")),("int2_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int2"],ArrayType (ScalarType "int8")),("int2_mul_cash",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("int2_sum",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int2abs",[ScalarType "int2"],ScalarType "int2"),("int2and",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2div",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2eq",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2ge",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2gt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2in",[Pseudo Cstring],ScalarType "int2"),("int2larger",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2le",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2lt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2mi",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mul",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2ne",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2not",[ScalarType "int2"],ScalarType "int2"),("int2or",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2out",[ScalarType "int2"],Pseudo Cstring),("int2pl",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2recv",[Pseudo Internal],ScalarType "int2"),("int2send",[ScalarType "int2"],ScalarType "bytea"),("int2shl",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2shr",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2smaller",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2um",[ScalarType "int2"],ScalarType "int2"),("int2up",[ScalarType "int2"],ScalarType "int2"),("int2vectoreq",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("int2vectorin",[Pseudo Cstring],ScalarType "int2vector"),("int2vectorout",[ScalarType "int2vector"],Pseudo Cstring),("int2vectorrecv",[Pseudo Internal],ScalarType "int2vector"),("int2vectorsend",[ScalarType "int2vector"],ScalarType "bytea"),("int2xor",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int4",[ScalarType "bool"],ScalarType "int4"),("int4",[ScalarType "char"],ScalarType "int4"),("int4",[ScalarType "int8"],ScalarType "int4"),("int4",[ScalarType "int2"],ScalarType "int4"),("int4",[ScalarType "float4"],ScalarType "int4"),("int4",[ScalarType "float8"],ScalarType "int4"),("int4",[ScalarType "bit"],ScalarType "int4"),("int4",[ScalarType "numeric"],ScalarType "int4"),("int42div",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42eq",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42ge",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42gt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42le",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42lt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42mi",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42mul",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42ne",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42pl",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int48div",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48eq",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48ge",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48gt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48le",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48lt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48mi",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48mul",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48ne",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48pl",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int4_accum",[ArrayType (ScalarType "numeric"),ScalarType "int4"],ArrayType (ScalarType "numeric")),("int4_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int4"],ArrayType (ScalarType "int8")),("int4_mul_cash",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("int4_sum",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int4abs",[ScalarType "int4"],ScalarType "int4"),("int4and",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4div",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4eq",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4ge",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4gt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4in",[Pseudo Cstring],ScalarType "int4"),("int4inc",[ScalarType "int4"],ScalarType "int4"),("int4larger",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4le",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4lt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4mi",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mul",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4ne",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4not",[ScalarType "int4"],ScalarType "int4"),("int4or",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4out",[ScalarType "int4"],Pseudo Cstring),("int4pl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4recv",[Pseudo Internal],ScalarType "int4"),("int4send",[ScalarType "int4"],ScalarType "bytea"),("int4shl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4shr",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4smaller",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4um",[ScalarType "int4"],ScalarType "int4"),("int4up",[ScalarType "int4"],ScalarType "int4"),("int4xor",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int8",[ScalarType "int2"],ScalarType "int8"),("int8",[ScalarType "int4"],ScalarType "int8"),("int8",[ScalarType "oid"],ScalarType "int8"),("int8",[ScalarType "float4"],ScalarType "int8"),("int8",[ScalarType "float8"],ScalarType "int8"),("int8",[ScalarType "bit"],ScalarType "int8"),("int8",[ScalarType "numeric"],ScalarType "int8"),("int82div",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82eq",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82ge",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82gt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82le",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82lt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82mi",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82mul",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82ne",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82pl",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int84div",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84eq",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84ge",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84gt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84le",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84lt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84mi",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84mul",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84ne",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84pl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_avg",[ArrayType (ScalarType "int8")],ScalarType "numeric"),("int8_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_sum",[ScalarType "numeric",ScalarType "int8"],ScalarType "numeric"),("int8abs",[ScalarType "int8"],ScalarType "int8"),("int8and",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8div",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8eq",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8ge",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8gt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8in",[Pseudo Cstring],ScalarType "int8"),("int8inc",[ScalarType "int8"],ScalarType "int8"),("int8inc_any",[ScalarType "int8",Pseudo Any],ScalarType "int8"),("int8inc_float8_float8",[ScalarType "int8",ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("int8larger",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8le",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8lt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8mi",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mul",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8ne",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8not",[ScalarType "int8"],ScalarType "int8"),("int8or",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8out",[ScalarType "int8"],Pseudo Cstring),("int8pl",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8pl_inet",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("int8recv",[Pseudo Internal],ScalarType "int8"),("int8send",[ScalarType "int8"],ScalarType "bytea"),("int8shl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8shr",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8smaller",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8um",[ScalarType "int8"],ScalarType "int8"),("int8up",[ScalarType "int8"],ScalarType "int8"),("int8xor",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("integer_pl_date",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("inter_lb",[ScalarType "line",ScalarType "box"],ScalarType "bool"),("inter_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("inter_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("internal_in",[Pseudo Cstring],Pseudo Internal),("internal_out",[Pseudo Internal],Pseudo Cstring),("interval",[ScalarType "reltime"],ScalarType "interval"),("interval",[ScalarType "time"],ScalarType "interval"),("interval",[ScalarType "interval",ScalarType "int4"],ScalarType "interval"),("interval_accum",[ArrayType (ScalarType "interval"),ScalarType "interval"],ArrayType (ScalarType "interval")),("interval_avg",[ArrayType (ScalarType "interval")],ScalarType "interval"),("interval_cmp",[ScalarType "interval",ScalarType "interval"],ScalarType "int4"),("interval_div",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_eq",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_ge",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_gt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_hash",[ScalarType "interval"],ScalarType "int4"),("interval_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_larger",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_le",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_lt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_mi",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_mul",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_ne",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_out",[ScalarType "interval"],Pseudo Cstring),("interval_pl",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_pl_date",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("interval_pl_time",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("interval_pl_timestamp",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("interval_pl_timestamptz",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("interval_pl_timetz",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("interval_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_send",[ScalarType "interval"],ScalarType "bytea"),("interval_smaller",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_um",[ScalarType "interval"],ScalarType "interval"),("intervaltypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("intervaltypmodout",[ScalarType "int4"],Pseudo Cstring),("intinterval",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("isclosed",[ScalarType "path"],ScalarType "bool"),("isfinite",[ScalarType "abstime"],ScalarType "bool"),("isfinite",[ScalarType "date"],ScalarType "bool"),("isfinite",[ScalarType "timestamp"],ScalarType "bool"),("isfinite",[ScalarType "timestamptz"],ScalarType "bool"),("isfinite",[ScalarType "interval"],ScalarType "bool"),("ishorizontal",[ScalarType "lseg"],ScalarType "bool"),("ishorizontal",[ScalarType "line"],ScalarType "bool"),("ishorizontal",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("iso8859_1_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso8859_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("isopen",[ScalarType "path"],ScalarType "bool"),("isparallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isparallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isperp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isperp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "lseg"],ScalarType "bool"),("isvertical",[ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("johab_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("justify_days",[ScalarType "interval"],ScalarType "interval"),("justify_hours",[ScalarType "interval"],ScalarType "interval"),("justify_interval",[ScalarType "interval"],ScalarType "interval"),("koi8r_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8u_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("language_handler_in",[Pseudo Cstring],Pseudo LanguageHandler),("language_handler_out",[Pseudo LanguageHandler],Pseudo Cstring),("lastval",[],ScalarType "int8"),("latin1_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin3_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin4_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("length",[ScalarType "bytea"],ScalarType "int4"),("length",[ScalarType "text"],ScalarType "int4"),("length",[ScalarType "lseg"],ScalarType "float8"),("length",[ScalarType "path"],ScalarType "float8"),("length",[ScalarType "bpchar"],ScalarType "int4"),("length",[ScalarType "bit"],ScalarType "int4"),("length",[ScalarType "tsvector"],ScalarType "int4"),("length",[ScalarType "bytea",ScalarType "name"],ScalarType "int4"),("like",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("like",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("like",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("like_escape",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("like_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("likejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("likesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("line",[ScalarType "point",ScalarType "point"],ScalarType "line"),("line_distance",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("line_eq",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_horizontal",[ScalarType "line"],ScalarType "bool"),("line_in",[Pseudo Cstring],ScalarType "line"),("line_interpt",[ScalarType "line",ScalarType "line"],ScalarType "point"),("line_intersect",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_out",[ScalarType "line"],Pseudo Cstring),("line_parallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_perp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_recv",[Pseudo Internal],ScalarType "line"),("line_send",[ScalarType "line"],ScalarType "bytea"),("line_vertical",[ScalarType "line"],ScalarType "bool"),("ln",[ScalarType "float8"],ScalarType "float8"),("ln",[ScalarType "numeric"],ScalarType "numeric"),("lo_close",[ScalarType "int4"],ScalarType "int4"),("lo_creat",[ScalarType "int4"],ScalarType "oid"),("lo_create",[ScalarType "oid"],ScalarType "oid"),("lo_export",[ScalarType "oid",ScalarType "text"],ScalarType "int4"),("lo_import",[ScalarType "text"],ScalarType "oid"),("lo_import",[ScalarType "text",ScalarType "oid"],ScalarType "oid"),("lo_lseek",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_open",[ScalarType "oid",ScalarType "int4"],ScalarType "int4"),("lo_tell",[ScalarType "int4"],ScalarType "int4"),("lo_truncate",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_unlink",[ScalarType "oid"],ScalarType "int4"),("log",[ScalarType "float8"],ScalarType "float8"),("log",[ScalarType "numeric"],ScalarType "numeric"),("log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("loread",[ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("lower",[ScalarType "text"],ScalarType "text"),("lowrite",[ScalarType "int4",ScalarType "bytea"],ScalarType "int4"),("lpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("lpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("lseg",[ScalarType "box"],ScalarType "lseg"),("lseg",[ScalarType "point",ScalarType "point"],ScalarType "lseg"),("lseg_center",[ScalarType "lseg"],ScalarType "point"),("lseg_distance",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("lseg_eq",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ge",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_gt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_horizontal",[ScalarType "lseg"],ScalarType "bool"),("lseg_in",[Pseudo Cstring],ScalarType "lseg"),("lseg_interpt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("lseg_intersect",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_le",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_length",[ScalarType "lseg"],ScalarType "float8"),("lseg_lt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ne",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_out",[ScalarType "lseg"],Pseudo Cstring),("lseg_parallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_perp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_recv",[Pseudo Internal],ScalarType "lseg"),("lseg_send",[ScalarType "lseg"],ScalarType "bytea"),("lseg_vertical",[ScalarType "lseg"],ScalarType "bool"),("ltrim",[ScalarType "text"],ScalarType "text"),("ltrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("macaddr_cmp",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "int4"),("macaddr_eq",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ge",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_gt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_in",[Pseudo Cstring],ScalarType "macaddr"),("macaddr_le",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_lt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ne",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_out",[ScalarType "macaddr"],Pseudo Cstring),("macaddr_recv",[Pseudo Internal],ScalarType "macaddr"),("macaddr_send",[ScalarType "macaddr"],ScalarType "bytea"),("makeaclitem",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "bool"],ScalarType "aclitem"),("masklen",[ScalarType "inet"],ScalarType "int4"),("md5",[ScalarType "bytea"],ScalarType "text"),("md5",[ScalarType "text"],ScalarType "text"),("mic_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin3",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin4",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mktinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("mul_d_interval",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("name",[ScalarType "text"],ScalarType "name"),("name",[ScalarType "bpchar"],ScalarType "name"),("name",[ScalarType "varchar"],ScalarType "name"),("nameeq",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namege",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namegt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("nameiclike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicnlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namein",[Pseudo Cstring],ScalarType "name"),("namele",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namelike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namelt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namene",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namenlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameout",[ScalarType "name"],Pseudo Cstring),("namerecv",[Pseudo Internal],ScalarType "name"),("nameregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namesend",[ScalarType "name"],ScalarType "bytea"),("neqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("neqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("netmask",[ScalarType "inet"],ScalarType "inet"),("network",[ScalarType "inet"],ScalarType "cidr"),("network_cmp",[ScalarType "inet",ScalarType "inet"],ScalarType "int4"),("network_eq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ge",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_gt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_le",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_lt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ne",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sub",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_subeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sup",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_supeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("nextval",[ScalarType "regclass"],ScalarType "int8"),("nlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("nlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("notlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("notlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("notlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("now",[],ScalarType "timestamptz"),("npoints",[ScalarType "path"],ScalarType "int4"),("npoints",[ScalarType "polygon"],ScalarType "int4"),("numeric",[ScalarType "int8"],ScalarType "numeric"),("numeric",[ScalarType "int2"],ScalarType "numeric"),("numeric",[ScalarType "int4"],ScalarType "numeric"),("numeric",[ScalarType "float4"],ScalarType "numeric"),("numeric",[ScalarType "float8"],ScalarType "numeric"),("numeric",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("numeric_abs",[ScalarType "numeric"],ScalarType "numeric"),("numeric_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_add",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_avg",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_cmp",[ScalarType "numeric",ScalarType "numeric"],ScalarType "int4"),("numeric_div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_div_trunc",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_eq",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_exp",[ScalarType "numeric"],ScalarType "numeric"),("numeric_fac",[ScalarType "int8"],ScalarType "numeric"),("numeric_ge",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_gt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_inc",[ScalarType "numeric"],ScalarType "numeric"),("numeric_larger",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_le",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_ln",[ScalarType "numeric"],ScalarType "numeric"),("numeric_log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_lt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_mul",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_ne",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_out",[ScalarType "numeric"],Pseudo Cstring),("numeric_power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_send",[ScalarType "numeric"],ScalarType "bytea"),("numeric_smaller",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_sqrt",[ScalarType "numeric"],ScalarType "numeric"),("numeric_stddev_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_stddev_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_sub",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_uminus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_uplus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_var_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_var_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numerictypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("numerictypmodout",[ScalarType "int4"],Pseudo Cstring),("numnode",[ScalarType "tsquery"],ScalarType "int4"),("obj_description",[ScalarType "oid"],ScalarType "text"),("obj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("octet_length",[ScalarType "bytea"],ScalarType "int4"),("octet_length",[ScalarType "text"],ScalarType "int4"),("octet_length",[ScalarType "bpchar"],ScalarType "int4"),("octet_length",[ScalarType "bit"],ScalarType "int4"),("oid",[ScalarType "int8"],ScalarType "oid"),("oideq",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidge",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidgt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidin",[Pseudo Cstring],ScalarType "oid"),("oidlarger",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidle",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidlt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidne",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidout",[ScalarType "oid"],Pseudo Cstring),("oidrecv",[Pseudo Internal],ScalarType "oid"),("oidsend",[ScalarType "oid"],ScalarType "bytea"),("oidsmaller",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidvectoreq",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorge",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorgt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorin",[Pseudo Cstring],ScalarType "oidvector"),("oidvectorle",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorlt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorne",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorout",[ScalarType "oidvector"],Pseudo Cstring),("oidvectorrecv",[Pseudo Internal],ScalarType "oidvector"),("oidvectorsend",[ScalarType "oidvector"],ScalarType "bytea"),("oidvectortypes",[ScalarType "oidvector"],ScalarType "text"),("on_pb",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("on_pl",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("on_ppath",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("on_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("on_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("on_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("opaque_in",[Pseudo Cstring],Pseudo Opaque),("opaque_out",[Pseudo Opaque],Pseudo Cstring),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timetz",ScalarType "timetz",ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("path",[ScalarType "polygon"],ScalarType "path"),("path_add",[ScalarType "path",ScalarType "path"],ScalarType "path"),("path_add_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_center",[ScalarType "path"],ScalarType "point"),("path_contain_pt",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("path_distance",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("path_div_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_in",[Pseudo Cstring],ScalarType "path"),("path_inter",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_length",[ScalarType "path"],ScalarType "float8"),("path_mul_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_n_eq",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_ge",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_gt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_le",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_lt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_npoints",[ScalarType "path"],ScalarType "int4"),("path_out",[ScalarType "path"],Pseudo Cstring),("path_recv",[Pseudo Internal],ScalarType "path"),("path_send",[ScalarType "path"],ScalarType "bytea"),("path_sub_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("pclose",[ScalarType "path"],ScalarType "path"),("pg_advisory_lock",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_unlock",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_advisory_unlock_all",[],Pseudo Void),("pg_advisory_unlock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_backend_pid",[],ScalarType "int4"),("pg_cancel_backend",[ScalarType "int4"],ScalarType "bool"),("pg_char_to_encoding",[ScalarType "name"],ScalarType "int4"),("pg_client_encoding",[],ScalarType "name"),("pg_column_size",[Pseudo Any],ScalarType "int4"),("pg_conf_load_time",[],ScalarType "timestamptz"),("pg_conversion_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_current_xlog_insert_location",[],ScalarType "text"),("pg_current_xlog_location",[],ScalarType "text"),("pg_cursor",[],SetOfType (Pseudo Record)),("pg_database_size",[ScalarType "name"],ScalarType "int8"),("pg_database_size",[ScalarType "oid"],ScalarType "int8"),("pg_encoding_to_char",[ScalarType "int4"],ScalarType "name"),("pg_function_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_get_constraintdef",[ScalarType "oid"],ScalarType "text"),("pg_get_constraintdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_function_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_identity_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_result",[ScalarType "oid"],ScalarType "text"),("pg_get_functiondef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid",ScalarType "int4",ScalarType "bool"],ScalarType "text"),("pg_get_keywords",[],SetOfType (Pseudo Record)),("pg_get_ruledef",[ScalarType "oid"],ScalarType "text"),("pg_get_ruledef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_serial_sequence",[ScalarType "text",ScalarType "text"],ScalarType "text"),("pg_get_triggerdef",[ScalarType "oid"],ScalarType "text"),("pg_get_userbyid",[ScalarType "oid"],ScalarType "name"),("pg_get_viewdef",[ScalarType "text"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid"],ScalarType "text"),("pg_get_viewdef",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_has_role",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_is_other_temp_schema",[ScalarType "oid"],ScalarType "bool"),("pg_lock_status",[],SetOfType (Pseudo Record)),("pg_ls_dir",[ScalarType "text"],SetOfType (ScalarType "text")),("pg_my_temp_schema",[],ScalarType "oid"),("pg_opclass_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_operator_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_options_to_table",[ArrayType (ScalarType "text")],SetOfType (Pseudo Record)),("pg_postmaster_start_time",[],ScalarType "timestamptz"),("pg_prepared_statement",[],SetOfType (Pseudo Record)),("pg_prepared_xact",[],SetOfType (Pseudo Record)),("pg_read_file",[ScalarType "text",ScalarType "int8",ScalarType "int8"],ScalarType "text"),("pg_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_relation_size",[ScalarType "regclass",ScalarType "text"],ScalarType "int8"),("pg_reload_conf",[],ScalarType "bool"),("pg_rotate_logfile",[],ScalarType "bool"),("pg_show_all_settings",[],SetOfType (Pseudo Record)),("pg_size_pretty",[ScalarType "int8"],ScalarType "text"),("pg_sleep",[ScalarType "float8"],Pseudo Void),("pg_start_backup",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_stat_clear_snapshot",[],Pseudo Void),("pg_stat_file",[ScalarType "text"],Pseudo Record),("pg_stat_get_activity",[ScalarType "int4"],SetOfType (Pseudo Record)),("pg_stat_get_backend_activity",[ScalarType "int4"],ScalarType "text"),("pg_stat_get_backend_activity_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_client_addr",[ScalarType "int4"],ScalarType "inet"),("pg_stat_get_backend_client_port",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_dbid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_idset",[],SetOfType (ScalarType "int4")),("pg_stat_get_backend_pid",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_userid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_waiting",[ScalarType "int4"],ScalarType "bool"),("pg_stat_get_backend_xact_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_bgwriter_buf_written_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_buf_written_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_maxwritten_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_requested_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_timed_checkpoints",[],ScalarType "int8"),("pg_stat_get_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_buf_alloc",[],ScalarType "int8"),("pg_stat_get_buf_written_backend",[],ScalarType "int8"),("pg_stat_get_db_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_numbackends",[ScalarType "oid"],ScalarType "int4"),("pg_stat_get_db_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_commit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_rollback",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_dead_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_calls",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_self_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_last_analyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autoanalyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autovacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_vacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_live_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_numscans",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_hot_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_reset",[],Pseudo Void),("pg_stop_backup",[],ScalarType "text"),("pg_switch_xlog",[],ScalarType "text"),("pg_table_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_tablespace_databases",[ScalarType "oid"],SetOfType (ScalarType "oid")),("pg_tablespace_size",[ScalarType "name"],ScalarType "int8"),("pg_tablespace_size",[ScalarType "oid"],ScalarType "int8"),("pg_terminate_backend",[ScalarType "int4"],ScalarType "bool"),("pg_timezone_abbrevs",[],SetOfType (Pseudo Record)),("pg_timezone_names",[],SetOfType (Pseudo Record)),("pg_total_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_try_advisory_lock",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_ts_config_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_dict_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_parser_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_template_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_type_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_typeof",[Pseudo Any],ScalarType "regtype"),("pg_xlogfile_name",[ScalarType "text"],ScalarType "text"),("pg_xlogfile_name_offset",[ScalarType "text"],Pseudo Record),("pi",[],ScalarType "float8"),("plainto_tsquery",[ScalarType "text"],ScalarType "tsquery"),("plainto_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("point",[ScalarType "lseg"],ScalarType "point"),("point",[ScalarType "path"],ScalarType "point"),("point",[ScalarType "box"],ScalarType "point"),("point",[ScalarType "polygon"],ScalarType "point"),("point",[ScalarType "circle"],ScalarType "point"),("point",[ScalarType "float8",ScalarType "float8"],ScalarType "point"),("point_above",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_add",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_below",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_distance",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("point_div",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_eq",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_horiz",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_in",[Pseudo Cstring],ScalarType "point"),("point_left",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_mul",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_ne",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_out",[ScalarType "point"],Pseudo Cstring),("point_recv",[Pseudo Internal],ScalarType "point"),("point_right",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_send",[ScalarType "point"],ScalarType "bytea"),("point_sub",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_vert",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("poly_above",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_below",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_center",[ScalarType "polygon"],ScalarType "point"),("poly_contain",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_contain_pt",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("poly_contained",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_distance",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("poly_in",[Pseudo Cstring],ScalarType "polygon"),("poly_left",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_npoints",[ScalarType "polygon"],ScalarType "int4"),("poly_out",[ScalarType "polygon"],Pseudo Cstring),("poly_overabove",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overbelow",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overlap",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overleft",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overright",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_recv",[Pseudo Internal],ScalarType "polygon"),("poly_right",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_same",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_send",[ScalarType "polygon"],ScalarType "bytea"),("polygon",[ScalarType "path"],ScalarType "polygon"),("polygon",[ScalarType "box"],ScalarType "polygon"),("polygon",[ScalarType "circle"],ScalarType "polygon"),("polygon",[ScalarType "int4",ScalarType "circle"],ScalarType "polygon"),("popen",[ScalarType "path"],ScalarType "path"),("position",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("position",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("position",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("positionjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("positionsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("postgresql_fdw_validator",[ArrayType (ScalarType "text"),ScalarType "oid"],ScalarType "bool"),("pow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("pow",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("power",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("prsd_end",[Pseudo Internal],Pseudo Void),("prsd_headline",[Pseudo Internal,Pseudo Internal,ScalarType "tsquery"],Pseudo Internal),("prsd_lextype",[Pseudo Internal],Pseudo Internal),("prsd_nexttoken",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("prsd_start",[Pseudo Internal,ScalarType "int4"],Pseudo Internal),("pt_contained_circle",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("pt_contained_poly",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("query_to_xml",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xml_and_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("querytree",[ScalarType "tsquery"],ScalarType "text"),("quote_ident",[ScalarType "text"],ScalarType "text"),("quote_literal",[ScalarType "text"],ScalarType "text"),("quote_literal",[Pseudo AnyElement],ScalarType "text"),("quote_nullable",[ScalarType "text"],ScalarType "text"),("quote_nullable",[Pseudo AnyElement],ScalarType "text"),("radians",[ScalarType "float8"],ScalarType "float8"),("radius",[ScalarType "circle"],ScalarType "float8"),("random",[],ScalarType "float8"),("record_eq",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ge",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_gt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_le",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_lt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ne",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_out",[Pseudo Record],Pseudo Cstring),("record_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_send",[Pseudo Record],ScalarType "bytea"),("regclass",[ScalarType "text"],ScalarType "regclass"),("regclassin",[Pseudo Cstring],ScalarType "regclass"),("regclassout",[ScalarType "regclass"],Pseudo Cstring),("regclassrecv",[Pseudo Internal],ScalarType "regclass"),("regclasssend",[ScalarType "regclass"],ScalarType "bytea"),("regconfigin",[Pseudo Cstring],ScalarType "regconfig"),("regconfigout",[ScalarType "regconfig"],Pseudo Cstring),("regconfigrecv",[Pseudo Internal],ScalarType "regconfig"),("regconfigsend",[ScalarType "regconfig"],ScalarType "bytea"),("regdictionaryin",[Pseudo Cstring],ScalarType "regdictionary"),("regdictionaryout",[ScalarType "regdictionary"],Pseudo Cstring),("regdictionaryrecv",[Pseudo Internal],ScalarType "regdictionary"),("regdictionarysend",[ScalarType "regdictionary"],ScalarType "bytea"),("regexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexp_matches",[ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_matches",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_split_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_array",[ScalarType "text",ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regoperatorin",[Pseudo Cstring],ScalarType "regoperator"),("regoperatorout",[ScalarType "regoperator"],Pseudo Cstring),("regoperatorrecv",[Pseudo Internal],ScalarType "regoperator"),("regoperatorsend",[ScalarType "regoperator"],ScalarType "bytea"),("regoperin",[Pseudo Cstring],ScalarType "regoper"),("regoperout",[ScalarType "regoper"],Pseudo Cstring),("regoperrecv",[Pseudo Internal],ScalarType "regoper"),("regopersend",[ScalarType "regoper"],ScalarType "bytea"),("regprocedurein",[Pseudo Cstring],ScalarType "regprocedure"),("regprocedureout",[ScalarType "regprocedure"],Pseudo Cstring),("regprocedurerecv",[Pseudo Internal],ScalarType "regprocedure"),("regproceduresend",[ScalarType "regprocedure"],ScalarType "bytea"),("regprocin",[Pseudo Cstring],ScalarType "regproc"),("regprocout",[ScalarType "regproc"],Pseudo Cstring),("regprocrecv",[Pseudo Internal],ScalarType "regproc"),("regprocsend",[ScalarType "regproc"],ScalarType "bytea"),("regtypein",[Pseudo Cstring],ScalarType "regtype"),("regtypeout",[ScalarType "regtype"],Pseudo Cstring),("regtyperecv",[Pseudo Internal],ScalarType "regtype"),("regtypesend",[ScalarType "regtype"],ScalarType "bytea"),("reltime",[ScalarType "interval"],ScalarType "reltime"),("reltimeeq",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimege",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimegt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimein",[Pseudo Cstring],ScalarType "reltime"),("reltimele",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimelt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimene",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimeout",[ScalarType "reltime"],Pseudo Cstring),("reltimerecv",[Pseudo Internal],ScalarType "reltime"),("reltimesend",[ScalarType "reltime"],ScalarType "bytea"),("repeat",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("round",[ScalarType "float8"],ScalarType "float8"),("round",[ScalarType "numeric"],ScalarType "numeric"),("round",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("rpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("rpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("scalargtjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalargtsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("scalarltjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalarltsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("schema_to_xml",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xml_and_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("session_user",[],ScalarType "name"),("set_bit",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_byte",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_config",[ScalarType "text",ScalarType "text",ScalarType "bool"],ScalarType "text"),("set_masklen",[ScalarType "cidr",ScalarType "int4"],ScalarType "cidr"),("set_masklen",[ScalarType "inet",ScalarType "int4"],ScalarType "inet"),("setseed",[ScalarType "float8"],Pseudo Void),("setval",[ScalarType "regclass",ScalarType "int8"],ScalarType "int8"),("setval",[ScalarType "regclass",ScalarType "int8",ScalarType "bool"],ScalarType "int8"),("setweight",[ScalarType "tsvector",ScalarType "char"],ScalarType "tsvector"),("shell_in",[Pseudo Cstring],Pseudo Opaque),("shell_out",[Pseudo Opaque],Pseudo Cstring),("shift_jis_2004_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shift_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shobj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("sign",[ScalarType "float8"],ScalarType "float8"),("sign",[ScalarType "numeric"],ScalarType "numeric"),("similar_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("sin",[ScalarType "float8"],ScalarType "float8"),("sjis_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("slope",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("smgreq",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrin",[Pseudo Cstring],ScalarType "smgr"),("smgrne",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrout",[ScalarType "smgr"],Pseudo Cstring),("split_part",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("sqrt",[ScalarType "float8"],ScalarType "float8"),("sqrt",[ScalarType "numeric"],ScalarType "numeric"),("statement_timestamp",[],ScalarType "timestamptz"),("string_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("strip",[ScalarType "tsvector"],ScalarType "tsvector"),("strpos",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("substr",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substr",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("substring",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("suppress_redundant_updates_trigger",[],Pseudo Trigger),("table_to_xml",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xml_and_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("tan",[ScalarType "float8"],ScalarType "float8"),("text",[ScalarType "bool"],ScalarType "text"),("text",[ScalarType "char"],ScalarType "text"),("text",[ScalarType "name"],ScalarType "text"),("text",[ScalarType "xml"],ScalarType "text"),("text",[ScalarType "inet"],ScalarType "text"),("text",[ScalarType "bpchar"],ScalarType "text"),("text_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_larger",[ScalarType "text",ScalarType "text"],ScalarType "text"),("text_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_smaller",[ScalarType "text",ScalarType "text"],ScalarType "text"),("textanycat",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("textcat",[ScalarType "text",ScalarType "text"],ScalarType "text"),("texteq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textin",[Pseudo Cstring],ScalarType "text"),("textlen",[ScalarType "text"],ScalarType "int4"),("textlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textout",[ScalarType "text"],Pseudo Cstring),("textrecv",[Pseudo Internal],ScalarType "text"),("textregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textsend",[ScalarType "text"],ScalarType "bytea"),("thesaurus_init",[Pseudo Internal],Pseudo Internal),("thesaurus_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("tideq",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidge",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidgt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidin",[Pseudo Cstring],ScalarType "tid"),("tidlarger",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("tidle",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidlt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidne",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidout",[ScalarType "tid"],Pseudo Cstring),("tidrecv",[Pseudo Internal],ScalarType "tid"),("tidsend",[ScalarType "tid"],ScalarType "bytea"),("tidsmaller",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("time",[ScalarType "abstime"],ScalarType "time"),("time",[ScalarType "timestamp"],ScalarType "time"),("time",[ScalarType "timestamptz"],ScalarType "time"),("time",[ScalarType "interval"],ScalarType "time"),("time",[ScalarType "timetz"],ScalarType "time"),("time",[ScalarType "time",ScalarType "int4"],ScalarType "time"),("time_cmp",[ScalarType "time",ScalarType "time"],ScalarType "int4"),("time_eq",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_ge",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_gt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_hash",[ScalarType "time"],ScalarType "int4"),("time_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_larger",[ScalarType "time",ScalarType "time"],ScalarType "time"),("time_le",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_lt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_mi_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_mi_time",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("time_ne",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_out",[ScalarType "time"],Pseudo Cstring),("time_pl_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_send",[ScalarType "time"],ScalarType "bytea"),("time_smaller",[ScalarType "time",ScalarType "time"],ScalarType "time"),("timedate_pl",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("timemi",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timenow",[],ScalarType "abstime"),("timeofday",[],ScalarType "text"),("timepl",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timestamp",[ScalarType "abstime"],ScalarType "timestamp"),("timestamp",[ScalarType "date"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamptz"],ScalarType "timestamp"),("timestamp",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamp",ScalarType "int4"],ScalarType "timestamp"),("timestamp_cmp",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "int4"),("timestamp_cmp_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "int4"),("timestamp_cmp_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "int4"),("timestamp_eq",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_eq_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_eq_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_ge",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ge_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ge_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_gt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_gt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_gt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_hash",[ScalarType "timestamp"],ScalarType "int4"),("timestamp_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_larger",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamp_le",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_le_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_le_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_lt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_lt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_lt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_mi",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("timestamp_mi_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_ne",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ne_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ne_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_out",[ScalarType "timestamp"],Pseudo Cstring),("timestamp_pl_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_send",[ScalarType "timestamp"],ScalarType "bytea"),("timestamp_smaller",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamptypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptypmodout",[ScalarType "int4"],Pseudo Cstring),("timestamptz",[ScalarType "abstime"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamp"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "time"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamptz",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_cmp",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "int4"),("timestamptz_cmp_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "int4"),("timestamptz_cmp_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "int4"),("timestamptz_eq",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_eq_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_eq_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_ge",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ge_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ge_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_gt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_gt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_gt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_larger",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptz_le",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_le_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_le_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_lt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_lt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_lt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_mi",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("timestamptz_mi_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_ne",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ne_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ne_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_out",[ScalarType "timestamptz"],Pseudo Cstring),("timestamptz_pl_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_send",[ScalarType "timestamptz"],ScalarType "bytea"),("timestamptz_smaller",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptztypmodout",[ScalarType "int4"],Pseudo Cstring),("timetypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetypmodout",[ScalarType "int4"],Pseudo Cstring),("timetz",[ScalarType "time"],ScalarType "timetz"),("timetz",[ScalarType "timestamptz"],ScalarType "timetz"),("timetz",[ScalarType "timetz",ScalarType "int4"],ScalarType "timetz"),("timetz_cmp",[ScalarType "timetz",ScalarType "timetz"],ScalarType "int4"),("timetz_eq",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_ge",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_gt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_hash",[ScalarType "timetz"],ScalarType "int4"),("timetz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_larger",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetz_le",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_lt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_mi_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_ne",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_out",[ScalarType "timetz"],Pseudo Cstring),("timetz_pl_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_send",[ScalarType "timetz"],ScalarType "bytea"),("timetz_smaller",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetzdate_pl",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("timetztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetztypmodout",[ScalarType "int4"],Pseudo Cstring),("timezone",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "text",ScalarType "timetz"],ScalarType "timetz"),("timezone",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("tinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("tintervalct",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalend",[ScalarType "tinterval"],ScalarType "abstime"),("tintervaleq",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalge",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalgt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalin",[Pseudo Cstring],ScalarType "tinterval"),("tintervalle",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalleneq",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenge",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallengt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenle",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenlt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenne",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalne",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalout",[ScalarType "tinterval"],Pseudo Cstring),("tintervalov",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalrecv",[Pseudo Internal],ScalarType "tinterval"),("tintervalrel",[ScalarType "tinterval"],ScalarType "reltime"),("tintervalsame",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalsend",[ScalarType "tinterval"],ScalarType "bytea"),("tintervalstart",[ScalarType "tinterval"],ScalarType "abstime"),("to_ascii",[ScalarType "text"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "name"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("to_char",[ScalarType "int8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "int4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamp",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamptz",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "interval",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "numeric",ScalarType "text"],ScalarType "text"),("to_date",[ScalarType "text",ScalarType "text"],ScalarType "date"),("to_hex",[ScalarType "int8"],ScalarType "text"),("to_hex",[ScalarType "int4"],ScalarType "text"),("to_number",[ScalarType "text",ScalarType "text"],ScalarType "numeric"),("to_timestamp",[ScalarType "float8"],ScalarType "timestamptz"),("to_timestamp",[ScalarType "text",ScalarType "text"],ScalarType "timestamptz"),("to_tsquery",[ScalarType "text"],ScalarType "tsquery"),("to_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("to_tsvector",[ScalarType "text"],ScalarType "tsvector"),("to_tsvector",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsvector"),("transaction_timestamp",[],ScalarType "timestamptz"),("translate",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("trigger_in",[Pseudo Cstring],Pseudo Trigger),("trigger_out",[Pseudo Trigger],Pseudo Cstring),("trunc",[ScalarType "float8"],ScalarType "float8"),("trunc",[ScalarType "macaddr"],ScalarType "macaddr"),("trunc",[ScalarType "numeric"],ScalarType "numeric"),("trunc",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("ts_debug",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_debug",[ScalarType "regconfig",ScalarType "text"],SetOfType (Pseudo Record)),("ts_headline",[ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_lexize",[ScalarType "regdictionary",ScalarType "text"],ArrayType (ScalarType "text")),("ts_match_qv",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("ts_match_tq",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("ts_match_tt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("ts_match_vq",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("ts_parse",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_parse",[ScalarType "oid",ScalarType "text"],SetOfType (Pseudo Record)),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rewrite",[ScalarType "tsquery",ScalarType "text"],ScalarType "tsquery"),("ts_rewrite",[ScalarType "tsquery",ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("ts_stat",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_stat",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "oid"],SetOfType (Pseudo Record)),("ts_typanalyze",[Pseudo Internal],ScalarType "bool"),("tsmatchjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("tsmatchsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("tsq_mcontained",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsq_mcontains",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_and",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_cmp",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "int4"),("tsquery_eq",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ge",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_gt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_le",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_lt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ne",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_not",[ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_or",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsqueryin",[Pseudo Cstring],ScalarType "tsquery"),("tsqueryout",[ScalarType "tsquery"],Pseudo Cstring),("tsqueryrecv",[Pseudo Internal],ScalarType "tsquery"),("tsquerysend",[ScalarType "tsquery"],ScalarType "bytea"),("tsvector_cmp",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "int4"),("tsvector_concat",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("tsvector_eq",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ge",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_gt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_le",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_lt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ne",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_update_trigger",[],Pseudo Trigger),("tsvector_update_trigger_column",[],Pseudo Trigger),("tsvectorin",[Pseudo Cstring],ScalarType "tsvector"),("tsvectorout",[ScalarType "tsvector"],Pseudo Cstring),("tsvectorrecv",[Pseudo Internal],ScalarType "tsvector"),("tsvectorsend",[ScalarType "tsvector"],ScalarType "bytea"),("txid_current",[],ScalarType "int8"),("txid_current_snapshot",[],ScalarType "txid_snapshot"),("txid_snapshot_in",[Pseudo Cstring],ScalarType "txid_snapshot"),("txid_snapshot_out",[ScalarType "txid_snapshot"],Pseudo Cstring),("txid_snapshot_recv",[Pseudo Internal],ScalarType "txid_snapshot"),("txid_snapshot_send",[ScalarType "txid_snapshot"],ScalarType "bytea"),("txid_snapshot_xip",[ScalarType "txid_snapshot"],SetOfType (ScalarType "int8")),("txid_snapshot_xmax",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_snapshot_xmin",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_visible_in_snapshot",[ScalarType "int8",ScalarType "txid_snapshot"],ScalarType "bool"),("uhc_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("unknownin",[Pseudo Cstring],ScalarType "unknown"),("unknownout",[ScalarType "unknown"],Pseudo Cstring),("unknownrecv",[Pseudo Internal],ScalarType "unknown"),("unknownsend",[ScalarType "unknown"],ScalarType "bytea"),("unnest",[Pseudo AnyArray],SetOfType (Pseudo AnyElement)),("upper",[ScalarType "text"],ScalarType "text"),("utf8_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gb18030",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gbk",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859_1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_johab",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8u",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_uhc",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_win",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("uuid_cmp",[ScalarType "uuid",ScalarType "uuid"],ScalarType "int4"),("uuid_eq",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ge",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_gt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_hash",[ScalarType "uuid"],ScalarType "int4"),("uuid_in",[Pseudo Cstring],ScalarType "uuid"),("uuid_le",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_lt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ne",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_out",[ScalarType "uuid"],Pseudo Cstring),("uuid_recv",[Pseudo Internal],ScalarType "uuid"),("uuid_send",[ScalarType "uuid"],ScalarType "bytea"),("varbit",[ScalarType "varbit",ScalarType "int4",ScalarType "bool"],ScalarType "varbit"),("varbit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_out",[ScalarType "varbit"],Pseudo Cstring),("varbit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_send",[ScalarType "varbit"],ScalarType "bytea"),("varbitcmp",[ScalarType "varbit",ScalarType "varbit"],ScalarType "int4"),("varbiteq",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitge",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitgt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitle",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitlt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitne",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varbittypmodout",[ScalarType "int4"],Pseudo Cstring),("varchar",[ScalarType "name"],ScalarType "varchar"),("varchar",[ScalarType "varchar",ScalarType "int4",ScalarType "bool"],ScalarType "varchar"),("varcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharout",[ScalarType "varchar"],Pseudo Cstring),("varcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharsend",[ScalarType "varchar"],ScalarType "bytea"),("varchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varchartypmodout",[ScalarType "int4"],Pseudo Cstring),("version",[],ScalarType "text"),("void_in",[Pseudo Cstring],Pseudo Void),("void_out",[Pseudo Void],Pseudo Cstring),("width",[ScalarType "box"],ScalarType "float8"),("width_bucket",[ScalarType "float8",ScalarType "float8",ScalarType "float8",ScalarType "int4"],ScalarType "int4"),("width_bucket",[ScalarType "numeric",ScalarType "numeric",ScalarType "numeric",ScalarType "int4"],ScalarType "int4"),("win1250_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1250_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("xideq",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("xideqint4",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("xidin",[Pseudo Cstring],ScalarType "xid"),("xidout",[ScalarType "xid"],Pseudo Cstring),("xidrecv",[Pseudo Internal],ScalarType "xid"),("xidsend",[ScalarType "xid"],ScalarType "bytea"),("xml",[ScalarType "text"],ScalarType "xml"),("xml_in",[Pseudo Cstring],ScalarType "xml"),("xml_out",[ScalarType "xml"],Pseudo Cstring),("xml_recv",[Pseudo Internal],ScalarType "xml"),("xml_send",[ScalarType "xml"],ScalarType "bytea"),("xmlcomment",[ScalarType "text"],ScalarType "xml"),("xmlconcat2",[ScalarType "xml",ScalarType "xml"],ScalarType "xml"),("xmlvalidate",[ScalarType "xml",ScalarType "text"],ScalarType "bool"),("xpath",[ScalarType "text",ScalarType "xml"],ArrayType (ScalarType "xml")),("xpath",[ScalarType "text",ScalarType "xml",ArrayType (ScalarType "text")],ArrayType (ScalarType "xml"))], scopeAggregates = [("array_agg",[Pseudo AnyElement],Pseudo AnyArray),("avg",[ScalarType "int8"],ScalarType "numeric"),("avg",[ScalarType "int2"],ScalarType "numeric"),("avg",[ScalarType "int4"],ScalarType "numeric"),("avg",[ScalarType "float4"],ScalarType "float8"),("avg",[ScalarType "float8"],ScalarType "float8"),("avg",[ScalarType "interval"],ScalarType "interval"),("avg",[ScalarType "numeric"],ScalarType "numeric"),("bit_and",[ScalarType "int8"],ScalarType "int8"),("bit_and",[ScalarType "int2"],ScalarType "int2"),("bit_and",[ScalarType "int4"],ScalarType "int4"),("bit_and",[ScalarType "bit"],ScalarType "bit"),("bit_or",[ScalarType "int8"],ScalarType "int8"),("bit_or",[ScalarType "int2"],ScalarType "int2"),("bit_or",[ScalarType "int4"],ScalarType "int4"),("bit_or",[ScalarType "bit"],ScalarType "bit"),("bool_and",[ScalarType "bool"],ScalarType "bool"),("bool_or",[ScalarType "bool"],ScalarType "bool"),("corr",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("count",[],ScalarType "int8"),("count",[Pseudo Any],ScalarType "int8"),("covar_pop",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("covar_samp",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("every",[ScalarType "bool"],ScalarType "bool"),("max",[ScalarType "int8"],ScalarType "int8"),("max",[ScalarType "int2"],ScalarType "int2"),("max",[ScalarType "int4"],ScalarType "int4"),("max",[ScalarType "text"],ScalarType "text"),("max",[ScalarType "oid"],ScalarType "oid"),("max",[ScalarType "tid"],ScalarType "tid"),("max",[ScalarType "float4"],ScalarType "float4"),("max",[ScalarType "float8"],ScalarType "float8"),("max",[ScalarType "abstime"],ScalarType "abstime"),("max",[ScalarType "money"],ScalarType "money"),("max",[ScalarType "bpchar"],ScalarType "bpchar"),("max",[ScalarType "date"],ScalarType "date"),("max",[ScalarType "time"],ScalarType "time"),("max",[ScalarType "timestamp"],ScalarType "timestamp"),("max",[ScalarType "timestamptz"],ScalarType "timestamptz"),("max",[ScalarType "interval"],ScalarType "interval"),("max",[ScalarType "timetz"],ScalarType "timetz"),("max",[ScalarType "numeric"],ScalarType "numeric"),("max",[Pseudo AnyArray],Pseudo AnyArray),("max",[Pseudo AnyEnum],Pseudo AnyEnum),("min",[ScalarType "int8"],ScalarType "int8"),("min",[ScalarType "int2"],ScalarType "int2"),("min",[ScalarType "int4"],ScalarType "int4"),("min",[ScalarType "text"],ScalarType "text"),("min",[ScalarType "oid"],ScalarType "oid"),("min",[ScalarType "tid"],ScalarType "tid"),("min",[ScalarType "float4"],ScalarType "float4"),("min",[ScalarType "float8"],ScalarType "float8"),("min",[ScalarType "abstime"],ScalarType "abstime"),("min",[ScalarType "money"],ScalarType "money"),("min",[ScalarType "bpchar"],ScalarType "bpchar"),("min",[ScalarType "date"],ScalarType "date"),("min",[ScalarType "time"],ScalarType "time"),("min",[ScalarType "timestamp"],ScalarType "timestamp"),("min",[ScalarType "timestamptz"],ScalarType "timestamptz"),("min",[ScalarType "interval"],ScalarType "interval"),("min",[ScalarType "timetz"],ScalarType "timetz"),("min",[ScalarType "numeric"],ScalarType "numeric"),("min",[Pseudo AnyArray],Pseudo AnyArray),("min",[Pseudo AnyEnum],Pseudo AnyEnum),("regr_avgx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_avgy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_count",[ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("regr_intercept",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_r2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_slope",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_syy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "int8"],ScalarType "numeric"),("stddev",[ScalarType "int2"],ScalarType "numeric"),("stddev",[ScalarType "int4"],ScalarType "numeric"),("stddev",[ScalarType "float4"],ScalarType "float8"),("stddev",[ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "numeric"],ScalarType "numeric"),("stddev_pop",[ScalarType "int8"],ScalarType "numeric"),("stddev_pop",[ScalarType "int2"],ScalarType "numeric"),("stddev_pop",[ScalarType "int4"],ScalarType "numeric"),("stddev_pop",[ScalarType "float4"],ScalarType "float8"),("stddev_pop",[ScalarType "float8"],ScalarType "float8"),("stddev_pop",[ScalarType "numeric"],ScalarType "numeric"),("stddev_samp",[ScalarType "int8"],ScalarType "numeric"),("stddev_samp",[ScalarType "int2"],ScalarType "numeric"),("stddev_samp",[ScalarType "int4"],ScalarType "numeric"),("stddev_samp",[ScalarType "float4"],ScalarType "float8"),("stddev_samp",[ScalarType "float8"],ScalarType "float8"),("stddev_samp",[ScalarType "numeric"],ScalarType "numeric"),("sum",[ScalarType "int8"],ScalarType "numeric"),("sum",[ScalarType "int2"],ScalarType "int8"),("sum",[ScalarType "int4"],ScalarType "int8"),("sum",[ScalarType "float4"],ScalarType "float4"),("sum",[ScalarType "float8"],ScalarType "float8"),("sum",[ScalarType "money"],ScalarType "money"),("sum",[ScalarType "interval"],ScalarType "interval"),("sum",[ScalarType "numeric"],ScalarType "numeric"),("var_pop",[ScalarType "int8"],ScalarType "numeric"),("var_pop",[ScalarType "int2"],ScalarType "numeric"),("var_pop",[ScalarType "int4"],ScalarType "numeric"),("var_pop",[ScalarType "float4"],ScalarType "float8"),("var_pop",[ScalarType "float8"],ScalarType "float8"),("var_pop",[ScalarType "numeric"],ScalarType "numeric"),("var_samp",[ScalarType "int8"],ScalarType "numeric"),("var_samp",[ScalarType "int2"],ScalarType "numeric"),("var_samp",[ScalarType "int4"],ScalarType "numeric"),("var_samp",[ScalarType "float4"],ScalarType "float8"),("var_samp",[ScalarType "float8"],ScalarType "float8"),("var_samp",[ScalarType "numeric"],ScalarType "numeric"),("variance",[ScalarType "int8"],ScalarType "numeric"),("variance",[ScalarType "int2"],ScalarType "numeric"),("variance",[ScalarType "int4"],ScalarType "numeric"),("variance",[ScalarType "float4"],ScalarType "float8"),("variance",[ScalarType "float8"],ScalarType "float8"),("variance",[ScalarType "numeric"],ScalarType "numeric"),("xmlagg",[ScalarType "xml"],ScalarType "xml")], scopeAllFns = [("~",[ScalarType "int8"],ScalarType "int8"),("~",[ScalarType "int4"],ScalarType "int4"),("~",[ScalarType "int2"],ScalarType "int2"),("~",[ScalarType "bit"],ScalarType "bit"),("~",[ScalarType "inet"],ScalarType "inet"),("||/",[ScalarType "float8"],ScalarType "float8"),("|/",[ScalarType "float8"],ScalarType "float8"),("|",[ScalarType "tinterval"],ScalarType "abstime"),("@@",[ScalarType "circle"],ScalarType "point"),("@@",[ScalarType "lseg"],ScalarType "point"),("@@",[ScalarType "path"],ScalarType "point"),("@@",[ScalarType "polygon"],ScalarType "point"),("@@",[ScalarType "box"],ScalarType "point"),("@-@",[ScalarType "path"],ScalarType "float8"),("@-@",[ScalarType "lseg"],ScalarType "float8"),("@",[ScalarType "int8"],ScalarType "int8"),("@",[ScalarType "int4"],ScalarType "int4"),("@",[ScalarType "int2"],ScalarType "int2"),("@",[ScalarType "float8"],ScalarType "float8"),("@",[ScalarType "float4"],ScalarType "float4"),("@",[ScalarType "numeric"],ScalarType "numeric"),("?|",[ScalarType "line"],ScalarType "bool"),("?|",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "line"],ScalarType "bool"),("-",[ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "path"],ScalarType "int4"),("#",[ScalarType "polygon"],ScalarType "int4"),("!!",[ScalarType "int8"],ScalarType "numeric"),("!!",[ScalarType "tsquery"],ScalarType "tsquery"),("!",[ScalarType "int8"],ScalarType "numeric"),("~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("~=",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~=",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("~<~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~<=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("||",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "text",ScalarType "text"],ScalarType "text"),("||",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("||",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("||",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("||",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("||",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("||",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("||",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("|>>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|>>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|>>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("|",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("|",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("|",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("|",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("^",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("^",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("@@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("@>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("@>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("@>",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("@>",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("?||",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?||",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?|",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?-|",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?-|",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?#",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("?#",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "box"],ScalarType "bool"),(">^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),(">>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">>",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),(">>",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),(">>",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),(">>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),(">=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">=",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),(">=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("=",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("=",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("=",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("=",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<@",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("<?>",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<>",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<>",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<>",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<>",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<>",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<>",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<>",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<>",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<>",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<>",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<>",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<>",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<>",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<>",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<>",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<>",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("<<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("<<",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("<<",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("<<",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<->",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("<#>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("<",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("/",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("/",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("/",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("/",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("/",[ScalarType "point",ScalarType "point"],ScalarType "point"),("/",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("/",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("/",[ScalarType "path",ScalarType "point"],ScalarType "path"),("/",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("/",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("/",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("/",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("/",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("/",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("/",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("-",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("-",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("-",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("-",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("-",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("-",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("-",[ScalarType "money",ScalarType "money"],ScalarType "money"),("-",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("-",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("-",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "path",ScalarType "point"],ScalarType "path"),("-",[ScalarType "point",ScalarType "point"],ScalarType "point"),("-",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("-",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("-",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("-",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("-",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("-",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("-",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("+",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("+",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("+",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("+",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("+",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("+",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("+",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("+",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "point",ScalarType "point"],ScalarType "point"),("+",[ScalarType "path",ScalarType "path"],ScalarType "path"),("+",[ScalarType "path",ScalarType "point"],ScalarType "path"),("+",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "box",ScalarType "point"],ScalarType "box"),("+",[ScalarType "money",ScalarType "money"],ScalarType "money"),("+",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("+",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("+",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("+",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("+",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("+",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("+",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("+",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("+",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("+",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("+",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("+",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("*",[ScalarType "point",ScalarType "point"],ScalarType "point"),("*",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("*",[ScalarType "path",ScalarType "point"],ScalarType "path"),("*",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("*",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "box",ScalarType "point"],ScalarType "box"),("*",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("*",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("*",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("*",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("*",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("*",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("*",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("*",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("*",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("*",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("*",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("&&",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("&&",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&&",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&&",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("&",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("&",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("&",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("&",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("&",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("%",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("%",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#>=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("##",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "box"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("##",[ScalarType "line",ScalarType "box"],ScalarType "point"),("##",[ScalarType "point",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("#",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("#",[ScalarType "line",ScalarType "line"],ScalarType "point"),("#",[ScalarType "box",ScalarType "box"],ScalarType "box"),("#",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("#",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("!~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("!~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("RI_FKey_cascade_del",[],Pseudo Trigger),("RI_FKey_cascade_upd",[],Pseudo Trigger),("RI_FKey_check_ins",[],Pseudo Trigger),("RI_FKey_check_upd",[],Pseudo Trigger),("RI_FKey_noaction_del",[],Pseudo Trigger),("RI_FKey_noaction_upd",[],Pseudo Trigger),("RI_FKey_restrict_del",[],Pseudo Trigger),("RI_FKey_restrict_upd",[],Pseudo Trigger),("RI_FKey_setdefault_del",[],Pseudo Trigger),("RI_FKey_setdefault_upd",[],Pseudo Trigger),("RI_FKey_setnull_del",[],Pseudo Trigger),("RI_FKey_setnull_upd",[],Pseudo Trigger),("abbrev",[ScalarType "cidr"],ScalarType "text"),("abbrev",[ScalarType "inet"],ScalarType "text"),("abs",[ScalarType "int8"],ScalarType "int8"),("abs",[ScalarType "int2"],ScalarType "int2"),("abs",[ScalarType "int4"],ScalarType "int4"),("abs",[ScalarType "float4"],ScalarType "float4"),("abs",[ScalarType "float8"],ScalarType "float8"),("abs",[ScalarType "numeric"],ScalarType "numeric"),("abstime",[ScalarType "timestamp"],ScalarType "abstime"),("abstime",[ScalarType "timestamptz"],ScalarType "abstime"),("abstimeeq",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimege",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimegt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimein",[Pseudo Cstring],ScalarType "abstime"),("abstimele",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimelt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimene",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimeout",[ScalarType "abstime"],Pseudo Cstring),("abstimerecv",[Pseudo Internal],ScalarType "abstime"),("abstimesend",[ScalarType "abstime"],ScalarType "bytea"),("aclcontains",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("aclinsert",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("aclitemeq",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("aclitemin",[Pseudo Cstring],ScalarType "aclitem"),("aclitemout",[ScalarType "aclitem"],Pseudo Cstring),("aclremove",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("acos",[ScalarType "float8"],ScalarType "float8"),("age",[ScalarType "xid"],ScalarType "int4"),("age",[ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz"],ScalarType "interval"),("age",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("any_in",[Pseudo Cstring],Pseudo Any),("any_out",[Pseudo Any],Pseudo Cstring),("anyarray_in",[Pseudo Cstring],Pseudo AnyArray),("anyarray_out",[Pseudo AnyArray],Pseudo Cstring),("anyarray_recv",[Pseudo Internal],Pseudo AnyArray),("anyarray_send",[Pseudo AnyArray],ScalarType "bytea"),("anyelement_in",[Pseudo Cstring],Pseudo AnyElement),("anyelement_out",[Pseudo AnyElement],Pseudo Cstring),("anyenum_in",[Pseudo Cstring],Pseudo AnyEnum),("anyenum_out",[Pseudo AnyEnum],Pseudo Cstring),("anynonarray_in",[Pseudo Cstring],Pseudo AnyNonArray),("anynonarray_out",[Pseudo AnyNonArray],Pseudo Cstring),("anytextcat",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("area",[ScalarType "path"],ScalarType "float8"),("area",[ScalarType "box"],ScalarType "float8"),("area",[ScalarType "circle"],ScalarType "float8"),("areajoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("areasel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("array_agg_finalfn",[Pseudo Internal],Pseudo AnyArray),("array_agg_transfn",[Pseudo Internal,Pseudo AnyElement],Pseudo Internal),("array_append",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("array_cat",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_dims",[Pseudo AnyArray],ScalarType "text"),("array_eq",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4"),ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_ge",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_gt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_larger",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_le",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_length",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lower",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_ndims",[Pseudo AnyArray],ScalarType "int4"),("array_ne",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_out",[Pseudo AnyArray],Pseudo Cstring),("array_prepend",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("array_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_send",[Pseudo AnyArray],ScalarType "bytea"),("array_smaller",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_to_string",[Pseudo AnyArray,ScalarType "text"],ScalarType "text"),("array_upper",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("arraycontained",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arraycontains",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arrayoverlap",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("ascii",[ScalarType "text"],ScalarType "int4"),("ascii_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("ascii_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("asin",[ScalarType "float8"],ScalarType "float8"),("atan",[ScalarType "float8"],ScalarType "float8"),("atan2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("big5_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("bit",[ScalarType "int8",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "bit",ScalarType "int4",ScalarType "bool"],ScalarType "bit"),("bit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_length",[ScalarType "bytea"],ScalarType "int4"),("bit_length",[ScalarType "text"],ScalarType "int4"),("bit_length",[ScalarType "bit"],ScalarType "int4"),("bit_out",[ScalarType "bit"],Pseudo Cstring),("bit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_send",[ScalarType "bit"],ScalarType "bytea"),("bitand",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitcat",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("bitcmp",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("biteq",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitge",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitgt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitle",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitlt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitne",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitnot",[ScalarType "bit"],ScalarType "bit"),("bitor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitshiftleft",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bitshiftright",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bittypmodout",[ScalarType "int4"],Pseudo Cstring),("bitxor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bool",[ScalarType "int4"],ScalarType "bool"),("booland_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("booleq",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolge",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolgt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolin",[Pseudo Cstring],ScalarType "bool"),("boolle",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boollt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolne",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolor_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolout",[ScalarType "bool"],Pseudo Cstring),("boolrecv",[Pseudo Internal],ScalarType "bool"),("boolsend",[ScalarType "bool"],ScalarType "bytea"),("box",[ScalarType "polygon"],ScalarType "box"),("box",[ScalarType "circle"],ScalarType "box"),("box",[ScalarType "point",ScalarType "point"],ScalarType "box"),("box_above",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_above_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_add",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_below",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_below_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_center",[ScalarType "box"],ScalarType "point"),("box_contain",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_contained",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_distance",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("box_div",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_ge",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_gt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_in",[Pseudo Cstring],ScalarType "box"),("box_intersect",[ScalarType "box",ScalarType "box"],ScalarType "box"),("box_le",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_left",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_lt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_mul",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_out",[ScalarType "box"],Pseudo Cstring),("box_overabove",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overbelow",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overlap",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overleft",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overright",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_recv",[Pseudo Internal],ScalarType "box"),("box_right",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_same",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_send",[ScalarType "box"],ScalarType "bytea"),("box_sub",[ScalarType "box",ScalarType "point"],ScalarType "box"),("bpchar",[ScalarType "char"],ScalarType "bpchar"),("bpchar",[ScalarType "name"],ScalarType "bpchar"),("bpchar",[ScalarType "bpchar",ScalarType "int4",ScalarType "bool"],ScalarType "bpchar"),("bpchar_larger",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpchar_pattern_ge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_gt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_le",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_lt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_smaller",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpcharcmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("bpchareq",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchargt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchariclike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharle",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharlt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharne",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharout",[ScalarType "bpchar"],Pseudo Cstring),("bpcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharsend",[ScalarType "bpchar"],ScalarType "bytea"),("bpchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bpchartypmodout",[ScalarType "int4"],Pseudo Cstring),("broadcast",[ScalarType "inet"],ScalarType "inet"),("btabstimecmp",[ScalarType "abstime",ScalarType "abstime"],ScalarType "int4"),("btarraycmp",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "int4"),("btbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btboolcmp",[ScalarType "bool",ScalarType "bool"],ScalarType "int4"),("btbpchar_pattern_cmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("btbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btcharcmp",[ScalarType "char",ScalarType "char"],ScalarType "int4"),("btcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("btendscan",[Pseudo Internal],Pseudo Void),("btfloat48cmp",[ScalarType "float4",ScalarType "float8"],ScalarType "int4"),("btfloat4cmp",[ScalarType "float4",ScalarType "float4"],ScalarType "int4"),("btfloat84cmp",[ScalarType "float8",ScalarType "float4"],ScalarType "int4"),("btfloat8cmp",[ScalarType "float8",ScalarType "float8"],ScalarType "int4"),("btgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("btgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btint24cmp",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("btint28cmp",[ScalarType "int2",ScalarType "int8"],ScalarType "int4"),("btint2cmp",[ScalarType "int2",ScalarType "int2"],ScalarType "int4"),("btint42cmp",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("btint48cmp",[ScalarType "int4",ScalarType "int8"],ScalarType "int4"),("btint4cmp",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("btint82cmp",[ScalarType "int8",ScalarType "int2"],ScalarType "int4"),("btint84cmp",[ScalarType "int8",ScalarType "int4"],ScalarType "int4"),("btint8cmp",[ScalarType "int8",ScalarType "int8"],ScalarType "int4"),("btmarkpos",[Pseudo Internal],Pseudo Void),("btnamecmp",[ScalarType "name",ScalarType "name"],ScalarType "int4"),("btoidcmp",[ScalarType "oid",ScalarType "oid"],ScalarType "int4"),("btoidvectorcmp",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "int4"),("btoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("btrecordcmp",[Pseudo Record,Pseudo Record],ScalarType "int4"),("btreltimecmp",[ScalarType "reltime",ScalarType "reltime"],ScalarType "int4"),("btrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("btrestrpos",[Pseudo Internal],Pseudo Void),("btrim",[ScalarType "text"],ScalarType "text"),("btrim",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("btrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("bttext_pattern_cmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttextcmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttidcmp",[ScalarType "tid",ScalarType "tid"],ScalarType "int4"),("bttintervalcmp",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "int4"),("btvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("byteacat",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("byteacmp",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("byteaeq",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteage",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteagt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteain",[Pseudo Cstring],ScalarType "bytea"),("byteale",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteane",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteanlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteaout",[ScalarType "bytea"],Pseudo Cstring),("bytearecv",[Pseudo Internal],ScalarType "bytea"),("byteasend",[ScalarType "bytea"],ScalarType "bytea"),("cash_cmp",[ScalarType "money",ScalarType "money"],ScalarType "int4"),("cash_div_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_div_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_div_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_div_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_eq",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_ge",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_gt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_in",[Pseudo Cstring],ScalarType "money"),("cash_le",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_lt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_mi",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_mul_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_mul_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_mul_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_mul_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_ne",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_out",[ScalarType "money"],Pseudo Cstring),("cash_pl",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_recv",[Pseudo Internal],ScalarType "money"),("cash_send",[ScalarType "money"],ScalarType "bytea"),("cash_words",[ScalarType "money"],ScalarType "text"),("cashlarger",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cashsmaller",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cbrt",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "numeric"],ScalarType "numeric"),("ceiling",[ScalarType "float8"],ScalarType "float8"),("ceiling",[ScalarType "numeric"],ScalarType "numeric"),("center",[ScalarType "box"],ScalarType "point"),("center",[ScalarType "circle"],ScalarType "point"),("char",[ScalarType "int4"],ScalarType "char"),("char",[ScalarType "text"],ScalarType "char"),("char_length",[ScalarType "text"],ScalarType "int4"),("char_length",[ScalarType "bpchar"],ScalarType "int4"),("character_length",[ScalarType "text"],ScalarType "int4"),("character_length",[ScalarType "bpchar"],ScalarType "int4"),("chareq",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charge",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("chargt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charin",[Pseudo Cstring],ScalarType "char"),("charle",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charlt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charne",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charout",[ScalarType "char"],Pseudo Cstring),("charrecv",[Pseudo Internal],ScalarType "char"),("charsend",[ScalarType "char"],ScalarType "bytea"),("chr",[ScalarType "int4"],ScalarType "text"),("cideq",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("cidin",[Pseudo Cstring],ScalarType "cid"),("cidout",[ScalarType "cid"],Pseudo Cstring),("cidr",[ScalarType "inet"],ScalarType "cidr"),("cidr_in",[Pseudo Cstring],ScalarType "cidr"),("cidr_out",[ScalarType "cidr"],Pseudo Cstring),("cidr_recv",[Pseudo Internal],ScalarType "cidr"),("cidr_send",[ScalarType "cidr"],ScalarType "bytea"),("cidrecv",[Pseudo Internal],ScalarType "cid"),("cidsend",[ScalarType "cid"],ScalarType "bytea"),("circle",[ScalarType "box"],ScalarType "circle"),("circle",[ScalarType "polygon"],ScalarType "circle"),("circle",[ScalarType "point",ScalarType "float8"],ScalarType "circle"),("circle_above",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_add_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_below",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_center",[ScalarType "circle"],ScalarType "point"),("circle_contain",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_contain_pt",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("circle_contained",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_distance",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("circle_div_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_eq",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_ge",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_gt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_in",[Pseudo Cstring],ScalarType "circle"),("circle_le",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_left",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_lt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_mul_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_ne",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_out",[ScalarType "circle"],Pseudo Cstring),("circle_overabove",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overbelow",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overlap",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overleft",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overright",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_recv",[Pseudo Internal],ScalarType "circle"),("circle_right",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_same",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_send",[ScalarType "circle"],ScalarType "bytea"),("circle_sub_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("clock_timestamp",[],ScalarType "timestamptz"),("close_lb",[ScalarType "line",ScalarType "box"],ScalarType "point"),("close_ls",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("close_lseg",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("close_pb",[ScalarType "point",ScalarType "box"],ScalarType "point"),("close_pl",[ScalarType "point",ScalarType "line"],ScalarType "point"),("close_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("close_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("close_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("col_description",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("contjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("contsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("convert",[ScalarType "bytea",ScalarType "name",ScalarType "name"],ScalarType "bytea"),("convert_from",[ScalarType "bytea",ScalarType "name"],ScalarType "text"),("convert_to",[ScalarType "text",ScalarType "name"],ScalarType "bytea"),("cos",[ScalarType "float8"],ScalarType "float8"),("cot",[ScalarType "float8"],ScalarType "float8"),("cstring_in",[Pseudo Cstring],Pseudo Cstring),("cstring_out",[Pseudo Cstring],Pseudo Cstring),("cstring_recv",[Pseudo Internal],Pseudo Cstring),("cstring_send",[Pseudo Cstring],ScalarType "bytea"),("current_database",[],ScalarType "name"),("current_query",[],ScalarType "text"),("current_schema",[],ScalarType "name"),("current_schemas",[ScalarType "bool"],ArrayType (ScalarType "name")),("current_setting",[ScalarType "text"],ScalarType "text"),("current_user",[],ScalarType "name"),("currtid",[ScalarType "oid",ScalarType "tid"],ScalarType "tid"),("currtid2",[ScalarType "text",ScalarType "tid"],ScalarType "tid"),("currval",[ScalarType "regclass"],ScalarType "int8"),("cursor_to_xml",[ScalarType "refcursor",ScalarType "int4",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("cursor_to_xmlschema",[ScalarType "refcursor",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml_and_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("date",[ScalarType "abstime"],ScalarType "date"),("date",[ScalarType "timestamp"],ScalarType "date"),("date",[ScalarType "timestamptz"],ScalarType "date"),("date_cmp",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_cmp_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "int4"),("date_cmp_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "int4"),("date_eq",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_eq_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_eq_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_ge",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ge_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ge_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_gt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_gt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_gt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_in",[Pseudo Cstring],ScalarType "date"),("date_larger",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_le",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_le_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_le_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_lt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_lt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_lt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_mi",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_mi_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_mii",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_ne",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ne_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ne_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_out",[ScalarType "date"],Pseudo Cstring),("date_part",[ScalarType "text",ScalarType "abstime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "reltime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "date"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "time"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamp"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamptz"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "interval"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timetz"],ScalarType "float8"),("date_pl_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_pli",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_recv",[Pseudo Internal],ScalarType "date"),("date_send",[ScalarType "date"],ScalarType "bytea"),("date_smaller",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_trunc",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamp"),("date_trunc",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamptz"),("date_trunc",[ScalarType "text",ScalarType "interval"],ScalarType "interval"),("datetime_pl",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("datetimetz_pl",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("dcbrt",[ScalarType "float8"],ScalarType "float8"),("decode",[ScalarType "text",ScalarType "text"],ScalarType "bytea"),("degrees",[ScalarType "float8"],ScalarType "float8"),("dexp",[ScalarType "float8"],ScalarType "float8"),("diagonal",[ScalarType "box"],ScalarType "lseg"),("diameter",[ScalarType "circle"],ScalarType "float8"),("dispell_init",[Pseudo Internal],Pseudo Internal),("dispell_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dist_cpoly",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("dist_lb",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("dist_pb",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("dist_pc",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("dist_pl",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("dist_ppath",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("dist_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("dist_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("dist_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("dlog1",[ScalarType "float8"],ScalarType "float8"),("dlog10",[ScalarType "float8"],ScalarType "float8"),("domain_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Any),("domain_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Any),("dpow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("dround",[ScalarType "float8"],ScalarType "float8"),("dsimple_init",[Pseudo Internal],Pseudo Internal),("dsimple_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsnowball_init",[Pseudo Internal],Pseudo Internal),("dsnowball_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsqrt",[ScalarType "float8"],ScalarType "float8"),("dsynonym_init",[Pseudo Internal],Pseudo Internal),("dsynonym_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dtrunc",[ScalarType "float8"],ScalarType "float8"),("encode",[ScalarType "bytea",ScalarType "text"],ScalarType "text"),("enum_cmp",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "int4"),("enum_eq",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_first",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_ge",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_gt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_in",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_larger",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("enum_last",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_le",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_lt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_ne",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_out",[Pseudo AnyEnum],Pseudo Cstring),("enum_range",[Pseudo AnyEnum],Pseudo AnyArray),("enum_range",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyArray),("enum_recv",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_send",[Pseudo AnyEnum],ScalarType "bytea"),("enum_smaller",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("eqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("eqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("euc_cn_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_cn_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("exp",[ScalarType "float8"],ScalarType "float8"),("exp",[ScalarType "numeric"],ScalarType "numeric"),("factorial",[ScalarType "int8"],ScalarType "numeric"),("family",[ScalarType "inet"],ScalarType "int4"),("flatfile_update_trigger",[],Pseudo Trigger),("float4",[ScalarType "int8"],ScalarType "float4"),("float4",[ScalarType "int2"],ScalarType "float4"),("float4",[ScalarType "int4"],ScalarType "float4"),("float4",[ScalarType "float8"],ScalarType "float4"),("float4",[ScalarType "numeric"],ScalarType "float4"),("float48div",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48eq",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48ge",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48gt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48le",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48lt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48mi",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48mul",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48ne",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48pl",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float4_accum",[ArrayType (ScalarType "float8"),ScalarType "float4"],ArrayType (ScalarType "float8")),("float4abs",[ScalarType "float4"],ScalarType "float4"),("float4div",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4eq",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4ge",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4gt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4in",[Pseudo Cstring],ScalarType "float4"),("float4larger",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4le",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4lt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4mi",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4mul",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4ne",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4out",[ScalarType "float4"],Pseudo Cstring),("float4pl",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4recv",[Pseudo Internal],ScalarType "float4"),("float4send",[ScalarType "float4"],ScalarType "bytea"),("float4smaller",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4um",[ScalarType "float4"],ScalarType "float4"),("float4up",[ScalarType "float4"],ScalarType "float4"),("float8",[ScalarType "int8"],ScalarType "float8"),("float8",[ScalarType "int2"],ScalarType "float8"),("float8",[ScalarType "int4"],ScalarType "float8"),("float8",[ScalarType "float4"],ScalarType "float8"),("float8",[ScalarType "numeric"],ScalarType "float8"),("float84div",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84eq",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84ge",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84gt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84le",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84lt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84mi",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84mul",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84ne",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84pl",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float8_accum",[ArrayType (ScalarType "float8"),ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_avg",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_corr",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_accum",[ArrayType (ScalarType "float8"),ScalarType "float8",ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_regr_avgx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_avgy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_intercept",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_r2",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_slope",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_syy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8abs",[ScalarType "float8"],ScalarType "float8"),("float8div",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8eq",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8ge",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8gt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8in",[Pseudo Cstring],ScalarType "float8"),("float8larger",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8le",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8lt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8mi",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8mul",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8ne",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8out",[ScalarType "float8"],Pseudo Cstring),("float8pl",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8recv",[Pseudo Internal],ScalarType "float8"),("float8send",[ScalarType "float8"],ScalarType "bytea"),("float8smaller",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8um",[ScalarType "float8"],ScalarType "float8"),("float8up",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "numeric"],ScalarType "numeric"),("flt4_mul_cash",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("flt8_mul_cash",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("fmgr_c_validator",[ScalarType "oid"],Pseudo Void),("fmgr_internal_validator",[ScalarType "oid"],Pseudo Void),("fmgr_sql_validator",[ScalarType "oid"],Pseudo Void),("format_type",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("gb18030_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("gbk_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("generate_series",[ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "int8",ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],SetOfType (ScalarType "timestamp")),("generate_series",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],SetOfType (ScalarType "timestamptz")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4",ScalarType "bool"],SetOfType (ScalarType "int4")),("get_bit",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_byte",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_current_ts_config",[],ScalarType "regconfig"),("getdatabaseencoding",[],ScalarType "name"),("getpgusername",[],ScalarType "name"),("gin_cmp_prefix",[ScalarType "text",ScalarType "text",ScalarType "int2",Pseudo Internal],ScalarType "int4"),("gin_cmp_tslexeme",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("gin_extract_tsquery",[ScalarType "tsquery",Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("gin_extract_tsvector",[ScalarType "tsvector",Pseudo Internal],Pseudo Internal),("gin_tsquery_consistent",[Pseudo Internal,ScalarType "int2",ScalarType "tsquery",ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayconsistent",[Pseudo Internal,ScalarType "int2",Pseudo AnyArray,ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayextract",[Pseudo AnyArray,Pseudo Internal],Pseudo Internal),("ginbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gincostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("ginendscan",[Pseudo Internal],Pseudo Void),("gingetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gininsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginmarkpos",[Pseudo Internal],Pseudo Void),("ginoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("ginqueryarrayextract",[Pseudo AnyArray,Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("ginrestrpos",[Pseudo Internal],Pseudo Void),("ginvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_compress",[Pseudo Internal],Pseudo Internal),("gist_box_consistent",[Pseudo Internal,ScalarType "box",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_box_decompress",[Pseudo Internal],Pseudo Internal),("gist_box_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_same",[ScalarType "box",ScalarType "box",Pseudo Internal],Pseudo Internal),("gist_box_union",[Pseudo Internal,Pseudo Internal],ScalarType "box"),("gist_circle_compress",[Pseudo Internal],Pseudo Internal),("gist_circle_consistent",[Pseudo Internal,ScalarType "circle",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_poly_compress",[Pseudo Internal],Pseudo Internal),("gist_poly_consistent",[Pseudo Internal,ScalarType "polygon",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gistbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("gistendscan",[Pseudo Internal],Pseudo Void),("gistgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gistgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistmarkpos",[Pseudo Internal],Pseudo Void),("gistoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("gistrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("gistrestrpos",[Pseudo Internal],Pseudo Void),("gistvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_compress",[Pseudo Internal],Pseudo Internal),("gtsquery_consistent",[Pseudo Internal,Pseudo Internal,ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsquery_decompress",[Pseudo Internal],Pseudo Internal),("gtsquery_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_same",[ScalarType "int8",ScalarType "int8",Pseudo Internal],Pseudo Internal),("gtsquery_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_compress",[Pseudo Internal],Pseudo Internal),("gtsvector_consistent",[Pseudo Internal,ScalarType "gtsvector",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsvector_decompress",[Pseudo Internal],Pseudo Internal),("gtsvector_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_same",[ScalarType "gtsvector",ScalarType "gtsvector",Pseudo Internal],Pseudo Internal),("gtsvector_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvectorin",[Pseudo Cstring],ScalarType "gtsvector"),("gtsvectorout",[ScalarType "gtsvector"],Pseudo Cstring),("has_any_column_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("hash_aclitem",[ScalarType "aclitem"],ScalarType "int4"),("hash_numeric",[ScalarType "numeric"],ScalarType "int4"),("hashbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbpchar",[ScalarType "bpchar"],ScalarType "int4"),("hashbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashchar",[ScalarType "char"],ScalarType "int4"),("hashcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("hashendscan",[Pseudo Internal],Pseudo Void),("hashenum",[Pseudo AnyEnum],ScalarType "int4"),("hashfloat4",[ScalarType "float4"],ScalarType "int4"),("hashfloat8",[ScalarType "float8"],ScalarType "int4"),("hashgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("hashgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashinet",[ScalarType "inet"],ScalarType "int4"),("hashinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashint2",[ScalarType "int2"],ScalarType "int4"),("hashint2vector",[ScalarType "int2vector"],ScalarType "int4"),("hashint4",[ScalarType "int4"],ScalarType "int4"),("hashint8",[ScalarType "int8"],ScalarType "int4"),("hashmacaddr",[ScalarType "macaddr"],ScalarType "int4"),("hashmarkpos",[Pseudo Internal],Pseudo Void),("hashname",[ScalarType "name"],ScalarType "int4"),("hashoid",[ScalarType "oid"],ScalarType "int4"),("hashoidvector",[ScalarType "oidvector"],ScalarType "int4"),("hashoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("hashrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("hashrestrpos",[Pseudo Internal],Pseudo Void),("hashtext",[ScalarType "text"],ScalarType "int4"),("hashvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashvarlena",[Pseudo Internal],ScalarType "int4"),("height",[ScalarType "box"],ScalarType "float8"),("host",[ScalarType "inet"],ScalarType "text"),("hostmask",[ScalarType "inet"],ScalarType "inet"),("iclikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("iclikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icnlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icnlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("inet_client_addr",[],ScalarType "inet"),("inet_client_port",[],ScalarType "int4"),("inet_in",[Pseudo Cstring],ScalarType "inet"),("inet_out",[ScalarType "inet"],Pseudo Cstring),("inet_recv",[Pseudo Internal],ScalarType "inet"),("inet_send",[ScalarType "inet"],ScalarType "bytea"),("inet_server_addr",[],ScalarType "inet"),("inet_server_port",[],ScalarType "int4"),("inetand",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetmi",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("inetmi_int8",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("inetnot",[ScalarType "inet"],ScalarType "inet"),("inetor",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetpl",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("initcap",[ScalarType "text"],ScalarType "text"),("int2",[ScalarType "int8"],ScalarType "int2"),("int2",[ScalarType "int4"],ScalarType "int2"),("int2",[ScalarType "float4"],ScalarType "int2"),("int2",[ScalarType "float8"],ScalarType "int2"),("int2",[ScalarType "numeric"],ScalarType "int2"),("int24div",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24eq",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24ge",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24gt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24le",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24lt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24mi",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24mul",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24ne",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24pl",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int28div",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28eq",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28ge",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28gt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28le",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28lt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28mi",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28mul",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28ne",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28pl",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int2_accum",[ArrayType (ScalarType "numeric"),ScalarType "int2"],ArrayType (ScalarType "numeric")),("int2_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int2"],ArrayType (ScalarType "int8")),("int2_mul_cash",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("int2_sum",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int2abs",[ScalarType "int2"],ScalarType "int2"),("int2and",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2div",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2eq",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2ge",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2gt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2in",[Pseudo Cstring],ScalarType "int2"),("int2larger",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2le",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2lt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2mi",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mul",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2ne",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2not",[ScalarType "int2"],ScalarType "int2"),("int2or",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2out",[ScalarType "int2"],Pseudo Cstring),("int2pl",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2recv",[Pseudo Internal],ScalarType "int2"),("int2send",[ScalarType "int2"],ScalarType "bytea"),("int2shl",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2shr",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2smaller",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2um",[ScalarType "int2"],ScalarType "int2"),("int2up",[ScalarType "int2"],ScalarType "int2"),("int2vectoreq",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("int2vectorin",[Pseudo Cstring],ScalarType "int2vector"),("int2vectorout",[ScalarType "int2vector"],Pseudo Cstring),("int2vectorrecv",[Pseudo Internal],ScalarType "int2vector"),("int2vectorsend",[ScalarType "int2vector"],ScalarType "bytea"),("int2xor",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int4",[ScalarType "bool"],ScalarType "int4"),("int4",[ScalarType "char"],ScalarType "int4"),("int4",[ScalarType "int8"],ScalarType "int4"),("int4",[ScalarType "int2"],ScalarType "int4"),("int4",[ScalarType "float4"],ScalarType "int4"),("int4",[ScalarType "float8"],ScalarType "int4"),("int4",[ScalarType "bit"],ScalarType "int4"),("int4",[ScalarType "numeric"],ScalarType "int4"),("int42div",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42eq",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42ge",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42gt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42le",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42lt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42mi",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42mul",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42ne",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42pl",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int48div",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48eq",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48ge",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48gt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48le",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48lt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48mi",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48mul",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48ne",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48pl",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int4_accum",[ArrayType (ScalarType "numeric"),ScalarType "int4"],ArrayType (ScalarType "numeric")),("int4_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int4"],ArrayType (ScalarType "int8")),("int4_mul_cash",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("int4_sum",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int4abs",[ScalarType "int4"],ScalarType "int4"),("int4and",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4div",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4eq",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4ge",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4gt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4in",[Pseudo Cstring],ScalarType "int4"),("int4inc",[ScalarType "int4"],ScalarType "int4"),("int4larger",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4le",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4lt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4mi",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mul",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4ne",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4not",[ScalarType "int4"],ScalarType "int4"),("int4or",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4out",[ScalarType "int4"],Pseudo Cstring),("int4pl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4recv",[Pseudo Internal],ScalarType "int4"),("int4send",[ScalarType "int4"],ScalarType "bytea"),("int4shl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4shr",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4smaller",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4um",[ScalarType "int4"],ScalarType "int4"),("int4up",[ScalarType "int4"],ScalarType "int4"),("int4xor",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int8",[ScalarType "int2"],ScalarType "int8"),("int8",[ScalarType "int4"],ScalarType "int8"),("int8",[ScalarType "oid"],ScalarType "int8"),("int8",[ScalarType "float4"],ScalarType "int8"),("int8",[ScalarType "float8"],ScalarType "int8"),("int8",[ScalarType "bit"],ScalarType "int8"),("int8",[ScalarType "numeric"],ScalarType "int8"),("int82div",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82eq",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82ge",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82gt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82le",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82lt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82mi",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82mul",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82ne",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82pl",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int84div",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84eq",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84ge",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84gt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84le",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84lt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84mi",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84mul",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84ne",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84pl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_avg",[ArrayType (ScalarType "int8")],ScalarType "numeric"),("int8_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_sum",[ScalarType "numeric",ScalarType "int8"],ScalarType "numeric"),("int8abs",[ScalarType "int8"],ScalarType "int8"),("int8and",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8div",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8eq",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8ge",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8gt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8in",[Pseudo Cstring],ScalarType "int8"),("int8inc",[ScalarType "int8"],ScalarType "int8"),("int8inc_any",[ScalarType "int8",Pseudo Any],ScalarType "int8"),("int8inc_float8_float8",[ScalarType "int8",ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("int8larger",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8le",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8lt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8mi",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mul",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8ne",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8not",[ScalarType "int8"],ScalarType "int8"),("int8or",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8out",[ScalarType "int8"],Pseudo Cstring),("int8pl",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8pl_inet",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("int8recv",[Pseudo Internal],ScalarType "int8"),("int8send",[ScalarType "int8"],ScalarType "bytea"),("int8shl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8shr",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8smaller",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8um",[ScalarType "int8"],ScalarType "int8"),("int8up",[ScalarType "int8"],ScalarType "int8"),("int8xor",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("integer_pl_date",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("inter_lb",[ScalarType "line",ScalarType "box"],ScalarType "bool"),("inter_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("inter_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("internal_in",[Pseudo Cstring],Pseudo Internal),("internal_out",[Pseudo Internal],Pseudo Cstring),("interval",[ScalarType "reltime"],ScalarType "interval"),("interval",[ScalarType "time"],ScalarType "interval"),("interval",[ScalarType "interval",ScalarType "int4"],ScalarType "interval"),("interval_accum",[ArrayType (ScalarType "interval"),ScalarType "interval"],ArrayType (ScalarType "interval")),("interval_avg",[ArrayType (ScalarType "interval")],ScalarType "interval"),("interval_cmp",[ScalarType "interval",ScalarType "interval"],ScalarType "int4"),("interval_div",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_eq",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_ge",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_gt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_hash",[ScalarType "interval"],ScalarType "int4"),("interval_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_larger",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_le",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_lt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_mi",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_mul",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_ne",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_out",[ScalarType "interval"],Pseudo Cstring),("interval_pl",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_pl_date",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("interval_pl_time",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("interval_pl_timestamp",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("interval_pl_timestamptz",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("interval_pl_timetz",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("interval_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_send",[ScalarType "interval"],ScalarType "bytea"),("interval_smaller",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_um",[ScalarType "interval"],ScalarType "interval"),("intervaltypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("intervaltypmodout",[ScalarType "int4"],Pseudo Cstring),("intinterval",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("isclosed",[ScalarType "path"],ScalarType "bool"),("isfinite",[ScalarType "abstime"],ScalarType "bool"),("isfinite",[ScalarType "date"],ScalarType "bool"),("isfinite",[ScalarType "timestamp"],ScalarType "bool"),("isfinite",[ScalarType "timestamptz"],ScalarType "bool"),("isfinite",[ScalarType "interval"],ScalarType "bool"),("ishorizontal",[ScalarType "lseg"],ScalarType "bool"),("ishorizontal",[ScalarType "line"],ScalarType "bool"),("ishorizontal",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("iso8859_1_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso8859_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("isopen",[ScalarType "path"],ScalarType "bool"),("isparallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isparallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isperp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isperp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "lseg"],ScalarType "bool"),("isvertical",[ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("johab_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("justify_days",[ScalarType "interval"],ScalarType "interval"),("justify_hours",[ScalarType "interval"],ScalarType "interval"),("justify_interval",[ScalarType "interval"],ScalarType "interval"),("koi8r_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8u_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("language_handler_in",[Pseudo Cstring],Pseudo LanguageHandler),("language_handler_out",[Pseudo LanguageHandler],Pseudo Cstring),("lastval",[],ScalarType "int8"),("latin1_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin3_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin4_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("length",[ScalarType "bytea"],ScalarType "int4"),("length",[ScalarType "text"],ScalarType "int4"),("length",[ScalarType "lseg"],ScalarType "float8"),("length",[ScalarType "path"],ScalarType "float8"),("length",[ScalarType "bpchar"],ScalarType "int4"),("length",[ScalarType "bit"],ScalarType "int4"),("length",[ScalarType "tsvector"],ScalarType "int4"),("length",[ScalarType "bytea",ScalarType "name"],ScalarType "int4"),("like",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("like",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("like",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("like_escape",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("like_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("likejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("likesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("line",[ScalarType "point",ScalarType "point"],ScalarType "line"),("line_distance",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("line_eq",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_horizontal",[ScalarType "line"],ScalarType "bool"),("line_in",[Pseudo Cstring],ScalarType "line"),("line_interpt",[ScalarType "line",ScalarType "line"],ScalarType "point"),("line_intersect",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_out",[ScalarType "line"],Pseudo Cstring),("line_parallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_perp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_recv",[Pseudo Internal],ScalarType "line"),("line_send",[ScalarType "line"],ScalarType "bytea"),("line_vertical",[ScalarType "line"],ScalarType "bool"),("ln",[ScalarType "float8"],ScalarType "float8"),("ln",[ScalarType "numeric"],ScalarType "numeric"),("lo_close",[ScalarType "int4"],ScalarType "int4"),("lo_creat",[ScalarType "int4"],ScalarType "oid"),("lo_create",[ScalarType "oid"],ScalarType "oid"),("lo_export",[ScalarType "oid",ScalarType "text"],ScalarType "int4"),("lo_import",[ScalarType "text"],ScalarType "oid"),("lo_import",[ScalarType "text",ScalarType "oid"],ScalarType "oid"),("lo_lseek",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_open",[ScalarType "oid",ScalarType "int4"],ScalarType "int4"),("lo_tell",[ScalarType "int4"],ScalarType "int4"),("lo_truncate",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_unlink",[ScalarType "oid"],ScalarType "int4"),("log",[ScalarType "float8"],ScalarType "float8"),("log",[ScalarType "numeric"],ScalarType "numeric"),("log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("loread",[ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("lower",[ScalarType "text"],ScalarType "text"),("lowrite",[ScalarType "int4",ScalarType "bytea"],ScalarType "int4"),("lpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("lpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("lseg",[ScalarType "box"],ScalarType "lseg"),("lseg",[ScalarType "point",ScalarType "point"],ScalarType "lseg"),("lseg_center",[ScalarType "lseg"],ScalarType "point"),("lseg_distance",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("lseg_eq",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ge",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_gt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_horizontal",[ScalarType "lseg"],ScalarType "bool"),("lseg_in",[Pseudo Cstring],ScalarType "lseg"),("lseg_interpt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("lseg_intersect",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_le",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_length",[ScalarType "lseg"],ScalarType "float8"),("lseg_lt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ne",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_out",[ScalarType "lseg"],Pseudo Cstring),("lseg_parallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_perp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_recv",[Pseudo Internal],ScalarType "lseg"),("lseg_send",[ScalarType "lseg"],ScalarType "bytea"),("lseg_vertical",[ScalarType "lseg"],ScalarType "bool"),("ltrim",[ScalarType "text"],ScalarType "text"),("ltrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("macaddr_cmp",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "int4"),("macaddr_eq",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ge",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_gt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_in",[Pseudo Cstring],ScalarType "macaddr"),("macaddr_le",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_lt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ne",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_out",[ScalarType "macaddr"],Pseudo Cstring),("macaddr_recv",[Pseudo Internal],ScalarType "macaddr"),("macaddr_send",[ScalarType "macaddr"],ScalarType "bytea"),("makeaclitem",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "bool"],ScalarType "aclitem"),("masklen",[ScalarType "inet"],ScalarType "int4"),("md5",[ScalarType "bytea"],ScalarType "text"),("md5",[ScalarType "text"],ScalarType "text"),("mic_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin3",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin4",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mktinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("mul_d_interval",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("name",[ScalarType "text"],ScalarType "name"),("name",[ScalarType "bpchar"],ScalarType "name"),("name",[ScalarType "varchar"],ScalarType "name"),("nameeq",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namege",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namegt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("nameiclike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicnlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namein",[Pseudo Cstring],ScalarType "name"),("namele",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namelike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namelt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namene",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namenlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameout",[ScalarType "name"],Pseudo Cstring),("namerecv",[Pseudo Internal],ScalarType "name"),("nameregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namesend",[ScalarType "name"],ScalarType "bytea"),("neqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("neqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("netmask",[ScalarType "inet"],ScalarType "inet"),("network",[ScalarType "inet"],ScalarType "cidr"),("network_cmp",[ScalarType "inet",ScalarType "inet"],ScalarType "int4"),("network_eq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ge",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_gt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_le",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_lt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ne",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sub",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_subeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sup",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_supeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("nextval",[ScalarType "regclass"],ScalarType "int8"),("nlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("nlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("notlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("notlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("notlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("now",[],ScalarType "timestamptz"),("npoints",[ScalarType "path"],ScalarType "int4"),("npoints",[ScalarType "polygon"],ScalarType "int4"),("numeric",[ScalarType "int8"],ScalarType "numeric"),("numeric",[ScalarType "int2"],ScalarType "numeric"),("numeric",[ScalarType "int4"],ScalarType "numeric"),("numeric",[ScalarType "float4"],ScalarType "numeric"),("numeric",[ScalarType "float8"],ScalarType "numeric"),("numeric",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("numeric_abs",[ScalarType "numeric"],ScalarType "numeric"),("numeric_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_add",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_avg",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_cmp",[ScalarType "numeric",ScalarType "numeric"],ScalarType "int4"),("numeric_div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_div_trunc",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_eq",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_exp",[ScalarType "numeric"],ScalarType "numeric"),("numeric_fac",[ScalarType "int8"],ScalarType "numeric"),("numeric_ge",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_gt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_inc",[ScalarType "numeric"],ScalarType "numeric"),("numeric_larger",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_le",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_ln",[ScalarType "numeric"],ScalarType "numeric"),("numeric_log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_lt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_mul",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_ne",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_out",[ScalarType "numeric"],Pseudo Cstring),("numeric_power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_send",[ScalarType "numeric"],ScalarType "bytea"),("numeric_smaller",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_sqrt",[ScalarType "numeric"],ScalarType "numeric"),("numeric_stddev_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_stddev_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_sub",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_uminus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_uplus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_var_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_var_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numerictypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("numerictypmodout",[ScalarType "int4"],Pseudo Cstring),("numnode",[ScalarType "tsquery"],ScalarType "int4"),("obj_description",[ScalarType "oid"],ScalarType "text"),("obj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("octet_length",[ScalarType "bytea"],ScalarType "int4"),("octet_length",[ScalarType "text"],ScalarType "int4"),("octet_length",[ScalarType "bpchar"],ScalarType "int4"),("octet_length",[ScalarType "bit"],ScalarType "int4"),("oid",[ScalarType "int8"],ScalarType "oid"),("oideq",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidge",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidgt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidin",[Pseudo Cstring],ScalarType "oid"),("oidlarger",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidle",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidlt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidne",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidout",[ScalarType "oid"],Pseudo Cstring),("oidrecv",[Pseudo Internal],ScalarType "oid"),("oidsend",[ScalarType "oid"],ScalarType "bytea"),("oidsmaller",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidvectoreq",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorge",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorgt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorin",[Pseudo Cstring],ScalarType "oidvector"),("oidvectorle",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorlt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorne",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorout",[ScalarType "oidvector"],Pseudo Cstring),("oidvectorrecv",[Pseudo Internal],ScalarType "oidvector"),("oidvectorsend",[ScalarType "oidvector"],ScalarType "bytea"),("oidvectortypes",[ScalarType "oidvector"],ScalarType "text"),("on_pb",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("on_pl",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("on_ppath",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("on_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("on_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("on_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("opaque_in",[Pseudo Cstring],Pseudo Opaque),("opaque_out",[Pseudo Opaque],Pseudo Cstring),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timetz",ScalarType "timetz",ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("path",[ScalarType "polygon"],ScalarType "path"),("path_add",[ScalarType "path",ScalarType "path"],ScalarType "path"),("path_add_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_center",[ScalarType "path"],ScalarType "point"),("path_contain_pt",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("path_distance",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("path_div_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_in",[Pseudo Cstring],ScalarType "path"),("path_inter",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_length",[ScalarType "path"],ScalarType "float8"),("path_mul_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_n_eq",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_ge",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_gt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_le",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_lt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_npoints",[ScalarType "path"],ScalarType "int4"),("path_out",[ScalarType "path"],Pseudo Cstring),("path_recv",[Pseudo Internal],ScalarType "path"),("path_send",[ScalarType "path"],ScalarType "bytea"),("path_sub_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("pclose",[ScalarType "path"],ScalarType "path"),("pg_advisory_lock",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_unlock",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_advisory_unlock_all",[],Pseudo Void),("pg_advisory_unlock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_backend_pid",[],ScalarType "int4"),("pg_cancel_backend",[ScalarType "int4"],ScalarType "bool"),("pg_char_to_encoding",[ScalarType "name"],ScalarType "int4"),("pg_client_encoding",[],ScalarType "name"),("pg_column_size",[Pseudo Any],ScalarType "int4"),("pg_conf_load_time",[],ScalarType "timestamptz"),("pg_conversion_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_current_xlog_insert_location",[],ScalarType "text"),("pg_current_xlog_location",[],ScalarType "text"),("pg_cursor",[],SetOfType (Pseudo Record)),("pg_database_size",[ScalarType "name"],ScalarType "int8"),("pg_database_size",[ScalarType "oid"],ScalarType "int8"),("pg_encoding_to_char",[ScalarType "int4"],ScalarType "name"),("pg_function_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_get_constraintdef",[ScalarType "oid"],ScalarType "text"),("pg_get_constraintdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_function_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_identity_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_result",[ScalarType "oid"],ScalarType "text"),("pg_get_functiondef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid",ScalarType "int4",ScalarType "bool"],ScalarType "text"),("pg_get_keywords",[],SetOfType (Pseudo Record)),("pg_get_ruledef",[ScalarType "oid"],ScalarType "text"),("pg_get_ruledef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_serial_sequence",[ScalarType "text",ScalarType "text"],ScalarType "text"),("pg_get_triggerdef",[ScalarType "oid"],ScalarType "text"),("pg_get_userbyid",[ScalarType "oid"],ScalarType "name"),("pg_get_viewdef",[ScalarType "text"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid"],ScalarType "text"),("pg_get_viewdef",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_has_role",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_is_other_temp_schema",[ScalarType "oid"],ScalarType "bool"),("pg_lock_status",[],SetOfType (Pseudo Record)),("pg_ls_dir",[ScalarType "text"],SetOfType (ScalarType "text")),("pg_my_temp_schema",[],ScalarType "oid"),("pg_opclass_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_operator_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_options_to_table",[ArrayType (ScalarType "text")],SetOfType (Pseudo Record)),("pg_postmaster_start_time",[],ScalarType "timestamptz"),("pg_prepared_statement",[],SetOfType (Pseudo Record)),("pg_prepared_xact",[],SetOfType (Pseudo Record)),("pg_read_file",[ScalarType "text",ScalarType "int8",ScalarType "int8"],ScalarType "text"),("pg_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_relation_size",[ScalarType "regclass",ScalarType "text"],ScalarType "int8"),("pg_reload_conf",[],ScalarType "bool"),("pg_rotate_logfile",[],ScalarType "bool"),("pg_show_all_settings",[],SetOfType (Pseudo Record)),("pg_size_pretty",[ScalarType "int8"],ScalarType "text"),("pg_sleep",[ScalarType "float8"],Pseudo Void),("pg_start_backup",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_stat_clear_snapshot",[],Pseudo Void),("pg_stat_file",[ScalarType "text"],Pseudo Record),("pg_stat_get_activity",[ScalarType "int4"],SetOfType (Pseudo Record)),("pg_stat_get_backend_activity",[ScalarType "int4"],ScalarType "text"),("pg_stat_get_backend_activity_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_client_addr",[ScalarType "int4"],ScalarType "inet"),("pg_stat_get_backend_client_port",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_dbid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_idset",[],SetOfType (ScalarType "int4")),("pg_stat_get_backend_pid",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_userid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_waiting",[ScalarType "int4"],ScalarType "bool"),("pg_stat_get_backend_xact_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_bgwriter_buf_written_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_buf_written_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_maxwritten_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_requested_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_timed_checkpoints",[],ScalarType "int8"),("pg_stat_get_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_buf_alloc",[],ScalarType "int8"),("pg_stat_get_buf_written_backend",[],ScalarType "int8"),("pg_stat_get_db_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_numbackends",[ScalarType "oid"],ScalarType "int4"),("pg_stat_get_db_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_commit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_rollback",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_dead_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_calls",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_self_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_last_analyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autoanalyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autovacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_vacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_live_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_numscans",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_hot_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_reset",[],Pseudo Void),("pg_stop_backup",[],ScalarType "text"),("pg_switch_xlog",[],ScalarType "text"),("pg_table_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_tablespace_databases",[ScalarType "oid"],SetOfType (ScalarType "oid")),("pg_tablespace_size",[ScalarType "name"],ScalarType "int8"),("pg_tablespace_size",[ScalarType "oid"],ScalarType "int8"),("pg_terminate_backend",[ScalarType "int4"],ScalarType "bool"),("pg_timezone_abbrevs",[],SetOfType (Pseudo Record)),("pg_timezone_names",[],SetOfType (Pseudo Record)),("pg_total_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_try_advisory_lock",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_ts_config_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_dict_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_parser_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_template_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_type_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_typeof",[Pseudo Any],ScalarType "regtype"),("pg_xlogfile_name",[ScalarType "text"],ScalarType "text"),("pg_xlogfile_name_offset",[ScalarType "text"],Pseudo Record),("pi",[],ScalarType "float8"),("plainto_tsquery",[ScalarType "text"],ScalarType "tsquery"),("plainto_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("point",[ScalarType "lseg"],ScalarType "point"),("point",[ScalarType "path"],ScalarType "point"),("point",[ScalarType "box"],ScalarType "point"),("point",[ScalarType "polygon"],ScalarType "point"),("point",[ScalarType "circle"],ScalarType "point"),("point",[ScalarType "float8",ScalarType "float8"],ScalarType "point"),("point_above",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_add",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_below",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_distance",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("point_div",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_eq",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_horiz",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_in",[Pseudo Cstring],ScalarType "point"),("point_left",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_mul",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_ne",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_out",[ScalarType "point"],Pseudo Cstring),("point_recv",[Pseudo Internal],ScalarType "point"),("point_right",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_send",[ScalarType "point"],ScalarType "bytea"),("point_sub",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_vert",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("poly_above",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_below",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_center",[ScalarType "polygon"],ScalarType "point"),("poly_contain",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_contain_pt",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("poly_contained",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_distance",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("poly_in",[Pseudo Cstring],ScalarType "polygon"),("poly_left",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_npoints",[ScalarType "polygon"],ScalarType "int4"),("poly_out",[ScalarType "polygon"],Pseudo Cstring),("poly_overabove",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overbelow",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overlap",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overleft",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overright",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_recv",[Pseudo Internal],ScalarType "polygon"),("poly_right",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_same",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_send",[ScalarType "polygon"],ScalarType "bytea"),("polygon",[ScalarType "path"],ScalarType "polygon"),("polygon",[ScalarType "box"],ScalarType "polygon"),("polygon",[ScalarType "circle"],ScalarType "polygon"),("polygon",[ScalarType "int4",ScalarType "circle"],ScalarType "polygon"),("popen",[ScalarType "path"],ScalarType "path"),("position",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("position",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("position",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("positionjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("positionsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("postgresql_fdw_validator",[ArrayType (ScalarType "text"),ScalarType "oid"],ScalarType "bool"),("pow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("pow",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("power",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("prsd_end",[Pseudo Internal],Pseudo Void),("prsd_headline",[Pseudo Internal,Pseudo Internal,ScalarType "tsquery"],Pseudo Internal),("prsd_lextype",[Pseudo Internal],Pseudo Internal),("prsd_nexttoken",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("prsd_start",[Pseudo Internal,ScalarType "int4"],Pseudo Internal),("pt_contained_circle",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("pt_contained_poly",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("query_to_xml",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xml_and_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("querytree",[ScalarType "tsquery"],ScalarType "text"),("quote_ident",[ScalarType "text"],ScalarType "text"),("quote_literal",[ScalarType "text"],ScalarType "text"),("quote_literal",[Pseudo AnyElement],ScalarType "text"),("quote_nullable",[ScalarType "text"],ScalarType "text"),("quote_nullable",[Pseudo AnyElement],ScalarType "text"),("radians",[ScalarType "float8"],ScalarType "float8"),("radius",[ScalarType "circle"],ScalarType "float8"),("random",[],ScalarType "float8"),("record_eq",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ge",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_gt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_le",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_lt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ne",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_out",[Pseudo Record],Pseudo Cstring),("record_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_send",[Pseudo Record],ScalarType "bytea"),("regclass",[ScalarType "text"],ScalarType "regclass"),("regclassin",[Pseudo Cstring],ScalarType "regclass"),("regclassout",[ScalarType "regclass"],Pseudo Cstring),("regclassrecv",[Pseudo Internal],ScalarType "regclass"),("regclasssend",[ScalarType "regclass"],ScalarType "bytea"),("regconfigin",[Pseudo Cstring],ScalarType "regconfig"),("regconfigout",[ScalarType "regconfig"],Pseudo Cstring),("regconfigrecv",[Pseudo Internal],ScalarType "regconfig"),("regconfigsend",[ScalarType "regconfig"],ScalarType "bytea"),("regdictionaryin",[Pseudo Cstring],ScalarType "regdictionary"),("regdictionaryout",[ScalarType "regdictionary"],Pseudo Cstring),("regdictionaryrecv",[Pseudo Internal],ScalarType "regdictionary"),("regdictionarysend",[ScalarType "regdictionary"],ScalarType "bytea"),("regexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexp_matches",[ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_matches",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_split_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_array",[ScalarType "text",ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regoperatorin",[Pseudo Cstring],ScalarType "regoperator"),("regoperatorout",[ScalarType "regoperator"],Pseudo Cstring),("regoperatorrecv",[Pseudo Internal],ScalarType "regoperator"),("regoperatorsend",[ScalarType "regoperator"],ScalarType "bytea"),("regoperin",[Pseudo Cstring],ScalarType "regoper"),("regoperout",[ScalarType "regoper"],Pseudo Cstring),("regoperrecv",[Pseudo Internal],ScalarType "regoper"),("regopersend",[ScalarType "regoper"],ScalarType "bytea"),("regprocedurein",[Pseudo Cstring],ScalarType "regprocedure"),("regprocedureout",[ScalarType "regprocedure"],Pseudo Cstring),("regprocedurerecv",[Pseudo Internal],ScalarType "regprocedure"),("regproceduresend",[ScalarType "regprocedure"],ScalarType "bytea"),("regprocin",[Pseudo Cstring],ScalarType "regproc"),("regprocout",[ScalarType "regproc"],Pseudo Cstring),("regprocrecv",[Pseudo Internal],ScalarType "regproc"),("regprocsend",[ScalarType "regproc"],ScalarType "bytea"),("regtypein",[Pseudo Cstring],ScalarType "regtype"),("regtypeout",[ScalarType "regtype"],Pseudo Cstring),("regtyperecv",[Pseudo Internal],ScalarType "regtype"),("regtypesend",[ScalarType "regtype"],ScalarType "bytea"),("reltime",[ScalarType "interval"],ScalarType "reltime"),("reltimeeq",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimege",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimegt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimein",[Pseudo Cstring],ScalarType "reltime"),("reltimele",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimelt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimene",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimeout",[ScalarType "reltime"],Pseudo Cstring),("reltimerecv",[Pseudo Internal],ScalarType "reltime"),("reltimesend",[ScalarType "reltime"],ScalarType "bytea"),("repeat",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("round",[ScalarType "float8"],ScalarType "float8"),("round",[ScalarType "numeric"],ScalarType "numeric"),("round",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("rpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("rpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("scalargtjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalargtsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("scalarltjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalarltsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("schema_to_xml",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xml_and_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("session_user",[],ScalarType "name"),("set_bit",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_byte",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_config",[ScalarType "text",ScalarType "text",ScalarType "bool"],ScalarType "text"),("set_masklen",[ScalarType "cidr",ScalarType "int4"],ScalarType "cidr"),("set_masklen",[ScalarType "inet",ScalarType "int4"],ScalarType "inet"),("setseed",[ScalarType "float8"],Pseudo Void),("setval",[ScalarType "regclass",ScalarType "int8"],ScalarType "int8"),("setval",[ScalarType "regclass",ScalarType "int8",ScalarType "bool"],ScalarType "int8"),("setweight",[ScalarType "tsvector",ScalarType "char"],ScalarType "tsvector"),("shell_in",[Pseudo Cstring],Pseudo Opaque),("shell_out",[Pseudo Opaque],Pseudo Cstring),("shift_jis_2004_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shift_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shobj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("sign",[ScalarType "float8"],ScalarType "float8"),("sign",[ScalarType "numeric"],ScalarType "numeric"),("similar_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("sin",[ScalarType "float8"],ScalarType "float8"),("sjis_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("slope",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("smgreq",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrin",[Pseudo Cstring],ScalarType "smgr"),("smgrne",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrout",[ScalarType "smgr"],Pseudo Cstring),("split_part",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("sqrt",[ScalarType "float8"],ScalarType "float8"),("sqrt",[ScalarType "numeric"],ScalarType "numeric"),("statement_timestamp",[],ScalarType "timestamptz"),("string_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("strip",[ScalarType "tsvector"],ScalarType "tsvector"),("strpos",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("substr",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substr",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("substring",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("suppress_redundant_updates_trigger",[],Pseudo Trigger),("table_to_xml",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xml_and_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("tan",[ScalarType "float8"],ScalarType "float8"),("text",[ScalarType "bool"],ScalarType "text"),("text",[ScalarType "char"],ScalarType "text"),("text",[ScalarType "name"],ScalarType "text"),("text",[ScalarType "xml"],ScalarType "text"),("text",[ScalarType "inet"],ScalarType "text"),("text",[ScalarType "bpchar"],ScalarType "text"),("text_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_larger",[ScalarType "text",ScalarType "text"],ScalarType "text"),("text_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_smaller",[ScalarType "text",ScalarType "text"],ScalarType "text"),("textanycat",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("textcat",[ScalarType "text",ScalarType "text"],ScalarType "text"),("texteq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textin",[Pseudo Cstring],ScalarType "text"),("textlen",[ScalarType "text"],ScalarType "int4"),("textlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textout",[ScalarType "text"],Pseudo Cstring),("textrecv",[Pseudo Internal],ScalarType "text"),("textregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textsend",[ScalarType "text"],ScalarType "bytea"),("thesaurus_init",[Pseudo Internal],Pseudo Internal),("thesaurus_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("tideq",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidge",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidgt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidin",[Pseudo Cstring],ScalarType "tid"),("tidlarger",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("tidle",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidlt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidne",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidout",[ScalarType "tid"],Pseudo Cstring),("tidrecv",[Pseudo Internal],ScalarType "tid"),("tidsend",[ScalarType "tid"],ScalarType "bytea"),("tidsmaller",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("time",[ScalarType "abstime"],ScalarType "time"),("time",[ScalarType "timestamp"],ScalarType "time"),("time",[ScalarType "timestamptz"],ScalarType "time"),("time",[ScalarType "interval"],ScalarType "time"),("time",[ScalarType "timetz"],ScalarType "time"),("time",[ScalarType "time",ScalarType "int4"],ScalarType "time"),("time_cmp",[ScalarType "time",ScalarType "time"],ScalarType "int4"),("time_eq",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_ge",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_gt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_hash",[ScalarType "time"],ScalarType "int4"),("time_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_larger",[ScalarType "time",ScalarType "time"],ScalarType "time"),("time_le",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_lt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_mi_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_mi_time",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("time_ne",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_out",[ScalarType "time"],Pseudo Cstring),("time_pl_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_send",[ScalarType "time"],ScalarType "bytea"),("time_smaller",[ScalarType "time",ScalarType "time"],ScalarType "time"),("timedate_pl",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("timemi",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timenow",[],ScalarType "abstime"),("timeofday",[],ScalarType "text"),("timepl",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timestamp",[ScalarType "abstime"],ScalarType "timestamp"),("timestamp",[ScalarType "date"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamptz"],ScalarType "timestamp"),("timestamp",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamp",ScalarType "int4"],ScalarType "timestamp"),("timestamp_cmp",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "int4"),("timestamp_cmp_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "int4"),("timestamp_cmp_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "int4"),("timestamp_eq",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_eq_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_eq_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_ge",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ge_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ge_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_gt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_gt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_gt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_hash",[ScalarType "timestamp"],ScalarType "int4"),("timestamp_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_larger",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamp_le",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_le_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_le_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_lt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_lt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_lt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_mi",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("timestamp_mi_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_ne",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ne_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ne_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_out",[ScalarType "timestamp"],Pseudo Cstring),("timestamp_pl_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_send",[ScalarType "timestamp"],ScalarType "bytea"),("timestamp_smaller",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamptypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptypmodout",[ScalarType "int4"],Pseudo Cstring),("timestamptz",[ScalarType "abstime"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamp"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "time"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamptz",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_cmp",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "int4"),("timestamptz_cmp_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "int4"),("timestamptz_cmp_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "int4"),("timestamptz_eq",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_eq_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_eq_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_ge",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ge_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ge_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_gt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_gt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_gt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_larger",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptz_le",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_le_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_le_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_lt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_lt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_lt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_mi",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("timestamptz_mi_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_ne",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ne_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ne_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_out",[ScalarType "timestamptz"],Pseudo Cstring),("timestamptz_pl_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_send",[ScalarType "timestamptz"],ScalarType "bytea"),("timestamptz_smaller",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptztypmodout",[ScalarType "int4"],Pseudo Cstring),("timetypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetypmodout",[ScalarType "int4"],Pseudo Cstring),("timetz",[ScalarType "time"],ScalarType "timetz"),("timetz",[ScalarType "timestamptz"],ScalarType "timetz"),("timetz",[ScalarType "timetz",ScalarType "int4"],ScalarType "timetz"),("timetz_cmp",[ScalarType "timetz",ScalarType "timetz"],ScalarType "int4"),("timetz_eq",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_ge",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_gt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_hash",[ScalarType "timetz"],ScalarType "int4"),("timetz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_larger",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetz_le",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_lt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_mi_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_ne",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_out",[ScalarType "timetz"],Pseudo Cstring),("timetz_pl_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_send",[ScalarType "timetz"],ScalarType "bytea"),("timetz_smaller",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetzdate_pl",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("timetztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetztypmodout",[ScalarType "int4"],Pseudo Cstring),("timezone",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "text",ScalarType "timetz"],ScalarType "timetz"),("timezone",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("tinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("tintervalct",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalend",[ScalarType "tinterval"],ScalarType "abstime"),("tintervaleq",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalge",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalgt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalin",[Pseudo Cstring],ScalarType "tinterval"),("tintervalle",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalleneq",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenge",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallengt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenle",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenlt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenne",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalne",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalout",[ScalarType "tinterval"],Pseudo Cstring),("tintervalov",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalrecv",[Pseudo Internal],ScalarType "tinterval"),("tintervalrel",[ScalarType "tinterval"],ScalarType "reltime"),("tintervalsame",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalsend",[ScalarType "tinterval"],ScalarType "bytea"),("tintervalstart",[ScalarType "tinterval"],ScalarType "abstime"),("to_ascii",[ScalarType "text"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "name"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("to_char",[ScalarType "int8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "int4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamp",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamptz",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "interval",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "numeric",ScalarType "text"],ScalarType "text"),("to_date",[ScalarType "text",ScalarType "text"],ScalarType "date"),("to_hex",[ScalarType "int8"],ScalarType "text"),("to_hex",[ScalarType "int4"],ScalarType "text"),("to_number",[ScalarType "text",ScalarType "text"],ScalarType "numeric"),("to_timestamp",[ScalarType "float8"],ScalarType "timestamptz"),("to_timestamp",[ScalarType "text",ScalarType "text"],ScalarType "timestamptz"),("to_tsquery",[ScalarType "text"],ScalarType "tsquery"),("to_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("to_tsvector",[ScalarType "text"],ScalarType "tsvector"),("to_tsvector",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsvector"),("transaction_timestamp",[],ScalarType "timestamptz"),("translate",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("trigger_in",[Pseudo Cstring],Pseudo Trigger),("trigger_out",[Pseudo Trigger],Pseudo Cstring),("trunc",[ScalarType "float8"],ScalarType "float8"),("trunc",[ScalarType "macaddr"],ScalarType "macaddr"),("trunc",[ScalarType "numeric"],ScalarType "numeric"),("trunc",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("ts_debug",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_debug",[ScalarType "regconfig",ScalarType "text"],SetOfType (Pseudo Record)),("ts_headline",[ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_lexize",[ScalarType "regdictionary",ScalarType "text"],ArrayType (ScalarType "text")),("ts_match_qv",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("ts_match_tq",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("ts_match_tt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("ts_match_vq",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("ts_parse",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_parse",[ScalarType "oid",ScalarType "text"],SetOfType (Pseudo Record)),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rewrite",[ScalarType "tsquery",ScalarType "text"],ScalarType "tsquery"),("ts_rewrite",[ScalarType "tsquery",ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("ts_stat",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_stat",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "oid"],SetOfType (Pseudo Record)),("ts_typanalyze",[Pseudo Internal],ScalarType "bool"),("tsmatchjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("tsmatchsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("tsq_mcontained",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsq_mcontains",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_and",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_cmp",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "int4"),("tsquery_eq",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ge",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_gt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_le",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_lt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ne",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_not",[ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_or",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsqueryin",[Pseudo Cstring],ScalarType "tsquery"),("tsqueryout",[ScalarType "tsquery"],Pseudo Cstring),("tsqueryrecv",[Pseudo Internal],ScalarType "tsquery"),("tsquerysend",[ScalarType "tsquery"],ScalarType "bytea"),("tsvector_cmp",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "int4"),("tsvector_concat",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("tsvector_eq",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ge",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_gt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_le",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_lt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ne",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_update_trigger",[],Pseudo Trigger),("tsvector_update_trigger_column",[],Pseudo Trigger),("tsvectorin",[Pseudo Cstring],ScalarType "tsvector"),("tsvectorout",[ScalarType "tsvector"],Pseudo Cstring),("tsvectorrecv",[Pseudo Internal],ScalarType "tsvector"),("tsvectorsend",[ScalarType "tsvector"],ScalarType "bytea"),("txid_current",[],ScalarType "int8"),("txid_current_snapshot",[],ScalarType "txid_snapshot"),("txid_snapshot_in",[Pseudo Cstring],ScalarType "txid_snapshot"),("txid_snapshot_out",[ScalarType "txid_snapshot"],Pseudo Cstring),("txid_snapshot_recv",[Pseudo Internal],ScalarType "txid_snapshot"),("txid_snapshot_send",[ScalarType "txid_snapshot"],ScalarType "bytea"),("txid_snapshot_xip",[ScalarType "txid_snapshot"],SetOfType (ScalarType "int8")),("txid_snapshot_xmax",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_snapshot_xmin",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_visible_in_snapshot",[ScalarType "int8",ScalarType "txid_snapshot"],ScalarType "bool"),("uhc_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("unknownin",[Pseudo Cstring],ScalarType "unknown"),("unknownout",[ScalarType "unknown"],Pseudo Cstring),("unknownrecv",[Pseudo Internal],ScalarType "unknown"),("unknownsend",[ScalarType "unknown"],ScalarType "bytea"),("unnest",[Pseudo AnyArray],SetOfType (Pseudo AnyElement)),("upper",[ScalarType "text"],ScalarType "text"),("utf8_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gb18030",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gbk",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859_1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_johab",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8u",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_uhc",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_win",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("uuid_cmp",[ScalarType "uuid",ScalarType "uuid"],ScalarType "int4"),("uuid_eq",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ge",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_gt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_hash",[ScalarType "uuid"],ScalarType "int4"),("uuid_in",[Pseudo Cstring],ScalarType "uuid"),("uuid_le",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_lt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ne",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_out",[ScalarType "uuid"],Pseudo Cstring),("uuid_recv",[Pseudo Internal],ScalarType "uuid"),("uuid_send",[ScalarType "uuid"],ScalarType "bytea"),("varbit",[ScalarType "varbit",ScalarType "int4",ScalarType "bool"],ScalarType "varbit"),("varbit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_out",[ScalarType "varbit"],Pseudo Cstring),("varbit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_send",[ScalarType "varbit"],ScalarType "bytea"),("varbitcmp",[ScalarType "varbit",ScalarType "varbit"],ScalarType "int4"),("varbiteq",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitge",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitgt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitle",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitlt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitne",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varbittypmodout",[ScalarType "int4"],Pseudo Cstring),("varchar",[ScalarType "name"],ScalarType "varchar"),("varchar",[ScalarType "varchar",ScalarType "int4",ScalarType "bool"],ScalarType "varchar"),("varcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharout",[ScalarType "varchar"],Pseudo Cstring),("varcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharsend",[ScalarType "varchar"],ScalarType "bytea"),("varchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varchartypmodout",[ScalarType "int4"],Pseudo Cstring),("version",[],ScalarType "text"),("void_in",[Pseudo Cstring],Pseudo Void),("void_out",[Pseudo Void],Pseudo Cstring),("width",[ScalarType "box"],ScalarType "float8"),("width_bucket",[ScalarType "float8",ScalarType "float8",ScalarType "float8",ScalarType "int4"],ScalarType "int4"),("width_bucket",[ScalarType "numeric",ScalarType "numeric",ScalarType "numeric",ScalarType "int4"],ScalarType "int4"),("win1250_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1250_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("xideq",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("xideqint4",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("xidin",[Pseudo Cstring],ScalarType "xid"),("xidout",[ScalarType "xid"],Pseudo Cstring),("xidrecv",[Pseudo Internal],ScalarType "xid"),("xidsend",[ScalarType "xid"],ScalarType "bytea"),("xml",[ScalarType "text"],ScalarType "xml"),("xml_in",[Pseudo Cstring],ScalarType "xml"),("xml_out",[ScalarType "xml"],Pseudo Cstring),("xml_recv",[Pseudo Internal],ScalarType "xml"),("xml_send",[ScalarType "xml"],ScalarType "bytea"),("xmlcomment",[ScalarType "text"],ScalarType "xml"),("xmlconcat2",[ScalarType "xml",ScalarType "xml"],ScalarType "xml"),("xmlvalidate",[ScalarType "xml",ScalarType "text"],ScalarType "bool"),("xpath",[ScalarType "text",ScalarType "xml"],ArrayType (ScalarType "xml")),("xpath",[ScalarType "text",ScalarType "xml",ArrayType (ScalarType "text")],ArrayType (ScalarType "xml")),("array_agg",[Pseudo AnyElement],Pseudo AnyArray),("avg",[ScalarType "int8"],ScalarType "numeric"),("avg",[ScalarType "int2"],ScalarType "numeric"),("avg",[ScalarType "int4"],ScalarType "numeric"),("avg",[ScalarType "float4"],ScalarType "float8"),("avg",[ScalarType "float8"],ScalarType "float8"),("avg",[ScalarType "interval"],ScalarType "interval"),("avg",[ScalarType "numeric"],ScalarType "numeric"),("bit_and",[ScalarType "int8"],ScalarType "int8"),("bit_and",[ScalarType "int2"],ScalarType "int2"),("bit_and",[ScalarType "int4"],ScalarType "int4"),("bit_and",[ScalarType "bit"],ScalarType "bit"),("bit_or",[ScalarType "int8"],ScalarType "int8"),("bit_or",[ScalarType "int2"],ScalarType "int2"),("bit_or",[ScalarType "int4"],ScalarType "int4"),("bit_or",[ScalarType "bit"],ScalarType "bit"),("bool_and",[ScalarType "bool"],ScalarType "bool"),("bool_or",[ScalarType "bool"],ScalarType "bool"),("corr",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("count",[],ScalarType "int8"),("count",[Pseudo Any],ScalarType "int8"),("covar_pop",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("covar_samp",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("every",[ScalarType "bool"],ScalarType "bool"),("max",[ScalarType "int8"],ScalarType "int8"),("max",[ScalarType "int2"],ScalarType "int2"),("max",[ScalarType "int4"],ScalarType "int4"),("max",[ScalarType "text"],ScalarType "text"),("max",[ScalarType "oid"],ScalarType "oid"),("max",[ScalarType "tid"],ScalarType "tid"),("max",[ScalarType "float4"],ScalarType "float4"),("max",[ScalarType "float8"],ScalarType "float8"),("max",[ScalarType "abstime"],ScalarType "abstime"),("max",[ScalarType "money"],ScalarType "money"),("max",[ScalarType "bpchar"],ScalarType "bpchar"),("max",[ScalarType "date"],ScalarType "date"),("max",[ScalarType "time"],ScalarType "time"),("max",[ScalarType "timestamp"],ScalarType "timestamp"),("max",[ScalarType "timestamptz"],ScalarType "timestamptz"),("max",[ScalarType "interval"],ScalarType "interval"),("max",[ScalarType "timetz"],ScalarType "timetz"),("max",[ScalarType "numeric"],ScalarType "numeric"),("max",[Pseudo AnyArray],Pseudo AnyArray),("max",[Pseudo AnyEnum],Pseudo AnyEnum),("min",[ScalarType "int8"],ScalarType "int8"),("min",[ScalarType "int2"],ScalarType "int2"),("min",[ScalarType "int4"],ScalarType "int4"),("min",[ScalarType "text"],ScalarType "text"),("min",[ScalarType "oid"],ScalarType "oid"),("min",[ScalarType "tid"],ScalarType "tid"),("min",[ScalarType "float4"],ScalarType "float4"),("min",[ScalarType "float8"],ScalarType "float8"),("min",[ScalarType "abstime"],ScalarType "abstime"),("min",[ScalarType "money"],ScalarType "money"),("min",[ScalarType "bpchar"],ScalarType "bpchar"),("min",[ScalarType "date"],ScalarType "date"),("min",[ScalarType "time"],ScalarType "time"),("min",[ScalarType "timestamp"],ScalarType "timestamp"),("min",[ScalarType "timestamptz"],ScalarType "timestamptz"),("min",[ScalarType "interval"],ScalarType "interval"),("min",[ScalarType "timetz"],ScalarType "timetz"),("min",[ScalarType "numeric"],ScalarType "numeric"),("min",[Pseudo AnyArray],Pseudo AnyArray),("min",[Pseudo AnyEnum],Pseudo AnyEnum),("regr_avgx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_avgy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_count",[ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("regr_intercept",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_r2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_slope",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_syy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "int8"],ScalarType "numeric"),("stddev",[ScalarType "int2"],ScalarType "numeric"),("stddev",[ScalarType "int4"],ScalarType "numeric"),("stddev",[ScalarType "float4"],ScalarType "float8"),("stddev",[ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "numeric"],ScalarType "numeric"),("stddev_pop",[ScalarType "int8"],ScalarType "numeric"),("stddev_pop",[ScalarType "int2"],ScalarType "numeric"),("stddev_pop",[ScalarType "int4"],ScalarType "numeric"),("stddev_pop",[ScalarType "float4"],ScalarType "float8"),("stddev_pop",[ScalarType "float8"],ScalarType "float8"),("stddev_pop",[ScalarType "numeric"],ScalarType "numeric"),("stddev_samp",[ScalarType "int8"],ScalarType "numeric"),("stddev_samp",[ScalarType "int2"],ScalarType "numeric"),("stddev_samp",[ScalarType "int4"],ScalarType "numeric"),("stddev_samp",[ScalarType "float4"],ScalarType "float8"),("stddev_samp",[ScalarType "float8"],ScalarType "float8"),("stddev_samp",[ScalarType "numeric"],ScalarType "numeric"),("sum",[ScalarType "int8"],ScalarType "numeric"),("sum",[ScalarType "int2"],ScalarType "int8"),("sum",[ScalarType "int4"],ScalarType "int8"),("sum",[ScalarType "float4"],ScalarType "float4"),("sum",[ScalarType "float8"],ScalarType "float8"),("sum",[ScalarType "money"],ScalarType "money"),("sum",[ScalarType "interval"],ScalarType "interval"),("sum",[ScalarType "numeric"],ScalarType "numeric"),("var_pop",[ScalarType "int8"],ScalarType "numeric"),("var_pop",[ScalarType "int2"],ScalarType "numeric"),("var_pop",[ScalarType "int4"],ScalarType "numeric"),("var_pop",[ScalarType "float4"],ScalarType "float8"),("var_pop",[ScalarType "float8"],ScalarType "float8"),("var_pop",[ScalarType "numeric"],ScalarType "numeric"),("var_samp",[ScalarType "int8"],ScalarType "numeric"),("var_samp",[ScalarType "int2"],ScalarType "numeric"),("var_samp",[ScalarType "int4"],ScalarType "numeric"),("var_samp",[ScalarType "float4"],ScalarType "float8"),("var_samp",[ScalarType "float8"],ScalarType "float8"),("var_samp",[ScalarType "numeric"],ScalarType "numeric"),("variance",[ScalarType "int8"],ScalarType "numeric"),("variance",[ScalarType "int2"],ScalarType "numeric"),("variance",[ScalarType "int4"],ScalarType "numeric"),("variance",[ScalarType "float4"],ScalarType "float8"),("variance",[ScalarType "float8"],ScalarType "float8"),("variance",[ScalarType "numeric"],ScalarType "numeric"),("xmlagg",[ScalarType "xml"],ScalarType "xml")], scopeAttrDefs = [("pg_aggregate",TableComposite,UnnamedCompositeType [("aggfnoid",ScalarType "regproc"),("aggtransfn",ScalarType "regproc"),("aggfinalfn",ScalarType "regproc"),("aggsortop",ScalarType "oid"),("aggtranstype",ScalarType "oid"),("agginitval",ScalarType "text")]),("pg_am",TableComposite,UnnamedCompositeType [("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")]),("pg_amop",TableComposite,UnnamedCompositeType [("amopfamily",ScalarType "oid"),("amoplefttype",ScalarType "oid"),("amoprighttype",ScalarType "oid"),("amopstrategy",ScalarType "int2"),("amopopr",ScalarType "oid"),("amopmethod",ScalarType "oid")]),("pg_amproc",TableComposite,UnnamedCompositeType [("amprocfamily",ScalarType "oid"),("amproclefttype",ScalarType "oid"),("amprocrighttype",ScalarType "oid"),("amprocnum",ScalarType "int2"),("amproc",ScalarType "regproc")]),("pg_attrdef",TableComposite,UnnamedCompositeType [("adrelid",ScalarType "oid"),("adnum",ScalarType "int2"),("adbin",ScalarType "text"),("adsrc",ScalarType "text")]),("pg_attribute",TableComposite,UnnamedCompositeType [("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"))]),("pg_auth_members",TableComposite,UnnamedCompositeType [("roleid",ScalarType "oid"),("member",ScalarType "oid"),("grantor",ScalarType "oid"),("admin_option",ScalarType "bool")]),("pg_authid",TableComposite,UnnamedCompositeType [("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"))]),("pg_cast",TableComposite,UnnamedCompositeType [("castsource",ScalarType "oid"),("casttarget",ScalarType "oid"),("castfunc",ScalarType "oid"),("castcontext",ScalarType "char"),("castmethod",ScalarType "char")]),("pg_class",TableComposite,UnnamedCompositeType [("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"))]),("pg_constraint",TableComposite,UnnamedCompositeType [("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")]),("pg_conversion",TableComposite,UnnamedCompositeType [("conname",ScalarType "name"),("connamespace",ScalarType "oid"),("conowner",ScalarType "oid"),("conforencoding",ScalarType "int4"),("contoencoding",ScalarType "int4"),("conproc",ScalarType "regproc"),("condefault",ScalarType "bool")]),("pg_database",TableComposite,UnnamedCompositeType [("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"))]),("pg_depend",TableComposite,UnnamedCompositeType [("classid",ScalarType "oid"),("objid",ScalarType "oid"),("objsubid",ScalarType "int4"),("refclassid",ScalarType "oid"),("refobjid",ScalarType "oid"),("refobjsubid",ScalarType "int4"),("deptype",ScalarType "char")]),("pg_description",TableComposite,UnnamedCompositeType [("objoid",ScalarType "oid"),("classoid",ScalarType "oid"),("objsubid",ScalarType "int4"),("description",ScalarType "text")]),("pg_enum",TableComposite,UnnamedCompositeType [("enumtypid",ScalarType "oid"),("enumlabel",ScalarType "name")]),("pg_foreign_data_wrapper",TableComposite,UnnamedCompositeType [("fdwname",ScalarType "name"),("fdwowner",ScalarType "oid"),("fdwvalidator",ScalarType "oid"),("fdwacl",ArrayType (ScalarType "aclitem")),("fdwoptions",ArrayType (ScalarType "text"))]),("pg_foreign_server",TableComposite,UnnamedCompositeType [("srvname",ScalarType "name"),("srvowner",ScalarType "oid"),("srvfdw",ScalarType "oid"),("srvtype",ScalarType "text"),("srvversion",ScalarType "text"),("srvacl",ArrayType (ScalarType "aclitem")),("srvoptions",ArrayType (ScalarType "text"))]),("pg_index",TableComposite,UnnamedCompositeType [("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")]),("pg_inherits",TableComposite,UnnamedCompositeType [("inhrelid",ScalarType "oid"),("inhparent",ScalarType "oid"),("inhseqno",ScalarType "int4")]),("pg_language",TableComposite,UnnamedCompositeType [("lanname",ScalarType "name"),("lanowner",ScalarType "oid"),("lanispl",ScalarType "bool"),("lanpltrusted",ScalarType "bool"),("lanplcallfoid",ScalarType "oid"),("lanvalidator",ScalarType "oid"),("lanacl",ArrayType (ScalarType "aclitem"))]),("pg_largeobject",TableComposite,UnnamedCompositeType [("loid",ScalarType "oid"),("pageno",ScalarType "int4"),("data",ScalarType "bytea")]),("pg_listener",TableComposite,UnnamedCompositeType [("relname",ScalarType "name"),("listenerpid",ScalarType "int4"),("notification",ScalarType "int4")]),("pg_namespace",TableComposite,UnnamedCompositeType [("nspname",ScalarType "name"),("nspowner",ScalarType "oid"),("nspacl",ArrayType (ScalarType "aclitem"))]),("pg_opclass",TableComposite,UnnamedCompositeType [("opcmethod",ScalarType "oid"),("opcname",ScalarType "name"),("opcnamespace",ScalarType "oid"),("opcowner",ScalarType "oid"),("opcfamily",ScalarType "oid"),("opcintype",ScalarType "oid"),("opcdefault",ScalarType "bool"),("opckeytype",ScalarType "oid")]),("pg_operator",TableComposite,UnnamedCompositeType [("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")]),("pg_opfamily",TableComposite,UnnamedCompositeType [("opfmethod",ScalarType "oid"),("opfname",ScalarType "name"),("opfnamespace",ScalarType "oid"),("opfowner",ScalarType "oid")]),("pg_pltemplate",TableComposite,UnnamedCompositeType [("tmplname",ScalarType "name"),("tmpltrusted",ScalarType "bool"),("tmpldbacreate",ScalarType "bool"),("tmplhandler",ScalarType "text"),("tmplvalidator",ScalarType "text"),("tmpllibrary",ScalarType "text"),("tmplacl",ArrayType (ScalarType "aclitem"))]),("pg_proc",TableComposite,UnnamedCompositeType [("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"))]),("pg_rewrite",TableComposite,UnnamedCompositeType [("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")]),("pg_shdepend",TableComposite,UnnamedCompositeType [("dbid",ScalarType "oid"),("classid",ScalarType "oid"),("objid",ScalarType "oid"),("objsubid",ScalarType "int4"),("refclassid",ScalarType "oid"),("refobjid",ScalarType "oid"),("deptype",ScalarType "char")]),("pg_shdescription",TableComposite,UnnamedCompositeType [("objoid",ScalarType "oid"),("classoid",ScalarType "oid"),("description",ScalarType "text")]),("pg_statistic",TableComposite,UnnamedCompositeType [("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)]),("pg_tablespace",TableComposite,UnnamedCompositeType [("spcname",ScalarType "name"),("spcowner",ScalarType "oid"),("spclocation",ScalarType "text"),("spcacl",ArrayType (ScalarType "aclitem"))]),("pg_trigger",TableComposite,UnnamedCompositeType [("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")]),("pg_ts_config",TableComposite,UnnamedCompositeType [("cfgname",ScalarType "name"),("cfgnamespace",ScalarType "oid"),("cfgowner",ScalarType "oid"),("cfgparser",ScalarType "oid")]),("pg_ts_config_map",TableComposite,UnnamedCompositeType [("mapcfg",ScalarType "oid"),("maptokentype",ScalarType "int4"),("mapseqno",ScalarType "int4"),("mapdict",ScalarType "oid")]),("pg_ts_dict",TableComposite,UnnamedCompositeType [("dictname",ScalarType "name"),("dictnamespace",ScalarType "oid"),("dictowner",ScalarType "oid"),("dicttemplate",ScalarType "oid"),("dictinitoption",ScalarType "text")]),("pg_ts_parser",TableComposite,UnnamedCompositeType [("prsname",ScalarType "name"),("prsnamespace",ScalarType "oid"),("prsstart",ScalarType "regproc"),("prstoken",ScalarType "regproc"),("prsend",ScalarType "regproc"),("prsheadline",ScalarType "regproc"),("prslextype",ScalarType "regproc")]),("pg_ts_template",TableComposite,UnnamedCompositeType [("tmplname",ScalarType "name"),("tmplnamespace",ScalarType "oid"),("tmplinit",ScalarType "regproc"),("tmpllexize",ScalarType "regproc")]),("pg_type",TableComposite,UnnamedCompositeType [("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")]),("pg_user_mapping",TableComposite,UnnamedCompositeType [("umuser",ScalarType "oid"),("umserver",ScalarType "oid"),("umoptions",ArrayType (ScalarType "text"))]),("pg_cursors",ViewComposite,UnnamedCompositeType [("name",ScalarType "text"),("statement",ScalarType "text"),("is_holdable",ScalarType "bool"),("is_binary",ScalarType "bool"),("is_scrollable",ScalarType "bool"),("creation_time",ScalarType "timestamptz")]),("pg_group",ViewComposite,UnnamedCompositeType [("groname",ScalarType "name"),("grosysid",ScalarType "oid"),("grolist",ArrayType (ScalarType "oid"))]),("pg_indexes",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("tablename",ScalarType "name"),("indexname",ScalarType "name"),("tablespace",ScalarType "name"),("indexdef",ScalarType "text")]),("pg_locks",ViewComposite,UnnamedCompositeType [("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")]),("pg_prepared_statements",ViewComposite,UnnamedCompositeType [("name",ScalarType "text"),("statement",ScalarType "text"),("prepare_time",ScalarType "timestamptz"),("parameter_types",ArrayType (ScalarType "regtype")),("from_sql",ScalarType "bool")]),("pg_prepared_xacts",ViewComposite,UnnamedCompositeType [("transaction",ScalarType "xid"),("gid",ScalarType "text"),("prepared",ScalarType "timestamptz"),("owner",ScalarType "name"),("database",ScalarType "name")]),("pg_roles",ViewComposite,UnnamedCompositeType [("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")]),("pg_rules",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("tablename",ScalarType "name"),("rulename",ScalarType "name"),("definition",ScalarType "text")]),("pg_settings",ViewComposite,UnnamedCompositeType [("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")]),("pg_shadow",ViewComposite,UnnamedCompositeType [("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"))]),("pg_stat_activity",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_all_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_all_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_bgwriter",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_database",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_sys_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_sys_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_user_functions",ViewComposite,UnnamedCompositeType [("funcid",ScalarType "oid"),("schemaname",ScalarType "name"),("funcname",ScalarType "name"),("calls",ScalarType "int8"),("total_time",ScalarType "int8"),("self_time",ScalarType "int8")]),("pg_stat_user_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_user_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_all_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_all_sequences",ViewComposite,UnnamedCompositeType [("relid",ScalarType "oid"),("schemaname",ScalarType "name"),("relname",ScalarType "name"),("blks_read",ScalarType "int8"),("blks_hit",ScalarType "int8")]),("pg_statio_all_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_sys_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_sys_sequences",ViewComposite,UnnamedCompositeType [("relid",ScalarType "oid"),("schemaname",ScalarType "name"),("relname",ScalarType "name"),("blks_read",ScalarType "int8"),("blks_hit",ScalarType "int8")]),("pg_statio_sys_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_user_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_user_sequences",ViewComposite,UnnamedCompositeType [("relid",ScalarType "oid"),("schemaname",ScalarType "name"),("relname",ScalarType "name"),("blks_read",ScalarType "int8"),("blks_hit",ScalarType "int8")]),("pg_statio_user_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_stats",ViewComposite,UnnamedCompositeType [("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")]),("pg_tables",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("tablename",ScalarType "name"),("tableowner",ScalarType "name"),("tablespace",ScalarType "name"),("hasindexes",ScalarType "bool"),("hasrules",ScalarType "bool"),("hastriggers",ScalarType "bool")]),("pg_timezone_abbrevs",ViewComposite,UnnamedCompositeType [("abbrev",ScalarType "text"),("utc_offset",ScalarType "interval"),("is_dst",ScalarType "bool")]),("pg_timezone_names",ViewComposite,UnnamedCompositeType [("name",ScalarType "text"),("abbrev",ScalarType "text"),("utc_offset",ScalarType "interval"),("is_dst",ScalarType "bool")]),("pg_user",ViewComposite,UnnamedCompositeType [("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"))]),("pg_user_mappings",ViewComposite,UnnamedCompositeType [("umid",ScalarType "oid"),("srvid",ScalarType "oid"),("srvname",ScalarType "name"),("umuser",ScalarType "oid"),("usename",ScalarType "name"),("umoptions",ArrayType (ScalarType "text"))]),("pg_views",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("viewname",ScalarType "name"),("viewowner",ScalarType "name"),("definition",ScalarType "text")])], scopeAttrSystemColumns = [("pg_aggregate",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_am",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_amop",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_amproc",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_attrdef",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_attribute",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_auth_members",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_authid",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_cast",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_class",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_constraint",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_conversion",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_database",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_depend",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_description",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_enum",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_foreign_data_wrapper",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_foreign_server",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_index",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_inherits",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_language",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_largeobject",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_listener",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_namespace",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_opclass",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_operator",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_opfamily",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_pltemplate",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_proc",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_rewrite",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_shdepend",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_shdescription",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_statistic",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_tablespace",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_trigger",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_config",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_config_map",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_ts_dict",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_parser",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_template",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_type",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_user_mapping",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")])], scopeIdentifierTypes = [], scopeJoinIdentifiers = []}
− Database/HsSqlPpp/DefaultScopeEmpty.hs
@@ -1,47 +0,0 @@-{--Copyright 2009 Jake Wheat--This file is used in the following scenario:--hack up scope or readscope or something--run ./HsSqlSystem.lhs getscope template1 >DefaultScope.hs--oops - DefaultScope.hs has been blanked too soon (i.e. before ghc has-loaded it as part of running HsSqlSystem), and HsSqlSystem can't run,-and we're stuck without being able to generate a new DefaultScope.--Or//--run ./HsSqlSystem.lhs getscope template1 >DefaultScope1.hs-then mv DefaultScope1.hs DefaultScope.hs--and, oops - DefaultScope hasn't generated properly and can't-compile. Once again we can't run HsSqlSystem.hs to fix it.--If you end up in this position, use-cp DefaultScopeEmpty.hs DefaultScope.hs-and you can then generate a new DefaultScope again using HsSqlPpp.--Finally//--You alter the scope type, and hssqlsystem won't run since the value in-defaultscope no longer matches the scope type, overwrite-DefaultScope.hs with this file and then you can regenerate the-DefaultScope with the new type. Assuming you've updated ScopeReader-also.--Perhaps having the program to generate defaultscope.hs depend on it-being a valid file before it can regenerate it is a bad design...---}---module Database.HsSqlPpp.DefaultScope where--import Database.HsSqlPpp.TypeType-import Database.HsSqlPpp.Scope---defaultScope :: Scope-defaultScope = emptyScope
− Database/HsSqlPpp/Lexer.lhs
@@ -1,290 +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)--> module Database.HsSqlPpp.Lexer (-> Token-> ,Tok(..)-> ,lexSqlFile-> ,lexSqlText-> ) where--> import Text.Parsec hiding(many, optional, (<|>))-> import qualified Text.Parsec.Token as P-> import Text.Parsec.Language-> import Text.Parsec.String--> import Control.Applicative-> import Control.Monad.Identity--> import Data.Char--> import Database.HsSqlPpp.ParseErrors--================================================================================--= 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 -- $1, etc.-> | FloatTok Double-> | IntegerTok Integer-> | CopyPayloadTok String -- support copy from stdin; with inline data-> deriving (Eq,Show)--> type ParseState = [Tok]--> lexSqlFile :: FilePath -> IO (Either ExtendedError [Token])-> lexSqlFile f = do-> te <- readFile f-> let x = runParser sqlTokens [] f te --parseFromFile sqlTokens f-> return $ convertToExtendedError x f te--> lexSqlText :: String -> Either ExtendedError [Token]-> lexSqlText s = convertToExtendedError (runParser sqlTokens [] "" s) "" s--================================================================================--= lexers--lexer for tokens, contains a hack for copy from stdin with inline-table data.--> sqlTokens :: ParsecT String ParseState 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 ParseState 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 ParseState 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 ParseState Identity Tok-> idString = IdStringTok <$> identifierString--> positionalArg :: ParsecT String ParseState 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--> sqlSymbol :: ParsecT String ParseState Identity Tok-> sqlSymbol =-> SymbolTok <$> lexeme (choice [-> replicate 1 <$> oneOf "()[],;"-> ,string ".."-> ,try $ string "::"-> ,try $ string ":="-> ,string ":"-> ,many1 (oneOf "+-*/<>=~!@#%^&|`?")-> ])--> sqlFloat :: ParsecT String ParseState Identity Tok-> sqlFloat = FloatTok <$> float--> sqlInteger :: ParsecT String ParseState 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 ParseState 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 = (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 ParseState 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)--doesn't seem too gratuitous, comes up a few times--> (<:>) :: (Applicative f) =>-> f a -> f [a] -> f [a]-> (<:>) a b = (:) <$> a <*> b--> 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 ParseState Identity String-> symbol = P.symbol lexer--> integer :: ParsecT String ParseState Identity Integer-> integer = lexeme $ P.integer lexer--> float :: ParsecT String ParseState Identity Double-> float = lexeme $ P.float lexer--> whiteSpace :: ParsecT String ParseState Identity ()-> whiteSpace= P.whiteSpace lexer--> lexeme :: ParsecT String ParseState Identity a-> -> ParsecT String ParseState 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 ParseState 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/ParseErrors.lhs
@@ -1,49 +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.--> module Database.HsSqlPpp.ParseErrors (convertToExtendedError, ExtendedError(..)) where--> import Text.Parsec--> showEr :: ParseError -> String -> String -> String-> showEr er fn src =-> let pos = errorPos er-> lineNo = sourceLine pos-> ls = lines src-> line = safeGet ls(lineNo - 1)-> prelines = map (safeGet ls) [(lineNo - 5) .. (lineNo - 2)]-> postlines = map (safeGet ls) [lineNo .. (lineNo + 5)]-> colNo = sourceColumn pos-> highlightLine = replicate (colNo - 1) ' ' ++ "^"-> errorHighlightText = prelines-> ++ [line, highlightLine, "ERROR HERE"]-> ++ postlines-> in "\n---------------------\n" ++ show er-> ++ "\nFILENAMESTUFF:\n" ++ fn ++ ":" ++ show lineNo ++ ":" ++ show colNo-> ++ "\n------------\nCheck it out:\n"-> ++ unlines (trimLines errorHighlightText)-> ++ "\n-----------------\n"-> where-> safeGet a i = if i < 0 || i >= length a-> then ""-> else a !! i-> trimLines = trimStartLines . reverse . trimStartLines . reverse-> trimStartLines = dropWhile (=="")--give access to the nicer error text via Show--> data ExtendedError = ExtendedError ParseError String--> instance Show ExtendedError where-> show (ExtendedError _ x) = x--> convertToExtendedError :: Either ParseError b-> -> String-> -> String-> -> Either ExtendedError b-> convertToExtendedError f fn src =-> case f of-> Left er -> Left $ ExtendedError er (showEr er fn src)-> Right l -> Right l
− Database/HsSqlPpp/Parser.lhs
@@ -1,1260 +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.--> module Database.HsSqlPpp.Parser (-> --parse fully formed sql statements from a string-> parseSql-> --parse a file containing sql statements only-> ,parseSqlFile-> --parse a file and return the parse tree and the-> --parser state also-> ,parseSqlFileWithState-> --parse an expression (one expression plus whitespace-> --only allowed-> ,parseExpression-> --parse fully formed plpgsql statements from a string-> ,parsePlpgsql-> )-> where--> import Text.Parsec hiding(many, optional, (<|>), string)-> import Text.Parsec.Expr-> import Text.Parsec.String--> import Control.Applicative-> import Control.Monad.Identity--> import Data.Maybe-> import Data.Char--> import Database.HsSqlPpp.Lexer-> import Database.HsSqlPpp.ParseErrors-> import Database.HsSqlPpp.Ast--> type ParseState = [MySourcePos]--> startState :: ParseState-> startState = []--> toMySp :: SourcePos -> MySourcePos-> toMySp sp = (sourceName sp, sourceLine sp, sourceColumn sp)--=====================================W==========================================--= Top level parsing functions--parse fully formed sql--> parseSql :: String -> Either ExtendedError StatementList-> parseSql s = statementsOnly $ parseIt (lexSqlText s) sqlStatements "" s startState--> parseSqlFile :: String -> IO (Either ExtendedError StatementList)-> parseSqlFile fn = do-> sc <- readFile fn-> x <- lexSqlFile fn-> return $ statementsOnly $ parseIt x sqlStatements fn sc startState--> parseSqlFileWithState :: String -> IO (Either ExtendedError StatementList)-> parseSqlFileWithState fn = do-> sc <- readFile fn-> x <- lexSqlFile fn-> return $ parseIt x sqlStatements fn sc startState--Parse expression fragment, used for testing purposes--> parseExpression :: String -> Either ExtendedError Expression-> parseExpression s = parseIt (lexSqlText s) (expr <* eof) "" s startState--parse plpgsql statements, used for testing purposes--> parsePlpgsql :: String -> Either ExtendedError StatementList-> parsePlpgsql s = parseIt (lexSqlText s) (many plPgsqlStatement <* eof) "" s startState--utility function to do error handling in one place--> parseIt lexed parser fn src ss =-> case lexed of-> Left er -> Left er-> Right toks -> convertToExtendedError-> (runParser parser ss fn toks) fn src--> statementsOnly :: Either ExtendedError StatementList-> -> Either ExtendedError StatementList-> statementsOnly s = case s of-> Left er -> Left er-> Right st -> Right st--================================================================================--= Parsing top level statements--> sqlStatements :: ParsecT [Token] ParseState Identity [(MySourcePos,Statement)]-> sqlStatements = many (sqlStatement True) <* eof--parse a statement--> sqlStatement :: Bool -> ParsecT [Token] ParseState Identity (MySourcePos,Statement)-> sqlStatement reqSemi = do-> p <- getAdjustedPosition-> st <- ((choice [-> selectStatement-> ,insert-> ,update-> ,delete-> ,truncateSt-> ,copy-> ,keyword "create" *>-> choice [-> createTable-> ,createType-> ,createFunction-> ,createView-> ,createDomain]-> ,keyword "drop" *>-> choice [-> dropSomething-> ,dropFunction]-> ]-> <* (if reqSemi-> then symbol ";" >> return ()-> else optional (symbol ";") >> return ()))-> <|> copyData)-> return (p, st)--> 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)--================================================================================--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--> selectStatement :: ParsecT [Token] ParseState Identity Statement-> selectStatement = SelectStatement <$> selectExpression--> selectExpression :: ParsecT [Token] ParseState Identity SelectExpression-> selectExpression =-> choice [selectE, values]-> where-> selectE = do-> keyword "select"-> s1 <- selQuerySpec-> choice [-> --don't know if this does associativity in the correct order for-> --statements with multiple excepts/ intersects and no parens-> CombineSelect Except s1 <$> (keyword "except" *> selectExpression)-> ,CombineSelect Intersect s1 <$> (keyword "intersect" *> selectExpression)-> ,CombineSelect UnionAll s1 <$> (try (keyword "union"-> *> keyword "all") *> selectExpression)-> ,CombineSelect Union s1 <$> (keyword "union" *> selectExpression)-> ,return s1]-> where-> selQuerySpec = Select-> <$> option Dupes (Distinct <$ keyword "distinct")-> <*> selectList-> <*> tryOptionMaybe from-> <*> tryOptionMaybe whereClause-> <*> option [] groupBy-> <*> tryOptionMaybe having-> <*> option [] orderBy-> <*> option Asc (choice [-> Asc <$ keyword "asc"-> ,Desc <$ keyword "desc"])-> <*> tryOptionMaybe limit-> <*> tryOptionMaybe offset-> from = keyword "from" *> tref-> groupBy = keyword "group" *> keyword "by"-> *> commaSep1 expr-> having = keyword "having" *> expr-> orderBy = keyword "order" *> keyword "by"-> *> commaSep1 expr-> 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 = threadOptionalSuffix getFirstTref joinPart-> getFirstTref = choice [-> SubTref-> <$> parens selectExpression-> <*> (optional (keyword "as") *> nkwid)-> ,optionalSuffix-> TrefFun (try $ identifier >>= functionCallSuffix)-> TrefFunAlias () (optional (keyword "as") *> nkwid)-> ,optionalSuffix-> Tref nkwid-> TrefAlias () (optional (keyword "as") *> nkwid)]-> --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 = JoinedTref tr1-> --look for the join flavour first-> <$> option Unnatural (Natural <$ keyword "natural")-> <*> choice [-> Inner <$ keyword "inner"-> ,LeftOuter <$ try (keyword "left" *> keyword "outer")-> ,RightOuter <$ try (keyword "right" *> keyword "outer")-> ,FullOuter <$ try (keyword "full" >> keyword "outer")-> ,Cross <$ keyword "cross"]-> --recurse back to tref to read the table-> <*> (keyword "join" *> tref)-> --now try and read the join condition-> <*> choice [-> Just <$> (JoinOn <$> (keyword "on" *> expr))-> ,Just <$> (JoinUsing <$> (keyword "using" *> columnNameList))-> ,return Nothing]-> 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-> --[]-> if map toLower x `elem` ["as"-> ,"where"-> ,"except"-> ,"union"-> ,"intersect"-> ,"loop"-> ,"inner"-> ,"on"-> ,"left"-> ,"right"-> ,"full"-> ,"cross"-> ,"natural"-> ,"order"-> ,"group"-> ,"limit"-> ,"using"-> ,"from"]-> then fail "not keyword"-> else return x-> values = keyword "values" >>-> Values <$> commaSep1 (parens $ commaSep1 expr)---= 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 = keyword "insert" >> keyword "into" >>-> Insert <$> idString-> <*> option [] (try columnNameList)-> <*> selectExpression-> <*> tryOptionMaybe returning--> update :: ParsecT [Token] ParseState Identity Statement-> update = keyword "update" >>-> Update-> <$> idString-> <*> (keyword "set" *> commaSep1 setClause)-> <*> tryOptionMaybe whereClause-> <*> tryOptionMaybe returning-> where-> setClause = choice-> [RowSetClause <$> parens (commaSep1 idString)-> <*> (symbol "=" *> parens (commaSep1 expr))-> ,SetClause <$> idString-> <*> (symbol "=" *> expr)]--> delete :: ParsecT [Token] ParseState Identity Statement-> delete = keyword "delete" >> keyword "from" >>-> Delete-> <$> idString-> <*> tryOptionMaybe whereClause-> <*> tryOptionMaybe returning--> truncateSt :: ParsecT [Token] ParseState Identity Statement-> truncateSt = keyword "truncate" >> optional (keyword "table") >>-> Truncate-> <$> commaSep1 idString-> <*> option ContinueIdentity (choice [-> ContinueIdentity <$ (keyword "continue"-> <* keyword "identity")-> ,RestartIdentity <$ (keyword "restart"-> <* keyword "identity")])-> <*> cascade--> copy :: ParsecT [Token] ParseState Identity Statement-> copy = do-> keyword "copy"-> tableName <- idString-> cols <- option [] (parens $ commaSep1 idString)-> keyword "from"-> src <- choice [-> CopyFilename <$> extrStr <$> stringLit-> ,Stdin <$ keyword "stdin"]-> return $ Copy tableName cols src--> copyData :: ParsecT [Token] ParseState Identity Statement-> copyData = CopyData <$> mytoken (\tok ->-> case tok of-> CopyPayloadTok n -> Just n-> _ -> Nothing)--= ddl--> createTable :: ParsecT [Token] ParseState Identity Statement-> createTable = do-> keyword "table"-> tname <- idString-> choice [-> CreateTableAs tname <$> (keyword "as" *> selectExpression)-> ,uncurry (CreateTable 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 tableConstr)-> tableAtt-> (symbol ","))-> where swap (a,b) = (b,a)-> tableAtt = AttributeDef-> <$> idString-> <*> typeName-> <*> tryOptionMaybe (keyword "default" *> expr)-> <*> many rowConstraint-> tableConstr = choice [-> UniqueConstraint-> <$> try (keyword "unique" *> columnNameList)-> ,PrimaryKeyConstraint-> <$> try (keyword "primary" *> keyword "key"-> *> choice [-> (:[]) <$> idString-> ,parens (commaSep1 idString)])-> ,CheckConstraint-> <$> try (keyword "check" *> parens expr)-> ,ReferenceConstraint-> <$> try (keyword "foreign" *> keyword "key"-> *> parens (commaSep1 idString))-> <*> (keyword "references" *> idString)-> <*> option [] (parens $ commaSep1 idString)-> <*> onDelete-> <*> onUpdate]-> rowConstraint =-> choice [-> RowUniqueConstraint <$ keyword "unique"-> ,RowPrimaryKeyConstraint <$ keyword "primary" <* keyword "key"-> ,RowCheckConstraint <$> (keyword "check" *> parens expr)-> ,NullConstraint <$ keyword "null"-> ,NotNullConstraint <$ (keyword "not" *> keyword "null")-> ,RowReferenceConstraint-> <$> (keyword "references" *> idString)-> <*> option Nothing (try $ parens $ Just <$> idString)-> <*> onDelete-> <*> onUpdate-> ]-> onDelete = onSomething "delete"-> onUpdate = onSomething "update"-> onSomething k = option Restrict $ try $ keyword "on"-> *> keyword k *> cascade---> createType :: ParsecT [Token] ParseState Identity Statement-> createType = keyword "type" >>-> CreateType-> <$> idString-> <*> (keyword "as" *> parens (commaSep1 typeAtt))-> where-> typeAtt = TypeAttDef <$> idString <*> typeName---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-> keyword "function"-> fnName <- idString-> params <- parens $ commaSep param-> retType <- keyword "returns" *> typeName-> keyword "as"-> bodypos <- getAdjustedPosition-> body <- stringLit-> lang <- readLang-> let (q, b) = parseBody lang body fnName bodypos-> CreateFunction lang fnName params retType q b <$> pVol-> where-> pVol = matchAKeyword [("volatile", Volatile)-> ,("stable", Stable)-> ,("immutable", Immutable)]-> readLang = keyword "language" *> matchAKeyword [("plpgsql", Plpgsql)-> ,("sql",Sql)]-> parseBody lang body fnName bodypos =-> case (parseIt-> (lexSqlText (extrStr body))-> (functionBody lang)-> ("function " ++ fnName)-> (extrStr body)-> [bodypos]) of-> Left er@(ExtendedError e _) ->-> -- don't know how to change the-> --position of the error we've been-> --given, so add some information to-> --show the position of the containing-> --function and the adjusted absolute-> --position of this error-> let ep = toMySp $ errorPos e-> (fn,fp,fc) = bodypos-> fnBit = "in function " ++ fnName ++ "\n"-> ++ fn ++ ":" ++ show fp ++ ":" ++ show fc ++ ":\n"-> (_,lp,lc) = adjustPosition bodypos ep-> lineBit = "on line\n"-> ++ fn ++ ":" ++ show lp ++ ":" ++ show lc ++ ":\n"-> in error $ show er ++ "\n" ++ fnBit ++ lineBit-> Right body' -> (quoteOfString body, body')--sql function is just a list of statements, the last one has the-trailing semicolon optional--> functionBody Sql = do-> a <- many (try $ sqlStatement True)-> -- this makes my head hurt, should probably write out-> -- more longhand-> SqlFnBody <$> 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-> <$> 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 <$> idString <*> typeName)-> ,ParamDefTp <$> typeName]--variable declarations in a plpgsql function--> varDef :: ParsecT [Token] ParseState Identity VarDef-> varDef = VarDef-> <$> idString-> <*> typeName-> <*> tryOptionMaybe ((symbol ":=" <|> symbol "=")*> expr) <* symbol ";"---> createView :: ParsecT [Token] ParseState Identity Statement-> createView = keyword "view" >>-> CreateView-> <$> idString-> <*> (keyword "as" *> selectExpression)--> createDomain :: ParsecT [Token] ParseState Identity Statement-> createDomain = keyword "domain" >>-> CreateDomain-> <$> idString-> <*> (tryOptionMaybe (keyword "as") *> typeName)-> <*> tryOptionMaybe (keyword "check" *> parens expr)--> dropSomething :: ParsecT [Token] ParseState Identity Statement-> dropSomething = do-> x <- try (choice [-> Domain <$ keyword "domain"-> ,Type <$ keyword "type"-> ,Table <$ keyword "table"-> ,View <$ keyword "view"-> ])-> (i,e,r) <- parseDrop idString-> return $ DropSomething x i e r--> dropFunction :: ParsecT [Token] ParseState Identity Statement-> dropFunction = do-> keyword "function"-> (i,e,r) <- parseDrop pFun-> return $ DropFunction i e r-> where-> pFun = (,) <$> idString-> <*> parens (many idString)--> 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"))--================================================================================--= 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 =-> choice [-> flip SelectList <$> readInto <*> itemList-> ,SelectList <$> itemList <*> option [] readInto]-> where-> readInto = keyword "into" *> commaSep1 idString-> itemList = commaSep1 selectItem-> selectItem = optionalSuffix-> SelExp expr-> SelectItem () (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 <$> (keyword "setof" *> typeName)-> ,do-> s <- map toLower <$> idString-> choice [-> PrecTypeName s <$> parens integer-> ,ArrayTypeName (SimpleTypeName s) <$ symbol "[" <* symbol "]"-> ,return $ SimpleTypeName s]]--> cascade :: ParsecT [Token] ParseState Identity Cascade-> cascade = option Restrict (choice [-> Restrict <$ keyword "restrict"-> ,Cascade <$ keyword "cascade"])--================================================================================--= plpgsql statements--> plPgsqlStatement :: ParsecT [Token] ParseState Identity (MySourcePos,Statement)-> plPgsqlStatement = do-> p <- getAdjustedPosition-> sqlStatement True-> <|> (,) p <$> (choice [-> continue-> ,execute-> ,caseStatement-> ,assignment-> ,ifStatement-> ,returnSt-> ,raise-> ,forStatement-> ,whileStatement-> ,perform-> ,nullStatement]-> <* symbol ";")--> nullStatement :: ParsecT [Token] ParseState Identity Statement-> nullStatement = NullStatement <$ keyword "null"--> continue :: ParsecT [Token] ParseState Identity Statement-> continue = ContinueStatement <$ keyword "continue"--> perform :: ParsecT [Token] ParseState Identity Statement-> perform = keyword "perform" >>-> Perform <$> expr--> execute :: ParsecT [Token] ParseState Identity Statement-> execute = keyword "execute" >>-> optionalSuffix-> Execute expr-> ExecuteInto () readInto-> where-> readInto = keyword "into" *> commaSep1 idString--> assignment :: ParsecT [Token] ParseState Identity Statement-> assignment = Assignment-> -- 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 = keyword "return" >>-> choice [-> ReturnNext <$> (keyword "next" *> expr)-> ,ReturnQuery <$> (keyword "query" *> selectExpression)-> ,Return <$> tryOptionMaybe expr]--> raise :: ParsecT [Token] ParseState Identity Statement-> raise = keyword "raise" >>-> Raise-> <$> raiseType-> <*> (extrStr <$> stringLit)-> <*> option [] (symbol "," *> commaSep1 expr)-> where-> raiseType = matchAKeyword [("notice", RNotice)-> ,("exception", RException)-> ,("error", RError)]--> forStatement :: ParsecT [Token] ParseState Identity Statement-> forStatement = do-> keyword "for"-> start <- idString-> keyword "in"-> choice [(ForSelectStatement start <$> try selectExpression <*> theRest)-> ,(ForIntegerStatement start-> <$> expr-> <*> (symbol ".." *> expr)-> <*> theRest)]-> where-> theRest = keyword "loop" *> many plPgsqlStatement-> <* keyword "end" <* keyword "loop"--> whileStatement :: ParsecT [Token] ParseState Identity Statement-> whileStatement = keyword "while" >>-> WhileStatement-> <$> (expr <* keyword "loop")-> <*> many plPgsqlStatement <* keyword "end" <* keyword "loop"--> ifStatement :: ParsecT [Token] ParseState Identity Statement-> ifStatement = keyword "if" >>-> 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 these in as well after all that-> -- can't do <,> unfortunately, so use <.> instead-> (<.>) a b = (,) <$> a <*> b--> caseStatement :: ParsecT [Token] ParseState Identity Statement-> caseStatement = keyword "case" >>-> CaseStatement <$> 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, 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, then finally vanilla parens--> ,scalarSubQuery-> ,try $ threadOptionalSuffix rowCtor inPredicateSuffix-> ,parens expr--we have two things which can start with a $,-do the position arg first, then we can unconditionally-try the dollar quoted string next--> ,positionalArg--string using quotes don't start like anything else and we've-already tried the other thing which starts with a $, so can-parse without a try--> ,stringLit--> ,floatLit-> ,integerLit--put the factors which start with keywords before the ones which start-with a function--> ,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-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 DefaultScope.hs should be used here.--> table :: [[Operator [Token] ParseState Identity Expression]]-> table = [--[binary "::" (BinOpCall Cast) AssocLeft]-> --missing [] for array element select-> [prefix "-" (FunCall "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"] (FunCall "!isNotNull")-> ,postfixks ["is", "null"] (FunCall "!isNull")]-> --other operators all added in this list according to the pg docs:-> ,[binary "<->" AssocNone-> ,binary "<=" AssocRight-> ,binary ">=" AssocRight-> ,binary "||" AssocLeft-> ,prefix "@" (FunCall "@")-> ]-> --in should be here, but is treated as a factor instead-> --between-> --overlaps-> ,[binaryk "like" "!like" AssocNone-> ,binarycust "!=" "<>" AssocNone]-> --(also ilike similar)-> ,[lt "<" AssocNone-> ,binary ">" AssocNone]-> ,[binary "=" AssocRight-> ,binary "<>" AssocNone]-> ,[prefixk "not" (FunCall "!not")]-> ,[binaryk "and" "!and" AssocLeft-> ,binaryk "or" "!or" AssocLeft]]-> where-> --use different parsers for symbols and keywords to get the-> --right whitespace behaviour-> binary s-> = Infix (try (symbol s >> return (binaryF s)))-> binarycust s t-> = Infix (try (symbol s >> return (binaryF t)))-> -- * ends up being lexed as an id token rather than a symbol-> -- * token, so work around here-> idHackBinary s-> = Infix (try (keyword s >> return (binaryF s)))-> prefix s f-> = Prefix (try (symbol s >> return (unaryF f)))-> binaryk s o-> = Infix (try (keyword s >> return (binaryF o)))-> prefixk s f-> = Prefix (try (keyword s >> return (unaryF f)))-> --postfixk s f-> -- = Postfix (try (keyword s >> return f))-> postfixks ss f-> = Postfix (try (mapM_ keyword ss >> return (unaryF f)))-> unaryF f l = f [l]-> binaryF s l m = FunCall s [l,m]--some custom parsers--fix problem parsing <> - don't parse as "<" if it is immediately-followed by ">"--don't know if this is needed anymore.--> lt _ = Infix (dontFollowWith "<" ">" >>-> return (\l -> (\m -> FunCall "<" [l,m])))--> dontFollowWith c1 c2 =-> try $ symbol c1 *> ((do-> lookAhead $ symbol c2-> fail "dont follow")-> <|> return ())--== factor parsers--> scalarSubQuery :: ParsecT [Token] ParseState Identity Expression-> scalarSubQuery = try (symbol "(" *> lookAhead (keyword "select")) >>-> ScalarSubQuery-> <$> 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 e-> <$> option True (False <$ keyword "not")-> <*> (keyword "in" *> parens ((InSelect <$> selectExpression)-> <|>-> (InList <$> 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 "!rowCtor" <$> choice [-> keyword "row" *> parens (commaSep expr)-> ,parens $ commaSep2 expr]--> floatLit :: ParsecT [Token] ParseState Identity Expression-> floatLit = FloatLit <$> float--> integerLit :: ParsecT [Token] ParseState Identity Expression-> integerLit = IntegerLit <$> integer--case - only supports 'case when condition' flavour and not 'case-expression when value' currently--> caseParse :: ParsecT [Token] ParseState Identity Expression-> caseParse = keyword "case" >>-> choice [-> try $ CaseSimple <$> expr-> <*> many whenParse-> <*> tryOptionMaybe (keyword "else" *> expr)-> <* keyword "end"-> ,Case <$> many whenParse-> <*> tryOptionMaybe (keyword "else" *> expr)-> <* keyword "end"]-> where-> whenParse = (,) <$> (keyword "when" *> commaSep1 expr)-> <*> (keyword "then" *> expr)--> exists :: ParsecT [Token] ParseState Identity Expression-> exists = keyword "exists" >>-> Exists <$> parens selectExpression--> booleanLit :: ParsecT [Token] ParseState Identity Expression-> booleanLit = BooleanLit <$> (True <$ keyword "true"-> <|> False <$ keyword "false")--> nullLit :: ParsecT [Token] ParseState Identity Expression-> nullLit = NullLit <$ keyword "null"--> arrayLit :: ParsecT [Token] ParseState Identity Expression-> arrayLit = keyword "array" >>-> FunCall "!arrayCtor" <$> squares (commaSep expr)--> arraySubSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> arraySubSuffix e = if e == Identifier "array"-> then fail "can't use array as identifier name"-> else FunCall "!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 e-> <$> (keyword "over" *> (symbol "(" *> option [] partitionBy))-> <*> option [] orderBy1-> <*> option Asc (try $ choice [-> Asc <$ keyword "asc"-> ,Desc <$ keyword "desc"])-> <* symbol ")"-> where-> orderBy1 = keyword "order" *> keyword "by" *> commaSep1 expr-> partitionBy = keyword "partition" *> keyword "by" *> commaSep1 expr--> betweenSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> betweenSuffix a = do-> keyword "between"-> b <- dodgyParseElement-> keyword "and"-> c <- dodgyParseElement-> return $ FunCall "!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.--Thanks to Sam Mason for the heads up on this.--TODO: copy this approach here.--> where-> dodgyParseElement = factor--> functionCallSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> functionCallSuffix (Identifier fnName) = FunCall fnName <$> parens (commaSep expr)-> functionCallSuffix s = error $ "internal error: cannot make functioncall from " ++ show s--> castKeyword :: ParsecT [Token] ParseState Identity Expression-> castKeyword = keyword "cast" *> symbol "(" >>-> Cast <$> expr-> <*> (keyword "as" *> typeName <* symbol ")")--> castSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression-> castSuffix ex = Cast ex <$> (symbol "::" *> typeName)--> substring :: ParsecT [Token] ParseState Identity Expression-> substring = do-> keyword "substring"-> symbol "("-> a <- expr-> keyword "from"-> b <- expr-> keyword "for"-> c <- expr-> symbol ")"-> return $ FunCall "!substring" [a,b,c]--> identifier :: ParsecT [Token] ParseState Identity Expression-> identifier = Identifier <$> idString--================================================================================--= 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 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)--> 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)--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 ",")--doesn't seem too gratuitous, comes up a few times--> (<:>) :: (Applicative f) =>-> f a -> f [a] -> f [a]-> (<:>) a b = (:) <$> a <*> b--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]--== 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 (pos,_) = pos-> testToken (_,tok) = test tok
− Database/HsSqlPpp/ParserTests.lhs
@@ -1,1121 +0,0 @@-#!/usr/bin/env runghc--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.--Also had some quickcheck stuff, but it got disabled since it failed-depressingly often and the code has now gone very stale. The idea with-this was to generate random asts, pretty print then parse them, and-check the new ast was the same as the original. Probably worth having-another go at this some time soon.--There are no tests for invalid sql at the moment.--> module Database.HsSqlPpp.ParserTests (parserTests) where--> import Test.HUnit-> import Test.Framework-> import Test.Framework.Providers.HUnit-> import Data.Char--> import Database.HsSqlPpp.Ast-> import Database.HsSqlPpp.Parser-> import Database.HsSqlPpp.PrettyPrinter-> import Database.HsSqlPpp.ParseErrors--> parserTests :: Test.Framework.Test-> parserTests =-> testGroup "parserTests" [--================================================================================--uses a whole bunch of shortcuts (at the bottom of main) to make this-code more concise. Could probably use a few more.--> testGroup "parse expression"-> (mapExpr [--start with some really basic expressions, we just use the expression-parser rather than the full sql statement parser. (the expression parser-requires a single expression followed by eof.)--> 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])--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])--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--array selector--> ,p "array[1,2]" (FunCall "!arrayCtor" [IntegerLit 1, IntegerLit 2])--array subscripting--> ,p "a[1]" (FunCall "!arraySub" [Identifier "a", IntegerLit 1])--we just produce a ast, so no type checking or anything like that is-done--some operator tests--> ,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 "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"])--some function call tests--> ,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"])--simple whitespace sanity checks--> ,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])--null stuff--> ,p "not null" (FunCall "!not" [NullLit])-> ,p "a is null" (FunCall "!isNull" [Identifier "a"])-> ,p "a is not null" (FunCall "!isNotNull" [Identifier "a"])--some slightly more complex stuff--> ,p "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))---positional args used in sql and sometimes plpgsql functions--> ,p "$1" (PositionalArg 1)--> ,p "exists (select 1 from a)"-> (Exists (selectFrom [SelExp (IntegerLit 1)] (Tref "a")))-- > (Exists (makeSelect {- > selSelectList = sle [(IntegerLit 1)]- > ,selTref = Just $ Tref "a"}))---selectFrom [SelExp (IntegerLit 1)] (Tref "a")))--in variants, including using row constructors--> ,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 "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.--> ,testGroup "string parsing"-> (mapExpr [-> 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")-> ])--================================================================================--first statement, pretty simple--> ,testGroup "select expression"-> (mapSql [-> p "select 1;" [SelectStatement $ selectE (SelectList [SelExp (IntegerLit 1)] [])]-> ])--================================================================================--test a whole bunch more select statements--> ,testGroup "select from table"-> (mapSql [-> p "select * from tbl;"-> [SelectStatement $ selectFrom (selIL ["*"]) (Tref "tbl")]-> ,p "select a,b from tbl;"-> [SelectStatement $ selectFrom (selIL ["a", "b"]) (Tref "tbl")]--> ,p "select a,b from inf.tbl;"-> [SelectStatement $ selectFrom (selIL ["a", "b"]) (Tref "inf.tbl")]--> ,p "select distinct * from tbl;"-> [SelectStatement $ Select Distinct (SelectList (selIL ["*"]) []) (Just $ Tref "tbl")-> Nothing [] Nothing [] Asc Nothing Nothing]--> ,p "select a from tbl where b=2;"-> [SelectStatement $ selectFromWhere-> (selIL ["a"])-> (Tref "tbl")-> (FunCall "="-> [Identifier "b", IntegerLit 2])]-> ,p "select a from tbl where b=2 and c=3;"-> [SelectStatement $ selectFromWhere-> (selIL ["a"])-> (Tref "tbl")-> (FunCall "!and"-> [FunCall "=" [Identifier "b", IntegerLit 2]-> ,FunCall "=" [Identifier "c", IntegerLit 3]])]--> ,p "select a from tbl\n\-> \except\n\-> \select a from tbl1;"-> [SelectStatement $ CombineSelect Except-> (selectFrom (selIL ["a"]) (Tref "tbl"))-> (selectFrom (selIL ["a"]) (Tref "tbl1"))]-> ,p "select a from tbl where true\n\-> \except\n\-> \select a from tbl1 where true;"-> [SelectStatement $ CombineSelect Except-> (selectFromWhere (selIL ["a"]) (Tref "tbl") (BooleanLit True))-> (selectFromWhere (selIL ["a"]) (Tref "tbl1") (BooleanLit True))]-> ,p "select a from tbl\n\-> \union\n\-> \select a from tbl1;"-> [SelectStatement $ CombineSelect Union-> (selectFrom (selIL ["a"]) (Tref "tbl"))-> (selectFrom (selIL ["a"]) (Tref "tbl1"))]-> ,p "select a from tbl\n\-> \union all\n\-> \select a from tbl1;"-> [SelectStatement $ CombineSelect UnionAll-> (selectFrom (selIL ["a"]) (Tref "tbl"))-> (selectFrom (selIL ["a"]) (Tref "tbl1"))]--> ,p "select a as b from tbl;"-> [SelectStatement $ selectFrom [SelectItem (Identifier "a") "b"] (Tref "tbl")]-> ,p "select a + b as b from tbl;"-> [SelectStatement $ selectFrom-> [SelectItem-> (FunCall "+"-> [Identifier "a", Identifier "b"]) "b"]-> (Tref "tbl")]-> ,p "select a.* from tbl a;"-> [SelectStatement $ selectFrom (selIL ["a.*"]) (TrefAlias "tbl" "a")]--> ,p "select a from b inner join c on b.a=c.a;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural Inner (Tref "c")-> (Just (JoinOn-> (FunCall "=" [Identifier "b.a", Identifier "c.a"]))))]-> ,p "select a from b inner join c as d on b.a=d.a;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural Inner (TrefAlias "c" "d")-> (Just (JoinOn-> (FunCall "=" [Identifier "b.a", Identifier "d.a"]))))]--> ,p "select a from b inner join c using(d,e);"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural Inner (Tref "c")-> (Just (JoinUsing ["d","e"])))]--> ,p "select a from b natural inner join c;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Natural Inner (Tref "c") Nothing)]-> ,p "select a from b left outer join c;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural LeftOuter (Tref "c") Nothing)]-> ,p "select a from b full outer join c;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural FullOuter (Tref "c") Nothing)]-> ,p "select a from b right outer join c;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural RightOuter (Tref "c") Nothing)]-> ,p "select a from b cross join c;"-> [SelectStatement $ selectFrom-> (selIL ["a"])-> (JoinedTref (Tref "b") Unnatural Cross (Tref "c") Nothing)]--> ,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") Unnatural Inner (Tref "c")-> (Just $ JoinOn (BooleanLit True)))-> Unnatural Inner (Tref "d")-> (Just $ JoinOn (FunCall "="-> [IntegerLit 1, IntegerLit 1])))]--> ,p "select row_number() over(order by a) as place from tbl;"-> [SelectStatement $ selectFrom [SelectItem-> (WindowFn-> (FunCall "row_number" [])-> []-> [Identifier "a"] Asc)-> "place"]-> (Tref "tbl")]-> ,p "select row_number() over(order by a asc) as place from tbl;"-> [SelectStatement $ selectFrom [SelectItem-> (WindowFn-> (FunCall "row_number" [])-> []-> [Identifier "a"] Asc)-> "place"]-> (Tref "tbl")]-> ,p "select row_number() over(order by a desc) as place from tbl;"-> [SelectStatement $ selectFrom [SelectItem-> (WindowFn-> (FunCall "row_number" [])-> []-> [Identifier "a"] Desc)-> "place"]-> (Tref "tbl")]-> ,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)-> "place"]-> (Tref "tbl")]--> ,p "select * from a natural inner join (select * from b) as a;"-> [SelectStatement $ selectFrom-> (selIL ["*"])-> (JoinedTref (Tref "a") Natural-> Inner (SubTref (selectFrom-> (selIL ["*"])-> (Tref "b")) "a")-> Nothing)]--> ,p "select * from a order by c;"-> [SelectStatement $ Select Dupes-> (sl (selIL ["*"]))-> (Just $ Tref "a")-> Nothing [] Nothing [Identifier "c"] Asc Nothing Nothing]--> ,p "select * from a order by c,d asc;"-> [SelectStatement $ Select Dupes-> (sl (selIL ["*"]))-> (Just $ Tref "a")-> Nothing [] Nothing [Identifier "c", Identifier "d"] Asc Nothing Nothing]--> ,p "select * from a order by c,d desc;"-> [SelectStatement $ Select Dupes-> (sl (selIL ["*"]))-> (Just $ Tref "a")-> Nothing [] Nothing [Identifier "c", Identifier "d"] Desc Nothing Nothing]--> ,p "select * from a order by c limit 1;"-> [SelectStatement $ Select Dupes-> (sl (selIL ["*"]))-> (Just $ Tref "a")-> Nothing [] Nothing [Identifier "c"] Asc (Just (IntegerLit 1)) Nothing]--> ,p "select * from a order by c offset 3;"-> [SelectStatement $ Select Dupes-> (sl (selIL ["*"]))-> (Just $ Tref "a")-> 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"))-> "d")]--> ,p "select * from gen();"-> [SelectStatement $ selectFrom (selIL ["*"]) (TrefFun $ FunCall "gen" [])]-> ,p "select * from gen() as t;"-> [SelectStatement $ selectFrom-> (selIL ["*"])-> (TrefFunAlias (FunCall "gen" []) "t")]--> ,p "select a, count(b) from c group by a;"-> [SelectStatement $ Select Dupes-> (sl [selI "a", SelExp (FunCall "count" [Identifier "b"])])-> (Just $ Tref "c") Nothing [Identifier "a"]-> Nothing [] Asc 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"])-> (Just $ Tref "c") Nothing [Identifier "a"]-> (Just $ FunCall ">" [Identifier "cnt", IntegerLit 4])-> [] Asc 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"] [])-> "x")]-> ])--================================================================================--one sanity check for parsing multiple statements--> ,testGroup "multiple statements"-> (mapSql [-> p "select 1;\nselect 2;" [SelectStatement $ selectE $ sl [SelExp (IntegerLit 1)]-> ,SelectStatement $ selectE $ sl [SelExp (IntegerLit 2)]]-> ])--================================================================================--test comment behaviour--> ,testGroup "comments"-> (mapSql [-> p "" []-> ,p "-- this is a test" []-> ,p "/* this is\n\-> \a test*/" []--maybe some people actually put block comments inside parts of-statements when they program?--> ,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--> ,testGroup "dml"-> (mapSql [--simple insert--> 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"))-> 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"])]--updates--> ,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]--delete--> ,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"])]--> ,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--> ,p "copy tbl(a,b) from stdin;\n\-> \bat t\n\-> \bear f\n\-> \\\.\n"-> [Copy "tbl" ["a", "b"] Stdin-> ,CopyData "\-> \bat t\n\-> \bear f\n"]-> ])--================================================================================--some ddl--> ,testGroup "create"-> (mapSql [--create table tests--> 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)] []))]--other creates--> ,p "create view v1 as\n\-> \select a,b from t;"-> [CreateView-> "v1"-> (selectFrom [selI "a", selI "b"] (Tref "t"))]-> ,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")]]--drops--> ,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]--> ])--constraints--> ,testGroup "constraints"-> (mapSql [--nulls--> 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]]-> []]--unique table--> ,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]][]]--primary key row, table--> ,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"]]]--check row, table--> ,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"])]]--row, whole load of constraints, todo: add reference here--> ,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"]))]] []]--reference row, table--> ,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 delete cascade on update cascade\n\-> \);"-> [CreateTable "t1" [att "x" "int"-> ,att "y" "int"]-> [ReferenceConstraint ["x", "y"] "t2" []-> Cascade Cascade]]--> ])--================================================================================--test functions--> ,testGroup "functions"-> (mapSql [-> p "create function t1(text) returns text as $$\n\-> \select a from t1 where b = $1;\n\-> \$$ language sql stable;"-> [CreateFunction Sql "t1" [ParamDefTp $ SimpleTypeName "text"]-> (SimpleTypeName "text") "$$"-> (SqlFnBody-> [addNsp $ SelectStatement $ selectFromWhere [SelExp (Identifier "a")] (Tref "t1")-> (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 Plpgsql "fn" [] (SimpleTypeName "void") "$$"-> (PlpgsqlFnBody [VarDef "a" (SimpleTypeName "int") Nothing-> ,VarDef "b" (SimpleTypeName "text") Nothing]-> [addNsp 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 Plpgsql "fn" [] (SimpleTypeName "void") "$$"-> (PlpgsqlFnBody [VarDef "a" (SimpleTypeName "int") Nothing-> ,VarDef "b" (SimpleTypeName "text") Nothing]-> [addNsp 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 Plpgsql "fn"-> [ParamDef "a" $ ArrayTypeName $ SimpleTypeName "text"]-> (ArrayTypeName $ SimpleTypeName "int") "$$"-> (PlpgsqlFnBody-> [VarDef "b" (ArrayTypeName $ SimpleTypeName "xtype") (Just $ stringQ "{}")]-> [addNsp 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 Plpgsql "fn" [] (SimpleTypeName "void") "'"-> (PlpgsqlFnBody [VarDef "a" (SimpleTypeName "int") (Just $ IntegerLit 3)]-> [addNsp NullStatement])-> Stable]-> ,p "create function fn() returns setof int as $$\n\-> \begin\n\-> \ null;\n\-> \end;\n\-> \$$ language plpgsql stable;"-> [CreateFunction Plpgsql "fn" []-> (SetOfTypeName $ SimpleTypeName "int") "$$"-> (PlpgsqlFnBody [] [addNsp NullStatement])-> Stable]-> ,p "create function fn() returns void as $$\n\-> \begin\n\-> \ null;\n\-> \end\n\-> \$$ language plpgsql stable;"-> [CreateFunction Plpgsql "fn" []-> (SimpleTypeName "void") "$$"-> (PlpgsqlFnBody [] [addNsp NullStatement])-> Stable]-> ,p "drop function test(text);"-> [DropFunction Require [("test",["text"])] Restrict]-> ,p "drop function if exists a(),test(text) cascade;"-> [DropFunction IfExists [("a",[])-> ,("test",["text"])] Cascade]-> ])--================================================================================--test non sql plpgsql statements--> ,testGroup "plpgsqlStatements"-> (mapPlpgsql [--simple statements--> 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")]-> ,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"])-> (Just $ Tref "e") Nothing [] Nothing [] Asc Nothing Nothing]-> ,p "select c,d into a,b from e;"-> [SelectStatement $ Select Dupes (SelectList [selI "c", selI "d"] ["a", "b"])-> (Just $ Tref "e") Nothing [] Nothing [] Asc Nothing Nothing]--> ,p "execute s;"-> [Execute (Identifier "s")]-> ,p "execute s into r;"-> [ExecuteInto (Identifier "s") ["r"]]--> ,p "continue;" [ContinueStatement]--complicated statements--> ,p "for r in select a from tbl loop\n\-> \null;\n\-> \end loop;"-> [ForSelectStatement "r" (selectFrom [selI "a"] (Tref "tbl"))-> [addNsp NullStatement]]-> ,p "for r in select a from tbl where true loop\n\-> \null;\n\-> \end loop;"-> [ForSelectStatement "r"-> (selectFromWhere [selI "a"] (Tref "tbl") (BooleanLit True))-> [addNsp NullStatement]]-> ,p "for r in 1 .. 10 loop\n\-> \null;\n\-> \end loop;"-> [ForIntegerStatement "r"-> (IntegerLit 1) (IntegerLit 10)-> [addNsp NullStatement]]--> ,p "if a=b then\n\-> \ update c set d = e;\n\-> \end if;"-> [If [((FunCall "=" [Identifier "a", Identifier "b"])-> ,[addNsp $ Update "c" [SetClause "d" (Identifier "e")] Nothing Nothing])]-> []]-> ,p "if true then\n\-> \ null;\n\-> \else\n\-> \ null;\n\-> \end if;"-> [If [((BooleanLit True),[addNsp NullStatement])]-> [addNsp NullStatement]]-> ,p "if true then\n\-> \ null;\n\-> \elseif false then\n\-> \ return;\n\-> \end if;"-> [If [((BooleanLit True), [addNsp NullStatement])-> ,((BooleanLit False), [addNsp $ 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), [addNsp NullStatement])-> ,((BooleanLit False), [addNsp $ Return Nothing])-> ,((BooleanLit False), [addNsp $ Return Nothing])]-> [addNsp $ 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"], [addNsp NullStatement])-> ,([Identifier "c", Identifier "d"], [addNsp NullStatement])]-> [addNsp NullStatement]]-> ])-> --,testProperty "random expression" prop_expression_ppp-> -- ,testProperty "random statements" prop_statements_ppp-> ]-> where-> mapExpr = map $ uncurry checkParseExpression-> mapSql = map $ uncurry checkParse-> mapPlpgsql = map $ uncurry checkParsePlpgsql-> p a b = (a,b)-> selIL = map selI-> selI = SelExp . Identifier-> sl a = SelectList a []-> selectE selList = Select Dupes selList-> Nothing Nothing [] Nothing [] Asc Nothing Nothing-> selectFrom selList frm =-> Select Dupes (SelectList selList [])-> (Just frm) Nothing [] Nothing [] Asc Nothing Nothing-> selectFromWhere selList frm whr =-> Select Dupes (SelectList selList [])-> (Just frm) (Just whr) [] Nothing [] Asc Nothing Nothing-> stringQ = StringLit "'"-> addNsp s = (nsp,s)-> att n t = AttributeDef n (SimpleTypeName t) Nothing []--================================================================================--Unit test helpers--parse and then pretty print and parse a statement--> checkParse :: String -> [Statement] -> Test.Framework.Test-> checkParse src ast = parseUtil1 src ast parseSql--parse and then pretty print and parse an expression--> checkParseExpression :: String -> Expression -> Test.Framework.Test-> checkParseExpression src ast = parseUtil src ast-> parseExpression printExpression--> checkParsePlpgsql :: String -> [Statement] -> Test.Framework.Test-> checkParsePlpgsql src ast = parseUtil1 src ast parsePlpgsql--> parseUtil :: (Show t, Eq b, Show b) =>-> String-> -> b-> -> (String -> Either t b)-> -> (b -> String)-> -> Test.Framework.Test-> parseUtil src ast parser printer = testCase ("parse " ++ src) $ do-> let ast' = case parser src of-> Left er -> error $ show er-> Right l -> l-> assertEqual ("parse " ++ src) ast ast'-> -- pretty print then parse to check-> let pp = printer ast-> let ast'' = case parser pp of-> Left er -> error $ "reparse\n" ++ show er ++ "\n" -- ++ pp ++ "\n"-> Right l -> l-> assertEqual ("reparse " ++ pp) ast ast''--> parseUtil1 :: String-> -> [Statement]-> -> (String -> Either ExtendedError StatementList)-> -> Test.Framework.Test-> parseUtil1 src ast parser = testCase ("parse " ++ src) $ do-> let ast' = case parser src of-> Left er -> error $ show er-> Right l -> l-> assertEqual ("parse " ++ src) ast $ resetSps (map snd ast')-> -- pretty print then parse to check-> let pp = printSql ast'-> let ast'' = case parser pp of-> Left er -> error $ "reparse\n" ++ show er ++ "\n" -- ++ pp ++ "\n"-> Right l -> l-> assertEqual ("reparse " ++ pp) ast $ resetSps (map snd ast'')-
+ Database/HsSqlPpp/Parsing/Lexer.lhs view
@@ -0,0 +1,292 @@+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+> ) where++> import Text.Parsec hiding(many, optional, (<|>))+> import qualified Text.Parsec.Token as P+> import Text.Parsec.Language+> import Text.Parsec.String++> import Control.Applicative+> import Control.Monad.Identity++> import Data.Char++> import Database.HsSqlPpp.Parsing.ParseErrors++================================================================================++= 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 ParseState = [Tok]++> lexSqlFile :: FilePath -> IO (Either ExtendedError [Token])+> lexSqlFile f = do+> te <- readFile f+> let x = runParser sqlTokens [] f te --parseFromFile sqlTokens f+> return $ convertToExtendedError x f te++> lexSqlText :: String -> Either ExtendedError [Token]+> lexSqlText s = convertToExtendedError (runParser sqlTokens [] "" s) "" s++================================================================================++= lexers++lexer for tokens, contains a hack for copy from stdin with inline+table data.++> sqlTokens :: ParsecT String ParseState 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 ParseState 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 ParseState 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 ParseState Identity Tok+> idString = IdStringTok <$> identifierString++> positionalArg :: ParsecT String ParseState 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++> sqlSymbol :: ParsecT String ParseState Identity Tok+> sqlSymbol =+> SymbolTok <$> lexeme (choice [+> replicate 1 <$> oneOf "()[],;"+> ,string ".."+> ,try $ string "::"+> ,try $ string ":="+> ,string ":"+> ,many1 (oneOf "+-*/<>=~!@#%^&|`?")+> ])++> sqlFloat :: ParsecT String ParseState Identity Tok+> sqlFloat = FloatTok <$> float++> sqlInteger :: ParsecT String ParseState 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 ParseState 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 = (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 ParseState 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)++doesn't seem too gratuitous, comes up a few times++> (<:>) :: (Applicative f) =>+> f a -> f [a] -> f [a]+> (<:>) a b = (:) <$> a <*> b++> 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 ParseState Identity String+> symbol = P.symbol lexer++> integer :: ParsecT String ParseState Identity Integer+> integer = lexeme $ P.integer lexer++> float :: ParsecT String ParseState Identity Double+> float = lexeme $ P.float lexer++> whiteSpace :: ParsecT String ParseState Identity ()+> whiteSpace= P.whiteSpace lexer++> lexeme :: ParsecT String ParseState Identity a+> -> ParsecT String ParseState 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 ParseState 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 view
@@ -0,0 +1,51 @@+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 (convertToExtendedError, ExtendedError(..)) where++> import Text.Parsec++> showEr :: ParseError -> String -> String -> String+> showEr er fn src =+> let pos = errorPos er+> lineNo = sourceLine pos+> ls = lines src+> line = safeGet ls(lineNo - 1)+> prelines = map (safeGet ls) [(lineNo - 5) .. (lineNo - 2)]+> postlines = map (safeGet ls) [lineNo .. (lineNo + 5)]+> colNo = sourceColumn pos+> highlightLine = replicate (colNo - 1) ' ' ++ "^"+> errorHighlightText = prelines+> ++ [line, highlightLine, "ERROR HERE"]+> ++ postlines+> in "\n---------------------\n" ++ show er+> ++ "\nFILENAMESTUFF:\n" ++ fn ++ ":" ++ show lineNo ++ ":" ++ show colNo+> ++ "\n------------\nCheck it out:\n"+> ++ unlines (trimLines errorHighlightText)+> ++ "\n-----------------\n"+> where+> safeGet a i = if i < 0 || i >= length a+> then ""+> else a !! i+> trimLines = trimStartLines . reverse . trimStartLines . reverse+> trimStartLines = dropWhile (=="")++give access to the nicer error text via Show++> data ExtendedError = ExtendedError ParseError String++> instance Show ExtendedError where+> show (ExtendedError _ x) = x++> convertToExtendedError :: Either ParseError b+> -> String+> -> String+> -> Either ExtendedError b+> convertToExtendedError f fn src =+> case f of+> Left er -> Left $ ExtendedError er (showEr er fn src)+> Right l -> Right l
+ Database/HsSqlPpp/Parsing/Parser.lhs view
@@ -0,0 +1,1290 @@+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.++> {- | Functions to parse sql.+> -}+> module Database.HsSqlPpp.Parsing.Parser (+> -- * Main+> parseSql+> ,parseSqlFile+> -- * Testing+> ,parseExpression+> ,parsePlpgsql+> )+> where++> import Text.Parsec hiding(many, optional, (<|>), string)+> import Text.Parsec.Expr+> import Text.Parsec.String++> import Control.Applicative+> import Control.Monad.Identity++> import Data.Maybe+> import Data.Char++> import Database.HsSqlPpp.Parsing.Lexer+> import Database.HsSqlPpp.Parsing.ParseErrors+> import Database.HsSqlPpp.TypeChecking.Ast+> import Database.HsSqlPpp.TypeChecking.TypeChecker as A++++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 -- ^ a string containing the sql to parse+> -> Either ExtendedError StatementList+> parseSql s = statementsOnly $ parseIt (lexSqlText s) sqlStatements "" s startState++> parseSqlFile :: FilePath -- ^ file name of file containing sql+> -> IO (Either ExtendedError StatementList)+> parseSqlFile fn = do+> sc <- readFile fn+> x <- lexSqlFile fn+> return $ statementsOnly $ parseIt x sqlStatements fn sc startState++> -- | Parse expression fragment, used for testing purposes+> parseExpression :: String -- ^ sql string containing a single expression, with no+> -- trailing ';'+> -> Either ExtendedError Expression+> parseExpression s = parseIt (lexSqlText s) (expr <* eof) "" 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+> -> Either ExtendedError StatementList+> parsePlpgsql s = parseIt (lexSqlText s) (many plPgsqlStatement <* eof) "" s startState++utility function to do error handling in one place++> parseIt lexed parser fn src ss =+> case lexed of+> Left er -> Left er+> Right toks -> convertToExtendedError+> (runParser parser ss fn toks) fn src++> statementsOnly :: Either ExtendedError StatementList+> -> Either ExtendedError StatementList+> statementsOnly s = case s of+> Left er -> Left er+> Right st -> Right st++================================================================================++= 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+> ,keyword "create" *>+> choice [+> createTable+> ,createType+> ,createFunction+> ,createView+> ,createDomain]+> ,keyword "drop" *>+> choice [+> dropSomething+> ,dropFunction]+> ]+> <* (if reqSemi+> then symbol ";" >> return ()+> else optional (symbol ";") >> return ()))+> <|> copyData++> getAdjustedPosition :: ParsecT [Token] ParseState Identity MySourcePos+> getAdjustedPosition = do+> p <- toMySp <$> getPosition+> s <- getState+> case s of+> [] -> return p+> x:_ -> return $ adjustPosition x p++> 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+++> adjustPosition :: MySourcePos -> MySourcePos -> MySourcePos+> adjustPosition (fn,pl,_) (_,l,c) = (fn,pl+l-1,c)++================================================================================++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++> selectStatement :: ParsecT [Token] ParseState Identity Statement+> selectStatement = SelectStatement <$> pos <*> selectExpression++> selectExpression :: ParsecT [Token] ParseState Identity SelectExpression+> selectExpression =+> choice [selectE, values]+> where+> selectE = do+> keyword "select"+> s1 <- selQuerySpec+> choice [+> --don't know if this does associativity in the correct order for+> --statements with multiple excepts/ intersects and no parens+> CombineSelect [] Except s1 <$> (keyword "except" *> selectExpression)+> ,CombineSelect [] Intersect s1 <$> (keyword "intersect" *> selectExpression)+> ,CombineSelect [] UnionAll s1 <$> (try (keyword "union"+> *> keyword "all") *> selectExpression)+> ,CombineSelect [] Union s1 <$> (keyword "union" *> selectExpression)+> ,return s1]+> where+> selQuerySpec = Select []+> <$> option Dupes (Distinct <$ keyword "distinct")+> <*> selectList+> <*> tryOptionMaybe from+> <*> tryOptionMaybe whereClause+> <*> option [] groupBy+> <*> tryOptionMaybe having+> <*> option [] orderBy+> <*> option Asc (choice [+> Asc <$ keyword "asc"+> ,Desc <$ keyword "desc"])+> <*> tryOptionMaybe limit+> <*> tryOptionMaybe offset+> from = keyword "from" *> tref+> groupBy = keyword "group" *> keyword "by"+> *> commaSep1 expr+> having = keyword "having" *> expr+> orderBy = keyword "order" *> keyword "by"+> *> commaSep1 expr+> 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 = threadOptionalSuffix getFirstTref joinPart+> getFirstTref = choice [+> SubTref []+> <$> parens selectExpression+> <*> (optional (keyword "as") *> nkwid)+> ,optionalSuffix+> (TrefFun []) (try $ identifier >>= functionCallSuffix)+> (TrefFunAlias []) () (optional (keyword "as") *> nkwid)+> ,optionalSuffix+> (Tref []) nkwid+> (TrefAlias []) () (optional (keyword "as") *> nkwid)]+> --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 = JoinedTref [] tr1+> --look for the join flavour first+> <$> option Unnatural (Natural <$ keyword "natural")+> <*> choice [+> Inner <$ keyword "inner"+> ,LeftOuter <$ try (keyword "left" *> keyword "outer")+> ,RightOuter <$ try (keyword "right" *> keyword "outer")+> ,FullOuter <$ try (keyword "full" >> keyword "outer")+> ,Cross <$ keyword "cross"]+> --recurse back to tref to read the table+> <*> (keyword "join" *> tref)+> --now try and read the join condition+> <*> choice [+> Just <$> (JoinOn <$> (keyword "on" *> expr))+> ,Just <$> (JoinUsing <$> (keyword "using" *> columnNameList))+> ,return Nothing]+> 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+> --[]+> if map toLower x `elem` ["as"+> ,"where"+> ,"except"+> ,"union"+> ,"intersect"+> ,"loop"+> ,"inner"+> ,"on"+> ,"left"+> ,"right"+> ,"full"+> ,"cross"+> ,"natural"+> ,"order"+> ,"group"+> ,"limit"+> ,"using"+> ,"from"]+> then fail "not keyword"+> else return x+> values = keyword "values" >>+> Values [] <$> commaSep1 (parens $ commaSep1 expr)+++= 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 = keyword "insert" >> keyword "into" >>+> Insert+> <$> pos+> <*> idString+> <*> option [] (try columnNameList)+> <*> selectExpression+> <*> tryOptionMaybe returning++> update :: ParsecT [Token] ParseState Identity Statement+> update = keyword "update" >>+> Update+> <$> pos+> <*> idString+> <*> (keyword "set" *> commaSep1 setClause)+> <*> tryOptionMaybe whereClause+> <*> tryOptionMaybe returning+> where+> setClause = choice+> [RowSetClause <$> parens (commaSep1 idString)+> <*> (symbol "=" *> parens (commaSep1 expr))+> ,SetClause <$> idString+> <*> (symbol "=" *> expr)]++> delete :: ParsecT [Token] ParseState Identity Statement+> delete = keyword "delete" >> keyword "from" >>+> Delete+> <$> pos+> <*> idString+> <*> tryOptionMaybe whereClause+> <*> tryOptionMaybe returning++> truncateSt :: ParsecT [Token] ParseState Identity Statement+> truncateSt = keyword "truncate" >> optional (keyword "table") >>+> Truncate+> <$> pos+> <*> 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)++= 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 tableConstr)+> tableAtt+> (symbol ","))+> where swap (a,b) = (b,a)+> tableAtt = AttributeDef+> <$> idString+> <*> typeName+> <*> tryOptionMaybe (keyword "default" *> expr)+> <*> many rowConstraint+> tableConstr = choice [+> UniqueConstraint+> <$> try (keyword "unique" *> columnNameList)+> ,PrimaryKeyConstraint+> <$> try (keyword "primary" *> keyword "key"+> *> choice [+> (:[]) <$> idString+> ,parens (commaSep1 idString)])+> ,CheckConstraint+> <$> try (keyword "check" *> parens expr)+> ,ReferenceConstraint+> <$> try (keyword "foreign" *> keyword "key"+> *> parens (commaSep1 idString))+> <*> (keyword "references" *> idString)+> <*> option [] (parens $ commaSep1 idString)+> <*> onDelete+> <*> onUpdate]+> rowConstraint =+> choice [+> RowUniqueConstraint <$ keyword "unique"+> ,RowPrimaryKeyConstraint <$ keyword "primary" <* keyword "key"+> ,RowCheckConstraint <$> (keyword "check" *> parens expr)+> ,NullConstraint <$ keyword "null"+> ,NotNullConstraint <$ (keyword "not" *> keyword "null")+> ,RowReferenceConstraint+> <$> (keyword "references" *> idString)+> <*> option Nothing (try $ parens $ Just <$> idString)+> <*> onDelete+> <*> onUpdate+> ]+> onDelete = onSomething "delete"+> onUpdate = onSomething "update"+> onSomething k = option Restrict $ try $ keyword "on"+> *> keyword k *> cascade+++> createType :: ParsecT [Token] ParseState Identity Statement+> createType = keyword "type" >>+> CreateType+> <$> pos+> <*> idString+> <*> (keyword "as" *> parens (commaSep1 typeAtt))+> where+> typeAtt = TypeAttDef <$> idString <*> typeName+++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+> keyword "as"+> bodypos <- getAdjustedPosition+> body <- stringLit+> lang <- readLang+> let (q, b) = parseBody lang body fnName bodypos+> CreateFunction p lang fnName params retType q b <$> pVol+> where+> pVol = matchAKeyword [("volatile", Volatile)+> ,("stable", Stable)+> ,("immutable", Immutable)]+> readLang = keyword "language" *> matchAKeyword [("plpgsql", Plpgsql)+> ,("sql",Sql)]+> parseBody lang body fnName bodypos =+> case (parseIt+> (lexSqlText (extrStr body))+> (functionBody lang)+> ("function " ++ fnName)+> (extrStr body)+> [bodypos]) of+> Left er@(ExtendedError e _) ->+> -- don't know how to change the+> --position of the error we've been+> --given, so add some information to+> --show the position of the containing+> --function and the adjusted absolute+> --position of this error+> let ep = toMySp $ errorPos e+> (fn,fp,fc) = bodypos+> fnBit = "in function " ++ fnName ++ "\n"+> ++ fn ++ ":" ++ show fp ++ ":" ++ show fc ++ ":\n"+> (_,lp,lc) = adjustPosition bodypos ep+> lineBit = "on line\n"+> ++ fn ++ ":" ++ show lp ++ ":" ++ show lc ++ ":\n"+> in error $ show er ++ "\n" ++ fnBit ++ lineBit+> Right body' -> (quoteOfString body, body')++sql function is just a list of statements, the last one has the+trailing semicolon optional++> functionBody Sql = do+> a <- many (try $ sqlStatement True)+> -- this makes my head hurt, should probably write out+> -- more longhand+> SqlFnBody <$> 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+> <$> 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 <$> idString <*> typeName)+> ,ParamDefTp <$> typeName]++variable declarations in a plpgsql function++> varDef :: ParsecT [Token] ParseState Identity VarDef+> varDef = VarDef+> <$> idString+> <*> typeName+> <*> tryOptionMaybe ((symbol ":=" <|> symbol "=")*> expr) <* symbol ";"+++> createView :: ParsecT [Token] ParseState Identity Statement+> createView = keyword "view" >>+> CreateView+> <$> pos+> <*> idString+> <*> (keyword "as" *> selectExpression)++> createDomain :: ParsecT [Token] ParseState Identity Statement+> createDomain = keyword "domain" >>+> CreateDomain+> <$> pos+> <*> idString+> <*> (tryOptionMaybe (keyword "as") *> typeName)+> <*> 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 idString)++> 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"))++================================================================================++= 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 =+> choice [+> flip SelectList <$> readInto <*> itemList+> ,SelectList <$> itemList <*> option [] readInto]+> where+> readInto = keyword "into" *> commaSep1 idString+> itemList = commaSep1 selectItem+> selectItem = optionalSuffix+> SelExp expr+> SelectItem () (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 <$> (keyword "setof" *> typeName)+> ,do+> s <- map toLower <$> idString+> choice [+> PrecTypeName s <$> parens integer+> ,ArrayTypeName (SimpleTypeName s) <$ symbol "[" <* symbol "]"+> ,return $ SimpleTypeName s]]++> 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 = keyword "perform" >>+> Perform <$> pos <*> 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 = keyword "while" >>+> WhileStatement+> <$> pos+> <*> (expr <* keyword "loop")+> <*> many plPgsqlStatement <* keyword "end" <* keyword "loop"++> ifStatement :: ParsecT [Token] ParseState Identity Statement+> ifStatement = keyword "if" >>+> If+> <$> pos+> <*> (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 these in as well after all that+> -- can't do <,> unfortunately, so use <.> instead+> (<.>) a b = (,) <$> a <*> b++> caseStatement :: ParsecT [Token] ParseState Identity Statement+> caseStatement = keyword "case" >>+> CaseStatement <$> pos+> <*> 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, 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, then finally vanilla parens++> ,scalarSubQuery+> ,try $ threadOptionalSuffix rowCtor inPredicateSuffix+> ,parens expr++we have two things which can start with a $,+do the position arg first, then we can unconditionally+try the dollar quoted string next++> ,positionalArg++string using quotes don't start like anything else and we've+already tried the other thing which starts with a $, so can+parse without a try++> ,stringLit++> ,floatLit+> ,integerLit++put the factors which start with keywords before the ones which start+with a function++> ,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+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 DefaultScope.hs should be used here.++> table :: [[Operator [Token] ParseState Identity Expression]]+> table = [--[binary "::" (BinOpCall Cast) AssocLeft]+> --missing [] for array element select+> [prefix "-" (FunCall [] "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"] (FunCall [] "!isNotNull")+> ,postfixks ["is", "null"] (FunCall [] "!isNull")]+> --other operators all added in this list according to the pg docs:+> ,[binary "<->" AssocNone+> ,binary "<=" AssocRight+> ,binary ">=" AssocRight+> ,binary "||" AssocLeft+> ,prefix "@" (FunCall [] "@")+> ]+> --in should be here, but is treated as a factor instead+> --between+> --overlaps+> ,[binaryk "like" "!like" AssocNone+> ,binarycust "!=" "<>" AssocNone]+> --(also ilike similar)+> ,[lt "<" AssocNone+> ,binary ">" AssocNone]+> ,[binary "=" AssocRight+> ,binary "<>" AssocNone]+> ,[prefixk "not" (FunCall [] "!not")]+> ,[binaryk "and" "!and" AssocLeft+> ,binaryk "or" "!or" AssocLeft]]+> where+> --use different parsers for symbols and keywords to get the+> --right whitespace behaviour+> binary s+> = Infix (try (symbol s >> return (binaryF s)))+> binarycust s t+> = Infix (try (symbol s >> return (binaryF t)))+> -- * ends up being lexed as an id token rather than a symbol+> -- * token, so work around here+> idHackBinary s+> = Infix (try (keyword s >> return (binaryF s)))+> prefix s f+> = Prefix (try (symbol s >> return (unaryF f)))+> binaryk s o+> = Infix (try (keyword s >> return (binaryF o)))+> prefixk s f+> = Prefix (try (keyword s >> return (unaryF f)))+> --postfixk s f+> -- = Postfix (try (keyword s >> return f))+> postfixks ss f+> = Postfix (try (mapM_ keyword ss >> return (unaryF f)))+> unaryF f l = f [l]+> binaryF s l m = FunCall [] s [l,m]++some custom parsers++fix problem parsing <> - don't parse as "<" if it is immediately+followed by ">"++don't know if this is needed anymore.++> lt _ = Infix (dontFollowWith "<" ">" >>+> return (\l -> (\m -> FunCall [] "<" [l,m])))++> dontFollowWith c1 c2 =+> try $ symbol c1 *> ((do+> lookAhead $ symbol c2+> fail "dont follow")+> <|> return ())++== factor parsers++> scalarSubQuery :: ParsecT [Token] ParseState Identity Expression+> scalarSubQuery = try (symbol "(" *> lookAhead (keyword "select")) >>+> ScalarSubQuery []+> <$> 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 [] e+> <$> option True (False <$ keyword "not")+> <*> (keyword "in" *> parens ((InSelect <$> selectExpression)+> <|>+> (InList <$> 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 [] "!rowCtor" <$> choice [+> keyword "row" *> parens (commaSep expr)+> ,parens $ commaSep2 expr]++> floatLit :: ParsecT [Token] ParseState Identity Expression+> floatLit = FloatLit [] <$> float++> integerLit :: ParsecT [Token] ParseState Identity Expression+> integerLit = IntegerLit [] <$> integer++case - only supports 'case when condition' flavour and not 'case+expression when value' currently++> caseParse :: ParsecT [Token] ParseState Identity Expression+> caseParse = keyword "case" >>+> choice [+> try $ CaseSimple [] <$> expr+> <*> many whenParse+> <*> tryOptionMaybe (keyword "else" *> expr)+> <* keyword "end"+> ,Case [] <$> many whenParse+> <*> tryOptionMaybe (keyword "else" *> expr)+> <* keyword "end"]+> where+> whenParse = (,) <$> (keyword "when" *> commaSep1 expr)+> <*> (keyword "then" *> expr)++> exists :: ParsecT [Token] ParseState Identity Expression+> exists = keyword "exists" >>+> Exists [] <$> parens selectExpression++> booleanLit :: ParsecT [Token] ParseState Identity Expression+> booleanLit = BooleanLit [] <$> (True <$ keyword "true"+> <|> False <$ keyword "false")++> nullLit :: ParsecT [Token] ParseState Identity Expression+> nullLit = NullLit [] <$ keyword "null"++> arrayLit :: ParsecT [Token] ParseState Identity Expression+> arrayLit = keyword "array" >>+> FunCall [] "!arrayCtor" <$> squares (commaSep expr)++> arraySubSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression+> arraySubSuffix e = if e == Identifier [] "array"+> then fail "can't use array as identifier name"+> else FunCall [] "!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 [] e+> <$> (keyword "over" *> (symbol "(" *> option [] partitionBy))+> <*> option [] orderBy1+> <*> option Asc (try $ choice [+> Asc <$ keyword "asc"+> ,Desc <$ keyword "desc"])+> <* symbol ")"+> where+> orderBy1 = keyword "order" *> keyword "by" *> commaSep1 expr+> partitionBy = keyword "partition" *> keyword "by" *> commaSep1 expr++> betweenSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression+> betweenSuffix a = do+> keyword "between"+> b <- dodgyParseElement+> keyword "and"+> c <- dodgyParseElement+> return $ FunCall [] "!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.++Thanks to Sam Mason for the heads up on this.++TODO: copy this approach here.++> where+> dodgyParseElement = factor++> functionCallSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression+> functionCallSuffix (Identifier _ fnName) = FunCall [] fnName <$> parens (commaSep expr)+> functionCallSuffix s = error $ "internal error: cannot make functioncall from " ++ show s++> castKeyword :: ParsecT [Token] ParseState Identity Expression+> castKeyword = keyword "cast" *> symbol "(" >>+> Cast [] <$> expr+> <*> (keyword "as" *> typeName <* symbol ")")++> castSuffix :: Expression -> ParsecT [Token] ParseState Identity Expression+> castSuffix ex = Cast [] ex <$> (symbol "::" *> typeName)++> substring :: ParsecT [Token] ParseState Identity Expression+> substring = do+> keyword "substring"+> symbol "("+> a <- expr+> keyword "from"+> b <- expr+> keyword "for"+> c <- expr+> symbol ")"+> return $ FunCall [] "!substring" [a,b,c]++> identifier :: ParsecT [Token] ParseState Identity Expression+> identifier = Identifier [] <$> idString++================================================================================++= 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 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)++> 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)++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 ",")++doesn't seem too gratuitous, comes up a few times++> (<:>) :: (Applicative f) =>+> f a -> f [a] -> f [a]+> (<:>) a b = (:) <$> a <*> b++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]++== 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
− Database/HsSqlPpp/PrettyPrinter.lhs
@@ -1,538 +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.--> module Database.HsSqlPpp.PrettyPrinter (-> --convert a sql ast to text-> printSql-> --convert a single expression parse node to text-> ,printExpression-> )-> where--> import Text.PrettyPrint-> import Data.List (stripPrefix)-> import Data.Maybe--> import Database.HsSqlPpp.Ast-> import Database.HsSqlPpp.TypeType--================================================================================--Public functions--> printSql :: StatementList -> String-> printSql ast = render $ vcat (map (convStatement . snd) ast) <> text "\n"--> printExpression :: Expression -> String-> printExpression = render . convExp--================================================================================--Conversion routines - convert Sql asts into Docs-= Statements--> convStatement :: Statement -> Doc--== selects--> convStatement (SelectStatement s) =-> convSelectExpression True s <> statementEnd--== dml--> convStatement (Insert tb atts idata rt) =-> text "insert into" <+> text tb-> <+> ifNotEmpty (parens . hcatCsvMap text) atts-> $+$ convSelectExpression True idata-> $+$ convReturning rt-> <> statementEnd--> convStatement (Update tb scs wh rt) =-> 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 (Delete tbl wh rt) = text "delete from" <+> text tbl-> <+> convWhere wh-> $+$ convReturning rt-> <> statementEnd--> convStatement (Truncate names ri casc) =-> text "truncate"-> <+> hcatCsvMap text names-> <+> text (case ri of-> RestartIdentity -> "restart identity"-> ContinueIdentity -> "continue identity")-> <+> convCasc casc-> <> statementEnd--== ddl--> convStatement (CreateTable tbl atts cns) =-> 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 -> text "null"-> NotNullConstraint -> text "not null"-> RowCheckConstraint ew ->-> text "check" <+> parens (convExp ew)-> RowUniqueConstraint -> text "unique"-> RowPrimaryKeyConstraint -> text "primary key"-> RowReferenceConstraint tb att ondel onupd ->-> text "references" <+> text tb-> <+> maybeConv (parens . text) att-> <+> text "on delete" <+> convCasc ondel-> <+> text "on update" <+> convCasc onupd-> )) cons)-> convCon (UniqueConstraint c) = text "unique"-> <+> parens (hcatCsvMap text c)-> convCon (PrimaryKeyConstraint p) = text "primary key"-> <+> parens (hcatCsvMap text p)-> convCon (CheckConstraint c) = text "check" <+> parens (convExp c)-> convCon (ReferenceConstraint at tb rat ondel onupd) =-> text "foreign key" <+> parens (hcatCsvMap text at)-> <+> text "references" <+> text tb-> <+> ifNotEmpty (parens . hcatCsvMap text) rat-> <+> text "on delete" <+> convCasc ondel-> <+> text "on update" <+> convCasc onupd----> convStatement (CreateTableAs t sel) =-> text "create table"-> <+> text t <+> text "as"-> $+$ convSelectExpression True sel-> <> statementEnd--> convStatement (CreateFunction lang name args retType qt body vol) =-> 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 sts) = convNestedStatements sts-> convFnBody (PlpgsqlFnBody decls sts) =-> ifNotEmpty (\l -> text "declare"-> $+$ nest 2 (vcat $ map convVarDef l)) decls-> $+$ text "begin"-> $+$ convNestedStatements 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 (CreateView name sel) =-> text "create view" <+> text name <+> text "as"-> $+$ nest 2 (convSelectExpression True sel) <> statementEnd--> convStatement (CreateDomain name tp ex) =-> text "create domain" <+> text name <+> text "as"-> <+> convTypeName tp <+> checkExp ex <> statementEnd-> where-> checkExp = maybeConv (\e -> text "check" <+> parens (convExp e))--> convStatement (DropFunction ifExists fns casc) =-> text "drop function"-> <+> convIfExists ifExists-> <+> hcatCsvMap doFunction fns-> <+> convCasc casc-> <> statementEnd-> where-> doFunction (name,types) = text name <> parens (hcatCsvMap text types)--> convStatement (DropSomething dropType ifExists names casc) =-> text "drop"-> <+> text (case dropType of-> Table -> "table"-> View -> "view"-> Domain -> "domain"-> Type -> "type")-> <+> convIfExists ifExists-> <+> hcatCsvMap text names-> <+> convCasc casc-> <> statementEnd--> convStatement (CreateType name atts) =-> text "create type" <+> text name <+> text "as" <+> lparen-> $+$ nest 2 (vcat (csv-> (map (\(TypeAttDef n t) -> text n <+> convTypeName t) atts)))-> $+$ rparen <> statementEnd--== plpgsql--> convStatement NullStatement = text "null" <> statementEnd--> convStatement (Assignment name val) =-> text name <+> text ":=" <+> convExp val <> statementEnd--> convStatement (Return ex) =-> text "return" <+> maybeConv convExp ex <> statementEnd--> convStatement (ReturnNext ex) =-> text "return" <+> text "next" <+> convExp ex <> statementEnd--> convStatement (ReturnQuery sel) =-> text "return" <+> text "query"-> <+> convSelectExpression True sel <> statementEnd--> convStatement (Raise rt st exps) =-> 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 (ForSelectStatement i sel stmts) =-> text "for" <+> text i <+> text "in"-> <+> convSelectExpression True sel <+> text "loop"-> $+$ convNestedStatements stmts-> $+$ text "end loop" <> statementEnd--> convStatement (ForIntegerStatement var st en stmts) =-> text "for" <+> text var <+> text "in"-> <+> convExp st <+> text ".." <+> convExp en <+> text "loop"-> $+$ convNestedStatements stmts-> $+$ text "end loop" <> statementEnd--> convStatement (WhileStatement ex stmts) =-> text "while" <+> convExp ex <+> text "loop"-> $+$ convNestedStatements stmts-> $+$ text "end loop" <> statementEnd--> convStatement (ContinueStatement) = text "continue" <> statementEnd--> convStatement (Perform f@(FunCall _ _)) =-> text "perform" <+> convExp f <> statementEnd-> convStatement (Perform x) =-> error $ "internal error: convStatement not supported for " ++ show x--> convStatement (Copy tb cols src) =-> text "copy" <+> text tb-> <+> ifNotEmpty (parens . hcatCsvMap text) cols-> <+> text "from" <+> case src of-> CopyFilename s -> quotes $ text s-> Stdin -> text "stdin"-> <> statementEnd--> convStatement (CopyData s) = text s <> text "\\." <> newline--> convStatement (If conds els) =-> text "if" <+> convCond (head conds)-> $+$ vcat (map (\c -> text "elseif" <+> convCond c) $ tail conds)-> $+$ ifNotEmpty (\e -> text "else" $+$ convNestedStatements e) els-> $+$ text "end if" <> statementEnd-> where-> convCond (ex, sts) = convExp ex <+> text "then"-> $+$ convNestedStatements sts-> convStatement (Execute s) = text "execute" <+> convExp s <> statementEnd-> convStatement (ExecuteInto s is) = text "execute" <+> convExp s-> <+> text "into" <+> hcatCsvMap text is-> <> statementEnd--> convStatement (CaseStatement c conds els) =-> 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 sts-> convElseSt = ifNotEmpty (\s -> text "else" $+$ convNestedStatements s)---> statementEnd :: Doc-> statementEnd = semi <> newline--================================================================================--= Statement components--== selects--> convSelectExpression :: Bool -> SelectExpression -> Doc-> convSelectExpression writeSelect (Select dis l tb wh grp hav-> ord orddir lim off) =-> text (if writeSelect then "select" else "")-> <+> (case dis of-> Dupes -> empty-> Distinct -> text "distinct")-> <+> convSelList l-> $+$ nest 2 (-> maybeConv (\tr -> text "from" <+> convTref tr) 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 convExp o-> <+> convDir orddir) ord-> <+> maybeConv (\lm -> text "limit" <+> convExp lm) lim-> <+> maybeConv (\offs -> text "offset" <+> convExp offs) off-> where-> convTref (Tref f) = text f-> convTref (TrefAlias f a) = text f <+> text a-> convTref (JoinedTref t1 nat jt t2 ex) =-> 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-> where-> convJoinExpression (JoinOn e) = text "on" <+> convExp e-> convJoinExpression (JoinUsing ids) =-> text "using" <+> parens (hcatCsvMap text ids)--> convTref (SubTref sub alias) =-> parens (convSelectExpression True sub)-> <+> text "as" <+> text alias-> convTref (TrefFun f@(FunCall _ _)) = convExp f-> convTref (TrefFun x) =-> error $ "internal error: node not supported in function tref: " ++ show x-> convTref (TrefFunAlias f@(FunCall _ _) a) =-> convExp f <+> text "as" <+> text a-> convTref (TrefFunAlias x _) =-> error $ "internal error: node not supported in function tref: " ++ show x--> convSelectExpression writeSelect (CombineSelect tp s1 s2) =-> convSelectExpression writeSelect s1-> $+$ (case tp of-> Except -> text "except"-> Union -> text "union"-> UnionAll -> text "union" <+> text "all"-> Intersect -> text "intersect")-> $+$ convSelectExpression True s2-> 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--> 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 :: StatementList -> Doc-> convNestedStatements = nest 2 . vcat . map (convStatement . snd)--> 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) = text i-> 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)-> _ | isOperator n ->-> case getOperatorType n of-> BinaryOp ->-> parens (convExp (head es)-> <+> text (filterKeyword n)-> <+> convExp (es !! 1))-> PrefixOp -> parens (text (if n == "u-"-> then "-"-> else filterKeyword n)-> <+> 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 sel)-> convExp (ScalarSubQuery s) = parens (convSelectExpression True s)-> convExp NullLit = text "null"-> convExp (WindowFn fn partition order asc) =-> convExp fn <+> text "over"-> <+> (if hp || ho-> then-> parens ((if hp-> then text "partition by" <+> csvExp partition-> else empty)-> <+> (if ho-> then text "order by" <+> csvExp order-> <+> convDir asc-> else empty))-> else empty)-> where-> hp = not (null partition)-> ho = not (null order)-> 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 (Exists s) = text "exists" <+> parens (convSelectExpression 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--run conversion function if Just, return empty if nothing--> 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--map the converter ex over a list-then hcatcsv the results--> 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"--> 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'
+ Database/HsSqlPpp/PrettyPrinter/PrettyPrinter.lhs view
@@ -0,0 +1,593 @@+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.List (stripPrefix)+> import Data.Maybe++> import Database.HsSqlPpp.TypeChecking.Ast+> import Database.HsSqlPpp.TypeChecking.TypeChecker+> import Database.HsSqlPpp.TypeChecking.TypeType++================================================================================++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 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 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 -> text "null"+> NotNullConstraint -> text "not null"+> RowCheckConstraint ew ->+> text "check" <+> parens (convExp ew)+> RowUniqueConstraint -> text "unique"+> RowPrimaryKeyConstraint -> text "primary key"+> RowReferenceConstraint tb att ondel onupd ->+> text "references" <+> text tb+> <+> maybeConv (parens . text) att+> <+> text "on delete" <+> convCasc ondel+> <+> text "on update" <+> convCasc onupd+> )) cons)+> convCon (UniqueConstraint c) = text "unique"+> <+> parens (hcatCsvMap text c)+> convCon (PrimaryKeyConstraint p) = text "primary key"+> <+> parens (hcatCsvMap text p)+> convCon (CheckConstraint c) = text "check" <+> parens (convExp c)+> convCon (ReferenceConstraint at tb rat ondel onupd) =+> text "foreign key" <+> parens (hcatCsvMap text at)+> <+> text "references" <+> text tb+> <+> ifNotEmpty (parens . hcatCsvMap text) rat+> <+> text "on delete" <+> convCasc ondel+> <+> text "on update" <+> convCasc onupd++++> convStatement ca (CreateTableAs ann t sel) =+> convPa ca ann <+>+> text "create table"+> <+> text t <+> text "as"+> $+$ convSelectExpression True sel+> <> statementEnd++> convStatement ca (CreateFunction ann lang name args retType 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 sts) = convNestedStatements ca sts+> convFnBody (PlpgsqlFnBody decls sts) =+> 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 sel) <> statementEnd++> convStatement ca (CreateDomain ann name tp ex) =+> convPa ca ann <+>+> text "create domain" <+> text name <+> text "as"+> <+> convTypeName tp <+> checkExp ex <> statementEnd+> where+> checkExp = maybeConv (\e -> text "check" <+> parens (convExp e))++> 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 text 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++== 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 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 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)+++> statementEnd :: Doc+> statementEnd = semi <> newline++================================================================================++= Statement components++== selects++> convSelectExpression :: Bool -> SelectExpression -> Doc+> convSelectExpression writeSelect (Select _ dis l tb wh grp hav+> ord orddir lim off) =+> text (if writeSelect then "select" else "")+> <+> (case dis of+> Dupes -> empty+> Distinct -> text "distinct")+> <+> convSelList l+> $+$ nest 2 (+> maybeConv (\tr -> text "from" <+> convTref tr) 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 convExp o+> <+> convDir orddir) ord+> <+> maybeConv (\lm -> text "limit" <+> convExp lm) lim+> <+> maybeConv (\offs -> text "offset" <+> convExp offs) off+> where+> convTref (Tref _ f) = text f+> convTref (TrefAlias _ f a) = text f <+> text a+> convTref (JoinedTref _ t1 nat jt t2 ex) =+> 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+> where+> convJoinExpression (JoinOn e) = text "on" <+> convExp e+> convJoinExpression (JoinUsing ids) =+> text "using" <+> parens (hcatCsvMap text ids)++> convTref (SubTref _ sub alias) =+> parens (convSelectExpression True sub)+> <+> text "as" <+> text alias+> convTref (TrefFun _ f@(FunCall _ _ _)) = convExp f+> convTref (TrefFun _ x) =+> error $ "internal error: node not supported in function tref: " ++ show x+> convTref (TrefFunAlias _ f@(FunCall _ _ _) a) =+> convExp f <+> text "as" <+> text a+> convTref (TrefFunAlias _ x _) =+> error $ "internal error: node not supported in function tref: " ++ show x++> convSelectExpression writeSelect (CombineSelect _ tp s1 s2) =+> convSelectExpression writeSelect s1+> $+$ (case tp of+> Except -> text "except"+> Union -> text "union"+> UnionAll -> text "union" <+> text "all"+> Intersect -> text "intersect")+> $+$ convSelectExpression True s2+> 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++> 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) = text i+> 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)+> _ | isOperator n ->+> case getOperatorType n of+> BinaryOp ->+> parens (convExp (head es)+> <+> text (filterKeyword n)+> <+> convExp (es !! 1))+> PrefixOp -> parens (text (if n == "u-"+> then "-"+> else filterKeyword n)+> <+> 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 sel)+> convExp (ScalarSubQuery _ s) = parens (convSelectExpression True s)+> convExp (NullLit _) = text "null"+> convExp (WindowFn _ fn partition order asc) =+> convExp fn <+> text "over"+> <+> (if hp || ho+> then+> parens ((if hp+> then text "partition by" <+> csvExp partition+> else empty)+> <+> (if ho+> then text "order by" <+> csvExp order+> <+> convDir asc+> else empty))+> else empty)+> where+> hp = not (null partition)+> ho = not (null order)+> 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 (Exists _ s) = text "exists" <+> parens (convSelectExpression 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++run conversion function if Just, return empty if nothing++> 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++map the converter ex over a list+then hcatcsv the results++> 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"++> 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'++> 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/Scope.lhs
@@ -1,135 +0,0 @@-Copyright 2009 Jake Wheat--Represents the types, identifiers, etc available. Used internally for-static and changing scopes in the type checker, as well as the input-to the type checking routines if you want to supply different/extra-definitions before type checking something, and you're not getting the-extra definitions from an accessible database.--> module Database.HsSqlPpp.Scope where--> import Data.List-> import Debug.Trace--> import Database.HsSqlPpp.TypeType--> type FunctionPrototype = (String, [Type], Type)-> type DomainDefinition = (Type,Type)--> data Scope = Scope {scopeTypes :: [Type]-> ,scopeTypeNames :: [(String, Type)]-> ,scopeDomainDefs :: [DomainDefinition]-> ,scopeCasts :: [(Type,Type,CastContext)]-> ,scopeTypeCategories :: [(Type,String,Bool)]-> ,scopePrefixOperators :: [FunctionPrototype]-> ,scopePostfixOperators :: [FunctionPrototype]-> ,scopeBinaryOperators :: [FunctionPrototype]-> ,scopeFunctions :: [FunctionPrototype]-> ,scopeAggregates :: [FunctionPrototype]-> --this should be done better:-> ,scopeAllFns :: [FunctionPrototype]-> ,scopeAttrDefs :: [CompositeDef]-> ,scopeAttrSystemColumns :: [CompositeDef]-> ,scopeIdentifierTypes :: [QualifiedScope]-> ,scopeJoinIdentifiers :: [String]}-> deriving (Eq,Show)--= 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.--scopeIdentifierTypes 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.--> type QualifiedScope = (String, ([(String,Type)], [(String,Type)]))--> emptyScope :: Scope-> emptyScope = Scope [] [] [] [] [] [] [] [] [] [] [] [] [] [] []--> scopeReplaceIds :: Scope -> [QualifiedScope] -> [String] -> Scope-> scopeReplaceIds scope ids commonJoinFields =-> scope { scopeIdentifierTypes = ids-> ,scopeJoinIdentifiers = commonJoinFields }--> catPair :: ([a],[a]) -> [a]-> catPair = uncurry (++)--> scopeLookupID :: Scope -> MySourcePos -> String -> String -> Type-> scopeLookupID scope sp correlationName iden =-> if correlationName == ""-> then let types = concatMap (filter (\ (s, _) -> s == iden))-> (map (catPair.snd) $ scopeIdentifierTypes scope)-> in case length types of-> 0 -> TypeError sp (UnrecognisedIdentifier iden)-> 1 -> (snd . head) types-> _ -> --see if this identifier is in the join list-> if iden `elem` scopeJoinIdentifiers scope-> then (snd . head) types-> else TypeError sp (AmbiguousIdentifier iden)-> else case lookup correlationName (scopeIdentifierTypes scope) of-> Nothing -> TypeError sp $ UnrecognisedCorrelationName correlationName-> Just s -> case lookup iden (catPair s) of-> Nothing -> TypeError sp $ UnrecognisedIdentifier $ correlationName ++ "." ++ iden-> Just t -> t--> scopeExpandStar :: Scope -> MySourcePos -> String -> [(String,Type)]-> scopeExpandStar scope sp correlationName =-> if correlationName == ""-> then let allFields = concatMap (fst.snd) $ scopeIdentifierTypes scope-> (commonFields,uncommonFields) =-> partition (\(a,_) -> a `elem` scopeJoinIdentifiers scope) allFields-> in nub commonFields ++ uncommonFields-> else-> case lookup correlationName $ scopeIdentifierTypes scope of-> Nothing -> [("", TypeError sp $ UnrecognisedCorrelationName correlationName)]-> Just s -> fst s---> combineScopes :: Scope -> Scope -> Scope-> --base, overrides-> combineScopes (Scope bt btn bdod bc btc bpre bpost bbin bf bagg baf bcd basc _ _)-> (Scope ot otn odod oc otc opre opost obin off oagg oaf ocd oasc oi oji) =-> Scope (funion ot bt)-> (funion otn btn)-> (funion odod bdod)-> (funion oc bc)-> (funion otc btc)-> (funion opre bpre)-> (funion opost bpost)-> (funion obin bbin)-> (funion off bf)-> (funion oagg bagg)-> (funion oaf baf)-> (funion ocd bcd)-> (funion oasc basc)-> oi -- overwrites old scopes, might need to be looked at again-> oji-> where-> --without this it runs very slowly - guessing because it creates-> --a lot of garbage-> funion a b = case () of-> _ | a == [] -> b-> | b == [] -> a-> | otherwise -> union a b--combine scopes still seems to run slowly, so change it so that it-chains scope lookups along a list of scopes instead of unioning the-individual lists.
− Database/HsSqlPpp/ScopeReader.lhs
@@ -1,230 +0,0 @@-Copyright 2009 Jake Wheat--This file contains the code to read all the scope data from a-postgresql database catalog. This is used to generate the default-scope, and to type check against a database schema in a live database.--It basically runs through each field in the Scope data type and reads-the values for that field out of the database, and turns it into the-appropriate data types.--Maps are use to hold oids during this process to e.g. hook up the-types of table columns (which are read as oids which refer to the-pg_type table) to the haskell values represent those types. These maps-are discarded after the Scope value is created.--> module Database.HsSqlPpp.ScopeReader (readScope) where--> import qualified Data.Map as M-> import Data.Maybe--> import Debug.Trace--> import Database.HsSqlPpp.DBAccess-> import Database.HsSqlPpp.Scope-> import Database.HsSqlPpp.TypeType---> readScope :: String -> IO Scope-> readScope dbName = withConn ("dbname=" ++ dbName) $ \conn -> do-> typeInfo <- selectRelation conn-> "select t.oid as oid,\n\-> \ t.typtype,\n\-> \ t.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\-> \ 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-> types = map snd typeAssoc-> typeNames = map (\(_,a,b) -> (b,a)) typeStuff--> domainDefInfo <- selectRelation conn-> "select oid, typbasetype\n\-> \from pg_type 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)))-> typeCatInfo <- selectRelation conn-> "select pg_type.oid, typcategory, typispreferred from pg_type\n\-> \where pg_catalog.pg_type_is_visible(pg_type.oid);" []-> let typeCats = flip map typeCatInfo-> (\l -> (jlt (l!!0), l!!1, read (l!!2)::Bool))-> 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---> attrInfo <- selectRelation conn-> "select distinct\n\-> \ cls.relkind,\n\-> \ cls.relname,\n\-> \ array_to_string(\n\-> \ array_agg(attname || ';' || atttypid)\n\-> \ over (partition by relname order by attnum\n\-> \ range between unbounded preceding\n\-> \ and unbounded following)\n\-> \ ,',')\n\-> \ from pg_attribute att\n\-> \ inner join pg_class cls\n\-> \ on cls.oid = attrelid\n\-> \ where\n\-> \ pg_catalog.pg_table_is_visible(cls.oid)\n\-> \ and cls.relkind in ('r','v','c')\n\-> \ and not attisdropped\n\-> \ and attnum > 0\n\-> \ order by relkind, relname;" []-> let attrs = map (convAttrRow jlt) attrInfo--> systemAttrInfo <- selectRelation conn-> "select distinct\n\-> \ cls.relkind,\n\-> \ cls.relname,\n\-> \ array_to_string(\n\-> \ array_agg(attname || ';' || atttypid)\n\-> \ over (partition by relname order by attnum\n\-> \ range between unbounded preceding\n\-> \ and unbounded following)\n\-> \ ,',')\n\-> \ from pg_attribute att\n\-> \ inner join pg_class cls\n\-> \ on cls.oid = attrelid\n\-> \ where\n\-> \ pg_catalog.pg_table_is_visible(cls.oid)\n\-> \ and cls.relkind in ('r','v','c')\n\-> \ and not attisdropped\n\-> \ and attnum < 0\n\-> \ order by relkind, relname;" []-> let systemAttrs = map (convAttrRow jlt) systemAttrInfo--> return Scope {scopeTypes = types-> ,scopeTypeNames = typeNames-> ,scopeDomainDefs = domainDefs-> ,scopeCasts = casts-> ,scopeTypeCategories = typeCats-> ,scopePrefixOperators = prefixOps-> ,scopePostfixOperators = postfixOps-> ,scopeBinaryOperators = binaryOps-> ,scopeFunctions = fnProts-> ,scopeAggregates = aggProts-> ,scopeAllFns = (prefixOps ++ postfixOps ++-> binaryOps ++ fnProts ++ aggProts)-> ,scopeAttrDefs = attrs-> ,scopeAttrSystemColumns = systemAttrs-> ,scopeIdentifierTypes = []-> ,scopeJoinIdentifiers = []}--> where-> convAttrRow jlt l =-> (l!!1, ty, atts)-> where-> ty = case l!!0 of-> "r" -> TableComposite-> "v" -> ViewComposite-> "c" -> Composite-> x -> error $ "internal error: unknown composite type: " ++ x-> atts = let ps = split ',' (l!!2)-> ps1 = map (split ';') ps-> in UnnamedCompositeType $ 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" -> CompositeType-> "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]---> split :: Char -> String -> [String]-> split _ "" = []-> split c s = let (l, s') = break (== c) s-> in l : case s' of-> [] -> []-> (_:s'') -> split c s''
+ Database/HsSqlPpp/Tests/AstCheckTests.lhs view
@@ -0,0 +1,643 @@+Copyright 2009 Jake Wheat++Set of tests to check the type checking code++> module Database.HsSqlPpp.Tests.AstCheckTests (astCheckTests) where++> import Test.HUnit+> import Test.Framework+> import Test.Framework.Providers.HUnit+> import Data.Char+> import Control.Arrow+> import Debug.Trace++> import Database.HsSqlPpp.TypeChecking.Ast+> import Database.HsSqlPpp.TypeChecking.TypeChecker+> import Database.HsSqlPpp.Parsing.Parser+> import Database.HsSqlPpp.TypeChecking.Scope+> import Database.HsSqlPpp.TypeChecking.ScopeData+> import Database.HsSqlPpp.TypeChecking.TypeType++> astCheckTests :: Test.Framework.Test+> astCheckTests = testGroup "astCheckTests" [+> --testGroup "test test"+> --(mapAttr [+> -- p "select 1;" []+> -- ])++this is disabled because the messages are getting a rethink, the code+that supports this test passing is commented out also++> {-+> ,testGroup "loop tests"+> (mapAttr [] {-+> p "create function cont_test1() returns void as $$\n\+> \declare\n\+> \ r record;\n\+> \begin\n\+> \ for r in select a from b loop\n\+> \ null;\n\+> \ continue;\n\+> \ end loop;\n\+> \end;\n\+> \$$ language plpgsql volatile;\n" []+> ,p "create function cont_test2() returns void as $$\n\+> \begin\n\+> \ continue;\n\+> \end;\n\+> \$$ language plpgsql volatile;\n" [Error ("",3,5) ContinueNotInLoop]+> ]-}+> )-}++> testGroup "basic literal types"+> (mapExprType [+> p "1" $ Right typeInt+> ,p "1.0" $ Right typeNumeric+> ,p "'test'" $ Right UnknownStringLit+> ,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 [IncompatibleTypeSet [typeInt,typeBool]]+> ])+>+> ,testGroup "some expressions"+> (mapExprType [+> 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"+> [UnknownStringLit+> ,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+ > UnknownStringLit))++> ,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 "-" [UnknownStringLit]]++> ,p "4-3" $ Right typeInt++> --,p "1 is null" typeBool+> --,p "1 is not null" 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]]+> ])++> ,testGroup "special functions"+> (mapExprType [+> p "coalesce(null,1,2,null)" $ Right typeInt+> ,p "coalesce('3',1,2,null)" $ Right typeInt+> ,p "coalesce('3',1,true,null)"+> $ Left [IncompatibleTypeSet [UnknownStringLit+> ,ScalarType "int4"+> ,ScalarType "bool"+> ,UnknownStringLit]]+> ,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 [IncompatibleTypeSet [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++> ,testGroup "some expressions"+> (mapExprType [+> p "3 + '4'" $ Right typeInt+> ,p "3.0 + '4'" $ Right typeNumeric+> ,p "'3' + '4'" $ Left [NoMatchingOperator "+" [UnknownStringLit+> ,UnknownStringLit]]+> ])+>++> ,testGroup "expressions and scope"+> (mapExprScopeType [+> t "a" (makeScope [("test", [("a", typeInt)])]) $ Right typeInt+> ,t "b" (makeScope [("test", [("a", typeInt)])])+> $ Left [UnrecognisedIdentifier "b"]+> ])++> ,testGroup "random expressions"+> (mapExprType [+> p "exists (select 1 from pg_type)" $ Right typeBool+> ,p "exists (select testit from pg_type)"+> $ Left [UnrecognisedIdentifier "testit"]+> ])++rows different lengths+rows match types pairwise, same and different types+rows implicit cast from unknown+rows don't match types+++> ,testGroup "row comparison expressions"+> (mapExprType [+> p "row(1)" $ Right (RowCtor [typeInt])+> ,p "row(1,2)" $ Right (RowCtor [typeInt,typeInt])+> ,p "row('t1','t2')" $ Right (RowCtor [UnknownStringLit,UnknownStringLit])+> ,p "row(true,1,'t3')" $ Right (RowCtor [typeBool, typeInt,UnknownStringLit])+> ,p "(true,1,'t3',75.3)" $ Right (RowCtor [typeBool,typeInt+> ,UnknownStringLit,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 [ValuesListsMustBeSameLength]+> ,p "('1',2) = (2,'1')" $ Right typeBool+> ,p "(1,true) = (2,1)" $ Left [IncompatibleTypeSet [ScalarType "bool",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+> ])++++> ,testGroup "case expressions"+> (mapExprType [+> 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"]]++> ])++> ,testGroup "polymorphic functions"+> (mapExprType [+> 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)+> ])++todo:++++> ,testGroup "cast expressions"+> (mapExprType [+> p "cast ('1' as integer)"+> $ Right typeInt+> ,p "cast ('1' as baz)"+> $ Left [UnknownTypeName "baz"]+> ,p "array[]"+> $ Left [TypelessEmptyArray]+> --todo: figure out how to do this+> --,p "array[] :: text[]"+> -- (ArrayType (ScalarType "text"))++> ])++> ,testGroup "simple selects"+> (mapStatementInfo [+> p "select 1;" $ Right [SelectInfo $ SetOfType $+> UnnamedCompositeType [("?column?", typeInt)]]+> ,p "select 1 as a;" $+> Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("a", typeInt)]]+> ,p "select 1,2;" $+> Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("?column?", typeInt)+> ,("?column?", typeInt)]]+> ,p "select 1 as a, 2 as b;" $+> Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("a", typeInt)+> ,("b", typeInt)]]+> ,p "select 1+2 as a, 'a' || 'b';" $+> Right [SelectInfo $ SetOfType $+> UnnamedCompositeType [("a", typeInt)+> ,("?column?", ScalarType "text")]]+> ,p "values (1,2);" $ Right [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("column1", typeInt)+> ,("column2", typeInt)]]+> ,p "values (1,2),('3', '4');" $ Right [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("column1", typeInt)+> ,("column2", typeInt)]]+> ,p "values (1,2),('a', true);" $ Left [IncompatibleTypeSet [typeInt+> ,typeBool]]+> ,p "values ('3', '4'),(1,2);" $ Right [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("column1", typeInt)+> ,("column2", typeInt)]]+> ,p "values ('a', true),(1,2);" $ Left [IncompatibleTypeSet [typeBool+> ,typeInt]]+> ,p "values ('a'::text, '2'::int2),('1','2');" $ Right [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("column1", ScalarType "text")+> ,("column2", typeSmallInt)]]+> ,p "values (1,2,3),(1,2);" $ Left [ValuesListsMustBeSameLength]+> ])++> ,testGroup "simple combine selects"+> (mapStatementInfo [+> p "select 1,2 union select '3', '4';" $ Right [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("?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 [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("?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 [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("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 [SelectInfo $ SetOfType $+> UnnamedCompositeType+> [("a", typeInt)+> ,("b", typeInt)]]+> ])+++> ,testGroup "simple selects from"+> (mapStatementInfo [+> p "select a from (select 1 as a, 2 as b) x;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("a", typeInt)]]+> ,p "select b from (select 1 as a, 2 as b) x;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("b", typeInt)]]+> ,p "select c from (select 1 as a, 2 as b) x;"+> $ Left [UnrecognisedIdentifier "c"]+> ,p "select typlen from pg_type;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("typlen", typeSmallInt)]]+> ,p "select oid from pg_type;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("oid", ScalarType "oid")]]+> ,p "select p.oid from pg_type p;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("oid", ScalarType "oid")]]+> ,p "select typlen from nope;"+> $ Left [UnrecognisedIdentifier "typlen",UnrecognisedRelation "nope"]+> ,p "select generate_series from generate_series(1,7);"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("generate_series", typeInt)]]++check aliasing++> ,p "select generate_series.generate_series from generate_series(1,7);"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("generate_series", typeInt)]]+> ,p "select g from generate_series(1,7) g;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("g", typeInt)]]+> ,p "select g.g from generate_series(1,7) g;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType+> [("adrelid",ScalarType "oid")+> ,("adnum",ScalarType "int2")+> ,("adbin",ScalarType "text")+> ,("adsrc",ScalarType "text")]]+> ,p "select abs from abs(3);"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("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);+> ])+++> ,testGroup "simple selects from 2"+> (mapStatementInfoScope [+> t "select a,b from testfunc();"+> (let fn = ("testfunc", [], SetOfType $ CompositeType "testType")+> in emptyScope {scopeFunctions = [fn]+> ,scopeAllFns = [fn]+> ,scopeAttrDefs =+> [("testType"+> ,Composite+> ,UnnamedCompositeType+> [("a", ScalarType "text")+> ,("b", typeInt)+> ,("c", typeInt)])]})+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType+> [("a",ScalarType "text"),("b",ScalarType "int4")]]++> ,t "select testfunc();"+> (let fn = ("testfunc", [], Pseudo Void)+> in emptyScope {scopeFunctions = [fn]+> ,scopeAllFns = [fn]+> ,scopeAttrDefs =+> []})+> $ Right [SelectInfo $ Pseudo Void]++> ])++> ,testGroup "simple join selects"+> (mapStatementInfo [+> p "select * from (select 1 as a, 2 as b) a\n\+> \ cross join (select true as c, 4.5 as d) b;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("a", typeInt)+> ,("b", typeInt)+> ,("d", typeNumeric)]]+> ,p "select * from (select 1 as a, 2 as b) a\n\+> \ natural inner join (select true as a, 4.5 as d) b;"+> $ Left [IncompatibleTypeSet [ScalarType "int4"+> ,ScalarType "bool"]]+> ])++> ,testGroup "simple scalar identifier qualification"+> (mapStatementInfo [+> 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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("a", typeInt)+> ,("a", typeInt)]]++> ,p "select pg_attrdef.adsrc from pg_attrdef;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("adsrc", ScalarType "text")]]++> ,p "select a.adsrc from pg_attrdef a;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("a", typeInt)]]++select g.fn from fn() g+++> ])++> ,testGroup "aggregates"+> (mapStatementInfo [+> p "select max(prorettype::int) from pg_proc;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("max", typeInt)]]+> ])++> ,testGroup "simple wheres"+> (mapStatementInfo [+> p "select 1 from pg_type where true;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("?column?", typeInt)]]+> ,p "select 1 from pg_type where 1;"+> $ Left [ExpressionMustBeBool]+> ,p "select typname from pg_type where typbyval;"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("typname", ScalarType "name")]]+> ,p "select typname from pg_type where typtype = 'b';"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("typname", ScalarType "name")]]+> ,p "select typname from pg_type where what = 'b';"+> $ Left [UnrecognisedIdentifier "what"]+> ])++> ,testGroup "subqueries"+> (mapStatementInfo [+> 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 [SelectInfo $ SetOfType $ UnnamedCompositeType [("relvar_name",ScalarType "name")]]+> ,p "select relname from pg_class where relkind in ('r', 'v');"+> $ Right [SelectInfo $ SetOfType $ UnnamedCompositeType [("relname",ScalarType "name")]]+> ,p "select * from generate_series(1,7) g\n\+> \where g not in (select * from generate_series(3,5));"+> $ Right [SelectInfo $ SetOfType (UnnamedCompositeType [("g",ScalarType "int4")])]+> ])++insert++> ,testGroup "insert"+> (mapStatementInfo [+> 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 [InsertInfo "pg_attrdef"+> (UnnamedCompositeType [("adrelid",ScalarType "oid")+> ,("adnum",ScalarType "int2")+> ,("adbin",ScalarType "text")+> ,("adsrc",ScalarType "text")])]+> ,p "insert into pg_attrdef\n\+> \values (1,2, 'a', 'b');"+> $ Right [InsertInfo "pg_attrdef"+> (UnnamedCompositeType [("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]++> ])++> ,testGroup "update"+> (mapStatementInfo [+> 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 [UpdateInfo "pg_attrdef" (UnnamedCompositeType [("adsrc",ScalarType "text")])]+> ,p "update pg_attrdef set adsrc='' where 1=2;"+> $ Right [UpdateInfo "pg_attrdef" (UnnamedCompositeType [("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 [UpdateInfo "pg_attrdef" (UnnamedCompositeType [("adbin",ScalarType "text"),("adsrc",ScalarType "text")])]+> ])++> ,testGroup "delete"+> (mapStatementInfo [+> p "delete from nope;"+> $ Left [UnrecognisedRelation "nope"]+> ,p "delete from pg_attrdef where 1=2;"+> $ Right [DeleteInfo "pg_attrdef"]+> ,p "delete from pg_attrdef where 1;"+> $ Left [ExpressionMustBeBool]+> ])+>+> ]+> where+> --mapAttr = map $ uncurry checkAttrs+> p a b = (a,b)+> t a b c = (a,b,c)+> mapExprType = map (uncurry $ checkExpressionType emptyScope)+> --mapStatementType = map $ uncurry checkStatementType+> mapStatementInfo = map $ uncurry checkStatementInfo+> mapExprScopeType = map (\(a,b,c) -> checkExpressionType b a c)+> makeScope l = scopeReplaceIds defaultScope (map (second (\a->(a,[]))) l) []+> mapStatementInfoScope = map (\(a,b,c) -> checkStatementInfoScope b a c)++> checkExpressionType :: Scope -> String -> Either [TypeError] Type -> Test.Framework.Test+> checkExpressionType scope src typ = testCase ("typecheck " ++ src) $+> let ast = case parseExpression src of+> Left e -> error $ show e+> Right l -> l+> aast = annotateExpression scope ast+> ty = getTopLevelTypes [aast]+> er = 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++> checkStatementInfo :: String -> Either [TypeError] [StatementInfo] -> Test.Framework.Test+> checkStatementInfo src sis = testCase ("typecheck " ++ src) $+> let ast = case parseSql src of+> Left e -> error $ show e+> Right l -> l+> aast = annotateAst ast+> is = getTopLevelInfos aast+> er = 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++> checkStatementInfoScope :: Scope -> String -> Either [TypeError] [StatementInfo] -> Test.Framework.Test+> checkStatementInfoScope scope src sis = testCase ("typecheck " ++ src) $+> let ast = case parseSql src of+> Left e -> error $ show e+> Right l -> l+> aast = annotateAstScope scope ast+> is = getTopLevelInfos aast+> er = getTypeErrors aast+> in 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
+ Database/HsSqlPpp/Tests/DatabaseLoaderTests.lhs view
@@ -0,0 +1,33 @@+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/ParserTests.lhs view
@@ -0,0 +1,1112 @@+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.++> module Database.HsSqlPpp.Tests.ParserTests (parserTests) where++> import Test.HUnit+> import Test.Framework+> import Test.Framework.Providers.HUnit+> import Data.Char++> import Database.HsSqlPpp.TypeChecking.Ast+> import Database.HsSqlPpp.TypeChecking.TypeChecker+> import Database.HsSqlPpp.Parsing.Parser+> import Database.HsSqlPpp.PrettyPrinter.PrettyPrinter++> parserTests :: Test.Framework.Test+> parserTests =+> testGroup "parserTests" [++================================================================================++uses a whole bunch of shortcuts (at the bottom of main) to make this+code more concise. Could probably use a few more.++> testGroup "parse expression"+> (mapExpr [++start with some really basic expressions, we just use the expression+parser rather than the full sql statement parser. (the expression parser+requires a single expression followed by eof.)++> 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])++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])++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 [])++array selector++> ,p "array[1,2]" (FunCall [] "!arrayCtor" [IntegerLit [] 1, IntegerLit [] 2])++array subscripting++> ,p "a[1]" (FunCall [] "!arraySub" [Identifier [] "a", IntegerLit [] 1])++we just produce a ast, so no type checking or anything like that is+done++some operator tests++> ,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 "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"])++some function call tests++> ,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"])++simple whitespace sanity checks++> ,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])++null stuff++> ,p "not null" (FunCall [] "!not" [NullLit []])+> ,p "a is null" (FunCall [] "!isNull" [Identifier [] "a"])+> ,p "a is not null" (FunCall [] "!isNotNull" [Identifier [] "a"])++some slightly more complex stuff++> ,p "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))+++positional args used in sql and sometimes plpgsql functions++> ,p "$1" (PositionalArg [] 1)++> ,p "exists (select 1 from a)"+> (Exists [] (selectFrom [SelExp (IntegerLit [] 1)] (Tref [] "a")))++ > (Exists (makeSelect {+ > selSelectList = sle [(IntegerLit [] 1)]+ > ,selTref = Just $ Tref "a"}))+++selectFrom [SelExp (IntegerLit [] 1)] (Tref "a")))++in variants, including using row constructors++> ,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 "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.++> ,testGroup "string parsing"+> (mapExpr [+> 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")+> ])++================================================================================++first statement, pretty simple++> ,testGroup "select expression"+> (mapSql [+> p "select 1;" [SelectStatement [] $ selectE (SelectList [SelExp (IntegerLit [] 1)] [])]+> ])++================================================================================++test a whole bunch more select statements++> ,testGroup "select from table"+> (mapSql [+> p "select * from tbl;"+> [SelectStatement [] $ selectFrom (selIL ["*"]) (Tref [] "tbl")]+> ,p "select a,b from tbl;"+> [SelectStatement [] $ selectFrom (selIL ["a", "b"]) (Tref [] "tbl")]++> ,p "select a,b from inf.tbl;"+> [SelectStatement [] $ selectFrom (selIL ["a", "b"]) (Tref [] "inf.tbl")]++> ,p "select distinct * from tbl;"+> [SelectStatement [] $ Select [] Distinct (SelectList (selIL ["*"]) []) (Just $ Tref [] "tbl")+> Nothing [] Nothing [] Asc Nothing Nothing]++> ,p "select a from tbl where b=2;"+> [SelectStatement [] $ selectFromWhere+> (selIL ["a"])+> (Tref [] "tbl")+> (FunCall [] "="+> [Identifier [] "b", IntegerLit [] 2])]+> ,p "select a from tbl where b=2 and c=3;"+> [SelectStatement [] $ selectFromWhere+> (selIL ["a"])+> (Tref [] "tbl")+> (FunCall [] "!and"+> [FunCall [] "=" [Identifier [] "b", IntegerLit [] 2]+> ,FunCall [] "=" [Identifier [] "c", IntegerLit [] 3]])]++> ,p "select a from tbl\n\+> \except\n\+> \select a from tbl1;"+> [SelectStatement [] $ CombineSelect [] Except+> (selectFrom (selIL ["a"]) (Tref [] "tbl"))+> (selectFrom (selIL ["a"]) (Tref [] "tbl1"))]+> ,p "select a from tbl where true\n\+> \except\n\+> \select a from tbl1 where true;"+> [SelectStatement [] $ CombineSelect [] Except+> (selectFromWhere (selIL ["a"]) (Tref [] "tbl") (BooleanLit [] True))+> (selectFromWhere (selIL ["a"]) (Tref [] "tbl1") (BooleanLit [] True))]+> ,p "select a from tbl\n\+> \union\n\+> \select a from tbl1;"+> [SelectStatement [] $ CombineSelect [] Union+> (selectFrom (selIL ["a"]) (Tref [] "tbl"))+> (selectFrom (selIL ["a"]) (Tref [] "tbl1"))]+> ,p "select a from tbl\n\+> \union all\n\+> \select a from tbl1;"+> [SelectStatement [] $ CombineSelect [] UnionAll+> (selectFrom (selIL ["a"]) (Tref [] "tbl"))+> (selectFrom (selIL ["a"]) (Tref [] "tbl1"))]++> ,p "select a as b from tbl;"+> [SelectStatement [] $ selectFrom [SelectItem (Identifier [] "a") "b"] (Tref [] "tbl")]+> ,p "select a + b as b from tbl;"+> [SelectStatement [] $ selectFrom+> [SelectItem+> (FunCall [] "+"+> [Identifier [] "a", Identifier [] "b"]) "b"]+> (Tref [] "tbl")]+> ,p "select a.* from tbl a;"+> [SelectStatement [] $ selectFrom (selIL ["a.*"]) (TrefAlias [] "tbl" "a")]++> ,p "select a from b inner join c on b.a=c.a;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural Inner (Tref [] "c")+> (Just (JoinOn+> (FunCall [] "=" [Identifier [] "b.a", Identifier [] "c.a"]))))]+> ,p "select a from b inner join c as d on b.a=d.a;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural Inner (TrefAlias [] "c" "d")+> (Just (JoinOn+> (FunCall [] "=" [Identifier [] "b.a", Identifier [] "d.a"]))))]++> ,p "select a from b inner join c using(d,e);"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural Inner (Tref [] "c")+> (Just (JoinUsing ["d","e"])))]++> ,p "select a from b natural inner join c;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Natural Inner (Tref [] "c") Nothing)]+> ,p "select a from b left outer join c;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural LeftOuter (Tref [] "c") Nothing)]+> ,p "select a from b full outer join c;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural FullOuter (Tref [] "c") Nothing)]+> ,p "select a from b right outer join c;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural RightOuter (Tref [] "c") Nothing)]+> ,p "select a from b cross join c;"+> [SelectStatement [] $ selectFrom+> (selIL ["a"])+> (JoinedTref [] (Tref [] "b") Unnatural Cross (Tref [] "c") Nothing)]++> ,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") Unnatural Inner (Tref [] "c")+> (Just $ JoinOn (BooleanLit [] True)))+> Unnatural Inner (Tref [] "d")+> (Just $ JoinOn (FunCall [] "="+> [IntegerLit [] 1, IntegerLit [] 1])))]++> ,p "select row_number() over(order by a) as place from tbl;"+> [SelectStatement [] $ selectFrom [SelectItem+> (WindowFn []+> (FunCall [] "row_number" [])+> []+> [Identifier [] "a"] Asc)+> "place"]+> (Tref [] "tbl")]+> ,p "select row_number() over(order by a asc) as place from tbl;"+> [SelectStatement [] $ selectFrom [SelectItem+> (WindowFn []+> (FunCall [] "row_number" [])+> []+> [Identifier [] "a"] Asc)+> "place"]+> (Tref [] "tbl")]+> ,p "select row_number() over(order by a desc) as place from tbl;"+> [SelectStatement [] $ selectFrom [SelectItem+> (WindowFn []+> (FunCall [] "row_number" [])+> []+> [Identifier [] "a"] Desc)+> "place"]+> (Tref [] "tbl")]+> ,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)+> "place"]+> (Tref [] "tbl")]++> ,p "select * from a natural inner join (select * from b) as a;"+> [SelectStatement [] $ selectFrom+> (selIL ["*"])+> (JoinedTref [] (Tref [] "a") Natural+> Inner (SubTref [] (selectFrom+> (selIL ["*"])+> (Tref [] "b")) "a")+> Nothing)]++> ,p "select * from a order by c;"+> [SelectStatement [] $ Select [] Dupes+> (sl (selIL ["*"]))+> (Just $ Tref [] "a")+> Nothing [] Nothing [Identifier [] "c"] Asc Nothing Nothing]++> ,p "select * from a order by c,d asc;"+> [SelectStatement [] $ Select [] Dupes+> (sl (selIL ["*"]))+> (Just $ Tref [] "a")+> Nothing [] Nothing [Identifier [] "c", Identifier [] "d"] Asc Nothing Nothing]++> ,p "select * from a order by c,d desc;"+> [SelectStatement [] $ Select [] Dupes+> (sl (selIL ["*"]))+> (Just $ Tref [] "a")+> Nothing [] Nothing [Identifier [] "c", Identifier [] "d"] Desc Nothing Nothing]++> ,p "select * from a order by c limit 1;"+> [SelectStatement [] $ Select [] Dupes+> (sl (selIL ["*"]))+> (Just $ Tref [] "a")+> Nothing [] Nothing [Identifier [] "c"] Asc (Just (IntegerLit [] 1)) Nothing]++> ,p "select * from a order by c offset 3;"+> [SelectStatement [] $ Select [] Dupes+> (sl (selIL ["*"]))+> (Just $ Tref [] "a")+> 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"))+> "d")]++> ,p "select * from gen();"+> [SelectStatement [] $ selectFrom (selIL ["*"]) (TrefFun [] $ FunCall [] "gen" [])]+> ,p "select * from gen() as t;"+> [SelectStatement [] $ selectFrom+> (selIL ["*"])+> (TrefFunAlias [] (FunCall [] "gen" []) "t")]++> ,p "select a, count(b) from c group by a;"+> [SelectStatement [] $ Select [] Dupes+> (sl [selI "a", SelExp (FunCall [] "count" [Identifier [] "b"])])+> (Just $ Tref [] "c") Nothing [Identifier [] "a"]+> Nothing [] Asc 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"])+> (Just $ Tref [] "c") Nothing [Identifier [] "a"]+> (Just $ FunCall [] ">" [Identifier [] "cnt", IntegerLit [] 4])+> [] Asc 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"] [])+> "x")]+> ])++================================================================================++one sanity check for parsing multiple statements++> ,testGroup "multiple statements"+> (mapSql [+> p "select 1;\nselect 2;" [SelectStatement [] $ selectE $ sl [SelExp (IntegerLit [] 1)]+> ,SelectStatement [] $ selectE $ sl [SelExp (IntegerLit [] 2)]]+> ])++================================================================================++test comment behaviour++> ,testGroup "comments"+> (mapSql [+> p "" []+> ,p "-- this is a test" []+> ,p "/* this is\n\+> \a test*/" []++maybe some people actually put block comments inside parts of+statements when they program?++> ,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++> ,testGroup "dml"+> (mapSql [++simple insert++> 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"))+> 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"])]++updates++> ,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]++delete++> ,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"])]++> ,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++> ,p "copy tbl(a,b) from stdin;\n\+> \bat t\n\+> \bear f\n\+> \\\.\n"+> [Copy [] "tbl" ["a", "b"] Stdin+> ,CopyData [] "\+> \bat t\n\+> \bear f\n"]+> ])++================================================================================++some ddl++> ,testGroup "create"+> (mapSql [++create table tests++> 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)] []))]++other creates++> ,p "create view v1 as\n\+> \select a,b from t;"+> [CreateView []+> "v1"+> (selectFrom [selI "a", selI "b"] (Tref [] "t"))]+> ,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")]]++drops++> ,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]++> ])++constraints++> ,testGroup "constraints"+> (mapSql [++nulls++> 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]]+> []]++unique table++> ,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]][]]++primary key row, table++> ,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"]]]++check row, table++> ,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"])]]++row, whole load of constraints, todo: add reference here++> ,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"]))]] []]++reference row, table++> ,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 delete cascade on update cascade\n\+> \);"+> [CreateTable [] "t1" [att "x" "int"+> ,att "y" "int"]+> [ReferenceConstraint ["x", "y"] "t2" []+> Cascade Cascade]]++> ])++================================================================================++test functions++> ,testGroup "functions"+> (mapSql [+> p "create function t1(text) returns text as $$\n\+> \select a from t1 where b = $1;\n\+> \$$ language sql stable;"+> [CreateFunction [] Sql "t1" [ParamDefTp $ SimpleTypeName "text"]+> (SimpleTypeName "text") "$$"+> (SqlFnBody+> [SelectStatement [] $ selectFromWhere [SelExp (Identifier [] "a")] (Tref [] "t1")+> (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 [] Plpgsql "fn" [] (SimpleTypeName "void") "$$"+> (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 [] Plpgsql "fn" [] (SimpleTypeName "void") "$$"+> (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 [] Plpgsql "fn"+> [ParamDef "a" $ ArrayTypeName $ SimpleTypeName "text"]+> (ArrayTypeName $ SimpleTypeName "int") "$$"+> (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 [] Plpgsql "fn" [] (SimpleTypeName "void") "'"+> (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 [] Plpgsql "fn" []+> (SetOfTypeName $ SimpleTypeName "int") "$$"+> (PlpgsqlFnBody [] [NullStatement []])+> Stable]+> ,p "create function fn() returns void as $$\n\+> \begin\n\+> \ null;\n\+> \end\n\+> \$$ language plpgsql stable;"+> [CreateFunction [] Plpgsql "fn" []+> (SimpleTypeName "void") "$$"+> (PlpgsqlFnBody [] [NullStatement []])+> Stable]+> ,p "drop function test(text);"+> [DropFunction [] Require [("test",["text"])] Restrict]+> ,p "drop function if exists a(),test(text) cascade;"+> [DropFunction [] IfExists [("a",[])+> ,("test",["text"])] Cascade]+> ])++================================================================================++test non sql plpgsql statements++> ,testGroup "plpgsqlStatements"+> (mapPlpgsql [++simple statements++> 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")]+> ,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"])+> (Just $ Tref [] "e") Nothing [] Nothing [] Asc Nothing Nothing]+> ,p "select c,d into a,b from e;"+> [SelectStatement [] $ Select [] Dupes (SelectList [selI "c", selI "d"] ["a", "b"])+> (Just $ Tref [] "e") Nothing [] Nothing [] Asc Nothing Nothing]++> ,p "execute s;"+> [Execute [] (Identifier [] "s")]+> ,p "execute s into r;"+> [ExecuteInto [] (Identifier [] "s") ["r"]]++> ,p "continue;" [ContinueStatement []]++complicated statements++> ,p "for r in select a from tbl loop\n\+> \null;\n\+> \end loop;"+> [ForSelectStatement [] "r" (selectFrom [selI "a"] (Tref [] "tbl"))+> [NullStatement []]]+> ,p "for r in select a from tbl where true loop\n\+> \null;\n\+> \end loop;"+> [ForSelectStatement [] "r"+> (selectFromWhere [selI "a"] (Tref [] "tbl") (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 []]]+> ])+> --,testProperty "random expression" prop_expression_ppp+> -- ,testProperty "random statements" prop_statements_ppp+> ]+> where+> mapExpr = map $ uncurry checkParseExpression+> mapSql = map $ uncurry checkParse+> mapPlpgsql = map $ uncurry checkParsePlpgsql+> p a b = (a,b)+> selIL = map selI+> selI = SelExp . Identifier []+> sl a = SelectList a []+> selectE selList = Select [] Dupes selList+> Nothing Nothing [] Nothing [] Asc Nothing Nothing+> selectFrom selList frm =+> Select [] Dupes (SelectList selList [])+> (Just frm) Nothing [] Nothing [] Asc Nothing Nothing+> selectFromWhere selList frm whr =+> Select [] Dupes (SelectList selList [])+> (Just frm) (Just whr) [] Nothing [] Asc Nothing Nothing+> stringQ = StringLit [] "'"+> att n t = AttributeDef n (SimpleTypeName t) Nothing []++================================================================================++Unit test helpers++parse and then pretty print and parse a statement++> checkParse :: String -> [Statement] -> Test.Framework.Test+> checkParse src ast = parseUtil1 src ast parseSql++parse and then pretty print and parse an expression++> checkParseExpression :: String -> Expression -> Test.Framework.Test+> checkParseExpression src ast = parseUtil src ast+> parseExpression printExpression++> checkParsePlpgsql :: String -> [Statement] -> Test.Framework.Test+> checkParsePlpgsql src ast = parseUtil1 src ast parsePlpgsql++> parseUtil :: (Show t, Eq b, Show b) =>+> String+> -> b+> -> (String -> Either t b)+> -> (b -> String)+> -> Test.Framework.Test+> parseUtil src ast parser printer = testCase ("parse " ++ src) $ do+> let ast' = case parser src of+> Left er -> error $ show er+> Right l -> l+> assertEqual ("parse " ++ src) ast ast'+> -- pretty print then parse to check+> let pp = printer ast+> let ast'' = case parser pp of+> Left er -> error $ "reparse\n" ++ show er ++ "\n" -- ++ pp ++ "\n"+> Right l -> l+> assertEqual ("reparse " ++ pp) ast ast''++> parseUtil1 :: (Show a) => String+> -> [Statement]+> -> (String -> Either a StatementList)+> -> Test.Framework.Test+> parseUtil1 src ast parser = testCase ("parse " ++ src) $ do+> let ast' = case parser src of+> Left er -> error $ show er+> Right l -> l+> assertEqual ("parse " ++ src) ast $ map stripAnnotations ast'+> -- pretty print then parse to check+> let pp = printSql ast'+> let ast'' = case parser pp of+> Left er -> error $ "reparse\n" ++ show er ++ "\n" -- ++ pp ++ "\n"+> Right l -> l+> assertEqual ("reparse " ++ pp) ast $ map stripAnnotations ast''+
− Database/HsSqlPpp/TypeChecking.ag
@@ -1,1091 +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 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...).--The main current limitation is that the ddl statements aren't passed-on in the scope so e.g. it doesn't type check a create table followed-by a select from that table. The support for this is nearly complete-and it should be working very soon.--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.--================================================================================--= main attributes used--Here are the main attributes used in the type checking:--sourcePos - holds the source position used in messages, not very-accurate at the moment, just gives you the position of the first-character in the current statement--actual value - add this to all nodes out of laziness. We use these-values in a limited number of places in the code---}--ATTR AllNodes- [ sourcePos: MySourcePos- |- |- ]--ATTR AllNodes Root ExpressionRoot- [ scope : Scope- |- | actualValue: SELF- ]--{---Node types--Just a hack to get started, provide a default type to each node (even-though it doesn't make sense for a lot of them), and provide default-rules for this attribute, even though this also doesn't make a lot of-sense. Will be reviewed and removed quite soon. (Some nodes will keep-the node type attribute, most will lose it.)---}--ATTR NonListNodes Root ExpressionRoot- [- |- | nodeType USE {`setUnknown`} {UnknownType} : {Type}- ]--ATTR ListNodes- [- |- | nodeType USE {`appendTypeList`} {TypeList []} : {Type}- ]--{-setUnknown :: Type -> Type -> Type-setUnknown _ _ = UnknownType--appendTypeList :: Type -> Type -> Type-appendTypeList t1 (TypeList ts) = TypeList (t1:ts)-appendTypeList t1 t2 = TypeList [t1,t2]-}--{--================================================================================--= statement info--slightly hacky, to support adding useful comments to sql source,-create a new data type which is more descriptive than Type, so-statements can expose information here. E.g. a create table can expose-the table name, a create function can expose the function prototype--This will evolve into the main annotation data type which is used to-supply information, e.g. to intersperse into some sql source, or to-get back info on an individual sql statement interactively in an ide.---}--{-data StatementInfo = DefaultStatementInfo Type- | RelvarInfo CompositeDef- | CreateFunctionInfo FunctionPrototype- | SelectInfo Type- | InsertInfo String Type- | UpdateInfo String Type- | DeleteInfo String- | CreateDomainInfo String Type- | DropInfo [(String,String)]- | DropFunctionInfo [(String,[Type])]- deriving (Eq,Show)-}--{---use this to make sure type errors are propagated into the statement---infos, temporary--makeStatementInfo :: Type -> StatementInfo -> StatementInfo-makeStatementInfo ty st =- if isError ty- then DefaultStatementInfo ty- else st- where- isError t = case t of- TypeError _ _ -> True- TypeList ts -> any isError ts- _ -> False-}--ATTR Statement- [- | backType : Type- | statementInfo : StatementInfo- ]--ATTR SourcePosStatement- [- |- | statementInfo : StatementInfo- ]--ATTR Root StatementList- [- |- | statementInfo : {[StatementInfo]}- ]--SEM StatementList- | Nil lhs.statementInfo = []- | Cons lhs.statementInfo = @hd.statementInfo : @tl.statementInfo----- don't know how to copy the nodetype to the statement info in the--- sem statement so bounce it out then back in like this-SEM SourcePosStatement- | Tuple x2.backType = @x2.nodeType--SEM Statement- | Copy CopyData Truncate- DropFunction DropSomething Assignment Return ReturnNext ReturnQuery- Raise NullStatement Perform Execute ExecuteInto ForSelectStatement- ForIntegerStatement WhileStatement ContinueStatement CaseStatement- If lhs.statementInfo = DefaultStatementInfo @lhs.backType--{---some helpers---}-SEM MaybeExpression- | Just lhs.nodeType = @just.nodeType- | Nothing lhs.nodeType = TypeList []--ATTR StringList- [- |- | strings : {[String]}- ]--SEM StringList- | Cons lhs.strings = @hd : @tl.strings- | Nil lhs.strings = []--{---================================================================================--semantics for source positions--source positions aren't collected by the parser properly yet, so we-just get what's available and propagate that. All the type errors-should collect the source position information properly, so when it-appears in the ast nodes, we can hook it up here and the errors should-start giving accurate positions.---}--SEM SourcePosStatement- | Tuple x2.sourcePos = @x1--SEM Root- | Root statements.sourcePos = ("",0,0)--SEM ExpressionRoot- | ExpressionRoot expr.sourcePos = ("",0,0)--{--================================================================================--= some basic typing--== type names--Types with type modifiers (called PrecTypeName here, to be changed),-are not supported at the moment.---}--SEM TypeName- | SimpleTypeName- --this needs to work a bit better, a simpletypename can match- --domains, composite types, etc., not just scalar types- lhs.nodeType = lookupTypeByName @lhs.scope @lhs.sourcePos $ canonicalizeTypeName @tn--- | PrecTypeName--- lhs.nodeType = if @tn `elem` defaultTypes--- then ScalarType @tn--- else TypeError @lhs.sourcePos--- (UnknownTypeError @tn)- | ArrayTypeName- lhs.nodeType = let t = ArrayType @typ.nodeType- in checkErrors- [@typ.nodeType- ,checkTypeExists @lhs.scope @lhs.sourcePos t]- t- | SetOfTypeName- lhs.nodeType = checkErrors [@typ.nodeType]- (SetOfType @typ.nodeType)--{--== literals--}--SEM Expression- | IntegerLit lhs.nodeType = typeInt- | StringLit lhs.nodeType = UnknownStringLit- | FloatLit lhs.nodeType = typeNumeric- | BooleanLit lhs.nodeType = typeBool- -- I think a null types like an unknown string lit- | NullLit lhs.nodeType = UnknownStringLit----{--================================================================================--= expressions--== cast expression---}--SEM Expression- | Cast lhs.nodeType = checkErrors [@expr.nodeType]- @tn.nodeType--{--== operators and functions--}--SEM Expression- | FunCall lhs.nodeType =- checkErrors [@args.nodeType] $- typeCheckFunCall- @lhs.scope- @lhs.sourcePos- @funName- @args.nodeType--{--== 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.--so, the caseexpressionlistexpressionpair items each set their node-type to a typelist with two elements, the first is a typelist of the-when expressions, and the second is the type of the then-expression. These can then be checked appropriately in the case or-casesimple sem code.---}--SEM Expression- | Case lhs.nodeType =- let elseThen =- case @els.nodeType of- TypeList [] -> []- t -> [t]- unwrappedLists = map unwrapTypeList $ unwrapTypeList @cases.nodeType- whenTypes :: [Type]- whenTypes = concat $ map unwrapTypeList $ map head unwrappedLists- thenTypes :: [Type]- thenTypes = map (head . tail) unwrappedLists ++ elseThen- whensAllBool :: Type- whensAllBool = if any (/= typeBool) whenTypes- then TypeError @lhs.sourcePos- (WrongTypes typeBool whenTypes)- else TypeList []- in checkErrors (whenTypes ++ thenTypes ++ [whensAllBool]) $- resolveResultSetType- @lhs.scope- @lhs.sourcePos- thenTypes--SEM Expression- | CaseSimple lhs.nodeType =- let elseThen =- case @els.nodeType of- TypeList [] -> []- t -> [t]- unwrappedLists = map unwrapTypeList $ unwrapTypeList @cases.nodeType- whenTypes :: [Type]- whenTypes = concat $ map unwrapTypeList $ map head unwrappedLists- thenTypes :: [Type]- thenTypes = map (head . tail) unwrappedLists ++ elseThen- checkWhenTypes = resolveResultSetType- @lhs.scope- @lhs.sourcePos- (@value.nodeType:whenTypes)- in checkErrors (whenTypes ++ thenTypes ++ [checkWhenTypes]) $- resolveResultSetType- @lhs.scope- @lhs.sourcePos- thenTypes---{--== identifiers-pull id types out of scope for identifiers---}--SEM Expression- | Identifier lhs.nodeType =- let (correlationName,iden) = splitIdentifier @i- in scopeLookupID @lhs.scope @lhs.sourcePos correlationName iden--{--- 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)-}--SEM Expression- | Exists lhs.nodeType = checkErrors [@sel.nodeType] typeBool--{--== scalar subquery-1 col -> type of that col-2 + cols -> row type--}--SEM Expression- | ScalarSubQuery- lhs.nodeType = let f = map snd $ unwrapComposite $ unwrapSetOf @sel.nodeType- in checkErrors [@sel.nodeType] $- case length f of- 0 -> error "internal error: no columns in scalar subquery?"- 1 -> head f- _ -> RowCtor f-{--== inlist--}-SEM Expression- | InPredicate- lhs.nodeType =- let er = resolveResultSetType- @lhs.scope- @lhs.sourcePos- [@expr.nodeType, @list.nodeType]- in checkErrors [er] typeBool--SEM InList- | InList- lhs.nodeType = resolveResultSetType- @lhs.scope- @lhs.sourcePos- $ unwrapTypeList @exprs.nodeType- | InSelect lhs.nodeType =- let attrs = map snd $ unwrapComposite $ unwrapSetOf $ @sel.nodeType- in case length attrs of- 0 -> error "internal error - got subquery with no columns? in inselect"- 1 -> head attrs- _ -> RowCtor attrs--{--================================================================================--= basic select statements--== nodeTypes---}--SEM Statement- | SelectStatement lhs.nodeType = @ex.nodeType- lhs.statementInfo = makeStatementInfo @lhs.backType $ SelectInfo @ex.nodeType--SEM SelectExpression- --assume we get TypeList (TypeList (Type)) out of vll- | Values lhs.nodeType =- checkErrors [@vll.nodeType] $- typeCheckValuesExpr- @lhs.scope- @lhs.sourcePos- @vll.nodeType- | Select- lhs.nodeType = checkErrors- [@selTref.nodeType- ,@selSelectList.nodeType- ,@selWhere.nodeType]- (let t = @selSelectList.nodeType- in case t of- UnnamedCompositeType [(_,Pseudo Void)] -> Pseudo Void- _ -> SetOfType @selSelectList.nodeType)- | CombineSelect lhs.nodeType =- checkErrors [@sel1.nodeType,@sel2.nodeType] $- typeCheckCombineSelect- @lhs.scope- @lhs.sourcePos- @sel1.nodeType- @sel2.nodeType--SEM TableRef- | SubTref lhs.nodeType = checkErrors [@sel.nodeType] $ unwrapSetOfComposite @sel.nodeType- lhs.idens = [(@alias, (unwrapComposite $ unwrapSetOf @sel.nodeType, []))]- lhs.joinIdens = []- | TrefAlias Tref- lhs.nodeType = fst $ getRelationType @lhs.scope @lhs.sourcePos @tbl- lhs.joinIdens = []- | Tref- lhs.idens = [(@tbl, both unwrapComposite $ getRelationType @lhs.scope @lhs.sourcePos @tbl)]- | TrefAlias- lhs.idens = [(@alias, both unwrapComposite $ getRelationType @lhs.scope @lhs.sourcePos @tbl)]- | TrefFun- lhs.nodeType = getFnType @lhs.scope @lhs.sourcePos "" @fn.actualValue @fn.nodeType- lhs.joinIdens = []- lhs.idens = [second (\l -> (unwrapComposite l, [])) $ getFunIdens @lhs.scope @lhs.sourcePos "" @fn.actualValue @fn.nodeType]- | TrefFunAlias- lhs.nodeType = getFnType @lhs.scope @lhs.sourcePos @alias @fn.actualValue @fn.nodeType- lhs.joinIdens = []- lhs.idens = [second (\l -> (unwrapComposite l, [])) $ getFunIdens @lhs.scope @lhs.sourcePos @alias @fn.actualValue @fn.nodeType]- | JoinedTref- lhs.nodeType =- checkErrors [@tbl.nodeType- ,@tbl1.nodeType]- ret- where- ret = case (@nat.actualValue, @onExpr.actualValue) of- (Natural, _) -> unionJoinList $ commonFieldNames- @tbl.nodeType- @tbl1.nodeType- (_,Just (JoinUsing s)) -> unionJoinList s- _ -> unionJoinList []- unionJoinList s = combineTableTypesWithUsingList- @lhs.scope- @lhs.sourcePos- s- @tbl.nodeType- @tbl1.nodeType- lhs.idens = @tbl.idens ++ @tbl1.idens- lhs.joinIdens = commonFieldNames @tbl.nodeType @tbl1.nodeType-{---returns the type of the relation, and the system columns also-getRelationType :: Scope -> MySourcePos -> String -> (Type,Type)-getRelationType scope sp tbl =- case getAttrs scope [TableComposite, ViewComposite] tbl of- Just ((_,_,a@(UnnamedCompositeType _))- ,(_,_,s@(UnnamedCompositeType _)) ) -> (a,s)- _ -> (TypeError sp (UnrecognisedRelation tbl), TypeList [])--getFnType :: Scope -> MySourcePos -> String -> Expression -> Type -> Type-getFnType scope sp alias fnVal fnType =- checkErrors [fnType] $ snd $ getFunIdens scope sp alias fnVal fnType--getFunIdens :: Scope -> MySourcePos -> String -> Expression -> Type -> (String, Type)-getFunIdens scope sp alias fnVal fnType =- case fnVal of- FunCall f _ ->- let correlationName = if alias /= ""- then alias- else f- in (correlationName, case fnType of- SetOfType (CompositeType t) -> getCompositeType t- SetOfType x -> UnnamedCompositeType [(correlationName,x)]- y -> UnnamedCompositeType [(correlationName,y)])- x -> ("", TypeError sp (ContextError "FunCall"))- where- getCompositeType t =- case getAttrs scope [Composite- ,TableComposite- ,ViewComposite] t of- Just ((_,_,a@(UnnamedCompositeType _)), _) -> a- _ -> UnnamedCompositeType []--commonFieldNames t1 t2 =- intersect (fn t1) (fn t2)- where- fn (UnnamedCompositeType s) = map fst s- fn _ = []--both :: (a->b) -> (a,a) -> (b,b)-both fn (x,y) = (fn x, fn y)--}----SEM MTableRef- | Nothing lhs.nodeType = TypeList []- lhs.idens = []- lhs.joinIdens = []- | Just lhs.nodeType = @just.nodeType---SEM Where- | Nothing lhs.nodeType = typeBool- | Just lhs.nodeType =- checkErrors- [@just.nodeType]- (if @just.nodeType /= typeBool- then TypeError @lhs.sourcePos ExpressionMustBeBool- else typeBool)--SEM SelectItem- | SelExp SelectItem lhs.nodeType = @ex.nodeType--SEM SelectItemList- | Cons lhs.nodeType =- foldr consComposite @tl.nodeType- (let (correlationName,iden) = splitIdentifier @hd.columnName- in if iden == "*"- then scopeExpandStar @lhs.scope @lhs.sourcePos correlationName- else [(iden, @hd.nodeType)])- | Nil lhs.nodeType = UnnamedCompositeType []--SEM SelectList- | SelectList lhs.nodeType = @items.nodeType--{---== scope passing--scope 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)-- 1. from- 2. where- 3. group by- 4. having- 5. select---}--ATTR TableRef- [- |- | idens : {[QualifiedScope]} joinIdens : {[String]}- ]--ATTR MTableRef- [- |- | idens : {[QualifiedScope]} joinIdens : {[String]}- ]---SEM SelectExpression- | Select- selSelectList.scope = scopeReplaceIds @lhs.scope @selTref.idens @selTref.joinIdens- selWhere.scope = scopeReplaceIds @lhs.scope @selTref.idens @selTref.joinIdens--{---== attributes--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--ATTR Expression- [- |- | liftedColumnName USE {`(fixedValue "")`} {""}: String- ]--{-fixedValue :: a -> a -> a -> a-fixedValue a _ _ = a-}--{--override for identifier nodes, this only makes it out to the selectitem-node if the identifier is not wrapped in parens, function calls, etc.--}--SEM Expression- | Identifier lhs.liftedColumnName = @i- | FunCall lhs.liftedColumnName =- if isOperator @funName- then ""- else @funName- | Cast lhs.liftedColumnName = case @tn.actualValue of- SimpleTypeName tn -> tn- _ -> ""---- 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--{--================================================================================--= insert---}--SEM Statement- | Insert- lhs.nodeType = checkErrors [checkTableExists @lhs.scope @lhs.sourcePos @table- ,@insData.nodeType- ,checkColumnConsistency @lhs.scope @lhs.sourcePos @table @targetCols.strings (unwrapComposite $ unwrapSetOf @insData.nodeType)]- @insData.nodeType- lhs.statementInfo =- makeStatementInfo @lhs.backType $ InsertInfo @table $ UnnamedCompositeType $ getColumnTypes @lhs.scope @lhs.sourcePos @table @targetCols.strings--{-checkTableExists :: Scope -> MySourcePos -> String -> Type-checkTableExists scope sp tbl =- case getAttrs scope [TableComposite, ViewComposite] tbl of- Just _ -> TypeList []- _ -> TypeError sp (UnrecognisedRelation tbl)--checkColumnConsistency :: Scope -> MySourcePos -> String -> [String] -> [(String,Type)] -> Type-checkColumnConsistency scope sp tbl cols' insNameTypePairs =- let --todo: check the cols have no duplicates- --todo: check the missing target cols have defaults- targetTableType = fst $ getRelationType scope sp tbl- targetTableCols = unwrapComposite targetTableType- --check the num cols in the insdata match the number of cols- cols = if null cols'- then map fst targetTableCols- else cols'- wrongLengthError = if length insNameTypePairs /= length cols- then TypeError sp WrongNumberOfColumns- else TypeList []- --check the target cols appear in the target table and get their types- nonMatchingColumns = cols \\ map fst targetTableCols- nonMatchingErrors = case length nonMatchingColumns of- 0 -> TypeList []- 1 -> makeUnknownColumnError $ head nonMatchingColumns- _ -> TypeList $ map makeUnknownColumnError nonMatchingColumns- targetNameTypePairs = map (\l -> (l, fromJust $ lookup l targetTableCols)) 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- matchingTypeErrors = map (\(_,b,c) -> checkAssignmentValid scope sp c b) typeTriples- in checkErrors [targetTableType- ,wrongLengthError- ,nonMatchingErrors- ,TypeList matchingTypeErrors] $ TypeList []- where- makeUnknownColumnError = TypeError sp . UnrecognisedIdentifier--getColumnTypes :: Scope -> MySourcePos -> String -> [String] -> [(String,Type)]-getColumnTypes scope sp tbl cols' =- let targetTableType = fst $ getRelationType scope sp tbl- targetTableCols = unwrapComposite targetTableType- cols = if null cols'- then map fst targetTableCols- else cols'- nonMatchingColumns = cols \\ map fst targetTableCols- nonMatchingErrors = case length nonMatchingColumns of- 0 -> TypeList []- 1 -> makeUnknownColumnError $ head nonMatchingColumns- _ -> TypeList $ map makeUnknownColumnError nonMatchingColumns- in map (\l -> (l, fromJust $ lookup l targetTableCols)) cols- where- makeUnknownColumnError = TypeError sp . UnrecognisedIdentifier-}--{--================================================================================--= update---}-SEM Statement- | Update- lhs.nodeType =- checkErrors [checkTableExists @lhs.scope @lhs.sourcePos @table- ,@whr.nodeType- ,@assigns.nodeType- ,checkColumnConsistency @lhs.scope @lhs.sourcePos- @table colNames colTypes]- @assigns.nodeType- where- colNames = map fst @assigns.pairs- colTypes = @assigns.pairs- lhs.statementInfo =- makeStatementInfo @lhs.backType $ UpdateInfo @table $- UnnamedCompositeType $ getColumnTypes @lhs.scope @lhs.sourcePos @table $ map fst @assigns.pairs--ATTR SetClauseList- [- |- | pairs : {[(String,Type)]}- ]--ATTR SetClause- [- |- | pairs : {[(String,Type)]}- ]--SEM SetClauseList- | Cons lhs.pairs = @hd.pairs ++ @tl.pairs- | Nil lhs.pairs = []--SEM SetClause- | SetClause- lhs.nodeType = checkErrors [@val.nodeType] $ TypeList []- lhs.pairs = [(@att, @val.nodeType)]- | RowSetClause- lhs.nodeType =- let atts = @atts.strings- types = getRowTypes @vals.nodeType- lengthError = if length atts /= length types- then TypeError @lhs.sourcePos WrongNumberOfColumns- else TypeList []- in checkErrors [lengthError] $ TypeList []- lhs.pairs = zip @atts.strings $ getRowTypes @vals.nodeType--{-getRowTypes :: Type -> [Type]-getRowTypes (TypeList [(RowCtor ts)]) = ts-getRowTypes (TypeList ts) = ts-getRowTypes x = error $ "cannot get row types from " ++ show x-}--{--================================================================================--= delete--}--SEM Statement- | Delete- lhs.nodeType =- checkErrors [checkTableExists @lhs.scope @lhs.sourcePos @table- ,@whr.nodeType]- $ TypeList []- lhs.statementInfo =- makeStatementInfo @lhs.backType $ DeleteInfo @table--{--================================================================================--= create table--scope needs to be modified:-types, typenames, typecats, attrdefs, systemcolumns--produces a compositedef: (name, tablecomposite, unnamedcomp [(attrname, type)])---}--ATTR AttributeDef- [- |- | attrName : String- ]--SEM AttributeDef- | AttributeDef- lhs.attrName = @name- lhs.nodeType = @typ.nodeType--SEM AttributeDefList- | Cons lhs.nodeType =- checkErrors [@tl.nodeType, @hd.nodeType] $- consComposite (@hd.attrName, @hd.nodeType) @tl.nodeType- | Nil lhs.nodeType = UnnamedCompositeType []--SEM Statement- | CreateTable lhs.nodeType = @atts.nodeType- lhs.statementInfo = makeStatementInfo @lhs.backType $ RelvarInfo (@name, TableComposite, @atts.nodeType)---SEM Statement- | CreateTableAs lhs.statementInfo = makeStatementInfo @lhs.backType $ RelvarInfo (@name, TableComposite, @expr.nodeType)---{--================================================================================--= create view---}--SEM Statement- | CreateView lhs.statementInfo = makeStatementInfo @lhs.backType $ RelvarInfo (@name, ViewComposite, @expr.nodeType)---{--================================================================================--= create type---}--ATTR TypeAttributeDef- [- |- | attrName : String- ]---SEM TypeAttributeDef- | TypeAttDef- lhs.nodeType = @typ.nodeType- lhs.attrName = @name--SEM TypeAttributeDefList- | Cons lhs.nodeType =- checkErrors [@tl.nodeType, @hd.nodeType] $- consComposite (@hd.attrName, @hd.nodeType) @tl.nodeType- | Nil lhs.nodeType = UnnamedCompositeType []--SEM Statement- | CreateType- lhs.statementInfo = makeStatementInfo @lhs.backType $ RelvarInfo (@name, Composite, @atts.nodeType)--{--================================================================================--= create domain---}--SEM Statement- | CreateDomain- lhs.statementInfo = makeStatementInfo @lhs.backType $ CreateDomainInfo @name @typ.nodeType--{--================================================================================--= create function--ignore body for now, just get the signature--}--ATTR ParamDef- [- |- | paramName : String- ]--ATTR ParamDefList- [- |- | params : {[(String,Type)]}- ]--SEM ParamDef- | ParamDef ParamDefTp- lhs.nodeType = @typ.nodeType- | ParamDef- lhs.paramName = @name- | ParamDefTp- lhs.paramName = ""--SEM ParamDefList- | Nil lhs.params = []- | Cons lhs.params = ((@hd.paramName, @hd.nodeType) : @tl.params)--SEM Statement- | CreateFunction- lhs.statementInfo =- makeStatementInfo @lhs.backType $ CreateFunctionInfo (@name,map snd @params.params,@rettype.nodeType)---{--================================================================================--= 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.--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.--Both the workarounds to these seem a bit tedious and error prone, and-will make the code much less readable. Maybe need a preprocessor to-produce the ag file? Alternatively, just attach the messages to each-node (so this appears in the data types and isn't an attribute, then-have a tree walker collect them all). Since an annotation field in-each node is going to be added anyway, so each node can be labelled-with a type, will probably do this at some point.--================================================================================--= 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 @lhs.sourcePos 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/TypeChecking/Ast.lhs view
@@ -0,0 +1,85 @@+Copyright 2009 Jake Wheat++This is the public module for the ast nodes.++> {- | This module contains the ast node data types.+> -}+> module Database.HsSqlPpp.TypeChecking.Ast+> (+> -- * Main nodes+> StatementList+> ,Statement (..)+> ,Expression (..)+> ,SelectExpression (..)+> -- * Components+> -- ** Selects+> ,SelectList (..)+> ,SelectItem (..)+> ,TableRef (..)+> ,JoinExpression (..)+> ,JoinType (..)+> ,Natural (..)+> ,CombineType (..)+> ,Direction (..)+> ,Distinct (..)+> ,InList (..)+> -- ** dml+> ,SetClause (..)+> ,CopySource (..)+> ,RestartIdentity (..)+> -- ** ddl+> ,AttributeDef (..)+> ,RowConstraint (..)+> ,Constraint (..)+> ,TypeAttributeDef (..)+> ,TypeName (..)+> ,DropType (..)+> ,IfExists (..)+> ,Cascade (..)+> -- ** functions+> ,FnBody (..)+> ,ParamDef (..)+> ,VarDef (..)+> ,RaiseType (..)+> ,Volatility (..)+> ,Language (..)+> -- ** typedefs+> ,ExpressionListStatementListPairList+> ,ExpressionListStatementListPair+> ,ExpressionList+> ,StringList+> ,ParamDefList+> ,AttributeDefList+> ,ConstraintList+> ,TypeAttributeDefList+> ,Where+> ,StringStringListPairList+> ,StringStringListPair+> ,ExpressionStatementListPairList+> ,SetClauseList+> ,CaseExpressionListExpressionPairList+> ,MaybeExpression+> ,MTableRef+> ,ExpressionListList+> ,SelectItemList+> ,OnExpr+> ,RowConstraintList+> ,VarDefList+> ,ExpressionStatementListPair+> ,MExpression+> ,CaseExpressionListExpressionPair+> ,CaseExpressionList++> -- * operator utils+> ,OperatorType(..)+> ,getOperatorType+> -- * 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+> ) where++> import Database.HsSqlPpp.TypeChecking.AstInternal+> import Database.HsSqlPpp.TypeChecking.AstUtils+
+ Database/HsSqlPpp/TypeChecking/AstAnnotation.lhs view
@@ -0,0 +1,149 @@+Copyright 2009 Jake Wheat++The annotation data types and utilities for working with them.++Annotations are used to store source positions, types, errors,+warnings, scope 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 #-}+> {-# OPTIONS_HADDOCK hide #-}++> module Database.HsSqlPpp.TypeChecking.AstAnnotation+> (+> Annotated(..)+> ,Annotation+> ,AnnotationElement(..)+> ,stripAnnotations+> ,getTopLevelTypes+> ,getTopLevelInfos+> ,getTypeAnnotation+> ,getTypeErrors+> ,pack+> ,StatementInfo(..)+> ,getSIAnnotation+> ) where++> import Database.HsSqlPpp.TypeChecking.TypeType++> -- | 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+> | StatementInfoA StatementInfo+> deriving (Eq, Show)++> class Annotated a where+> ann :: a -> Annotation+> setAnn :: a -> Annotation -> a+> changeAnn :: a -> (Annotation -> Annotation) -> a+> changeAnn a = setAnn a . ($ ann a)+> changeAnnRecurse :: (Annotation -> Annotation) -> a -> a+> getAnnChildren :: a -> [Annotatable]++> data Annotatable = forall a . (Annotated a, Show a) => MkAnnotatable a++> instance Show Annotatable+> where+> showsPrec p (MkAnnotatable a) = showsPrec p a++> pack :: (Annotated a, Show a) => a -> Annotatable+> pack = MkAnnotatable++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 :: Annotated a => a -> a+> stripAnnotations = changeAnnRecurse (const [])++> -- | run through the ast, and pull the type annotation from each+> -- of the top level items.+> getTopLevelTypes :: Annotated a =>+> [a] -- ^ the ast items+> -> [Type] -- ^ the type annotations, this list should be the same+> -- length as the argument+> getTopLevelTypes = map getTypeAnnotation++> getTypeAnnotation :: Annotated a => a -> Type+> getTypeAnnotation at = let as = ann at+> in gta as+> where+> gta (x:xs) = case x of+> TypeAnnotation t -> t+> _ -> gta xs+> gta _ = TypeCheckFailed -- error "couldn't find type annotation"++> getSIAnnotation :: Annotated a => a -> StatementInfo+> getSIAnnotation at = let as = ann at+> in gta as+> where+> gta (x:xs) = case x of+> StatementInfoA t -> t+> _ -> gta xs+> gta _ = error "couldn't find statement info annotation"+++> getAnnotationsRecurse :: Annotated a => a -> [Annotation]+> getAnnotationsRecurse a =+> ann a : concatMap getAnnotationsRecurse' (getAnnChildren a)+> where+> getAnnotationsRecurse' :: Annotatable -> [Annotation]+> getAnnotationsRecurse' an =+> hann an : concatMap getAnnotationsRecurse' (hgac an)+> hann (MkAnnotatable an) = ann an+> hgac (MkAnnotatable an) = getAnnChildren an++> -- | 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.+> -- Source position information will be added to the return type at some point+> getTypeErrors :: Annotated a => [a] -> [TypeError]+> getTypeErrors sts =+> concatMap (concatMap gte . getAnnotationsRecurse) sts+> where+> gte (a:as) = case a of+> TypeErrorA e -> [e]+> _ -> gte as+> gte _ = []++> -- | Run through the ast given and return a list of statementinfos+> -- from the top level items.+> getTopLevelInfos :: Annotated a =>+> [a] -- ^ the ast to check+> -> [StatementInfo]+> getTopLevelInfos = map getSIAnnotation+++> data StatementInfo = DefaultStatementInfo Type+> | RelvarInfo CompositeDef+> | CreateFunctionInfo FunctionPrototype+> | SelectInfo Type+> | InsertInfo String Type+> | UpdateInfo String Type+> | DeleteInfo String+> | CreateDomainInfo String Type+> | DropInfo [(String,String)]+> | DropFunctionInfo [(String,[Type])]+> deriving (Eq,Show)++todo:+add scope deltas to statementinfo++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?
+ Database/HsSqlPpp/TypeChecking/AstInternal.ag view
@@ -0,0 +1,961 @@+{-+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 pretty printer.++= compiling++use++uuagc -dcfws AstInternal.ag++to generate a new AstInternal.hs from this file++(install uuagc with+cabal install uuagc+)++-}+MODULE {Database.HsSqlPpp.TypeChecking.AstInternal}+{+ --from the ag files:+ --ast nodes+ 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 (..)+ ,StatementList+ ,ExpressionListStatementListPairList+ ,ExpressionListStatementListPair+ ,ExpressionList+ ,StringList+ ,ParamDefList+ ,AttributeDefList+ ,ConstraintList+ ,TypeAttributeDefList+ ,Where+ ,StringStringListPairList+ ,StringStringListPair+ ,ExpressionStatementListPairList+ ,SetClauseList+ ,CaseExpressionListExpressionPairList+ ,MaybeExpression+ ,MTableRef+ ,ExpressionListList+ ,SelectItemList+ ,OnExpr+ ,RowConstraintList+ ,VarDefList+ ,ExpressionStatementListPair+ ,MExpression+ ,CaseExpressionListExpressionPair+ ,CaseExpressionList+ -- annotations+ ,annotateAst+ ,annotateAstScope+ ,annotateExpression+}++{+import Data.Maybe+import Data.List+import Debug.Trace+import Control.Monad.Error+import Control.Arrow+import Data.Either+import Control.Applicative++import Database.HsSqlPpp.TypeChecking.TypeType+import Database.HsSqlPpp.TypeChecking.AstUtils+import Database.HsSqlPpp.TypeChecking.TypeConversion+import Database.HsSqlPpp.TypeChecking.TypeCheckingH+import Database.HsSqlPpp.TypeChecking.Scope+import Database.HsSqlPpp.TypeChecking.ScopeData+import Database.HsSqlPpp.TypeChecking.AstAnnotation++}++{-+================================================================================++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 : (Maybe SelectList)+ --tablename setitems where returning+ | Update ann:Annotation+ table : String+ assigns : SetClauseList+ whr : Where+ returning : (Maybe SelectList)+ --tablename, where, returning+ | Delete ann:Annotation+ table : String+ whr : Where+ returning : (Maybe SelectList)+ --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+ | 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+ lang : Language+ name : String+ params : ParamDefList+ rettype : TypeName+ bodyQuote : String+ body : FnBody+ vol : Volatility+ -- name type checkexpression+ | CreateDomain ann:Annotation+ name : String+ typ : TypeName+ check : (Maybe Expression)+ -- ifexists (name,argtypes)* cascadeorrestrict+ | DropFunction ann:Annotation+ ifE : IfExists+ sigs : StringStringListPairList+ 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 : (Maybe Expression)+ | 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++-- =============================================================================++--Statement components++-- maybe this should be called relation valued expression?+DATA SelectExpression+ | Select ann:Annotation+ selDistinct : Distinct+ selSelectList : SelectList+ selTref : MTableRef+ selWhere : Where+ selGroupBy : ExpressionList+ selHaving : MExpression+ selOrderBy : ExpressionList+ selDir : Direction+ selLimit : MExpression+ selOffset : MExpression+ | CombineSelect ann:Annotation+ ctype : CombineType+ sel1 : SelectExpression+ sel2 : SelectExpression+ | Values ann:Annotation+ vll:ExpressionListList++TYPE MTableRef = MAYBE TableRef+TYPE Where = MAYBE Expression+TYPE MExpression = MAYBE Expression++DATA FnBody | SqlFnBody sts : StatementList+ | PlpgsqlFnBody VarDefList sts : StatementList++DATA SetClause | SetClause att:String val:Expression+ | RowSetClause atts:StringList vals:ExpressionList++DATA TableRef | Tref ann:Annotation+ tbl:String+ | TrefAlias ann:Annotation+ tbl : String+ alias : String+ | JoinedTref ann:Annotation+ tbl : TableRef+ nat : Natural+ joinType : JoinType+ tbl1 : TableRef+ onExpr : OnExpr+ | SubTref ann:Annotation+ sel : SelectExpression+ alias : String+ | TrefFun ann:Annotation+ fn:Expression+ | TrefFunAlias ann:Annotation+ fn:Expression+ alias:String++TYPE OnExpr = MAYBE JoinExpression++DATA JoinExpression | JoinOn Expression | JoinUsing StringList++DATA JoinType | Inner | LeftOuter| RightOuter | FullOuter | Cross++-- select columns, into columns++DATA SelectList | SelectList items:SelectItemList StringList++DATA SelectItem | SelExp ex:Expression+ | SelectItem ex:Expression name:String++DATA CopySource | CopyFilename String | Stdin++--name type default null constraint++DATA AttributeDef | AttributeDef name : String+ typ : TypeName+ check : (Maybe Expression)+ cons : RowConstraintList++--Constraints which appear attached to an individual field++DATA RowConstraint | NullConstraint+ | NotNullConstraint+ | RowCheckConstraint Expression+ | RowUniqueConstraint+ | RowPrimaryKeyConstraint+ | RowReferenceConstraint table : String+ att : (Maybe String)+ onUpdate : Cascade+ onDelete : Cascade++--constraints which appear on a separate row in the create table++DATA Constraint | UniqueConstraint StringList+ | PrimaryKeyConstraint StringList+ | CheckConstraint Expression+ -- sourcecols targettable targetcols ondelete onupdate+ | ReferenceConstraint atts : StringList+ table : String+ tableAtts : StringList+ onUpdate : Cascade+ onDelete : Cascade++DATA TypeAttributeDef | TypeAttDef name : String+ typ : TypeName++DATA ParamDef | ParamDef name:String typ:TypeName+ | ParamDefTp typ:TypeName++DATA VarDef | VarDef 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 tn:String+ | PrecTypeName tn:String prec:Integer+ | ArrayTypeName typ:TypeName+ | SetOfTypeName 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+ | 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 selectitem partitionby orderby orderbyasc?+ | WindowFn ann:Annotation+ fn : Expression+ partitionBy : ExpressionList+ orderBy : ExpressionList+ dir : Direction+ | ScalarSubQuery ann:Annotation+ sel : SelectExpression++DATA InList | InList exprs : ExpressionList+ | InSelect sel : SelectExpression++TYPE MaybeExpression = MAYBE Expression++{-++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 StringStringListPair = (String,StringList)+TYPE StringStringListPairList = [StringStringListPair]+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]++-- 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+ ExpressionList ExpressionListList StringList SetClauseList+ AttributeDefList ConstraintList TypeAttributeDefList+ ParamDefList StringStringListPair StringStringListPairList+ StatementList ExpressionListStatementListPair+ ExpressionListStatementListPairList ExpressionStatementListPair+ ExpressionStatementListPairList VarDefList SelectItemList+ RowConstraintList CaseExpressionListExpressionPair+ CaseExpressionListExpressionPairList CaseExpressionList+ MTableRef TableRef OnExpr Where MExpression++DERIVING AllNodes: Show,Eq++INCLUDE "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++-}+{+-- | Takes an ast, and adds annotations, including types, type errors,+-- and statement info. Type checks against defaultScope.+annotateAst :: StatementList -> StatementList+annotateAst = annotateAstScope defaultScope++-- | As annotateAst but you supply an additional scope to add to the+-- defaultScope to type check against. See Scope module for how to+-- read a scope from an existing database so you can type check+-- against it.+annotateAstScope :: Scope -> StatementList -> StatementList+annotateAstScope scope sts =+ let t = sem_Root (Root sts)+ ta = wrap_Root t Inh_Root {scope_Inh_Root = combineScopes defaultScope scope}+ tl = annotatedTree_Syn_Root ta+ in case tl of+ Root r -> r++-- | Testing utility, mainly used to check an expression for type errors+-- or to get its type.+annotateExpression :: Scope -> Expression -> Expression+annotateExpression scope ex =+ let t = sem_ExpressionRoot (ExpressionRoot ex)+ rt = (annotatedTree_Syn_ExpressionRoot+ (wrap_ExpressionRoot t Inh_ExpressionRoot {scope_Inh_ExpressionRoot = combineScopes defaultScope scope}))+ in case rt of+ ExpressionRoot e -> e++{-++================================================================================++= instances for Annotated.++Hopefully, some sort of SYB approach can be used to autogenerate these+in the future. It is imperative that this or template haskell or+something similar be used because doing it by hand guarantees some+bits will be missed.++Stupidity watch update: use attributes to do this. Doh.++-}++instance Annotated Statement where+ ann a =+ case a of+ SelectStatement ann _ -> ann+ Insert ann _ _ _ _ -> ann+ Update ann _ _ _ _ -> ann+ Delete ann _ _ _ -> ann+ Copy ann _ _ _ -> ann+ CopyData ann _ -> ann+ Truncate ann _ _ _ -> ann+ CreateTable ann _ _ _ -> ann+ CreateTableAs ann _ _ -> ann+ CreateView ann _ _ -> ann+ CreateType ann _ _ -> ann+ CreateFunction ann _ _ _ _ _ _ _ -> ann+ CreateDomain ann _ _ _ -> ann+ DropFunction ann _ _ _ -> ann+ DropSomething ann _ _ _ _ -> ann+ Assignment ann _ _ -> ann+ Return ann _ -> ann+ ReturnNext ann _ -> ann+ ReturnQuery ann _ -> ann+ Raise ann _ _ _ -> ann+ NullStatement ann -> ann+ Perform ann _ -> ann+ Execute ann _ -> ann+ ExecuteInto ann _ _ -> ann+ ForSelectStatement ann _ _ _ -> ann+ ForIntegerStatement ann _ _ _ _ -> ann+ WhileStatement ann _ _ -> ann+ ContinueStatement ann -> ann+ CaseStatement ann _ _ _ -> ann+ If ann _ _ -> ann+ setAnn st a =+ case st of+ SelectStatement _ ex -> SelectStatement a ex+ Insert _ tbl cols ins ret -> Insert a tbl cols ins ret+ Update _ tbl as whr ret -> Update a tbl as whr ret+ Delete _ tbl whr ret -> Delete a tbl whr ret+ Copy _ tbl cols src -> Copy a tbl cols src+ CopyData _ i -> CopyData a i+ Truncate _ tbls ri cs -> Truncate a tbls ri cs+ CreateTable _ name atts cons -> CreateTable a name atts cons+ CreateTableAs _ name ex -> CreateTableAs a name ex+ CreateView _ name expr -> CreateView a name expr+ CreateType _ name atts -> CreateType a name atts+ CreateFunction _ lang name params rettype bodyQuote body vol ->+ CreateFunction a lang name params rettype bodyQuote body vol+ CreateDomain _ name typ check -> CreateDomain a name typ check+ DropFunction _ i s cs -> DropFunction a i s cs+ DropSomething _ dt i nms cs -> DropSomething a dt i nms cs+ Assignment _ tgt val -> Assignment a tgt val+ Return _ v -> Return a v+ ReturnNext _ ex -> ReturnNext a ex+ ReturnQuery _ sel -> ReturnQuery a sel+ Raise _ l m args -> Raise a l m args+ NullStatement _ -> NullStatement a+ Perform _ expr -> Perform a expr+ Execute _ expr -> Execute a expr+ ExecuteInto _ expr tgts -> ExecuteInto a expr tgts+ ForSelectStatement _ var sel sts -> ForSelectStatement a var sel sts+ ForIntegerStatement _ var from to sts -> ForIntegerStatement a var from to sts+ WhileStatement _ expr sts -> WhileStatement a expr sts+ ContinueStatement _ -> ContinueStatement a+ CaseStatement _ val cases els -> CaseStatement a val cases els+ If _ cases els -> If a cases els++ changeAnnRecurse f st =+ case st of+ SelectStatement a ex -> SelectStatement (f a) ex+ Insert a tbl cols ins ret -> Insert (f a) tbl cols ins ret+ Update a tbl as whr ret -> Update (f a) tbl as whr ret+ Delete a tbl whr ret -> Delete (f a) tbl whr ret+ Copy a tbl cols src -> Copy (f a) tbl cols src+ CopyData a i -> CopyData (f a) i+ Truncate a tbls ri cs -> Truncate (f a) tbls ri cs+ CreateTable a name atts cons -> CreateTable (f a) name atts cons+ CreateTableAs a name ex -> CreateTableAs (f a) name ex+ CreateView a name expr -> CreateView (f a) name expr+ CreateType a name atts -> CreateType (f a) name atts+ CreateFunction a lang name params rettype bodyQuote body vol ->+ CreateFunction (f a) lang name params rettype bodyQuote doBody vol+ where+ doBody = case body of+ SqlFnBody sts -> SqlFnBody $ cars f sts+ PlpgsqlFnBody vars sts -> PlpgsqlFnBody vars $ cars f sts+ CreateDomain a name typ check -> CreateDomain (f a) name typ check+ DropFunction a i s cs -> DropFunction (f a) i s cs+ DropSomething a dt i nms cs -> DropSomething (f a) dt i nms cs+ Assignment a tgt val -> Assignment (f a) tgt val+ Return a v -> Return (f a) v+ ReturnNext a ex -> ReturnNext (f a) ex+ ReturnQuery a sel -> ReturnQuery (f a) sel+ Raise a l m args -> Raise (f a) l m args+ NullStatement a -> NullStatement (f a)+ Perform a expr -> Perform (f a) expr+ Execute a expr -> Execute (f a) expr+ ExecuteInto a expr tgts -> ExecuteInto (f a) expr tgts+ ForSelectStatement a var sel sts -> ForSelectStatement (f a) var sel $ cars f sts+ ForIntegerStatement a var from to sts -> ForIntegerStatement (f a) var from to $ cars f sts+ WhileStatement a expr sts -> WhileStatement (f a) expr $ cars f sts+ ContinueStatement a -> ContinueStatement (f a)+ CaseStatement a val cases els -> CaseStatement (f a) val doCases $ cars f els+ where+ doCases = map (second (cars f)) cases+ If a cases els -> If (f a) doCases $ cars f els+ where+ doCases = map (second (cars f)) cases+ --where+ -- doCases cs = map (\(ex,sts) -> (ex,cars f sts)) cs+ getAnnChildren st =+ case st of+ SelectStatement _ ex -> gacse ex+ Insert _ _ _ ins _ -> gacse ins+ Update _ _ as whr _ -> mp (gacscl as) ++ gacme whr+ Delete _ _ whr _ -> gacme whr+ --Copy _ _ _ _ -> []+ --CopyData _ _ -> []+ --Truncate _ _ _ _ -> []+ --CreateTable _ _ _ _ -> []+ --CreateTableAs _ _ _ -> []+ CreateView _ _ expr -> gacse expr+ --CreateType _ _ _ -> []+ --CreateFunction a lang name params rettype bodyQuote body vol ->+ CreateFunction _ _ _ _ _ _ body _ ->+ case body of+ SqlFnBody sts -> mp sts+ PlpgsqlFnBody _ sts -> mp sts+ --CreateDomain _ _ _ _ -> []+ --DropFunction _ _ _ _ -> []+ --DropSomething _ _ _ _ _ -> []+ --Assignment _ _ _ -> []+ --Return a v -> Return (f a) v+ --ReturnNext a ex -> ReturnNext (f a) ex+ --ReturnQuery a sel -> ReturnQuery (f a) sel+ --Raise a l m args -> Raise (f a) l m args+ --NullStatement a -> NullStatement (f a)+ --Perform a expr -> Perform (f a) expr+ --Execute a expr -> Execute (f a) expr+ --ExecuteInto a expr tgts -> ExecuteInto (f a) expr tgts+ ForSelectStatement _ _ sel sts -> gacse sel ++ mp sts+ ForIntegerStatement _ _ _ _ sts -> mp sts+ WhileStatement _ expr sts -> pack expr : mp sts+ --ContinueStatement a -> ContinueStatement (f a)+ CaseStatement _ val cases els -> pack val : mp (doCases cases) ++ mp els+ If _ cases els -> mp $ doCases cases ++ els+ _ -> []+ where+ doCases = concatMap snd+ --gacse :: Annotated a => SelectExpression -> [a]+ gacse se = [pack se]+ gacscl :: Annotated a => SetClauseList -> [a]+ gacscl _ = []+ --gacme :: Annotated a => Maybe Expression -> [a]+ gacme e = case e of+ Nothing -> []+ Just e1 -> [pack e1]+ mp = map pack++cars = map . changeAnnRecurse++instance Annotated Expression where+ ann a =+ case a of+ IntegerLit ann _ -> ann+ FloatLit ann _ -> ann+ StringLit ann _ _ -> ann+ NullLit ann -> ann+ BooleanLit ann _ -> ann+ PositionalArg ann _ -> ann+ Cast ann _ _ -> ann+ Identifier ann _ -> ann+ Case ann _ _ -> ann+ CaseSimple ann _ _ _ -> ann+ Exists ann _ -> ann+ FunCall ann _ _ -> ann+ InPredicate ann _ _ _ -> ann+ WindowFn ann _ _ _ _ -> ann+ ScalarSubQuery ann _ -> ann+ setAnn ex a =+ case ex of+ IntegerLit _ i -> IntegerLit a i+ FloatLit _ d -> FloatLit a d+ StringLit _ q v -> StringLit a q v+ NullLit _ -> NullLit a+ BooleanLit _ b -> BooleanLit a b+ PositionalArg _ p -> PositionalArg a p+ Cast _ expr tn -> Cast a expr tn+ Identifier _ i -> Identifier a i+ Case _ cases els -> Case a cases els+ CaseSimple _ val cases els -> CaseSimple a val cases els+ Exists _ sel -> Exists a sel+ FunCall _ funName args -> FunCall a funName args+ InPredicate _ expr i list -> InPredicate a expr i list+ WindowFn _ fn par ord dir -> WindowFn a fn par ord dir+ ScalarSubQuery _ sel -> ScalarSubQuery a sel++ changeAnnRecurse f ex =+ case ex of+ IntegerLit a i -> IntegerLit (f a) i+ FloatLit a d -> FloatLit (f a) d+ StringLit a q v -> StringLit (f a) q v+ NullLit a -> NullLit a+ BooleanLit a b -> BooleanLit (f a) b+ PositionalArg a p -> PositionalArg (f a) p+ Cast a expr tn -> Cast (f a) (changeAnnRecurse f expr) tn+ Identifier a i -> Identifier (f a) i+ Case a cases els -> Case (f a) cases els+ CaseSimple a val cases els -> CaseSimple (f a) val cases els+ Exists a sel -> Exists (f a) sel+ FunCall a funName args -> FunCall (f a) funName args+ InPredicate a expr i list -> InPredicate (f a) expr i list+ WindowFn a fn par ord dir -> WindowFn (f a) fn par ord dir+ ScalarSubQuery a sel -> ScalarSubQuery (f a) sel++ getAnnChildren ex =+ case ex of+ Cast _ expr _ -> mp [expr]+ Case _ cases els -> gacce cases els+ CaseSimple _ val cases els -> pack val : gacce cases els+ Exists a sel -> [pack sel]+ FunCall _ _ args -> mp args+ --InPredicate a expr i list -> InPredicate (f a) expr i list+ --WindowFn a fn par ord dir -> WindowFn (f a) fn par ord dir+ --ScalarSubQuery a sel -> ScalarSubQuery (f a) sel+ _ -> []+ where+ gacme e = case e of+ Nothing -> []+ Just e1 -> [pack e1]+ gacce cs el = mp (concatMap (\(el,e) -> el ++ [e]) cs) ++ gacme el+ mp = map pack++++instance Annotated SelectExpression where+ ann a =+ case a of+ Select ann _ _ _ _ _ _ _ _ _ _ -> ann+ CombineSelect ann _ _ _ -> ann+ Values ann _ -> ann+ setAnn ex a =+ case ex of+ Select _ dis sl tref whr grp hav ord dir lim off ->+ Select a dis sl tref whr grp hav ord dir lim off+ CombineSelect _ ctype sel1 sel2 -> CombineSelect a ctype sel1 sel2+ Values _ vll -> Values a vll+ changeAnnRecurse f ex =+ case ex of+ Select a dis sl tref whr grp hav ord dir lim off ->+ Select (f a) dis sl tref whr grp hav ord dir lim off+ CombineSelect a ctype sel1 sel2 -> CombineSelect (f a) ctype+ (changeAnnRecurse f sel1)+ (changeAnnRecurse f sel2)+ Values a vll -> Values (f a) vll+ getAnnChildren ex =+ case ex of+ Select a dis sl tref whr grp hav ord dir lim off ->+ doSl +++ map pack (maybeToList tref) +++ doME whr ++ mp grp ++ doME hav ++ mp ord ++ doME lim ++ doME off+ where+ doSl = let SelectList x _ = sl+ ses = map (\s -> case s of+ SelExp se -> se+ SelectItem se _ -> se) x+ in map pack ses+ doME me = case me of+ Nothing -> []+ Just e -> [pack e]+ CombineSelect _ _ sel1 sel2 -> [pack sel1,pack sel2]+ Values _ vll -> mp $ concat vll+ where+ mp = map pack++instance Annotated TableRef where+ ann a =+ case a of+ Tref ann _ -> ann+ TrefAlias ann _ _ -> ann+ JoinedTref ann _ _ _ _ _ -> ann+ SubTref ann _ _ -> ann+ TrefFun ann _ -> ann+ TrefFunAlias ann _ _ -> ann+ setAnn ex a =+ case ex of+ Tref _ tbl -> Tref a tbl+ TrefAlias _ tbl alias -> TrefAlias a tbl alias+ JoinedTref _ tbl nat joinType tbl1 onExpr -> JoinedTref a tbl nat joinType tbl1 onExpr+ SubTref _ sel alias -> SubTref a sel alias+ TrefFun _ fn -> TrefFun a fn+ TrefFunAlias _ fn alias -> TrefFunAlias a fn alias+ changeAnnRecurse f ex =+ case ex of+ Tref a tbl -> Tref (f a) tbl+ TrefAlias a tbl alias -> TrefAlias (f a) tbl alias+ JoinedTref a tbl nat joinType tbl1 onExpr ->+ JoinedTref (f a)+ (changeAnnRecurse f tbl)+ nat+ joinType+ (changeAnnRecurse f tbl1)+ onExpr+ SubTref a sel alias -> SubTref (f a) (changeAnnRecurse f sel) alias+ TrefFun a fn -> TrefFun (f a) (changeAnnRecurse f fn)+ TrefFunAlias a fn alias -> TrefFunAlias (f a) (changeAnnRecurse f fn) alias+ getAnnChildren ex =+ case ex of+ Tref a tbl -> []+ TrefAlias a tbl alias -> []+ JoinedTref _ tbl _ _ tbl1 onExpr ->+ getAnnChildren tbl ++ getAnnChildren tbl1+ SubTref a sel alias -> getAnnChildren sel+ TrefFun a fn -> getAnnChildren fn+ TrefFunAlias a fn alias -> getAnnChildren fn+}++{-++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/TypeChecking/AstInternal.hs view
@@ -0,0 +1,5468 @@+{-# OPTIONS_HADDOCK hide #-}+++-- UUAGC 0.9.10 (AstInternal.ag)+module Database.HsSqlPpp.TypeChecking.AstInternal(+ --from the ag files:+ --ast nodes+ 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 (..)+ ,StatementList+ ,ExpressionListStatementListPairList+ ,ExpressionListStatementListPair+ ,ExpressionList+ ,StringList+ ,ParamDefList+ ,AttributeDefList+ ,ConstraintList+ ,TypeAttributeDefList+ ,Where+ ,StringStringListPairList+ ,StringStringListPair+ ,ExpressionStatementListPairList+ ,SetClauseList+ ,CaseExpressionListExpressionPairList+ ,MaybeExpression+ ,MTableRef+ ,ExpressionListList+ ,SelectItemList+ ,OnExpr+ ,RowConstraintList+ ,VarDefList+ ,ExpressionStatementListPair+ ,MExpression+ ,CaseExpressionListExpressionPair+ ,CaseExpressionList+ -- annotations+ ,annotateAst+ ,annotateAstScope+ ,annotateExpression+) where++import Data.Maybe+import Data.List+import Debug.Trace+import Control.Monad.Error+import Control.Arrow+import Data.Either+import Control.Applicative++import Database.HsSqlPpp.TypeChecking.TypeType+import Database.HsSqlPpp.TypeChecking.AstUtils+import Database.HsSqlPpp.TypeChecking.TypeConversion+import Database.HsSqlPpp.TypeChecking.TypeCheckingH+import Database.HsSqlPpp.TypeChecking.Scope+import Database.HsSqlPpp.TypeChecking.ScopeData+import Database.HsSqlPpp.TypeChecking.AstAnnotation++++-- | Takes an ast, and adds annotations, including types, type errors,+-- and statement info. Type checks against defaultScope.+annotateAst :: StatementList -> StatementList+annotateAst = annotateAstScope defaultScope++-- | As annotateAst but you supply an additional scope to add to the+-- defaultScope to type check against. See Scope module for how to+-- read a scope from an existing database so you can type check+-- against it.+annotateAstScope :: Scope -> StatementList -> StatementList+annotateAstScope scope sts =+ let t = sem_Root (Root sts)+ ta = wrap_Root t Inh_Root {scope_Inh_Root = combineScopes defaultScope scope}+ tl = annotatedTree_Syn_Root ta+ in case tl of+ Root r -> r++-- | Testing utility, mainly used to check an expression for type errors+-- or to get its type.+annotateExpression :: Scope -> Expression -> Expression+annotateExpression scope ex =+ let t = sem_ExpressionRoot (ExpressionRoot ex)+ rt = (annotatedTree_Syn_ExpressionRoot+ (wrap_ExpressionRoot t Inh_ExpressionRoot {scope_Inh_ExpressionRoot = combineScopes defaultScope scope}))+ in case rt of+ ExpressionRoot e -> e++{-++================================================================================++= instances for Annotated.++Hopefully, some sort of SYB approach can be used to autogenerate these+in the future. It is imperative that this or template haskell or+something similar be used because doing it by hand guarantees some+bits will be missed.++Stupidity watch update: use attributes to do this. Doh.++-}++instance Annotated Statement where+ ann a =+ case a of+ SelectStatement ann _ -> ann+ Insert ann _ _ _ _ -> ann+ Update ann _ _ _ _ -> ann+ Delete ann _ _ _ -> ann+ Copy ann _ _ _ -> ann+ CopyData ann _ -> ann+ Truncate ann _ _ _ -> ann+ CreateTable ann _ _ _ -> ann+ CreateTableAs ann _ _ -> ann+ CreateView ann _ _ -> ann+ CreateType ann _ _ -> ann+ CreateFunction ann _ _ _ _ _ _ _ -> ann+ CreateDomain ann _ _ _ -> ann+ DropFunction ann _ _ _ -> ann+ DropSomething ann _ _ _ _ -> ann+ Assignment ann _ _ -> ann+ Return ann _ -> ann+ ReturnNext ann _ -> ann+ ReturnQuery ann _ -> ann+ Raise ann _ _ _ -> ann+ NullStatement ann -> ann+ Perform ann _ -> ann+ Execute ann _ -> ann+ ExecuteInto ann _ _ -> ann+ ForSelectStatement ann _ _ _ -> ann+ ForIntegerStatement ann _ _ _ _ -> ann+ WhileStatement ann _ _ -> ann+ ContinueStatement ann -> ann+ CaseStatement ann _ _ _ -> ann+ If ann _ _ -> ann+ setAnn st a =+ case st of+ SelectStatement _ ex -> SelectStatement a ex+ Insert _ tbl cols ins ret -> Insert a tbl cols ins ret+ Update _ tbl as whr ret -> Update a tbl as whr ret+ Delete _ tbl whr ret -> Delete a tbl whr ret+ Copy _ tbl cols src -> Copy a tbl cols src+ CopyData _ i -> CopyData a i+ Truncate _ tbls ri cs -> Truncate a tbls ri cs+ CreateTable _ name atts cons -> CreateTable a name atts cons+ CreateTableAs _ name ex -> CreateTableAs a name ex+ CreateView _ name expr -> CreateView a name expr+ CreateType _ name atts -> CreateType a name atts+ CreateFunction _ lang name params rettype bodyQuote body vol ->+ CreateFunction a lang name params rettype bodyQuote body vol+ CreateDomain _ name typ check -> CreateDomain a name typ check+ DropFunction _ i s cs -> DropFunction a i s cs+ DropSomething _ dt i nms cs -> DropSomething a dt i nms cs+ Assignment _ tgt val -> Assignment a tgt val+ Return _ v -> Return a v+ ReturnNext _ ex -> ReturnNext a ex+ ReturnQuery _ sel -> ReturnQuery a sel+ Raise _ l m args -> Raise a l m args+ NullStatement _ -> NullStatement a+ Perform _ expr -> Perform a expr+ Execute _ expr -> Execute a expr+ ExecuteInto _ expr tgts -> ExecuteInto a expr tgts+ ForSelectStatement _ var sel sts -> ForSelectStatement a var sel sts+ ForIntegerStatement _ var from to sts -> ForIntegerStatement a var from to sts+ WhileStatement _ expr sts -> WhileStatement a expr sts+ ContinueStatement _ -> ContinueStatement a+ CaseStatement _ val cases els -> CaseStatement a val cases els+ If _ cases els -> If a cases els++ changeAnnRecurse f st =+ case st of+ SelectStatement a ex -> SelectStatement (f a) ex+ Insert a tbl cols ins ret -> Insert (f a) tbl cols ins ret+ Update a tbl as whr ret -> Update (f a) tbl as whr ret+ Delete a tbl whr ret -> Delete (f a) tbl whr ret+ Copy a tbl cols src -> Copy (f a) tbl cols src+ CopyData a i -> CopyData (f a) i+ Truncate a tbls ri cs -> Truncate (f a) tbls ri cs+ CreateTable a name atts cons -> CreateTable (f a) name atts cons+ CreateTableAs a name ex -> CreateTableAs (f a) name ex+ CreateView a name expr -> CreateView (f a) name expr+ CreateType a name atts -> CreateType (f a) name atts+ CreateFunction a lang name params rettype bodyQuote body vol ->+ CreateFunction (f a) lang name params rettype bodyQuote doBody vol+ where+ doBody = case body of+ SqlFnBody sts -> SqlFnBody $ cars f sts+ PlpgsqlFnBody vars sts -> PlpgsqlFnBody vars $ cars f sts+ CreateDomain a name typ check -> CreateDomain (f a) name typ check+ DropFunction a i s cs -> DropFunction (f a) i s cs+ DropSomething a dt i nms cs -> DropSomething (f a) dt i nms cs+ Assignment a tgt val -> Assignment (f a) tgt val+ Return a v -> Return (f a) v+ ReturnNext a ex -> ReturnNext (f a) ex+ ReturnQuery a sel -> ReturnQuery (f a) sel+ Raise a l m args -> Raise (f a) l m args+ NullStatement a -> NullStatement (f a)+ Perform a expr -> Perform (f a) expr+ Execute a expr -> Execute (f a) expr+ ExecuteInto a expr tgts -> ExecuteInto (f a) expr tgts+ ForSelectStatement a var sel sts -> ForSelectStatement (f a) var sel $ cars f sts+ ForIntegerStatement a var from to sts -> ForIntegerStatement (f a) var from to $ cars f sts+ WhileStatement a expr sts -> WhileStatement (f a) expr $ cars f sts+ ContinueStatement a -> ContinueStatement (f a)+ CaseStatement a val cases els -> CaseStatement (f a) val doCases $ cars f els+ where+ doCases = map (second (cars f)) cases+ If a cases els -> If (f a) doCases $ cars f els+ where+ doCases = map (second (cars f)) cases+ --where+ -- doCases cs = map (\(ex,sts) -> (ex,cars f sts)) cs+ getAnnChildren st =+ case st of+ SelectStatement _ ex -> gacse ex+ Insert _ _ _ ins _ -> gacse ins+ Update _ _ as whr _ -> mp (gacscl as) ++ gacme whr+ Delete _ _ whr _ -> gacme whr+ --Copy _ _ _ _ -> []+ --CopyData _ _ -> []+ --Truncate _ _ _ _ -> []+ --CreateTable _ _ _ _ -> []+ --CreateTableAs _ _ _ -> []+ CreateView _ _ expr -> gacse expr+ --CreateType _ _ _ -> []+ --CreateFunction a lang name params rettype bodyQuote body vol ->+ CreateFunction _ _ _ _ _ _ body _ ->+ case body of+ SqlFnBody sts -> mp sts+ PlpgsqlFnBody _ sts -> mp sts+ --CreateDomain _ _ _ _ -> []+ --DropFunction _ _ _ _ -> []+ --DropSomething _ _ _ _ _ -> []+ --Assignment _ _ _ -> []+ --Return a v -> Return (f a) v+ --ReturnNext a ex -> ReturnNext (f a) ex+ --ReturnQuery a sel -> ReturnQuery (f a) sel+ --Raise a l m args -> Raise (f a) l m args+ --NullStatement a -> NullStatement (f a)+ --Perform a expr -> Perform (f a) expr+ --Execute a expr -> Execute (f a) expr+ --ExecuteInto a expr tgts -> ExecuteInto (f a) expr tgts+ ForSelectStatement _ _ sel sts -> gacse sel ++ mp sts+ ForIntegerStatement _ _ _ _ sts -> mp sts+ WhileStatement _ expr sts -> pack expr : mp sts+ --ContinueStatement a -> ContinueStatement (f a)+ CaseStatement _ val cases els -> pack val : mp (doCases cases) ++ mp els+ If _ cases els -> mp $ doCases cases ++ els+ _ -> []+ where+ doCases = concatMap snd+ --gacse :: Annotated a => SelectExpression -> [a]+ gacse se = [pack se]+ gacscl :: Annotated a => SetClauseList -> [a]+ gacscl _ = []+ --gacme :: Annotated a => Maybe Expression -> [a]+ gacme e = case e of+ Nothing -> []+ Just e1 -> [pack e1]+ mp = map pack++cars = map . changeAnnRecurse++instance Annotated Expression where+ ann a =+ case a of+ IntegerLit ann _ -> ann+ FloatLit ann _ -> ann+ StringLit ann _ _ -> ann+ NullLit ann -> ann+ BooleanLit ann _ -> ann+ PositionalArg ann _ -> ann+ Cast ann _ _ -> ann+ Identifier ann _ -> ann+ Case ann _ _ -> ann+ CaseSimple ann _ _ _ -> ann+ Exists ann _ -> ann+ FunCall ann _ _ -> ann+ InPredicate ann _ _ _ -> ann+ WindowFn ann _ _ _ _ -> ann+ ScalarSubQuery ann _ -> ann+ setAnn ex a =+ case ex of+ IntegerLit _ i -> IntegerLit a i+ FloatLit _ d -> FloatLit a d+ StringLit _ q v -> StringLit a q v+ NullLit _ -> NullLit a+ BooleanLit _ b -> BooleanLit a b+ PositionalArg _ p -> PositionalArg a p+ Cast _ expr tn -> Cast a expr tn+ Identifier _ i -> Identifier a i+ Case _ cases els -> Case a cases els+ CaseSimple _ val cases els -> CaseSimple a val cases els+ Exists _ sel -> Exists a sel+ FunCall _ funName args -> FunCall a funName args+ InPredicate _ expr i list -> InPredicate a expr i list+ WindowFn _ fn par ord dir -> WindowFn a fn par ord dir+ ScalarSubQuery _ sel -> ScalarSubQuery a sel++ changeAnnRecurse f ex =+ case ex of+ IntegerLit a i -> IntegerLit (f a) i+ FloatLit a d -> FloatLit (f a) d+ StringLit a q v -> StringLit (f a) q v+ NullLit a -> NullLit a+ BooleanLit a b -> BooleanLit (f a) b+ PositionalArg a p -> PositionalArg (f a) p+ Cast a expr tn -> Cast (f a) (changeAnnRecurse f expr) tn+ Identifier a i -> Identifier (f a) i+ Case a cases els -> Case (f a) cases els+ CaseSimple a val cases els -> CaseSimple (f a) val cases els+ Exists a sel -> Exists (f a) sel+ FunCall a funName args -> FunCall (f a) funName args+ InPredicate a expr i list -> InPredicate (f a) expr i list+ WindowFn a fn par ord dir -> WindowFn (f a) fn par ord dir+ ScalarSubQuery a sel -> ScalarSubQuery (f a) sel++ getAnnChildren ex =+ case ex of+ Cast _ expr _ -> mp [expr]+ Case _ cases els -> gacce cases els+ CaseSimple _ val cases els -> pack val : gacce cases els+ Exists a sel -> [pack sel]+ FunCall _ _ args -> mp args+ --InPredicate a expr i list -> InPredicate (f a) expr i list+ --WindowFn a fn par ord dir -> WindowFn (f a) fn par ord dir+ --ScalarSubQuery a sel -> ScalarSubQuery (f a) sel+ _ -> []+ where+ gacme e = case e of+ Nothing -> []+ Just e1 -> [pack e1]+ gacce cs el = mp (concatMap (\(el,e) -> el ++ [e]) cs) ++ gacme el+ mp = map pack++++instance Annotated SelectExpression where+ ann a =+ case a of+ Select ann _ _ _ _ _ _ _ _ _ _ -> ann+ CombineSelect ann _ _ _ -> ann+ Values ann _ -> ann+ setAnn ex a =+ case ex of+ Select _ dis sl tref whr grp hav ord dir lim off ->+ Select a dis sl tref whr grp hav ord dir lim off+ CombineSelect _ ctype sel1 sel2 -> CombineSelect a ctype sel1 sel2+ Values _ vll -> Values a vll+ changeAnnRecurse f ex =+ case ex of+ Select a dis sl tref whr grp hav ord dir lim off ->+ Select (f a) dis sl tref whr grp hav ord dir lim off+ CombineSelect a ctype sel1 sel2 -> CombineSelect (f a) ctype+ (changeAnnRecurse f sel1)+ (changeAnnRecurse f sel2)+ Values a vll -> Values (f a) vll+ getAnnChildren ex =+ case ex of+ Select a dis sl tref whr grp hav ord dir lim off ->+ doSl +++ map pack (maybeToList tref) +++ doME whr ++ mp grp ++ doME hav ++ mp ord ++ doME lim ++ doME off+ where+ doSl = let SelectList x _ = sl+ ses = map (\s -> case s of+ SelExp se -> se+ SelectItem se _ -> se) x+ in map pack ses+ doME me = case me of+ Nothing -> []+ Just e -> [pack e]+ CombineSelect _ _ sel1 sel2 -> [pack sel1,pack sel2]+ Values _ vll -> mp $ concat vll+ where+ mp = map pack++instance Annotated TableRef where+ ann a =+ case a of+ Tref ann _ -> ann+ TrefAlias ann _ _ -> ann+ JoinedTref ann _ _ _ _ _ -> ann+ SubTref ann _ _ -> ann+ TrefFun ann _ -> ann+ TrefFunAlias ann _ _ -> ann+ setAnn ex a =+ case ex of+ Tref _ tbl -> Tref a tbl+ TrefAlias _ tbl alias -> TrefAlias a tbl alias+ JoinedTref _ tbl nat joinType tbl1 onExpr -> JoinedTref a tbl nat joinType tbl1 onExpr+ SubTref _ sel alias -> SubTref a sel alias+ TrefFun _ fn -> TrefFun a fn+ TrefFunAlias _ fn alias -> TrefFunAlias a fn alias+ changeAnnRecurse f ex =+ case ex of+ Tref a tbl -> Tref (f a) tbl+ TrefAlias a tbl alias -> TrefAlias (f a) tbl alias+ JoinedTref a tbl nat joinType tbl1 onExpr ->+ JoinedTref (f a)+ (changeAnnRecurse f tbl)+ nat+ joinType+ (changeAnnRecurse f tbl1)+ onExpr+ SubTref a sel alias -> SubTref (f a) (changeAnnRecurse f sel) alias+ TrefFun a fn -> TrefFun (f a) (changeAnnRecurse f fn)+ TrefFunAlias a fn alias -> TrefFunAlias (f a) (changeAnnRecurse f fn) alias+ getAnnChildren ex =+ case ex of+ Tref a tbl -> []+ TrefAlias a tbl alias -> []+ JoinedTref _ tbl _ _ tbl1 onExpr ->+ getAnnChildren tbl ++ getAnnChildren tbl1+ SubTref a sel alias -> getAnnChildren sel+ TrefFun a fn -> getAnnChildren fn+ TrefFunAlias a fn alias -> getAnnChildren fn+++annTypesAndErrors :: Annotated a => a -> Type -> [TypeError]+ -> Maybe AnnotationElement -> a+annTypesAndErrors item nt errs add =+ changeAnn item $+ (([TypeAnnotation nt] ++ maybeToList add +++ map TypeErrorA errs) ++)+++checkExpressionBool :: Maybe Expression -> Either [TypeError] Type+checkExpressionBool whr = do+ let ty = fromMaybe typeBool $ fmap getTypeAnnotation whr+ when (ty `notElem` [typeBool, TypeCheckFailed]) $+ Left [ExpressionMustBeBool]+ return ty+++getTbCols = unwrapComposite . unwrapSetOf . getTypeAnnotation++++getFnType :: Scope -> String -> Expression -> Either [TypeError] Type+getFnType scope alias =+ either Left (Right . snd) . getFunIdens scope alias++getFunIdens :: Scope -> String -> Expression -> Either [TypeError] (String,Type)+getFunIdens scope alias fnVal =+ case fnVal of+ FunCall _ f _ ->+ let correlationName = if alias /= ""+ then alias+ else f+ in Right (correlationName, case getTypeAnnotation fnVal of+ SetOfType (CompositeType t) -> getCompositeType t+ SetOfType x -> UnnamedCompositeType [(correlationName,x)]+ y -> UnnamedCompositeType [(correlationName,y)])+ x -> Left [ContextError "FunCall"]+ where+ getCompositeType t =+ case getAttrs scope [Composite+ ,TableComposite+ ,ViewComposite] t of+ Just ((_,_,a@(UnnamedCompositeType _)), _) -> a+ _ -> UnnamedCompositeType []+++fixStar ex =+ changeAnnRecurse fs ex+ where+ fs 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+++fixedValue :: a -> a -> a -> a+fixedValue a _ _ = a++++++getRowTypes :: [Type] -> [Type]+getRowTypes [RowCtor ts] = ts+getRowTypes ts = ts+-- AttributeDef ------------------------------------------------+data AttributeDef = AttributeDef (String) (TypeName) (Maybe Expression) (RowConstraintList) + deriving ( Eq,Show)+-- cata+sem_AttributeDef :: AttributeDef ->+ T_AttributeDef +sem_AttributeDef (AttributeDef _name _typ _check _cons ) =+ (sem_AttributeDef_AttributeDef _name (sem_TypeName _typ ) _check (sem_RowConstraintList _cons ) )+-- semantic domain+type T_AttributeDef = Scope ->+ ( AttributeDef,String,(Either [TypeError] Type))+data Inh_AttributeDef = Inh_AttributeDef {scope_Inh_AttributeDef :: Scope}+data Syn_AttributeDef = Syn_AttributeDef {annotatedTree_Syn_AttributeDef :: AttributeDef,attrName_Syn_AttributeDef :: String,namedType_Syn_AttributeDef :: Either [TypeError] Type}+wrap_AttributeDef :: T_AttributeDef ->+ Inh_AttributeDef ->+ Syn_AttributeDef +wrap_AttributeDef sem (Inh_AttributeDef _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType) =+ (sem _lhsIscope )+ in (Syn_AttributeDef _lhsOannotatedTree _lhsOattrName _lhsOnamedType ))+sem_AttributeDef_AttributeDef :: String ->+ T_TypeName ->+ (Maybe Expression) ->+ T_RowConstraintList ->+ T_AttributeDef +sem_AttributeDef_AttributeDef name_ typ_ check_ cons_ =+ (\ _lhsIscope ->+ (let _lhsOattrName :: String+ _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: AttributeDef+ _typOscope :: Scope+ _consOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _consIannotatedTree :: RowConstraintList+ _lhsOattrName =+ name_+ _lhsOnamedType =+ _typInamedType+ _annotatedTree =+ AttributeDef name_ _typIannotatedTree check_ _consIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _typOscope =+ _lhsIscope+ _consOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ ( _consIannotatedTree) =+ (cons_ _consOscope )+ in ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType)))+-- AttributeDefList --------------------------------------------+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 = Scope ->+ ( AttributeDefList,([(String, Either [TypeError] Type)]))+data Inh_AttributeDefList = Inh_AttributeDefList {scope_Inh_AttributeDefList :: Scope}+data Syn_AttributeDefList = Syn_AttributeDefList {annotatedTree_Syn_AttributeDefList :: AttributeDefList,attrs_Syn_AttributeDefList :: [(String, Either [TypeError] Type)]}+wrap_AttributeDefList :: T_AttributeDefList ->+ Inh_AttributeDefList ->+ Syn_AttributeDefList +wrap_AttributeDefList sem (Inh_AttributeDefList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOattrs) =+ (sem _lhsIscope )+ in (Syn_AttributeDefList _lhsOannotatedTree _lhsOattrs ))+sem_AttributeDefList_Cons :: T_AttributeDef ->+ T_AttributeDefList ->+ T_AttributeDefList +sem_AttributeDefList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOattrs :: ([(String, Either [TypeError] Type)])+ _lhsOannotatedTree :: AttributeDefList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: AttributeDef+ _hdIattrName :: String+ _hdInamedType :: (Either [TypeError] Type)+ _tlIannotatedTree :: AttributeDefList+ _tlIattrs :: ([(String, Either [TypeError] Type)])+ _lhsOattrs =+ (_hdIattrName, _hdInamedType) : _tlIattrs+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdIattrName,_hdInamedType) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlIattrs) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOattrs)))+sem_AttributeDefList_Nil :: T_AttributeDefList +sem_AttributeDefList_Nil =+ (\ _lhsIscope ->+ (let _lhsOattrs :: ([(String, Either [TypeError] Type)])+ _lhsOannotatedTree :: AttributeDefList+ _lhsOattrs =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOattrs)))+-- Cascade -----------------------------------------------------+data Cascade = Cascade + | Restrict + deriving ( Eq,Show)+-- cata+sem_Cascade :: Cascade ->+ T_Cascade +sem_Cascade (Cascade ) =+ (sem_Cascade_Cascade )+sem_Cascade (Restrict ) =+ (sem_Cascade_Restrict )+-- semantic domain+type T_Cascade = Scope ->+ ( Cascade)+data Inh_Cascade = Inh_Cascade {scope_Inh_Cascade :: Scope}+data Syn_Cascade = Syn_Cascade {annotatedTree_Syn_Cascade :: Cascade}+wrap_Cascade :: T_Cascade ->+ Inh_Cascade ->+ Syn_Cascade +wrap_Cascade sem (Inh_Cascade _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Cascade _lhsOannotatedTree ))+sem_Cascade_Cascade :: T_Cascade +sem_Cascade_Cascade =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Cascade+ _annotatedTree =+ Cascade+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Cascade_Restrict :: T_Cascade +sem_Cascade_Restrict =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Cascade+ _annotatedTree =+ Restrict+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- CaseExpressionList ------------------------------------------+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 = Scope ->+ ( CaseExpressionList)+data Inh_CaseExpressionList = Inh_CaseExpressionList {scope_Inh_CaseExpressionList :: Scope}+data Syn_CaseExpressionList = Syn_CaseExpressionList {annotatedTree_Syn_CaseExpressionList :: CaseExpressionList}+wrap_CaseExpressionList :: T_CaseExpressionList ->+ Inh_CaseExpressionList ->+ Syn_CaseExpressionList +wrap_CaseExpressionList sem (Inh_CaseExpressionList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_CaseExpressionList _lhsOannotatedTree ))+sem_CaseExpressionList_Cons :: T_Expression ->+ T_CaseExpressionList ->+ T_CaseExpressionList +sem_CaseExpressionList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CaseExpressionList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: Expression+ _hdIliftedColumnName :: String+ _tlIannotatedTree :: CaseExpressionList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdIliftedColumnName) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_CaseExpressionList_Nil :: T_CaseExpressionList +sem_CaseExpressionList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CaseExpressionList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- CaseExpressionListExpressionPair ----------------------------+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 = Scope ->+ ( CaseExpressionListExpressionPair)+data Inh_CaseExpressionListExpressionPair = Inh_CaseExpressionListExpressionPair {scope_Inh_CaseExpressionListExpressionPair :: Scope}+data Syn_CaseExpressionListExpressionPair = Syn_CaseExpressionListExpressionPair {annotatedTree_Syn_CaseExpressionListExpressionPair :: CaseExpressionListExpressionPair}+wrap_CaseExpressionListExpressionPair :: T_CaseExpressionListExpressionPair ->+ Inh_CaseExpressionListExpressionPair ->+ Syn_CaseExpressionListExpressionPair +wrap_CaseExpressionListExpressionPair sem (Inh_CaseExpressionListExpressionPair _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_CaseExpressionListExpressionPair _lhsOannotatedTree ))+sem_CaseExpressionListExpressionPair_Tuple :: T_CaseExpressionList ->+ T_Expression ->+ T_CaseExpressionListExpressionPair +sem_CaseExpressionListExpressionPair_Tuple x1_ x2_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CaseExpressionListExpressionPair+ _x1Oscope :: Scope+ _x2Oscope :: Scope+ _x1IannotatedTree :: CaseExpressionList+ _x2IannotatedTree :: Expression+ _x2IliftedColumnName :: String+ _annotatedTree =+ (_x1IannotatedTree,_x2IannotatedTree)+ _lhsOannotatedTree =+ _annotatedTree+ _x1Oscope =+ _lhsIscope+ _x2Oscope =+ _lhsIscope+ ( _x1IannotatedTree) =+ (x1_ _x1Oscope )+ ( _x2IannotatedTree,_x2IliftedColumnName) =+ (x2_ _x2Oscope )+ in ( _lhsOannotatedTree)))+-- CaseExpressionListExpressionPairList ------------------------+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 = Scope ->+ ( CaseExpressionListExpressionPairList)+data Inh_CaseExpressionListExpressionPairList = Inh_CaseExpressionListExpressionPairList {scope_Inh_CaseExpressionListExpressionPairList :: Scope}+data Syn_CaseExpressionListExpressionPairList = Syn_CaseExpressionListExpressionPairList {annotatedTree_Syn_CaseExpressionListExpressionPairList :: CaseExpressionListExpressionPairList}+wrap_CaseExpressionListExpressionPairList :: T_CaseExpressionListExpressionPairList ->+ Inh_CaseExpressionListExpressionPairList ->+ Syn_CaseExpressionListExpressionPairList +wrap_CaseExpressionListExpressionPairList sem (Inh_CaseExpressionListExpressionPairList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_CaseExpressionListExpressionPairList _lhsOannotatedTree ))+sem_CaseExpressionListExpressionPairList_Cons :: T_CaseExpressionListExpressionPair ->+ T_CaseExpressionListExpressionPairList ->+ T_CaseExpressionListExpressionPairList +sem_CaseExpressionListExpressionPairList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CaseExpressionListExpressionPairList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: CaseExpressionListExpressionPair+ _tlIannotatedTree :: CaseExpressionListExpressionPairList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_CaseExpressionListExpressionPairList_Nil :: T_CaseExpressionListExpressionPairList +sem_CaseExpressionListExpressionPairList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CaseExpressionListExpressionPairList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- CombineType -------------------------------------------------+data CombineType = Except + | Intersect + | Union + | UnionAll + deriving ( Eq,Show)+-- 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 = Scope ->+ ( CombineType)+data Inh_CombineType = Inh_CombineType {scope_Inh_CombineType :: Scope}+data Syn_CombineType = Syn_CombineType {annotatedTree_Syn_CombineType :: CombineType}+wrap_CombineType :: T_CombineType ->+ Inh_CombineType ->+ Syn_CombineType +wrap_CombineType sem (Inh_CombineType _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_CombineType _lhsOannotatedTree ))+sem_CombineType_Except :: T_CombineType +sem_CombineType_Except =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CombineType+ _annotatedTree =+ Except+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_CombineType_Intersect :: T_CombineType +sem_CombineType_Intersect =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CombineType+ _annotatedTree =+ Intersect+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_CombineType_Union :: T_CombineType +sem_CombineType_Union =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CombineType+ _annotatedTree =+ Union+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_CombineType_UnionAll :: T_CombineType +sem_CombineType_UnionAll =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CombineType+ _annotatedTree =+ UnionAll+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Constraint --------------------------------------------------+data Constraint = CheckConstraint (Expression) + | PrimaryKeyConstraint (StringList) + | ReferenceConstraint (StringList) (String) (StringList) (Cascade) (Cascade) + | UniqueConstraint (StringList) + deriving ( Eq,Show)+-- cata+sem_Constraint :: Constraint ->+ T_Constraint +sem_Constraint (CheckConstraint _expression ) =+ (sem_Constraint_CheckConstraint (sem_Expression _expression ) )+sem_Constraint (PrimaryKeyConstraint _stringList ) =+ (sem_Constraint_PrimaryKeyConstraint (sem_StringList _stringList ) )+sem_Constraint (ReferenceConstraint _atts _table _tableAtts _onUpdate _onDelete ) =+ (sem_Constraint_ReferenceConstraint (sem_StringList _atts ) _table (sem_StringList _tableAtts ) (sem_Cascade _onUpdate ) (sem_Cascade _onDelete ) )+sem_Constraint (UniqueConstraint _stringList ) =+ (sem_Constraint_UniqueConstraint (sem_StringList _stringList ) )+-- semantic domain+type T_Constraint = Scope ->+ ( Constraint)+data Inh_Constraint = Inh_Constraint {scope_Inh_Constraint :: Scope}+data Syn_Constraint = Syn_Constraint {annotatedTree_Syn_Constraint :: Constraint}+wrap_Constraint :: T_Constraint ->+ Inh_Constraint ->+ Syn_Constraint +wrap_Constraint sem (Inh_Constraint _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Constraint _lhsOannotatedTree ))+sem_Constraint_CheckConstraint :: T_Expression ->+ T_Constraint +sem_Constraint_CheckConstraint expression_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Constraint+ _expressionOscope :: Scope+ _expressionIannotatedTree :: Expression+ _expressionIliftedColumnName :: String+ _annotatedTree =+ CheckConstraint _expressionIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _expressionOscope =+ _lhsIscope+ ( _expressionIannotatedTree,_expressionIliftedColumnName) =+ (expression_ _expressionOscope )+ in ( _lhsOannotatedTree)))+sem_Constraint_PrimaryKeyConstraint :: T_StringList ->+ T_Constraint +sem_Constraint_PrimaryKeyConstraint stringList_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Constraint+ _stringListOscope :: Scope+ _stringListIannotatedTree :: StringList+ _stringListIstrings :: ([String])+ _annotatedTree =+ PrimaryKeyConstraint _stringListIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _stringListOscope =+ _lhsIscope+ ( _stringListIannotatedTree,_stringListIstrings) =+ (stringList_ _stringListOscope )+ in ( _lhsOannotatedTree)))+sem_Constraint_ReferenceConstraint :: T_StringList ->+ String ->+ T_StringList ->+ T_Cascade ->+ T_Cascade ->+ T_Constraint +sem_Constraint_ReferenceConstraint atts_ table_ tableAtts_ onUpdate_ onDelete_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Constraint+ _attsOscope :: Scope+ _tableAttsOscope :: Scope+ _onUpdateOscope :: Scope+ _onDeleteOscope :: Scope+ _attsIannotatedTree :: StringList+ _attsIstrings :: ([String])+ _tableAttsIannotatedTree :: StringList+ _tableAttsIstrings :: ([String])+ _onUpdateIannotatedTree :: Cascade+ _onDeleteIannotatedTree :: Cascade+ _annotatedTree =+ ReferenceConstraint _attsIannotatedTree table_ _tableAttsIannotatedTree _onUpdateIannotatedTree _onDeleteIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _attsOscope =+ _lhsIscope+ _tableAttsOscope =+ _lhsIscope+ _onUpdateOscope =+ _lhsIscope+ _onDeleteOscope =+ _lhsIscope+ ( _attsIannotatedTree,_attsIstrings) =+ (atts_ _attsOscope )+ ( _tableAttsIannotatedTree,_tableAttsIstrings) =+ (tableAtts_ _tableAttsOscope )+ ( _onUpdateIannotatedTree) =+ (onUpdate_ _onUpdateOscope )+ ( _onDeleteIannotatedTree) =+ (onDelete_ _onDeleteOscope )+ in ( _lhsOannotatedTree)))+sem_Constraint_UniqueConstraint :: T_StringList ->+ T_Constraint +sem_Constraint_UniqueConstraint stringList_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Constraint+ _stringListOscope :: Scope+ _stringListIannotatedTree :: StringList+ _stringListIstrings :: ([String])+ _annotatedTree =+ UniqueConstraint _stringListIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _stringListOscope =+ _lhsIscope+ ( _stringListIannotatedTree,_stringListIstrings) =+ (stringList_ _stringListOscope )+ in ( _lhsOannotatedTree)))+-- ConstraintList ----------------------------------------------+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 = Scope ->+ ( ConstraintList)+data Inh_ConstraintList = Inh_ConstraintList {scope_Inh_ConstraintList :: Scope}+data Syn_ConstraintList = Syn_ConstraintList {annotatedTree_Syn_ConstraintList :: ConstraintList}+wrap_ConstraintList :: T_ConstraintList ->+ Inh_ConstraintList ->+ Syn_ConstraintList +wrap_ConstraintList sem (Inh_ConstraintList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_ConstraintList _lhsOannotatedTree ))+sem_ConstraintList_Cons :: T_Constraint ->+ T_ConstraintList ->+ T_ConstraintList +sem_ConstraintList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ConstraintList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: Constraint+ _tlIannotatedTree :: ConstraintList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_ConstraintList_Nil :: T_ConstraintList +sem_ConstraintList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ConstraintList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- CopySource --------------------------------------------------+data CopySource = CopyFilename (String) + | Stdin + deriving ( Eq,Show)+-- 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 = Scope ->+ ( CopySource)+data Inh_CopySource = Inh_CopySource {scope_Inh_CopySource :: Scope}+data Syn_CopySource = Syn_CopySource {annotatedTree_Syn_CopySource :: CopySource}+wrap_CopySource :: T_CopySource ->+ Inh_CopySource ->+ Syn_CopySource +wrap_CopySource sem (Inh_CopySource _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_CopySource _lhsOannotatedTree ))+sem_CopySource_CopyFilename :: String ->+ T_CopySource +sem_CopySource_CopyFilename string_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CopySource+ _annotatedTree =+ CopyFilename string_+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_CopySource_Stdin :: T_CopySource +sem_CopySource_Stdin =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: CopySource+ _annotatedTree =+ Stdin+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Direction ---------------------------------------------------+data Direction = Asc + | Desc + deriving ( Eq,Show)+-- cata+sem_Direction :: Direction ->+ T_Direction +sem_Direction (Asc ) =+ (sem_Direction_Asc )+sem_Direction (Desc ) =+ (sem_Direction_Desc )+-- semantic domain+type T_Direction = Scope ->+ ( Direction)+data Inh_Direction = Inh_Direction {scope_Inh_Direction :: Scope}+data Syn_Direction = Syn_Direction {annotatedTree_Syn_Direction :: Direction}+wrap_Direction :: T_Direction ->+ Inh_Direction ->+ Syn_Direction +wrap_Direction sem (Inh_Direction _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Direction _lhsOannotatedTree ))+sem_Direction_Asc :: T_Direction +sem_Direction_Asc =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Direction+ _annotatedTree =+ Asc+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Direction_Desc :: T_Direction +sem_Direction_Desc =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Direction+ _annotatedTree =+ Desc+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Distinct ----------------------------------------------------+data Distinct = Distinct + | Dupes + deriving ( Eq,Show)+-- cata+sem_Distinct :: Distinct ->+ T_Distinct +sem_Distinct (Distinct ) =+ (sem_Distinct_Distinct )+sem_Distinct (Dupes ) =+ (sem_Distinct_Dupes )+-- semantic domain+type T_Distinct = Scope ->+ ( Distinct)+data Inh_Distinct = Inh_Distinct {scope_Inh_Distinct :: Scope}+data Syn_Distinct = Syn_Distinct {annotatedTree_Syn_Distinct :: Distinct}+wrap_Distinct :: T_Distinct ->+ Inh_Distinct ->+ Syn_Distinct +wrap_Distinct sem (Inh_Distinct _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Distinct _lhsOannotatedTree ))+sem_Distinct_Distinct :: T_Distinct +sem_Distinct_Distinct =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Distinct+ _annotatedTree =+ Distinct+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Distinct_Dupes :: T_Distinct +sem_Distinct_Dupes =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Distinct+ _annotatedTree =+ Dupes+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- DropType ----------------------------------------------------+data DropType = Domain + | Table + | Type + | View + deriving ( Eq,Show)+-- 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 = Scope ->+ ( DropType)+data Inh_DropType = Inh_DropType {scope_Inh_DropType :: Scope}+data Syn_DropType = Syn_DropType {annotatedTree_Syn_DropType :: DropType}+wrap_DropType :: T_DropType ->+ Inh_DropType ->+ Syn_DropType +wrap_DropType sem (Inh_DropType _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_DropType _lhsOannotatedTree ))+sem_DropType_Domain :: T_DropType +sem_DropType_Domain =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: DropType+ _annotatedTree =+ Domain+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_DropType_Table :: T_DropType +sem_DropType_Table =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: DropType+ _annotatedTree =+ Table+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_DropType_Type :: T_DropType +sem_DropType_Type =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: DropType+ _annotatedTree =+ Type+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_DropType_View :: T_DropType +sem_DropType_View =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: DropType+ _annotatedTree =+ View+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Expression --------------------------------------------------+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) + | NullLit (Annotation) + | PositionalArg (Annotation) (Integer) + | ScalarSubQuery (Annotation) (SelectExpression) + | StringLit (Annotation) (String) (String) + | WindowFn (Annotation) (Expression) (ExpressionList) (ExpressionList) (Direction) + deriving ( Eq,Show)+-- 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 (NullLit _ann ) =+ (sem_Expression_NullLit _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 ) =+ (sem_Expression_WindowFn _ann (sem_Expression _fn ) (sem_ExpressionList _partitionBy ) (sem_ExpressionList _orderBy ) (sem_Direction _dir ) )+-- semantic domain+type T_Expression = Scope ->+ ( Expression,String)+data Inh_Expression = Inh_Expression {scope_Inh_Expression :: Scope}+data Syn_Expression = Syn_Expression {annotatedTree_Syn_Expression :: Expression,liftedColumnName_Syn_Expression :: String}+wrap_Expression :: T_Expression ->+ Inh_Expression ->+ Syn_Expression +wrap_Expression sem (Inh_Expression _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOliftedColumnName) =+ (sem _lhsIscope )+ in (Syn_Expression _lhsOannotatedTree _lhsOliftedColumnName ))+sem_Expression_BooleanLit :: Annotation ->+ Bool ->+ T_Expression +sem_Expression_BooleanLit ann_ b_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _backTree =+ BooleanLit ann_ b_+ _tpe =+ Right typeBool+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ BooleanLit ann_ b_+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_Case :: Annotation ->+ T_CaseExpressionListExpressionPairList ->+ T_MaybeExpression ->+ T_Expression +sem_Expression_Case ann_ cases_ els_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _casesOscope :: Scope+ _elsOscope :: Scope+ _casesIannotatedTree :: CaseExpressionListExpressionPairList+ _elsIannotatedTree :: MaybeExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _whenTypes =+ map getTypeAnnotation $ concatMap fst $+ _casesIannotatedTree+ _thenTypes =+ map getTypeAnnotation $+ (map snd $ _casesIannotatedTree) +++ maybeToList _elsIannotatedTree+ _tpe =+ checkTypes _whenTypes $ do+ when (any (/= typeBool) _whenTypes ) $+ Left [WrongTypes typeBool _whenTypes ]+ checkTypes _thenTypes $+ resolveResultSetType+ _lhsIscope+ _thenTypes+ _backTree =+ Case ann_ _casesIannotatedTree _elsIannotatedTree+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ Case ann_ _casesIannotatedTree _elsIannotatedTree+ _casesOscope =+ _lhsIscope+ _elsOscope =+ _lhsIscope+ ( _casesIannotatedTree) =+ (cases_ _casesOscope )+ ( _elsIannotatedTree) =+ (els_ _elsOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_CaseSimple :: Annotation ->+ T_Expression ->+ T_CaseExpressionListExpressionPairList ->+ T_MaybeExpression ->+ T_Expression +sem_Expression_CaseSimple ann_ value_ cases_ els_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _valueOscope :: Scope+ _casesOscope :: Scope+ _elsOscope :: Scope+ _valueIannotatedTree :: Expression+ _valueIliftedColumnName :: String+ _casesIannotatedTree :: CaseExpressionListExpressionPairList+ _elsIannotatedTree :: MaybeExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _whenTypes =+ map getTypeAnnotation $ concatMap fst $+ _casesIannotatedTree+ _thenTypes =+ map getTypeAnnotation $+ (map snd $ _casesIannotatedTree) +++ maybeToList _elsIannotatedTree+ _tpe =+ checkTypes _whenTypes $ do+ checkWhenTypes <- resolveResultSetType+ _lhsIscope+ (getTypeAnnotation _valueIannotatedTree: _whenTypes )+ checkTypes _thenTypes $+ resolveResultSetType+ _lhsIscope+ _thenTypes+ _backTree =+ CaseSimple ann_ _valueIannotatedTree _casesIannotatedTree _elsIannotatedTree+ _lhsOliftedColumnName =+ _valueIliftedColumnName+ _annotatedTree =+ CaseSimple ann_ _valueIannotatedTree _casesIannotatedTree _elsIannotatedTree+ _valueOscope =+ _lhsIscope+ _casesOscope =+ _lhsIscope+ _elsOscope =+ _lhsIscope+ ( _valueIannotatedTree,_valueIliftedColumnName) =+ (value_ _valueOscope )+ ( _casesIannotatedTree) =+ (cases_ _casesOscope )+ ( _elsIannotatedTree) =+ (els_ _elsOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_Cast :: Annotation ->+ T_Expression ->+ T_TypeName ->+ T_Expression +sem_Expression_Cast ann_ expr_ tn_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _exprOscope :: Scope+ _tnOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _tnIannotatedTree :: TypeName+ _tnInamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ _tnInamedType+ _backTree =+ Cast ann_ _exprIannotatedTree _tnIannotatedTree+ _lhsOliftedColumnName =+ case _tnIannotatedTree of+ SimpleTypeName tn -> tn+ _ -> ""+ _annotatedTree =+ Cast ann_ _exprIannotatedTree _tnIannotatedTree+ _exprOscope =+ _lhsIscope+ _tnOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ ( _tnIannotatedTree,_tnInamedType) =+ (tn_ _tnOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_Exists :: Annotation ->+ T_SelectExpression ->+ T_Expression +sem_Expression_Exists ann_ sel_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _selOscope :: Scope+ _selIannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ Right typeBool+ _backTree =+ Exists ann_ _selIannotatedTree+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ Exists ann_ _selIannotatedTree+ _selOscope =+ _lhsIscope+ ( _selIannotatedTree) =+ (sel_ _selOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_FloatLit :: Annotation ->+ Double ->+ T_Expression +sem_Expression_FloatLit ann_ d_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _backTree =+ FloatLit ann_ d_+ _tpe =+ Right typeNumeric+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ FloatLit ann_ d_+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_FunCall :: Annotation ->+ String ->+ T_ExpressionList ->+ T_Expression +sem_Expression_FunCall ann_ funName_ args_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _argsOscope :: Scope+ _argsIannotatedTree :: ExpressionList+ _argsItypeList :: ([Type])+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ checkTypes _argsItypeList $+ typeCheckFunCall+ _lhsIscope+ funName_+ _argsItypeList+ _backTree =+ FunCall ann_ funName_ _argsIannotatedTree+ _lhsOliftedColumnName =+ if isOperator funName_+ then ""+ else funName_+ _annotatedTree =+ FunCall ann_ funName_ _argsIannotatedTree+ _argsOscope =+ _lhsIscope+ ( _argsIannotatedTree,_argsItypeList) =+ (args_ _argsOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_Identifier :: Annotation ->+ String ->+ T_Expression +sem_Expression_Identifier ann_ i_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ let (correlationName,iden) = splitIdentifier i_+ in scopeLookupID _lhsIscope correlationName iden+ _backTree =+ Identifier ann_ i_+ _lhsOliftedColumnName =+ i_+ _annotatedTree =+ Identifier ann_ i_+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_InPredicate :: Annotation ->+ T_Expression ->+ Bool ->+ T_InList ->+ T_Expression +sem_Expression_InPredicate ann_ expr_ i_ list_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _exprOscope :: Scope+ _listOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _listIannotatedTree :: InList+ _listIlistType :: (Either [TypeError] Type)+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ do+ lt <- _listIlistType+ ty <- resolveResultSetType+ _lhsIscope+ [getTypeAnnotation _exprIannotatedTree, lt]+ return typeBool+ _backTree =+ InPredicate ann_ _exprIannotatedTree i_ _listIannotatedTree+ _lhsOliftedColumnName =+ _exprIliftedColumnName+ _annotatedTree =+ InPredicate ann_ _exprIannotatedTree i_ _listIannotatedTree+ _exprOscope =+ _lhsIscope+ _listOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ ( _listIannotatedTree,_listIlistType) =+ (list_ _listOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_IntegerLit :: Annotation ->+ Integer ->+ T_Expression +sem_Expression_IntegerLit ann_ i_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _backTree =+ IntegerLit ann_ i_+ _tpe =+ Right typeInt+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ IntegerLit ann_ i_+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_NullLit :: Annotation ->+ T_Expression +sem_Expression_NullLit ann_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _backTree =+ NullLit ann_+ _tpe =+ Right UnknownStringLit+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ NullLit ann_+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_PositionalArg :: Annotation ->+ Integer ->+ T_Expression +sem_Expression_PositionalArg ann_ p_ =+ (\ _lhsIscope ->+ (let _lhsOliftedColumnName :: String+ _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ PositionalArg ann_ p_+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_ScalarSubQuery :: Annotation ->+ T_SelectExpression ->+ T_Expression +sem_Expression_ScalarSubQuery ann_ sel_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _selOscope :: Scope+ _selIannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ let selType = getTypeAnnotation _selIannotatedTree+ in checkTypes [selType]+ $ let f = map snd $ unwrapComposite $ unwrapSetOf selType+ in case length f of+ 0 -> error "internal error: no columns in scalar subquery?"+ 1 -> Right $ head f+ _ -> Right $ RowCtor f+ _backTree =+ ScalarSubQuery ann_ _selIannotatedTree+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ ScalarSubQuery ann_ _selIannotatedTree+ _selOscope =+ _lhsIscope+ ( _selIannotatedTree) =+ (sel_ _selOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_StringLit :: Annotation ->+ String ->+ String ->+ T_Expression +sem_Expression_StringLit ann_ quote_ value_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Expression+ _lhsOliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _backTree =+ StringLit ann_ quote_ value_+ _tpe =+ Right UnknownStringLit+ _lhsOliftedColumnName =+ ""+ _annotatedTree =+ StringLit ann_ quote_ value_+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+sem_Expression_WindowFn :: Annotation ->+ T_Expression ->+ T_ExpressionList ->+ T_ExpressionList ->+ T_Direction ->+ T_Expression +sem_Expression_WindowFn ann_ fn_ partitionBy_ orderBy_ dir_ =+ (\ _lhsIscope ->+ (let _lhsOliftedColumnName :: String+ _lhsOannotatedTree :: Expression+ _fnOscope :: Scope+ _partitionByOscope :: Scope+ _orderByOscope :: Scope+ _dirOscope :: Scope+ _fnIannotatedTree :: Expression+ _fnIliftedColumnName :: String+ _partitionByIannotatedTree :: ExpressionList+ _partitionByItypeList :: ([Type])+ _orderByIannotatedTree :: ExpressionList+ _orderByItypeList :: ([Type])+ _dirIannotatedTree :: Direction+ _lhsOliftedColumnName =+ _fnIliftedColumnName+ _annotatedTree =+ WindowFn ann_ _fnIannotatedTree _partitionByIannotatedTree _orderByIannotatedTree _dirIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _fnOscope =+ _lhsIscope+ _partitionByOscope =+ _lhsIscope+ _orderByOscope =+ _lhsIscope+ _dirOscope =+ _lhsIscope+ ( _fnIannotatedTree,_fnIliftedColumnName) =+ (fn_ _fnOscope )+ ( _partitionByIannotatedTree,_partitionByItypeList) =+ (partitionBy_ _partitionByOscope )+ ( _orderByIannotatedTree,_orderByItypeList) =+ (orderBy_ _orderByOscope )+ ( _dirIannotatedTree) =+ (dir_ _dirOscope )+ in ( _lhsOannotatedTree,_lhsOliftedColumnName)))+-- ExpressionList ----------------------------------------------+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 = Scope ->+ ( ExpressionList,([Type]))+data Inh_ExpressionList = Inh_ExpressionList {scope_Inh_ExpressionList :: Scope}+data Syn_ExpressionList = Syn_ExpressionList {annotatedTree_Syn_ExpressionList :: ExpressionList,typeList_Syn_ExpressionList :: [Type]}+wrap_ExpressionList :: T_ExpressionList ->+ Inh_ExpressionList ->+ Syn_ExpressionList +wrap_ExpressionList sem (Inh_ExpressionList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOtypeList) =+ (sem _lhsIscope )+ in (Syn_ExpressionList _lhsOannotatedTree _lhsOtypeList ))+sem_ExpressionList_Cons :: T_Expression ->+ T_ExpressionList ->+ T_ExpressionList +sem_ExpressionList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOtypeList :: ([Type])+ _lhsOannotatedTree :: ExpressionList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: Expression+ _hdIliftedColumnName :: String+ _tlIannotatedTree :: ExpressionList+ _tlItypeList :: ([Type])+ _lhsOtypeList =+ getTypeAnnotation _hdIannotatedTree : _tlItypeList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdIliftedColumnName) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlItypeList) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOtypeList)))+sem_ExpressionList_Nil :: T_ExpressionList +sem_ExpressionList_Nil =+ (\ _lhsIscope ->+ (let _lhsOtypeList :: ([Type])+ _lhsOannotatedTree :: ExpressionList+ _lhsOtypeList =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOtypeList)))+-- ExpressionListList ------------------------------------------+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 = Scope ->+ ( ExpressionListList,([[Type]]))+data Inh_ExpressionListList = Inh_ExpressionListList {scope_Inh_ExpressionListList :: Scope}+data Syn_ExpressionListList = Syn_ExpressionListList {annotatedTree_Syn_ExpressionListList :: ExpressionListList,typeListList_Syn_ExpressionListList :: [[Type]]}+wrap_ExpressionListList :: T_ExpressionListList ->+ Inh_ExpressionListList ->+ Syn_ExpressionListList +wrap_ExpressionListList sem (Inh_ExpressionListList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOtypeListList) =+ (sem _lhsIscope )+ in (Syn_ExpressionListList _lhsOannotatedTree _lhsOtypeListList ))+sem_ExpressionListList_Cons :: T_ExpressionList ->+ T_ExpressionListList ->+ T_ExpressionListList +sem_ExpressionListList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOtypeListList :: ([[Type]])+ _lhsOannotatedTree :: ExpressionListList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: ExpressionList+ _hdItypeList :: ([Type])+ _tlIannotatedTree :: ExpressionListList+ _tlItypeListList :: ([[Type]])+ _lhsOtypeListList =+ _hdItypeList : _tlItypeListList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdItypeList) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlItypeListList) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOtypeListList)))+sem_ExpressionListList_Nil :: T_ExpressionListList +sem_ExpressionListList_Nil =+ (\ _lhsIscope ->+ (let _lhsOtypeListList :: ([[Type]])+ _lhsOannotatedTree :: ExpressionListList+ _lhsOtypeListList =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOtypeListList)))+-- ExpressionListStatementListPair -----------------------------+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 = Scope ->+ ( ExpressionListStatementListPair)+data Inh_ExpressionListStatementListPair = Inh_ExpressionListStatementListPair {scope_Inh_ExpressionListStatementListPair :: Scope}+data Syn_ExpressionListStatementListPair = Syn_ExpressionListStatementListPair {annotatedTree_Syn_ExpressionListStatementListPair :: ExpressionListStatementListPair}+wrap_ExpressionListStatementListPair :: T_ExpressionListStatementListPair ->+ Inh_ExpressionListStatementListPair ->+ Syn_ExpressionListStatementListPair +wrap_ExpressionListStatementListPair sem (Inh_ExpressionListStatementListPair _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_ExpressionListStatementListPair _lhsOannotatedTree ))+sem_ExpressionListStatementListPair_Tuple :: T_ExpressionList ->+ T_StatementList ->+ T_ExpressionListStatementListPair +sem_ExpressionListStatementListPair_Tuple x1_ x2_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionListStatementListPair+ _x1Oscope :: Scope+ _x2Oscope :: Scope+ _x1IannotatedTree :: ExpressionList+ _x1ItypeList :: ([Type])+ _x2IannotatedTree :: StatementList+ _annotatedTree =+ (_x1IannotatedTree,_x2IannotatedTree)+ _lhsOannotatedTree =+ _annotatedTree+ _x1Oscope =+ _lhsIscope+ _x2Oscope =+ _lhsIscope+ ( _x1IannotatedTree,_x1ItypeList) =+ (x1_ _x1Oscope )+ ( _x2IannotatedTree) =+ (x2_ _x2Oscope )+ in ( _lhsOannotatedTree)))+-- ExpressionListStatementListPairList -------------------------+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 = Scope ->+ ( ExpressionListStatementListPairList)+data Inh_ExpressionListStatementListPairList = Inh_ExpressionListStatementListPairList {scope_Inh_ExpressionListStatementListPairList :: Scope}+data Syn_ExpressionListStatementListPairList = Syn_ExpressionListStatementListPairList {annotatedTree_Syn_ExpressionListStatementListPairList :: ExpressionListStatementListPairList}+wrap_ExpressionListStatementListPairList :: T_ExpressionListStatementListPairList ->+ Inh_ExpressionListStatementListPairList ->+ Syn_ExpressionListStatementListPairList +wrap_ExpressionListStatementListPairList sem (Inh_ExpressionListStatementListPairList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_ExpressionListStatementListPairList _lhsOannotatedTree ))+sem_ExpressionListStatementListPairList_Cons :: T_ExpressionListStatementListPair ->+ T_ExpressionListStatementListPairList ->+ T_ExpressionListStatementListPairList +sem_ExpressionListStatementListPairList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionListStatementListPairList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: ExpressionListStatementListPair+ _tlIannotatedTree :: ExpressionListStatementListPairList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_ExpressionListStatementListPairList_Nil :: T_ExpressionListStatementListPairList +sem_ExpressionListStatementListPairList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionListStatementListPairList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- ExpressionRoot ----------------------------------------------+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 = Scope ->+ ( ExpressionRoot)+data Inh_ExpressionRoot = Inh_ExpressionRoot {scope_Inh_ExpressionRoot :: Scope}+data Syn_ExpressionRoot = Syn_ExpressionRoot {annotatedTree_Syn_ExpressionRoot :: ExpressionRoot}+wrap_ExpressionRoot :: T_ExpressionRoot ->+ Inh_ExpressionRoot ->+ Syn_ExpressionRoot +wrap_ExpressionRoot sem (Inh_ExpressionRoot _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_ExpressionRoot _lhsOannotatedTree ))+sem_ExpressionRoot_ExpressionRoot :: T_Expression ->+ T_ExpressionRoot +sem_ExpressionRoot_ExpressionRoot expr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionRoot+ _exprOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _annotatedTree =+ ExpressionRoot _exprIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ in ( _lhsOannotatedTree)))+-- ExpressionStatementListPair ---------------------------------+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 = Scope ->+ ( ExpressionStatementListPair)+data Inh_ExpressionStatementListPair = Inh_ExpressionStatementListPair {scope_Inh_ExpressionStatementListPair :: Scope}+data Syn_ExpressionStatementListPair = Syn_ExpressionStatementListPair {annotatedTree_Syn_ExpressionStatementListPair :: ExpressionStatementListPair}+wrap_ExpressionStatementListPair :: T_ExpressionStatementListPair ->+ Inh_ExpressionStatementListPair ->+ Syn_ExpressionStatementListPair +wrap_ExpressionStatementListPair sem (Inh_ExpressionStatementListPair _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_ExpressionStatementListPair _lhsOannotatedTree ))+sem_ExpressionStatementListPair_Tuple :: T_Expression ->+ T_StatementList ->+ T_ExpressionStatementListPair +sem_ExpressionStatementListPair_Tuple x1_ x2_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionStatementListPair+ _x1Oscope :: Scope+ _x2Oscope :: Scope+ _x1IannotatedTree :: Expression+ _x1IliftedColumnName :: String+ _x2IannotatedTree :: StatementList+ _annotatedTree =+ (_x1IannotatedTree,_x2IannotatedTree)+ _lhsOannotatedTree =+ _annotatedTree+ _x1Oscope =+ _lhsIscope+ _x2Oscope =+ _lhsIscope+ ( _x1IannotatedTree,_x1IliftedColumnName) =+ (x1_ _x1Oscope )+ ( _x2IannotatedTree) =+ (x2_ _x2Oscope )+ in ( _lhsOannotatedTree)))+-- ExpressionStatementListPairList -----------------------------+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 = Scope ->+ ( ExpressionStatementListPairList)+data Inh_ExpressionStatementListPairList = Inh_ExpressionStatementListPairList {scope_Inh_ExpressionStatementListPairList :: Scope}+data Syn_ExpressionStatementListPairList = Syn_ExpressionStatementListPairList {annotatedTree_Syn_ExpressionStatementListPairList :: ExpressionStatementListPairList}+wrap_ExpressionStatementListPairList :: T_ExpressionStatementListPairList ->+ Inh_ExpressionStatementListPairList ->+ Syn_ExpressionStatementListPairList +wrap_ExpressionStatementListPairList sem (Inh_ExpressionStatementListPairList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_ExpressionStatementListPairList _lhsOannotatedTree ))+sem_ExpressionStatementListPairList_Cons :: T_ExpressionStatementListPair ->+ T_ExpressionStatementListPairList ->+ T_ExpressionStatementListPairList +sem_ExpressionStatementListPairList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionStatementListPairList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: ExpressionStatementListPair+ _tlIannotatedTree :: ExpressionStatementListPairList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_ExpressionStatementListPairList_Nil :: T_ExpressionStatementListPairList +sem_ExpressionStatementListPairList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: ExpressionStatementListPairList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- FnBody ------------------------------------------------------+data FnBody = PlpgsqlFnBody (VarDefList) (StatementList) + | SqlFnBody (StatementList) + deriving ( Eq,Show)+-- cata+sem_FnBody :: FnBody ->+ T_FnBody +sem_FnBody (PlpgsqlFnBody _varDefList _sts ) =+ (sem_FnBody_PlpgsqlFnBody (sem_VarDefList _varDefList ) (sem_StatementList _sts ) )+sem_FnBody (SqlFnBody _sts ) =+ (sem_FnBody_SqlFnBody (sem_StatementList _sts ) )+-- semantic domain+type T_FnBody = Scope ->+ ( FnBody)+data Inh_FnBody = Inh_FnBody {scope_Inh_FnBody :: Scope}+data Syn_FnBody = Syn_FnBody {annotatedTree_Syn_FnBody :: FnBody}+wrap_FnBody :: T_FnBody ->+ Inh_FnBody ->+ Syn_FnBody +wrap_FnBody sem (Inh_FnBody _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_FnBody _lhsOannotatedTree ))+sem_FnBody_PlpgsqlFnBody :: T_VarDefList ->+ T_StatementList ->+ T_FnBody +sem_FnBody_PlpgsqlFnBody varDefList_ sts_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: FnBody+ _varDefListOscope :: Scope+ _stsOscope :: Scope+ _varDefListIannotatedTree :: VarDefList+ _stsIannotatedTree :: StatementList+ _annotatedTree =+ PlpgsqlFnBody _varDefListIannotatedTree _stsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _varDefListOscope =+ _lhsIscope+ _stsOscope =+ _lhsIscope+ ( _varDefListIannotatedTree) =+ (varDefList_ _varDefListOscope )+ ( _stsIannotatedTree) =+ (sts_ _stsOscope )+ in ( _lhsOannotatedTree)))+sem_FnBody_SqlFnBody :: T_StatementList ->+ T_FnBody +sem_FnBody_SqlFnBody sts_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: FnBody+ _stsOscope :: Scope+ _stsIannotatedTree :: StatementList+ _annotatedTree =+ SqlFnBody _stsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _stsOscope =+ _lhsIscope+ ( _stsIannotatedTree) =+ (sts_ _stsOscope )+ in ( _lhsOannotatedTree)))+-- IfExists ----------------------------------------------------+data IfExists = IfExists + | Require + deriving ( Eq,Show)+-- cata+sem_IfExists :: IfExists ->+ T_IfExists +sem_IfExists (IfExists ) =+ (sem_IfExists_IfExists )+sem_IfExists (Require ) =+ (sem_IfExists_Require )+-- semantic domain+type T_IfExists = Scope ->+ ( IfExists)+data Inh_IfExists = Inh_IfExists {scope_Inh_IfExists :: Scope}+data Syn_IfExists = Syn_IfExists {annotatedTree_Syn_IfExists :: IfExists}+wrap_IfExists :: T_IfExists ->+ Inh_IfExists ->+ Syn_IfExists +wrap_IfExists sem (Inh_IfExists _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_IfExists _lhsOannotatedTree ))+sem_IfExists_IfExists :: T_IfExists +sem_IfExists_IfExists =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: IfExists+ _annotatedTree =+ IfExists+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_IfExists_Require :: T_IfExists +sem_IfExists_Require =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: IfExists+ _annotatedTree =+ Require+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- InList ------------------------------------------------------+data InList = InList (ExpressionList) + | InSelect (SelectExpression) + deriving ( Eq,Show)+-- cata+sem_InList :: InList ->+ T_InList +sem_InList (InList _exprs ) =+ (sem_InList_InList (sem_ExpressionList _exprs ) )+sem_InList (InSelect _sel ) =+ (sem_InList_InSelect (sem_SelectExpression _sel ) )+-- semantic domain+type T_InList = Scope ->+ ( InList,(Either [TypeError] Type))+data Inh_InList = Inh_InList {scope_Inh_InList :: Scope}+data Syn_InList = Syn_InList {annotatedTree_Syn_InList :: InList,listType_Syn_InList :: Either [TypeError] Type}+wrap_InList :: T_InList ->+ Inh_InList ->+ Syn_InList +wrap_InList sem (Inh_InList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOlistType) =+ (sem _lhsIscope )+ in (Syn_InList _lhsOannotatedTree _lhsOlistType ))+sem_InList_InList :: T_ExpressionList ->+ T_InList +sem_InList_InList exprs_ =+ (\ _lhsIscope ->+ (let _lhsOlistType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: InList+ _exprsOscope :: Scope+ _exprsIannotatedTree :: ExpressionList+ _exprsItypeList :: ([Type])+ _lhsOlistType =+ resolveResultSetType+ _lhsIscope+ _exprsItypeList+ _annotatedTree =+ InList _exprsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprsOscope =+ _lhsIscope+ ( _exprsIannotatedTree,_exprsItypeList) =+ (exprs_ _exprsOscope )+ in ( _lhsOannotatedTree,_lhsOlistType)))+sem_InList_InSelect :: T_SelectExpression ->+ T_InList +sem_InList_InSelect sel_ =+ (\ _lhsIscope ->+ (let _lhsOlistType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: InList+ _selOscope :: Scope+ _selIannotatedTree :: SelectExpression+ _lhsOlistType =+ let attrs = map snd $ unwrapComposite $ unwrapSetOf $ getTypeAnnotation _selIannotatedTree+ typ = case length attrs of+ 0 -> error "internal error - got subquery with no columns? in inselect"+ 1 -> head attrs+ _ -> RowCtor attrs+ in checkTypes attrs $ Right typ+ _annotatedTree =+ InSelect _selIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _selOscope =+ _lhsIscope+ ( _selIannotatedTree) =+ (sel_ _selOscope )+ in ( _lhsOannotatedTree,_lhsOlistType)))+-- JoinExpression ----------------------------------------------+data JoinExpression = JoinOn (Expression) + | JoinUsing (StringList) + deriving ( Eq,Show)+-- cata+sem_JoinExpression :: JoinExpression ->+ T_JoinExpression +sem_JoinExpression (JoinOn _expression ) =+ (sem_JoinExpression_JoinOn (sem_Expression _expression ) )+sem_JoinExpression (JoinUsing _stringList ) =+ (sem_JoinExpression_JoinUsing (sem_StringList _stringList ) )+-- semantic domain+type T_JoinExpression = Scope ->+ ( JoinExpression)+data Inh_JoinExpression = Inh_JoinExpression {scope_Inh_JoinExpression :: Scope}+data Syn_JoinExpression = Syn_JoinExpression {annotatedTree_Syn_JoinExpression :: JoinExpression}+wrap_JoinExpression :: T_JoinExpression ->+ Inh_JoinExpression ->+ Syn_JoinExpression +wrap_JoinExpression sem (Inh_JoinExpression _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_JoinExpression _lhsOannotatedTree ))+sem_JoinExpression_JoinOn :: T_Expression ->+ T_JoinExpression +sem_JoinExpression_JoinOn expression_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinExpression+ _expressionOscope :: Scope+ _expressionIannotatedTree :: Expression+ _expressionIliftedColumnName :: String+ _annotatedTree =+ JoinOn _expressionIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _expressionOscope =+ _lhsIscope+ ( _expressionIannotatedTree,_expressionIliftedColumnName) =+ (expression_ _expressionOscope )+ in ( _lhsOannotatedTree)))+sem_JoinExpression_JoinUsing :: T_StringList ->+ T_JoinExpression +sem_JoinExpression_JoinUsing stringList_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinExpression+ _stringListOscope :: Scope+ _stringListIannotatedTree :: StringList+ _stringListIstrings :: ([String])+ _annotatedTree =+ JoinUsing _stringListIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _stringListOscope =+ _lhsIscope+ ( _stringListIannotatedTree,_stringListIstrings) =+ (stringList_ _stringListOscope )+ in ( _lhsOannotatedTree)))+-- JoinType ----------------------------------------------------+data JoinType = Cross + | FullOuter + | Inner + | LeftOuter + | RightOuter + deriving ( Eq,Show)+-- 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 = Scope ->+ ( JoinType)+data Inh_JoinType = Inh_JoinType {scope_Inh_JoinType :: Scope}+data Syn_JoinType = Syn_JoinType {annotatedTree_Syn_JoinType :: JoinType}+wrap_JoinType :: T_JoinType ->+ Inh_JoinType ->+ Syn_JoinType +wrap_JoinType sem (Inh_JoinType _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_JoinType _lhsOannotatedTree ))+sem_JoinType_Cross :: T_JoinType +sem_JoinType_Cross =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinType+ _annotatedTree =+ Cross+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_JoinType_FullOuter :: T_JoinType +sem_JoinType_FullOuter =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinType+ _annotatedTree =+ FullOuter+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_JoinType_Inner :: T_JoinType +sem_JoinType_Inner =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinType+ _annotatedTree =+ Inner+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_JoinType_LeftOuter :: T_JoinType +sem_JoinType_LeftOuter =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinType+ _annotatedTree =+ LeftOuter+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_JoinType_RightOuter :: T_JoinType +sem_JoinType_RightOuter =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: JoinType+ _annotatedTree =+ RightOuter+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Language ----------------------------------------------------+data Language = Plpgsql + | Sql + deriving ( Eq,Show)+-- cata+sem_Language :: Language ->+ T_Language +sem_Language (Plpgsql ) =+ (sem_Language_Plpgsql )+sem_Language (Sql ) =+ (sem_Language_Sql )+-- semantic domain+type T_Language = Scope ->+ ( Language)+data Inh_Language = Inh_Language {scope_Inh_Language :: Scope}+data Syn_Language = Syn_Language {annotatedTree_Syn_Language :: Language}+wrap_Language :: T_Language ->+ Inh_Language ->+ Syn_Language +wrap_Language sem (Inh_Language _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Language _lhsOannotatedTree ))+sem_Language_Plpgsql :: T_Language +sem_Language_Plpgsql =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Language+ _annotatedTree =+ Plpgsql+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Language_Sql :: T_Language +sem_Language_Sql =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Language+ _annotatedTree =+ Sql+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- MExpression -------------------------------------------------+type MExpression = (Maybe (Expression))+-- cata+sem_MExpression :: MExpression ->+ T_MExpression +sem_MExpression (Prelude.Just x ) =+ (sem_MExpression_Just (sem_Expression x ) )+sem_MExpression Prelude.Nothing =+ sem_MExpression_Nothing+-- semantic domain+type T_MExpression = Scope ->+ ( MExpression)+data Inh_MExpression = Inh_MExpression {scope_Inh_MExpression :: Scope}+data Syn_MExpression = Syn_MExpression {annotatedTree_Syn_MExpression :: MExpression}+wrap_MExpression :: T_MExpression ->+ Inh_MExpression ->+ Syn_MExpression +wrap_MExpression sem (Inh_MExpression _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_MExpression _lhsOannotatedTree ))+sem_MExpression_Just :: T_Expression ->+ T_MExpression +sem_MExpression_Just just_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: MExpression+ _justOscope :: Scope+ _justIannotatedTree :: Expression+ _justIliftedColumnName :: String+ _annotatedTree =+ Just _justIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _justOscope =+ _lhsIscope+ ( _justIannotatedTree,_justIliftedColumnName) =+ (just_ _justOscope )+ in ( _lhsOannotatedTree)))+sem_MExpression_Nothing :: T_MExpression +sem_MExpression_Nothing =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: MExpression+ _annotatedTree =+ Nothing+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- MTableRef ---------------------------------------------------+type MTableRef = (Maybe (TableRef))+-- cata+sem_MTableRef :: MTableRef ->+ T_MTableRef +sem_MTableRef (Prelude.Just x ) =+ (sem_MTableRef_Just (sem_TableRef x ) )+sem_MTableRef Prelude.Nothing =+ sem_MTableRef_Nothing+-- semantic domain+type T_MTableRef = Scope ->+ ( MTableRef,([QualifiedScope]),([String]))+data Inh_MTableRef = Inh_MTableRef {scope_Inh_MTableRef :: Scope}+data Syn_MTableRef = Syn_MTableRef {annotatedTree_Syn_MTableRef :: MTableRef,idens_Syn_MTableRef :: [QualifiedScope],joinIdens_Syn_MTableRef :: [String]}+wrap_MTableRef :: T_MTableRef ->+ Inh_MTableRef ->+ Syn_MTableRef +wrap_MTableRef sem (Inh_MTableRef _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens) =+ (sem _lhsIscope )+ in (Syn_MTableRef _lhsOannotatedTree _lhsOidens _lhsOjoinIdens ))+sem_MTableRef_Just :: T_TableRef ->+ T_MTableRef +sem_MTableRef_Just just_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: MTableRef+ _lhsOidens :: ([QualifiedScope])+ _lhsOjoinIdens :: ([String])+ _justOscope :: Scope+ _justIannotatedTree :: TableRef+ _justIidens :: ([QualifiedScope])+ _justIjoinIdens :: ([String])+ _annotatedTree =+ Just _justIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _lhsOidens =+ _justIidens+ _lhsOjoinIdens =+ _justIjoinIdens+ _justOscope =+ _lhsIscope+ ( _justIannotatedTree,_justIidens,_justIjoinIdens) =+ (just_ _justOscope )+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+sem_MTableRef_Nothing :: T_MTableRef +sem_MTableRef_Nothing =+ (\ _lhsIscope ->+ (let _lhsOidens :: ([QualifiedScope])+ _lhsOjoinIdens :: ([String])+ _lhsOannotatedTree :: MTableRef+ _lhsOidens =+ []+ _lhsOjoinIdens =+ []+ _annotatedTree =+ Nothing+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+-- MaybeExpression ---------------------------------------------+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 = Scope ->+ ( MaybeExpression)+data Inh_MaybeExpression = Inh_MaybeExpression {scope_Inh_MaybeExpression :: Scope}+data Syn_MaybeExpression = Syn_MaybeExpression {annotatedTree_Syn_MaybeExpression :: MaybeExpression}+wrap_MaybeExpression :: T_MaybeExpression ->+ Inh_MaybeExpression ->+ Syn_MaybeExpression +wrap_MaybeExpression sem (Inh_MaybeExpression _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_MaybeExpression _lhsOannotatedTree ))+sem_MaybeExpression_Just :: T_Expression ->+ T_MaybeExpression +sem_MaybeExpression_Just just_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: MaybeExpression+ _justOscope :: Scope+ _justIannotatedTree :: Expression+ _justIliftedColumnName :: String+ _annotatedTree =+ Just _justIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _justOscope =+ _lhsIscope+ ( _justIannotatedTree,_justIliftedColumnName) =+ (just_ _justOscope )+ in ( _lhsOannotatedTree)))+sem_MaybeExpression_Nothing :: T_MaybeExpression +sem_MaybeExpression_Nothing =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: MaybeExpression+ _annotatedTree =+ Nothing+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Natural -----------------------------------------------------+data Natural = Natural + | Unnatural + deriving ( Eq,Show)+-- cata+sem_Natural :: Natural ->+ T_Natural +sem_Natural (Natural ) =+ (sem_Natural_Natural )+sem_Natural (Unnatural ) =+ (sem_Natural_Unnatural )+-- semantic domain+type T_Natural = Scope ->+ ( Natural)+data Inh_Natural = Inh_Natural {scope_Inh_Natural :: Scope}+data Syn_Natural = Syn_Natural {annotatedTree_Syn_Natural :: Natural}+wrap_Natural :: T_Natural ->+ Inh_Natural ->+ Syn_Natural +wrap_Natural sem (Inh_Natural _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Natural _lhsOannotatedTree ))+sem_Natural_Natural :: T_Natural +sem_Natural_Natural =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Natural+ _annotatedTree =+ Natural+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Natural_Unnatural :: T_Natural +sem_Natural_Unnatural =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Natural+ _annotatedTree =+ Unnatural+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- OnExpr ------------------------------------------------------+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 = Scope ->+ ( OnExpr)+data Inh_OnExpr = Inh_OnExpr {scope_Inh_OnExpr :: Scope}+data Syn_OnExpr = Syn_OnExpr {annotatedTree_Syn_OnExpr :: OnExpr}+wrap_OnExpr :: T_OnExpr ->+ Inh_OnExpr ->+ Syn_OnExpr +wrap_OnExpr sem (Inh_OnExpr _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_OnExpr _lhsOannotatedTree ))+sem_OnExpr_Just :: T_JoinExpression ->+ T_OnExpr +sem_OnExpr_Just just_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: OnExpr+ _justOscope :: Scope+ _justIannotatedTree :: JoinExpression+ _annotatedTree =+ Just _justIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _justOscope =+ _lhsIscope+ ( _justIannotatedTree) =+ (just_ _justOscope )+ in ( _lhsOannotatedTree)))+sem_OnExpr_Nothing :: T_OnExpr +sem_OnExpr_Nothing =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: OnExpr+ _annotatedTree =+ Nothing+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- ParamDef ----------------------------------------------------+data ParamDef = ParamDef (String) (TypeName) + | ParamDefTp (TypeName) + deriving ( Eq,Show)+-- cata+sem_ParamDef :: ParamDef ->+ T_ParamDef +sem_ParamDef (ParamDef _name _typ ) =+ (sem_ParamDef_ParamDef _name (sem_TypeName _typ ) )+sem_ParamDef (ParamDefTp _typ ) =+ (sem_ParamDef_ParamDefTp (sem_TypeName _typ ) )+-- semantic domain+type T_ParamDef = Scope ->+ ( ParamDef,(Either [TypeError] Type),String)+data Inh_ParamDef = Inh_ParamDef {scope_Inh_ParamDef :: Scope}+data Syn_ParamDef = Syn_ParamDef {annotatedTree_Syn_ParamDef :: ParamDef,namedType_Syn_ParamDef :: Either [TypeError] Type,paramName_Syn_ParamDef :: String}+wrap_ParamDef :: T_ParamDef ->+ Inh_ParamDef ->+ Syn_ParamDef +wrap_ParamDef sem (Inh_ParamDef _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOnamedType,_lhsOparamName) =+ (sem _lhsIscope )+ in (Syn_ParamDef _lhsOannotatedTree _lhsOnamedType _lhsOparamName ))+sem_ParamDef_ParamDef :: String ->+ T_TypeName ->+ T_ParamDef +sem_ParamDef_ParamDef name_ typ_ =+ (\ _lhsIscope ->+ (let _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOparamName :: String+ _lhsOannotatedTree :: ParamDef+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _lhsOnamedType =+ _typInamedType+ _lhsOparamName =+ name_+ _annotatedTree =+ ParamDef name_ _typIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOparamName)))+sem_ParamDef_ParamDefTp :: T_TypeName ->+ T_ParamDef +sem_ParamDef_ParamDefTp typ_ =+ (\ _lhsIscope ->+ (let _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOparamName :: String+ _lhsOannotatedTree :: ParamDef+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _lhsOnamedType =+ _typInamedType+ _lhsOparamName =+ ""+ _annotatedTree =+ ParamDefTp _typIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree,_lhsOnamedType,_lhsOparamName)))+-- ParamDefList ------------------------------------------------+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 = Scope ->+ ( ParamDefList,([(String,Either [TypeError] Type)]))+data Inh_ParamDefList = Inh_ParamDefList {scope_Inh_ParamDefList :: Scope}+data Syn_ParamDefList = Syn_ParamDefList {annotatedTree_Syn_ParamDefList :: ParamDefList,params_Syn_ParamDefList :: [(String,Either [TypeError] Type)]}+wrap_ParamDefList :: T_ParamDefList ->+ Inh_ParamDefList ->+ Syn_ParamDefList +wrap_ParamDefList sem (Inh_ParamDefList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOparams) =+ (sem _lhsIscope )+ in (Syn_ParamDefList _lhsOannotatedTree _lhsOparams ))+sem_ParamDefList_Cons :: T_ParamDef ->+ T_ParamDefList ->+ T_ParamDefList +sem_ParamDefList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOparams :: ([(String,Either [TypeError] Type)])+ _lhsOannotatedTree :: ParamDefList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: ParamDef+ _hdInamedType :: (Either [TypeError] Type)+ _hdIparamName :: String+ _tlIannotatedTree :: ParamDefList+ _tlIparams :: ([(String,Either [TypeError] Type)])+ _lhsOparams =+ ((_hdIparamName, _hdInamedType) : _tlIparams)+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdInamedType,_hdIparamName) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlIparams) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOparams)))+sem_ParamDefList_Nil :: T_ParamDefList +sem_ParamDefList_Nil =+ (\ _lhsIscope ->+ (let _lhsOparams :: ([(String,Either [TypeError] Type)])+ _lhsOannotatedTree :: ParamDefList+ _lhsOparams =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOparams)))+-- RaiseType ---------------------------------------------------+data RaiseType = RError + | RException + | RNotice + deriving ( Eq,Show)+-- 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 = Scope ->+ ( RaiseType)+data Inh_RaiseType = Inh_RaiseType {scope_Inh_RaiseType :: Scope}+data Syn_RaiseType = Syn_RaiseType {annotatedTree_Syn_RaiseType :: RaiseType}+wrap_RaiseType :: T_RaiseType ->+ Inh_RaiseType ->+ Syn_RaiseType +wrap_RaiseType sem (Inh_RaiseType _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_RaiseType _lhsOannotatedTree ))+sem_RaiseType_RError :: T_RaiseType +sem_RaiseType_RError =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RaiseType+ _annotatedTree =+ RError+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_RaiseType_RException :: T_RaiseType +sem_RaiseType_RException =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RaiseType+ _annotatedTree =+ RException+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_RaiseType_RNotice :: T_RaiseType +sem_RaiseType_RNotice =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RaiseType+ _annotatedTree =+ RNotice+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- RestartIdentity ---------------------------------------------+data RestartIdentity = ContinueIdentity + | RestartIdentity + deriving ( Eq,Show)+-- cata+sem_RestartIdentity :: RestartIdentity ->+ T_RestartIdentity +sem_RestartIdentity (ContinueIdentity ) =+ (sem_RestartIdentity_ContinueIdentity )+sem_RestartIdentity (RestartIdentity ) =+ (sem_RestartIdentity_RestartIdentity )+-- semantic domain+type T_RestartIdentity = Scope ->+ ( RestartIdentity)+data Inh_RestartIdentity = Inh_RestartIdentity {scope_Inh_RestartIdentity :: Scope}+data Syn_RestartIdentity = Syn_RestartIdentity {annotatedTree_Syn_RestartIdentity :: RestartIdentity}+wrap_RestartIdentity :: T_RestartIdentity ->+ Inh_RestartIdentity ->+ Syn_RestartIdentity +wrap_RestartIdentity sem (Inh_RestartIdentity _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_RestartIdentity _lhsOannotatedTree ))+sem_RestartIdentity_ContinueIdentity :: T_RestartIdentity +sem_RestartIdentity_ContinueIdentity =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RestartIdentity+ _annotatedTree =+ ContinueIdentity+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_RestartIdentity_RestartIdentity :: T_RestartIdentity +sem_RestartIdentity_RestartIdentity =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RestartIdentity+ _annotatedTree =+ RestartIdentity+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Root --------------------------------------------------------+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 = Scope ->+ ( Root)+data Inh_Root = Inh_Root {scope_Inh_Root :: Scope}+data Syn_Root = Syn_Root {annotatedTree_Syn_Root :: Root}+wrap_Root :: T_Root ->+ Inh_Root ->+ Syn_Root +wrap_Root sem (Inh_Root _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Root _lhsOannotatedTree ))+sem_Root_Root :: T_StatementList ->+ T_Root +sem_Root_Root statements_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Root+ _statementsOscope :: Scope+ _statementsIannotatedTree :: StatementList+ _annotatedTree =+ Root _statementsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _statementsOscope =+ _lhsIscope+ ( _statementsIannotatedTree) =+ (statements_ _statementsOscope )+ in ( _lhsOannotatedTree)))+-- RowConstraint -----------------------------------------------+data RowConstraint = NotNullConstraint + | NullConstraint + | RowCheckConstraint (Expression) + | RowPrimaryKeyConstraint + | RowReferenceConstraint (String) (Maybe String) (Cascade) (Cascade) + | RowUniqueConstraint + deriving ( Eq,Show)+-- cata+sem_RowConstraint :: RowConstraint ->+ T_RowConstraint +sem_RowConstraint (NotNullConstraint ) =+ (sem_RowConstraint_NotNullConstraint )+sem_RowConstraint (NullConstraint ) =+ (sem_RowConstraint_NullConstraint )+sem_RowConstraint (RowCheckConstraint _expression ) =+ (sem_RowConstraint_RowCheckConstraint (sem_Expression _expression ) )+sem_RowConstraint (RowPrimaryKeyConstraint ) =+ (sem_RowConstraint_RowPrimaryKeyConstraint )+sem_RowConstraint (RowReferenceConstraint _table _att _onUpdate _onDelete ) =+ (sem_RowConstraint_RowReferenceConstraint _table _att (sem_Cascade _onUpdate ) (sem_Cascade _onDelete ) )+sem_RowConstraint (RowUniqueConstraint ) =+ (sem_RowConstraint_RowUniqueConstraint )+-- semantic domain+type T_RowConstraint = Scope ->+ ( RowConstraint)+data Inh_RowConstraint = Inh_RowConstraint {scope_Inh_RowConstraint :: Scope}+data Syn_RowConstraint = Syn_RowConstraint {annotatedTree_Syn_RowConstraint :: RowConstraint}+wrap_RowConstraint :: T_RowConstraint ->+ Inh_RowConstraint ->+ Syn_RowConstraint +wrap_RowConstraint sem (Inh_RowConstraint _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_RowConstraint _lhsOannotatedTree ))+sem_RowConstraint_NotNullConstraint :: T_RowConstraint +sem_RowConstraint_NotNullConstraint =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraint+ _annotatedTree =+ NotNullConstraint+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_RowConstraint_NullConstraint :: T_RowConstraint +sem_RowConstraint_NullConstraint =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraint+ _annotatedTree =+ NullConstraint+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_RowConstraint_RowCheckConstraint :: T_Expression ->+ T_RowConstraint +sem_RowConstraint_RowCheckConstraint expression_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraint+ _expressionOscope :: Scope+ _expressionIannotatedTree :: Expression+ _expressionIliftedColumnName :: String+ _annotatedTree =+ RowCheckConstraint _expressionIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _expressionOscope =+ _lhsIscope+ ( _expressionIannotatedTree,_expressionIliftedColumnName) =+ (expression_ _expressionOscope )+ in ( _lhsOannotatedTree)))+sem_RowConstraint_RowPrimaryKeyConstraint :: T_RowConstraint +sem_RowConstraint_RowPrimaryKeyConstraint =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraint+ _annotatedTree =+ RowPrimaryKeyConstraint+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_RowConstraint_RowReferenceConstraint :: String ->+ (Maybe String) ->+ T_Cascade ->+ T_Cascade ->+ T_RowConstraint +sem_RowConstraint_RowReferenceConstraint table_ att_ onUpdate_ onDelete_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraint+ _onUpdateOscope :: Scope+ _onDeleteOscope :: Scope+ _onUpdateIannotatedTree :: Cascade+ _onDeleteIannotatedTree :: Cascade+ _annotatedTree =+ RowReferenceConstraint table_ att_ _onUpdateIannotatedTree _onDeleteIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _onUpdateOscope =+ _lhsIscope+ _onDeleteOscope =+ _lhsIscope+ ( _onUpdateIannotatedTree) =+ (onUpdate_ _onUpdateOscope )+ ( _onDeleteIannotatedTree) =+ (onDelete_ _onDeleteOscope )+ in ( _lhsOannotatedTree)))+sem_RowConstraint_RowUniqueConstraint :: T_RowConstraint +sem_RowConstraint_RowUniqueConstraint =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraint+ _annotatedTree =+ RowUniqueConstraint+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- RowConstraintList -------------------------------------------+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 = Scope ->+ ( RowConstraintList)+data Inh_RowConstraintList = Inh_RowConstraintList {scope_Inh_RowConstraintList :: Scope}+data Syn_RowConstraintList = Syn_RowConstraintList {annotatedTree_Syn_RowConstraintList :: RowConstraintList}+wrap_RowConstraintList :: T_RowConstraintList ->+ Inh_RowConstraintList ->+ Syn_RowConstraintList +wrap_RowConstraintList sem (Inh_RowConstraintList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_RowConstraintList _lhsOannotatedTree ))+sem_RowConstraintList_Cons :: T_RowConstraint ->+ T_RowConstraintList ->+ T_RowConstraintList +sem_RowConstraintList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraintList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: RowConstraint+ _tlIannotatedTree :: RowConstraintList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_RowConstraintList_Nil :: T_RowConstraintList +sem_RowConstraintList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: RowConstraintList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- SelectExpression --------------------------------------------+data SelectExpression = CombineSelect (Annotation) (CombineType) (SelectExpression) (SelectExpression) + | Select (Annotation) (Distinct) (SelectList) (MTableRef) (Where) (ExpressionList) (MExpression) (ExpressionList) (Direction) (MExpression) (MExpression) + | Values (Annotation) (ExpressionListList) + deriving ( Eq,Show)+-- 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 _selDir _selLimit _selOffset ) =+ (sem_SelectExpression_Select _ann (sem_Distinct _selDistinct ) (sem_SelectList _selSelectList ) (sem_MTableRef _selTref ) (sem_Where _selWhere ) (sem_ExpressionList _selGroupBy ) (sem_MExpression _selHaving ) (sem_ExpressionList _selOrderBy ) (sem_Direction _selDir ) (sem_MExpression _selLimit ) (sem_MExpression _selOffset ) )+sem_SelectExpression (Values _ann _vll ) =+ (sem_SelectExpression_Values _ann (sem_ExpressionListList _vll ) )+-- semantic domain+type T_SelectExpression = Scope ->+ ( SelectExpression)+data Inh_SelectExpression = Inh_SelectExpression {scope_Inh_SelectExpression :: Scope}+data Syn_SelectExpression = Syn_SelectExpression {annotatedTree_Syn_SelectExpression :: SelectExpression}+wrap_SelectExpression :: T_SelectExpression ->+ Inh_SelectExpression ->+ Syn_SelectExpression +wrap_SelectExpression sem (Inh_SelectExpression _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_SelectExpression _lhsOannotatedTree ))+sem_SelectExpression_CombineSelect :: Annotation ->+ T_CombineType ->+ T_SelectExpression ->+ T_SelectExpression ->+ T_SelectExpression +sem_SelectExpression_CombineSelect ann_ ctype_ sel1_ sel2_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: SelectExpression+ _ctypeOscope :: Scope+ _sel1Oscope :: Scope+ _sel2Oscope :: Scope+ _ctypeIannotatedTree :: CombineType+ _sel1IannotatedTree :: SelectExpression+ _sel2IannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ let sel1t = getTypeAnnotation _sel1IannotatedTree+ sel2t = getTypeAnnotation _sel2IannotatedTree+ in checkTypes [sel1t, sel2t] $+ typeCheckCombineSelect _lhsIscope sel1t sel2t+ _backTree =+ CombineSelect ann_ _ctypeIannotatedTree+ _sel1IannotatedTree+ _sel2IannotatedTree+ _annotatedTree =+ CombineSelect ann_ _ctypeIannotatedTree _sel1IannotatedTree _sel2IannotatedTree+ _ctypeOscope =+ _lhsIscope+ _sel1Oscope =+ _lhsIscope+ _sel2Oscope =+ _lhsIscope+ ( _ctypeIannotatedTree) =+ (ctype_ _ctypeOscope )+ ( _sel1IannotatedTree) =+ (sel1_ _sel1Oscope )+ ( _sel2IannotatedTree) =+ (sel2_ _sel2Oscope )+ in ( _lhsOannotatedTree)))+sem_SelectExpression_Select :: Annotation ->+ T_Distinct ->+ T_SelectList ->+ T_MTableRef ->+ T_Where ->+ T_ExpressionList ->+ T_MExpression ->+ T_ExpressionList ->+ T_Direction ->+ T_MExpression ->+ T_MExpression ->+ T_SelectExpression +sem_SelectExpression_Select ann_ selDistinct_ selSelectList_ selTref_ selWhere_ selGroupBy_ selHaving_ selOrderBy_ selDir_ selLimit_ selOffset_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: SelectExpression+ _selSelectListOscope :: Scope+ _selWhereOscope :: Scope+ _selDistinctOscope :: Scope+ _selTrefOscope :: Scope+ _selGroupByOscope :: Scope+ _selHavingOscope :: Scope+ _selOrderByOscope :: Scope+ _selDirOscope :: Scope+ _selLimitOscope :: Scope+ _selOffsetOscope :: Scope+ _selDistinctIannotatedTree :: Distinct+ _selSelectListIannotatedTree :: SelectList+ _selSelectListIlistType :: Type+ _selTrefIannotatedTree :: MTableRef+ _selTrefIidens :: ([QualifiedScope])+ _selTrefIjoinIdens :: ([String])+ _selWhereIannotatedTree :: Where+ _selGroupByIannotatedTree :: ExpressionList+ _selGroupByItypeList :: ([Type])+ _selHavingIannotatedTree :: MExpression+ _selOrderByIannotatedTree :: ExpressionList+ _selOrderByItypeList :: ([Type])+ _selDirIannotatedTree :: Direction+ _selLimitIannotatedTree :: MExpression+ _selOffsetIannotatedTree :: MExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ do+ whereType <- checkExpressionBool _selWhereIannotatedTree+ let trefType = fromMaybe typeBool $ fmap getTypeAnnotation+ _selTrefIannotatedTree+ slType = _selSelectListIlistType+ chainTypeCheckFailed [trefType, whereType, slType] $+ Right $ case slType of+ UnnamedCompositeType [(_,Pseudo Void)] -> Pseudo Void+ _ -> SetOfType slType+ _backTree =+ Select ann_+ _selDistinctIannotatedTree+ _selSelectListIannotatedTree+ _selTrefIannotatedTree+ _selWhereIannotatedTree+ _selGroupByIannotatedTree+ _selHavingIannotatedTree+ _selOrderByIannotatedTree+ _selDirIannotatedTree+ _selLimitIannotatedTree+ _selOffsetIannotatedTree+ _selSelectListOscope =+ scopeReplaceIds _lhsIscope _selTrefIidens _selTrefIjoinIdens+ _selWhereOscope =+ scopeReplaceIds _lhsIscope _selTrefIidens _selTrefIjoinIdens+ _annotatedTree =+ Select ann_ _selDistinctIannotatedTree _selSelectListIannotatedTree _selTrefIannotatedTree _selWhereIannotatedTree _selGroupByIannotatedTree _selHavingIannotatedTree _selOrderByIannotatedTree _selDirIannotatedTree _selLimitIannotatedTree _selOffsetIannotatedTree+ _selDistinctOscope =+ _lhsIscope+ _selTrefOscope =+ _lhsIscope+ _selGroupByOscope =+ _lhsIscope+ _selHavingOscope =+ _lhsIscope+ _selOrderByOscope =+ _lhsIscope+ _selDirOscope =+ _lhsIscope+ _selLimitOscope =+ _lhsIscope+ _selOffsetOscope =+ _lhsIscope+ ( _selDistinctIannotatedTree) =+ (selDistinct_ _selDistinctOscope )+ ( _selSelectListIannotatedTree,_selSelectListIlistType) =+ (selSelectList_ _selSelectListOscope )+ ( _selTrefIannotatedTree,_selTrefIidens,_selTrefIjoinIdens) =+ (selTref_ _selTrefOscope )+ ( _selWhereIannotatedTree) =+ (selWhere_ _selWhereOscope )+ ( _selGroupByIannotatedTree,_selGroupByItypeList) =+ (selGroupBy_ _selGroupByOscope )+ ( _selHavingIannotatedTree) =+ (selHaving_ _selHavingOscope )+ ( _selOrderByIannotatedTree,_selOrderByItypeList) =+ (selOrderBy_ _selOrderByOscope )+ ( _selDirIannotatedTree) =+ (selDir_ _selDirOscope )+ ( _selLimitIannotatedTree) =+ (selLimit_ _selLimitOscope )+ ( _selOffsetIannotatedTree) =+ (selOffset_ _selOffsetOscope )+ in ( _lhsOannotatedTree)))+sem_SelectExpression_Values :: Annotation ->+ T_ExpressionListList ->+ T_SelectExpression +sem_SelectExpression_Values ann_ vll_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: SelectExpression+ _vllOscope :: Scope+ _vllIannotatedTree :: ExpressionListList+ _vllItypeListList :: ([[Type]])+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ typeCheckValuesExpr+ _lhsIscope+ _vllItypeListList+ _backTree =+ Values ann_ _vllIannotatedTree+ _annotatedTree =+ Values ann_ _vllIannotatedTree+ _vllOscope =+ _lhsIscope+ ( _vllIannotatedTree,_vllItypeListList) =+ (vll_ _vllOscope )+ in ( _lhsOannotatedTree)))+-- SelectItem --------------------------------------------------+data SelectItem = SelExp (Expression) + | SelectItem (Expression) (String) + deriving ( Eq,Show)+-- cata+sem_SelectItem :: SelectItem ->+ T_SelectItem +sem_SelectItem (SelExp _ex ) =+ (sem_SelectItem_SelExp (sem_Expression _ex ) )+sem_SelectItem (SelectItem _ex _name ) =+ (sem_SelectItem_SelectItem (sem_Expression _ex ) _name )+-- semantic domain+type T_SelectItem = Scope ->+ ( SelectItem,String,Type)+data Inh_SelectItem = Inh_SelectItem {scope_Inh_SelectItem :: Scope}+data Syn_SelectItem = Syn_SelectItem {annotatedTree_Syn_SelectItem :: SelectItem,columnName_Syn_SelectItem :: String,itemType_Syn_SelectItem :: Type}+wrap_SelectItem :: T_SelectItem ->+ Inh_SelectItem ->+ Syn_SelectItem +wrap_SelectItem sem (Inh_SelectItem _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOcolumnName,_lhsOitemType) =+ (sem _lhsIscope )+ in (Syn_SelectItem _lhsOannotatedTree _lhsOcolumnName _lhsOitemType ))+sem_SelectItem_SelExp :: T_Expression ->+ T_SelectItem +sem_SelectItem_SelExp ex_ =+ (\ _lhsIscope ->+ (let _lhsOitemType :: Type+ _lhsOcolumnName :: String+ _lhsOannotatedTree :: SelectItem+ _exOscope :: Scope+ _exIannotatedTree :: Expression+ _exIliftedColumnName :: String+ _lhsOitemType =+ getTypeAnnotation _exIannotatedTree+ _annotatedTree =+ SelExp $ fixStar _exIannotatedTree+ _lhsOcolumnName =+ case _exIliftedColumnName of+ "" -> "?column?"+ s -> s+ _lhsOannotatedTree =+ _annotatedTree+ _exOscope =+ _lhsIscope+ ( _exIannotatedTree,_exIliftedColumnName) =+ (ex_ _exOscope )+ in ( _lhsOannotatedTree,_lhsOcolumnName,_lhsOitemType)))+sem_SelectItem_SelectItem :: T_Expression ->+ String ->+ T_SelectItem +sem_SelectItem_SelectItem ex_ name_ =+ (\ _lhsIscope ->+ (let _lhsOitemType :: Type+ _lhsOcolumnName :: String+ _lhsOannotatedTree :: SelectItem+ _exOscope :: Scope+ _exIannotatedTree :: Expression+ _exIliftedColumnName :: String+ _lhsOitemType =+ getTypeAnnotation _exIannotatedTree+ _backTree =+ SelectItem (fixStar _exIannotatedTree) name_+ _lhsOcolumnName =+ name_+ _annotatedTree =+ SelectItem _exIannotatedTree name_+ _lhsOannotatedTree =+ _annotatedTree+ _exOscope =+ _lhsIscope+ ( _exIannotatedTree,_exIliftedColumnName) =+ (ex_ _exOscope )+ in ( _lhsOannotatedTree,_lhsOcolumnName,_lhsOitemType)))+-- SelectItemList ----------------------------------------------+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 = Scope ->+ ( SelectItemList,Type)+data Inh_SelectItemList = Inh_SelectItemList {scope_Inh_SelectItemList :: Scope}+data Syn_SelectItemList = Syn_SelectItemList {annotatedTree_Syn_SelectItemList :: SelectItemList,listType_Syn_SelectItemList :: Type}+wrap_SelectItemList :: T_SelectItemList ->+ Inh_SelectItemList ->+ Syn_SelectItemList +wrap_SelectItemList sem (Inh_SelectItemList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOlistType) =+ (sem _lhsIscope )+ in (Syn_SelectItemList _lhsOannotatedTree _lhsOlistType ))+sem_SelectItemList_Cons :: T_SelectItem ->+ T_SelectItemList ->+ T_SelectItemList +sem_SelectItemList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOlistType :: Type+ _lhsOannotatedTree :: SelectItemList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: SelectItem+ _hdIcolumnName :: String+ _hdIitemType :: Type+ _tlIannotatedTree :: SelectItemList+ _tlIlistType :: Type+ _lhsOlistType =+ doSelectItemListTpe _lhsIscope _hdIcolumnName _hdIitemType _tlIlistType+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdIcolumnName,_hdIitemType) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlIlistType) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOlistType)))+sem_SelectItemList_Nil :: T_SelectItemList +sem_SelectItemList_Nil =+ (\ _lhsIscope ->+ (let _lhsOlistType :: Type+ _lhsOannotatedTree :: SelectItemList+ _lhsOlistType =+ UnnamedCompositeType []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOlistType)))+-- SelectList --------------------------------------------------+data SelectList = SelectList (SelectItemList) (StringList) + deriving ( Eq,Show)+-- cata+sem_SelectList :: SelectList ->+ T_SelectList +sem_SelectList (SelectList _items _stringList ) =+ (sem_SelectList_SelectList (sem_SelectItemList _items ) (sem_StringList _stringList ) )+-- semantic domain+type T_SelectList = Scope ->+ ( SelectList,Type)+data Inh_SelectList = Inh_SelectList {scope_Inh_SelectList :: Scope}+data Syn_SelectList = Syn_SelectList {annotatedTree_Syn_SelectList :: SelectList,listType_Syn_SelectList :: Type}+wrap_SelectList :: T_SelectList ->+ Inh_SelectList ->+ Syn_SelectList +wrap_SelectList sem (Inh_SelectList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOlistType) =+ (sem _lhsIscope )+ in (Syn_SelectList _lhsOannotatedTree _lhsOlistType ))+sem_SelectList_SelectList :: T_SelectItemList ->+ T_StringList ->+ T_SelectList +sem_SelectList_SelectList items_ stringList_ =+ (\ _lhsIscope ->+ (let _lhsOlistType :: Type+ _lhsOannotatedTree :: SelectList+ _itemsOscope :: Scope+ _stringListOscope :: Scope+ _itemsIannotatedTree :: SelectItemList+ _itemsIlistType :: Type+ _stringListIannotatedTree :: StringList+ _stringListIstrings :: ([String])+ _lhsOlistType =+ _itemsIlistType+ _annotatedTree =+ SelectList _itemsIannotatedTree _stringListIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _itemsOscope =+ _lhsIscope+ _stringListOscope =+ _lhsIscope+ ( _itemsIannotatedTree,_itemsIlistType) =+ (items_ _itemsOscope )+ ( _stringListIannotatedTree,_stringListIstrings) =+ (stringList_ _stringListOscope )+ in ( _lhsOannotatedTree,_lhsOlistType)))+-- SetClause ---------------------------------------------------+data SetClause = RowSetClause (StringList) (ExpressionList) + | SetClause (String) (Expression) + deriving ( Eq,Show)+-- cata+sem_SetClause :: SetClause ->+ T_SetClause +sem_SetClause (RowSetClause _atts _vals ) =+ (sem_SetClause_RowSetClause (sem_StringList _atts ) (sem_ExpressionList _vals ) )+sem_SetClause (SetClause _att _val ) =+ (sem_SetClause_SetClause _att (sem_Expression _val ) )+-- semantic domain+type T_SetClause = Scope ->+ ( SetClause,([(String,Type)]),(Maybe TypeError))+data Inh_SetClause = Inh_SetClause {scope_Inh_SetClause :: Scope}+data Syn_SetClause = Syn_SetClause {annotatedTree_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 _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOpairs,_lhsOrowSetError) =+ (sem _lhsIscope )+ in (Syn_SetClause _lhsOannotatedTree _lhsOpairs _lhsOrowSetError ))+sem_SetClause_RowSetClause :: T_StringList ->+ T_ExpressionList ->+ T_SetClause +sem_SetClause_RowSetClause atts_ vals_ =+ (\ _lhsIscope ->+ (let _lhsOpairs :: ([(String,Type)])+ _lhsOannotatedTree :: SetClause+ _lhsOrowSetError :: (Maybe TypeError)+ _attsOscope :: Scope+ _valsOscope :: Scope+ _attsIannotatedTree :: StringList+ _attsIstrings :: ([String])+ _valsIannotatedTree :: ExpressionList+ _valsItypeList :: ([Type])+ _rowSetError =+ let atts = _attsIstrings+ types = getRowTypes _valsItypeList+ in if length atts /= length types+ then Just WrongNumberOfColumns+ else Nothing+ _lhsOpairs =+ zip _attsIstrings $ getRowTypes _valsItypeList+ _annotatedTree =+ RowSetClause _attsIannotatedTree _valsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _lhsOrowSetError =+ _rowSetError+ _attsOscope =+ _lhsIscope+ _valsOscope =+ _lhsIscope+ ( _attsIannotatedTree,_attsIstrings) =+ (atts_ _attsOscope )+ ( _valsIannotatedTree,_valsItypeList) =+ (vals_ _valsOscope )+ in ( _lhsOannotatedTree,_lhsOpairs,_lhsOrowSetError)))+sem_SetClause_SetClause :: String ->+ T_Expression ->+ T_SetClause +sem_SetClause_SetClause att_ val_ =+ (\ _lhsIscope ->+ (let _lhsOpairs :: ([(String,Type)])+ _lhsOrowSetError :: (Maybe TypeError)+ _lhsOannotatedTree :: SetClause+ _valOscope :: Scope+ _valIannotatedTree :: Expression+ _valIliftedColumnName :: String+ _lhsOpairs =+ [(att_, getTypeAnnotation _valIannotatedTree)]+ _lhsOrowSetError =+ Nothing+ _annotatedTree =+ SetClause att_ _valIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _valOscope =+ _lhsIscope+ ( _valIannotatedTree,_valIliftedColumnName) =+ (val_ _valOscope )+ in ( _lhsOannotatedTree,_lhsOpairs,_lhsOrowSetError)))+-- SetClauseList -----------------------------------------------+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 = Scope ->+ ( SetClauseList,([(String,Type)]),([TypeError]))+data Inh_SetClauseList = Inh_SetClauseList {scope_Inh_SetClauseList :: Scope}+data Syn_SetClauseList = Syn_SetClauseList {annotatedTree_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 _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOpairs,_lhsOrowSetErrors) =+ (sem _lhsIscope )+ in (Syn_SetClauseList _lhsOannotatedTree _lhsOpairs _lhsOrowSetErrors ))+sem_SetClauseList_Cons :: T_SetClause ->+ T_SetClauseList ->+ T_SetClauseList +sem_SetClauseList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOpairs :: ([(String,Type)])+ _lhsOrowSetErrors :: ([TypeError])+ _lhsOannotatedTree :: SetClauseList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: SetClause+ _hdIpairs :: ([(String,Type)])+ _hdIrowSetError :: (Maybe TypeError)+ _tlIannotatedTree :: SetClauseList+ _tlIpairs :: ([(String,Type)])+ _tlIrowSetErrors :: ([TypeError])+ _lhsOpairs =+ _hdIpairs ++ _tlIpairs+ _lhsOrowSetErrors =+ maybeToList _hdIrowSetError ++ _tlIrowSetErrors+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdIpairs,_hdIrowSetError) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlIpairs,_tlIrowSetErrors) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOpairs,_lhsOrowSetErrors)))+sem_SetClauseList_Nil :: T_SetClauseList +sem_SetClauseList_Nil =+ (\ _lhsIscope ->+ (let _lhsOpairs :: ([(String,Type)])+ _lhsOrowSetErrors :: ([TypeError])+ _lhsOannotatedTree :: SetClauseList+ _lhsOpairs =+ []+ _lhsOrowSetErrors =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOpairs,_lhsOrowSetErrors)))+-- Statement ---------------------------------------------------+data Statement = Assignment (Annotation) (String) (Expression) + | CaseStatement (Annotation) (Expression) (ExpressionListStatementListPairList) (StatementList) + | ContinueStatement (Annotation) + | Copy (Annotation) (String) (StringList) (CopySource) + | CopyData (Annotation) (String) + | CreateDomain (Annotation) (String) (TypeName) (Maybe Expression) + | CreateFunction (Annotation) (Language) (String) (ParamDefList) (TypeName) (String) (FnBody) (Volatility) + | CreateTable (Annotation) (String) (AttributeDefList) (ConstraintList) + | CreateTableAs (Annotation) (String) (SelectExpression) + | CreateType (Annotation) (String) (TypeAttributeDefList) + | CreateView (Annotation) (String) (SelectExpression) + | Delete (Annotation) (String) (Where) (Maybe SelectList) + | DropFunction (Annotation) (IfExists) (StringStringListPairList) (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) (Maybe SelectList) + | NullStatement (Annotation) + | Perform (Annotation) (Expression) + | Raise (Annotation) (RaiseType) (String) (ExpressionList) + | Return (Annotation) (Maybe Expression) + | ReturnNext (Annotation) (Expression) + | ReturnQuery (Annotation) (SelectExpression) + | SelectStatement (Annotation) (SelectExpression) + | Truncate (Annotation) (StringList) (RestartIdentity) (Cascade) + | Update (Annotation) (String) (SetClauseList) (Where) (Maybe SelectList) + | WhileStatement (Annotation) (Expression) (StatementList) + deriving ( Eq,Show)+-- cata+sem_Statement :: Statement ->+ T_Statement +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 _check ) =+ (sem_Statement_CreateDomain _ann _name (sem_TypeName _typ ) _check )+sem_Statement (CreateFunction _ann _lang _name _params _rettype _bodyQuote _body _vol ) =+ (sem_Statement_CreateFunction _ann (sem_Language _lang ) _name (sem_ParamDefList _params ) (sem_TypeName _rettype ) _bodyQuote (sem_FnBody _body ) (sem_Volatility _vol ) )+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 (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_Where _whr ) _returning )+sem_Statement (DropFunction _ann _ifE _sigs _cascade ) =+ (sem_Statement_DropFunction _ann (sem_IfExists _ifE ) (sem_StringStringListPairList _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 ) _returning )+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 _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 (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_Where _whr ) _returning )+sem_Statement (WhileStatement _ann _expr _sts ) =+ (sem_Statement_WhileStatement _ann (sem_Expression _expr ) (sem_StatementList _sts ) )+-- semantic domain+type T_Statement = Scope ->+ ( Statement)+data Inh_Statement = Inh_Statement {scope_Inh_Statement :: Scope}+data Syn_Statement = Syn_Statement {annotatedTree_Syn_Statement :: Statement}+wrap_Statement :: T_Statement ->+ Inh_Statement ->+ Syn_Statement +wrap_Statement sem (Inh_Statement _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Statement _lhsOannotatedTree ))+sem_Statement_Assignment :: Annotation ->+ String ->+ T_Expression ->+ T_Statement +sem_Statement_Assignment ann_ target_ value_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _valueOscope :: Scope+ _valueIannotatedTree :: Expression+ _valueIliftedColumnName :: String+ _annotatedTree =+ Assignment ann_ target_ _valueIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _valueOscope =+ _lhsIscope+ ( _valueIannotatedTree,_valueIliftedColumnName) =+ (value_ _valueOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CaseStatement :: Annotation ->+ T_Expression ->+ T_ExpressionListStatementListPairList ->+ T_StatementList ->+ T_Statement +sem_Statement_CaseStatement ann_ val_ cases_ els_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _valOscope :: Scope+ _casesOscope :: Scope+ _elsOscope :: Scope+ _valIannotatedTree :: Expression+ _valIliftedColumnName :: String+ _casesIannotatedTree :: ExpressionListStatementListPairList+ _elsIannotatedTree :: StatementList+ _annotatedTree =+ CaseStatement ann_ _valIannotatedTree _casesIannotatedTree _elsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _valOscope =+ _lhsIscope+ _casesOscope =+ _lhsIscope+ _elsOscope =+ _lhsIscope+ ( _valIannotatedTree,_valIliftedColumnName) =+ (val_ _valOscope )+ ( _casesIannotatedTree) =+ (cases_ _casesOscope )+ ( _elsIannotatedTree) =+ (els_ _elsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_ContinueStatement :: Annotation ->+ T_Statement +sem_Statement_ContinueStatement ann_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _annotatedTree =+ ContinueStatement ann_+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Statement_Copy :: Annotation ->+ String ->+ T_StringList ->+ T_CopySource ->+ T_Statement +sem_Statement_Copy ann_ table_ targetCols_ source_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _targetColsOscope :: Scope+ _sourceOscope :: Scope+ _targetColsIannotatedTree :: StringList+ _targetColsIstrings :: ([String])+ _sourceIannotatedTree :: CopySource+ _annotatedTree =+ Copy ann_ table_ _targetColsIannotatedTree _sourceIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _targetColsOscope =+ _lhsIscope+ _sourceOscope =+ _lhsIscope+ ( _targetColsIannotatedTree,_targetColsIstrings) =+ (targetCols_ _targetColsOscope )+ ( _sourceIannotatedTree) =+ (source_ _sourceOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CopyData :: Annotation ->+ String ->+ T_Statement +sem_Statement_CopyData ann_ insData_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _annotatedTree =+ CopyData ann_ insData_+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Statement_CreateDomain :: Annotation ->+ String ->+ T_TypeName ->+ (Maybe Expression) ->+ T_Statement +sem_Statement_CreateDomain ann_ name_ typ_ check_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _namedTypeType =+ case _typInamedType of+ Left _ -> TypeCheckFailed+ Right x -> x+ _tpe =+ checkTypes [_namedTypeType ] $ Right $ Pseudo Void+ _backTree =+ CreateDomain ann_ name_ _typIannotatedTree check_+ _statementInfo =+ CreateDomainInfo name_ _namedTypeType+ _annotatedTree =+ CreateDomain ann_ name_ _typIannotatedTree check_+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CreateFunction :: Annotation ->+ T_Language ->+ String ->+ T_ParamDefList ->+ T_TypeName ->+ String ->+ T_FnBody ->+ T_Volatility ->+ T_Statement +sem_Statement_CreateFunction ann_ lang_ name_ params_ rettype_ bodyQuote_ body_ vol_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _langOscope :: Scope+ _paramsOscope :: Scope+ _rettypeOscope :: Scope+ _bodyOscope :: Scope+ _volOscope :: Scope+ _langIannotatedTree :: Language+ _paramsIannotatedTree :: ParamDefList+ _paramsIparams :: ([(String,Either [TypeError] Type)])+ _rettypeIannotatedTree :: TypeName+ _rettypeInamedType :: (Either [TypeError] Type)+ _bodyIannotatedTree :: FnBody+ _volIannotatedTree :: Volatility+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _retTypeType =+ errorToTypeFail _rettypeInamedType+ _paramTypes =+ let tpes = map snd _paramsIparams+ in if null $ concat $ lefts tpes+ then rights tpes+ else [TypeCheckFailed]+ _tpe =+ do+ _rettypeInamedType+ let tpes = map snd _paramsIparams+ checkErrorList (concat $ lefts tpes) $ Pseudo Void+ _backTree =+ CreateFunction ann_+ _langIannotatedTree+ name_+ _paramsIannotatedTree+ _rettypeIannotatedTree+ bodyQuote_+ _bodyIannotatedTree+ _volIannotatedTree+ _statementInfo =+ CreateFunctionInfo (name_,_paramTypes ,_retTypeType )+ _annotatedTree =+ CreateFunction ann_ _langIannotatedTree name_ _paramsIannotatedTree _rettypeIannotatedTree bodyQuote_ _bodyIannotatedTree _volIannotatedTree+ _langOscope =+ _lhsIscope+ _paramsOscope =+ _lhsIscope+ _rettypeOscope =+ _lhsIscope+ _bodyOscope =+ _lhsIscope+ _volOscope =+ _lhsIscope+ ( _langIannotatedTree) =+ (lang_ _langOscope )+ ( _paramsIannotatedTree,_paramsIparams) =+ (params_ _paramsOscope )+ ( _rettypeIannotatedTree,_rettypeInamedType) =+ (rettype_ _rettypeOscope )+ ( _bodyIannotatedTree) =+ (body_ _bodyOscope )+ ( _volIannotatedTree) =+ (vol_ _volOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CreateTable :: Annotation ->+ String ->+ T_AttributeDefList ->+ T_ConstraintList ->+ T_Statement +sem_Statement_CreateTable ann_ name_ atts_ cons_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _attsOscope :: Scope+ _consOscope :: Scope+ _attsIannotatedTree :: AttributeDefList+ _attsIattrs :: ([(String, Either [TypeError] Type)])+ _consIannotatedTree :: ConstraintList+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _attrTypes =+ map snd _attsIattrs+ _tpe =+ checkErrorList (concat $ lefts _attrTypes ) $ Pseudo Void+ _compositeType =+ errorToTypeFailF (const $ UnnamedCompositeType doneAtts) _tpe+ where+ doneAtts = map (second errorToTypeFail) _attsIattrs+ _backTree =+ CreateTable ann_ name_ _attsIannotatedTree _consIannotatedTree+ _statementInfo =+ RelvarInfo (name_, TableComposite, _compositeType )+ _annotatedTree =+ CreateTable ann_ name_ _attsIannotatedTree _consIannotatedTree+ _attsOscope =+ _lhsIscope+ _consOscope =+ _lhsIscope+ ( _attsIannotatedTree,_attsIattrs) =+ (atts_ _attsOscope )+ ( _consIannotatedTree) =+ (cons_ _consOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CreateTableAs :: Annotation ->+ String ->+ T_SelectExpression ->+ T_Statement +sem_Statement_CreateTableAs ann_ name_ expr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _exprIannotatedTree :: SelectExpression+ _selType =+ getTypeAnnotation _exprIannotatedTree+ _tpe =+ Right _selType+ _backTree =+ CreateTableAs ann_ name_ _exprIannotatedTree+ _statementInfo =+ RelvarInfo (name_, TableComposite, _selType )+ _annotatedTree =+ CreateTableAs ann_ name_ _exprIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ ( _exprIannotatedTree) =+ (expr_ _exprOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CreateType :: Annotation ->+ String ->+ T_TypeAttributeDefList ->+ T_Statement +sem_Statement_CreateType ann_ name_ atts_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _attsOscope :: Scope+ _attsIannotatedTree :: TypeAttributeDefList+ _attsIattrs :: ([(String, Either [TypeError] Type)])+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _attrTypes =+ map snd _attsIattrs+ _tpe =+ checkErrorList (concat $ lefts _attrTypes ) $ Pseudo Void+ _compositeType =+ errorToTypeFailF (const $ UnnamedCompositeType doneAtts) _tpe+ where+ doneAtts = map (second errorToTypeFail) _attsIattrs+ _backTree =+ CreateType ann_ name_ _attsIannotatedTree+ _statementInfo =+ RelvarInfo (name_, Composite, _compositeType )+ _annotatedTree =+ CreateType ann_ name_ _attsIannotatedTree+ _attsOscope =+ _lhsIscope+ ( _attsIannotatedTree,_attsIattrs) =+ (atts_ _attsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_CreateView :: Annotation ->+ String ->+ T_SelectExpression ->+ T_Statement +sem_Statement_CreateView ann_ name_ expr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _exprIannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _tpe =+ checkTypes [getTypeAnnotation _exprIannotatedTree] $ Right $ Pseudo Void+ _backTree =+ CreateView ann_ name_ _exprIannotatedTree+ _statementInfo =+ RelvarInfo (name_, ViewComposite, getTypeAnnotation _exprIannotatedTree)+ _annotatedTree =+ CreateView ann_ name_ _exprIannotatedTree+ _exprOscope =+ _lhsIscope+ ( _exprIannotatedTree) =+ (expr_ _exprOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Delete :: Annotation ->+ String ->+ T_Where ->+ (Maybe SelectList) ->+ T_Statement +sem_Statement_Delete ann_ table_ whr_ returning_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _whrOscope :: Scope+ _whrIannotatedTree :: Where+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _tpe =+ case checkRelationExists _lhsIscope table_ of+ Just e -> Left [e]+ Nothing -> do+ whereType <- checkExpressionBool _whrIannotatedTree+ return $ Pseudo Void+ _statementInfo =+ DeleteInfo table_+ _backTree =+ Delete ann_ table_ _whrIannotatedTree returning_+ _annotatedTree =+ Delete ann_ table_ _whrIannotatedTree returning_+ _whrOscope =+ _lhsIscope+ ( _whrIannotatedTree) =+ (whr_ _whrOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_DropFunction :: Annotation ->+ T_IfExists ->+ T_StringStringListPairList ->+ T_Cascade ->+ T_Statement +sem_Statement_DropFunction ann_ ifE_ sigs_ cascade_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _ifEOscope :: Scope+ _sigsOscope :: Scope+ _cascadeOscope :: Scope+ _ifEIannotatedTree :: IfExists+ _sigsIannotatedTree :: StringStringListPairList+ _cascadeIannotatedTree :: Cascade+ _annotatedTree =+ DropFunction ann_ _ifEIannotatedTree _sigsIannotatedTree _cascadeIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _ifEOscope =+ _lhsIscope+ _sigsOscope =+ _lhsIscope+ _cascadeOscope =+ _lhsIscope+ ( _ifEIannotatedTree) =+ (ifE_ _ifEOscope )+ ( _sigsIannotatedTree) =+ (sigs_ _sigsOscope )+ ( _cascadeIannotatedTree) =+ (cascade_ _cascadeOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_DropSomething :: Annotation ->+ T_DropType ->+ T_IfExists ->+ T_StringList ->+ T_Cascade ->+ T_Statement +sem_Statement_DropSomething ann_ dropType_ ifE_ names_ cascade_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _dropTypeOscope :: Scope+ _ifEOscope :: Scope+ _namesOscope :: Scope+ _cascadeOscope :: Scope+ _dropTypeIannotatedTree :: DropType+ _ifEIannotatedTree :: IfExists+ _namesIannotatedTree :: StringList+ _namesIstrings :: ([String])+ _cascadeIannotatedTree :: Cascade+ _annotatedTree =+ DropSomething ann_ _dropTypeIannotatedTree _ifEIannotatedTree _namesIannotatedTree _cascadeIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _dropTypeOscope =+ _lhsIscope+ _ifEOscope =+ _lhsIscope+ _namesOscope =+ _lhsIscope+ _cascadeOscope =+ _lhsIscope+ ( _dropTypeIannotatedTree) =+ (dropType_ _dropTypeOscope )+ ( _ifEIannotatedTree) =+ (ifE_ _ifEOscope )+ ( _namesIannotatedTree,_namesIstrings) =+ (names_ _namesOscope )+ ( _cascadeIannotatedTree) =+ (cascade_ _cascadeOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Execute :: Annotation ->+ T_Expression ->+ T_Statement +sem_Statement_Execute ann_ expr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _annotatedTree =+ Execute ann_ _exprIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_ExecuteInto :: Annotation ->+ T_Expression ->+ T_StringList ->+ T_Statement +sem_Statement_ExecuteInto ann_ expr_ targets_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _targetsOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _targetsIannotatedTree :: StringList+ _targetsIstrings :: ([String])+ _annotatedTree =+ ExecuteInto ann_ _exprIannotatedTree _targetsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ _targetsOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ ( _targetsIannotatedTree,_targetsIstrings) =+ (targets_ _targetsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_ForIntegerStatement :: Annotation ->+ String ->+ T_Expression ->+ T_Expression ->+ T_StatementList ->+ T_Statement +sem_Statement_ForIntegerStatement ann_ var_ from_ to_ sts_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _fromOscope :: Scope+ _toOscope :: Scope+ _stsOscope :: Scope+ _fromIannotatedTree :: Expression+ _fromIliftedColumnName :: String+ _toIannotatedTree :: Expression+ _toIliftedColumnName :: String+ _stsIannotatedTree :: StatementList+ _annotatedTree =+ ForIntegerStatement ann_ var_ _fromIannotatedTree _toIannotatedTree _stsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _fromOscope =+ _lhsIscope+ _toOscope =+ _lhsIscope+ _stsOscope =+ _lhsIscope+ ( _fromIannotatedTree,_fromIliftedColumnName) =+ (from_ _fromOscope )+ ( _toIannotatedTree,_toIliftedColumnName) =+ (to_ _toOscope )+ ( _stsIannotatedTree) =+ (sts_ _stsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_ForSelectStatement :: Annotation ->+ String ->+ T_SelectExpression ->+ T_StatementList ->+ T_Statement +sem_Statement_ForSelectStatement ann_ var_ sel_ sts_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _selOscope :: Scope+ _stsOscope :: Scope+ _selIannotatedTree :: SelectExpression+ _stsIannotatedTree :: StatementList+ _annotatedTree =+ ForSelectStatement ann_ var_ _selIannotatedTree _stsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _selOscope =+ _lhsIscope+ _stsOscope =+ _lhsIscope+ ( _selIannotatedTree) =+ (sel_ _selOscope )+ ( _stsIannotatedTree) =+ (sts_ _stsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_If :: Annotation ->+ T_ExpressionStatementListPairList ->+ T_StatementList ->+ T_Statement +sem_Statement_If ann_ cases_ els_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _casesOscope :: Scope+ _elsOscope :: Scope+ _casesIannotatedTree :: ExpressionStatementListPairList+ _elsIannotatedTree :: StatementList+ _annotatedTree =+ If ann_ _casesIannotatedTree _elsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _casesOscope =+ _lhsIscope+ _elsOscope =+ _lhsIscope+ ( _casesIannotatedTree) =+ (cases_ _casesOscope )+ ( _elsIannotatedTree) =+ (els_ _elsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Insert :: Annotation ->+ String ->+ T_StringList ->+ T_SelectExpression ->+ (Maybe SelectList) ->+ T_Statement +sem_Statement_Insert ann_ table_ targetCols_ insData_ returning_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _targetColsOscope :: Scope+ _insDataOscope :: Scope+ _targetColsIannotatedTree :: StringList+ _targetColsIstrings :: ([String])+ _insDataIannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _columnStuff =+ checkColumnConsistency _lhsIscope+ table_+ _targetColsIstrings+ (unwrapComposite $ unwrapSetOf $+ getTypeAnnotation _insDataIannotatedTree)+ _tpe =+ checkTypes [getTypeAnnotation _insDataIannotatedTree] $ do+ _columnStuff+ Right $ Pseudo Void+ _statementInfo =+ InsertInfo table_ $ errorToTypeFailF UnnamedCompositeType _columnStuff+ _backTree =+ Insert ann_ table_ _targetColsIannotatedTree+ _insDataIannotatedTree returning_+ _annotatedTree =+ Insert ann_ table_ _targetColsIannotatedTree _insDataIannotatedTree returning_+ _targetColsOscope =+ _lhsIscope+ _insDataOscope =+ _lhsIscope+ ( _targetColsIannotatedTree,_targetColsIstrings) =+ (targetCols_ _targetColsOscope )+ ( _insDataIannotatedTree) =+ (insData_ _insDataOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_NullStatement :: Annotation ->+ T_Statement +sem_Statement_NullStatement ann_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _annotatedTree =+ NullStatement ann_+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Statement_Perform :: Annotation ->+ T_Expression ->+ T_Statement +sem_Statement_Perform ann_ expr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _annotatedTree =+ Perform ann_ _exprIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Raise :: Annotation ->+ T_RaiseType ->+ String ->+ T_ExpressionList ->+ T_Statement +sem_Statement_Raise ann_ level_ message_ args_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _levelOscope :: Scope+ _argsOscope :: Scope+ _levelIannotatedTree :: RaiseType+ _argsIannotatedTree :: ExpressionList+ _argsItypeList :: ([Type])+ _annotatedTree =+ Raise ann_ _levelIannotatedTree message_ _argsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _levelOscope =+ _lhsIscope+ _argsOscope =+ _lhsIscope+ ( _levelIannotatedTree) =+ (level_ _levelOscope )+ ( _argsIannotatedTree,_argsItypeList) =+ (args_ _argsOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Return :: Annotation ->+ (Maybe Expression) ->+ T_Statement +sem_Statement_Return ann_ value_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _annotatedTree =+ Return ann_ value_+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Statement_ReturnNext :: Annotation ->+ T_Expression ->+ T_Statement +sem_Statement_ReturnNext ann_ expr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _annotatedTree =+ ReturnNext ann_ _exprIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_ReturnQuery :: Annotation ->+ T_SelectExpression ->+ T_Statement +sem_Statement_ReturnQuery ann_ sel_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _selOscope :: Scope+ _selIannotatedTree :: SelectExpression+ _annotatedTree =+ ReturnQuery ann_ _selIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _selOscope =+ _lhsIscope+ ( _selIannotatedTree) =+ (sel_ _selOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_SelectStatement :: Annotation ->+ T_SelectExpression ->+ T_Statement +sem_Statement_SelectStatement ann_ ex_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exOscope :: Scope+ _exIannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _tpe =+ checkTypes [getTypeAnnotation _exIannotatedTree] $ Right $ Pseudo Void+ _statementInfo =+ SelectInfo $ getTypeAnnotation _exIannotatedTree+ _backTree =+ SelectStatement ann_ _exIannotatedTree+ _annotatedTree =+ SelectStatement ann_ _exIannotatedTree+ _exOscope =+ _lhsIscope+ ( _exIannotatedTree) =+ (ex_ _exOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Truncate :: Annotation ->+ T_StringList ->+ T_RestartIdentity ->+ T_Cascade ->+ T_Statement +sem_Statement_Truncate ann_ tables_ restartIdentity_ cascade_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _tablesOscope :: Scope+ _restartIdentityOscope :: Scope+ _cascadeOscope :: Scope+ _tablesIannotatedTree :: StringList+ _tablesIstrings :: ([String])+ _restartIdentityIannotatedTree :: RestartIdentity+ _cascadeIannotatedTree :: Cascade+ _annotatedTree =+ Truncate ann_ _tablesIannotatedTree _restartIdentityIannotatedTree _cascadeIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _tablesOscope =+ _lhsIscope+ _restartIdentityOscope =+ _lhsIscope+ _cascadeOscope =+ _lhsIscope+ ( _tablesIannotatedTree,_tablesIstrings) =+ (tables_ _tablesOscope )+ ( _restartIdentityIannotatedTree) =+ (restartIdentity_ _restartIdentityOscope )+ ( _cascadeIannotatedTree) =+ (cascade_ _cascadeOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_Update :: Annotation ->+ String ->+ T_SetClauseList ->+ T_Where ->+ (Maybe SelectList) ->+ T_Statement +sem_Statement_Update ann_ table_ assigns_ whr_ returning_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _assignsOscope :: Scope+ _whrOscope :: Scope+ _assignsIannotatedTree :: SetClauseList+ _assignsIpairs :: ([(String,Type)])+ _assignsIrowSetErrors :: ([TypeError])+ _whrIannotatedTree :: Where+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ $ Just $ StatementInfoA _statementInfo+ _tpe =+ do+ let re = checkRelationExists _lhsIscope table_+ when (isJust re) $+ Left [fromJust $ re]+ whereType <- checkExpressionBool _whrIannotatedTree+ chainTypeCheckFailed (whereType:map snd _assignsIpairs) $ do+ _columnsConsistent+ checkErrorList _assignsIrowSetErrors $ Pseudo Void+ _columnsConsistent =+ checkColumnConsistency _lhsIscope table_ (map fst _assignsIpairs) _assignsIpairs+ _statementInfo =+ UpdateInfo table_ $ flip errorToTypeFailF _columnsConsistent $+ \c -> let colNames = map fst _assignsIpairs+ in UnnamedCompositeType $ map (\t -> (t,getType c t)) colNames+ where+ getType cols t = fromJust $ lookup t cols+ _backTree =+ Update ann_ table_ _assignsIannotatedTree _whrIannotatedTree returning_+ _annotatedTree =+ Update ann_ table_ _assignsIannotatedTree _whrIannotatedTree returning_+ _assignsOscope =+ _lhsIscope+ _whrOscope =+ _lhsIscope+ ( _assignsIannotatedTree,_assignsIpairs,_assignsIrowSetErrors) =+ (assigns_ _assignsOscope )+ ( _whrIannotatedTree) =+ (whr_ _whrOscope )+ in ( _lhsOannotatedTree)))+sem_Statement_WhileStatement :: Annotation ->+ T_Expression ->+ T_StatementList ->+ T_Statement +sem_Statement_WhileStatement ann_ expr_ sts_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Statement+ _exprOscope :: Scope+ _stsOscope :: Scope+ _exprIannotatedTree :: Expression+ _exprIliftedColumnName :: String+ _stsIannotatedTree :: StatementList+ _annotatedTree =+ WhileStatement ann_ _exprIannotatedTree _stsIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _exprOscope =+ _lhsIscope+ _stsOscope =+ _lhsIscope+ ( _exprIannotatedTree,_exprIliftedColumnName) =+ (expr_ _exprOscope )+ ( _stsIannotatedTree) =+ (sts_ _stsOscope )+ in ( _lhsOannotatedTree)))+-- StatementList -----------------------------------------------+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 = Scope ->+ ( StatementList)+data Inh_StatementList = Inh_StatementList {scope_Inh_StatementList :: Scope}+data Syn_StatementList = Syn_StatementList {annotatedTree_Syn_StatementList :: StatementList}+wrap_StatementList :: T_StatementList ->+ Inh_StatementList ->+ Syn_StatementList +wrap_StatementList sem (Inh_StatementList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_StatementList _lhsOannotatedTree ))+sem_StatementList_Cons :: T_Statement ->+ T_StatementList ->+ T_StatementList +sem_StatementList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: StatementList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: Statement+ _tlIannotatedTree :: StatementList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_StatementList_Nil :: T_StatementList +sem_StatementList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: StatementList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- StringList --------------------------------------------------+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 = Scope ->+ ( StringList,([String]))+data Inh_StringList = Inh_StringList {scope_Inh_StringList :: Scope}+data Syn_StringList = Syn_StringList {annotatedTree_Syn_StringList :: StringList,strings_Syn_StringList :: [String]}+wrap_StringList :: T_StringList ->+ Inh_StringList ->+ Syn_StringList +wrap_StringList sem (Inh_StringList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOstrings) =+ (sem _lhsIscope )+ in (Syn_StringList _lhsOannotatedTree _lhsOstrings ))+sem_StringList_Cons :: String ->+ T_StringList ->+ T_StringList +sem_StringList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOstrings :: ([String])+ _lhsOannotatedTree :: StringList+ _tlOscope :: Scope+ _tlIannotatedTree :: StringList+ _tlIstrings :: ([String])+ _lhsOstrings =+ hd_ : _tlIstrings+ _annotatedTree =+ (:) hd_ _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _tlOscope =+ _lhsIscope+ ( _tlIannotatedTree,_tlIstrings) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOstrings)))+sem_StringList_Nil :: T_StringList +sem_StringList_Nil =+ (\ _lhsIscope ->+ (let _lhsOstrings :: ([String])+ _lhsOannotatedTree :: StringList+ _lhsOstrings =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOstrings)))+-- StringStringListPair ----------------------------------------+type StringStringListPair = ( (String),(StringList))+-- cata+sem_StringStringListPair :: StringStringListPair ->+ T_StringStringListPair +sem_StringStringListPair ( x1,x2) =+ (sem_StringStringListPair_Tuple x1 (sem_StringList x2 ) )+-- semantic domain+type T_StringStringListPair = Scope ->+ ( StringStringListPair)+data Inh_StringStringListPair = Inh_StringStringListPair {scope_Inh_StringStringListPair :: Scope}+data Syn_StringStringListPair = Syn_StringStringListPair {annotatedTree_Syn_StringStringListPair :: StringStringListPair}+wrap_StringStringListPair :: T_StringStringListPair ->+ Inh_StringStringListPair ->+ Syn_StringStringListPair +wrap_StringStringListPair sem (Inh_StringStringListPair _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_StringStringListPair _lhsOannotatedTree ))+sem_StringStringListPair_Tuple :: String ->+ T_StringList ->+ T_StringStringListPair +sem_StringStringListPair_Tuple x1_ x2_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: StringStringListPair+ _x2Oscope :: Scope+ _x2IannotatedTree :: StringList+ _x2Istrings :: ([String])+ _annotatedTree =+ (x1_,_x2IannotatedTree)+ _lhsOannotatedTree =+ _annotatedTree+ _x2Oscope =+ _lhsIscope+ ( _x2IannotatedTree,_x2Istrings) =+ (x2_ _x2Oscope )+ in ( _lhsOannotatedTree)))+-- StringStringListPairList ------------------------------------+type StringStringListPairList = [(StringStringListPair)]+-- cata+sem_StringStringListPairList :: StringStringListPairList ->+ T_StringStringListPairList +sem_StringStringListPairList list =+ (Prelude.foldr sem_StringStringListPairList_Cons sem_StringStringListPairList_Nil (Prelude.map sem_StringStringListPair list) )+-- semantic domain+type T_StringStringListPairList = Scope ->+ ( StringStringListPairList)+data Inh_StringStringListPairList = Inh_StringStringListPairList {scope_Inh_StringStringListPairList :: Scope}+data Syn_StringStringListPairList = Syn_StringStringListPairList {annotatedTree_Syn_StringStringListPairList :: StringStringListPairList}+wrap_StringStringListPairList :: T_StringStringListPairList ->+ Inh_StringStringListPairList ->+ Syn_StringStringListPairList +wrap_StringStringListPairList sem (Inh_StringStringListPairList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_StringStringListPairList _lhsOannotatedTree ))+sem_StringStringListPairList_Cons :: T_StringStringListPair ->+ T_StringStringListPairList ->+ T_StringStringListPairList +sem_StringStringListPairList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: StringStringListPairList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: StringStringListPair+ _tlIannotatedTree :: StringStringListPairList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_StringStringListPairList_Nil :: T_StringStringListPairList +sem_StringStringListPairList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: StringStringListPairList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- TableRef ----------------------------------------------------+data TableRef = JoinedTref (Annotation) (TableRef) (Natural) (JoinType) (TableRef) (OnExpr) + | SubTref (Annotation) (SelectExpression) (String) + | Tref (Annotation) (String) + | TrefAlias (Annotation) (String) (String) + | TrefFun (Annotation) (Expression) + | TrefFunAlias (Annotation) (Expression) (String) + deriving ( Eq,Show)+-- cata+sem_TableRef :: TableRef ->+ T_TableRef +sem_TableRef (JoinedTref _ann _tbl _nat _joinType _tbl1 _onExpr ) =+ (sem_TableRef_JoinedTref _ann (sem_TableRef _tbl ) (sem_Natural _nat ) (sem_JoinType _joinType ) (sem_TableRef _tbl1 ) (sem_OnExpr _onExpr ) )+sem_TableRef (SubTref _ann _sel _alias ) =+ (sem_TableRef_SubTref _ann (sem_SelectExpression _sel ) _alias )+sem_TableRef (Tref _ann _tbl ) =+ (sem_TableRef_Tref _ann _tbl )+sem_TableRef (TrefAlias _ann _tbl _alias ) =+ (sem_TableRef_TrefAlias _ann _tbl _alias )+sem_TableRef (TrefFun _ann _fn ) =+ (sem_TableRef_TrefFun _ann (sem_Expression _fn ) )+sem_TableRef (TrefFunAlias _ann _fn _alias ) =+ (sem_TableRef_TrefFunAlias _ann (sem_Expression _fn ) _alias )+-- semantic domain+type T_TableRef = Scope ->+ ( TableRef,([QualifiedScope]),([String]))+data Inh_TableRef = Inh_TableRef {scope_Inh_TableRef :: Scope}+data Syn_TableRef = Syn_TableRef {annotatedTree_Syn_TableRef :: TableRef,idens_Syn_TableRef :: [QualifiedScope],joinIdens_Syn_TableRef :: [String]}+wrap_TableRef :: T_TableRef ->+ Inh_TableRef ->+ Syn_TableRef +wrap_TableRef sem (Inh_TableRef _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens) =+ (sem _lhsIscope )+ in (Syn_TableRef _lhsOannotatedTree _lhsOidens _lhsOjoinIdens ))+sem_TableRef_JoinedTref :: Annotation ->+ T_TableRef ->+ T_Natural ->+ T_JoinType ->+ T_TableRef ->+ T_OnExpr ->+ T_TableRef +sem_TableRef_JoinedTref ann_ tbl_ nat_ joinType_ tbl1_ onExpr_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: TableRef+ _lhsOidens :: ([QualifiedScope])+ _lhsOjoinIdens :: ([String])+ _tblOscope :: Scope+ _natOscope :: Scope+ _joinTypeOscope :: Scope+ _tbl1Oscope :: Scope+ _onExprOscope :: Scope+ _tblIannotatedTree :: TableRef+ _tblIidens :: ([QualifiedScope])+ _tblIjoinIdens :: ([String])+ _natIannotatedTree :: Natural+ _joinTypeIannotatedTree :: JoinType+ _tbl1IannotatedTree :: TableRef+ _tbl1Iidens :: ([QualifiedScope])+ _tbl1IjoinIdens :: ([String])+ _onExprIannotatedTree :: OnExpr+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ checkTypes [tblt+ ,tbl1t] $+ case (_natIannotatedTree, _onExprIannotatedTree) of+ (Natural, _) -> unionJoinList $+ commonFieldNames tblt tbl1t+ (_,Just (JoinUsing s)) -> unionJoinList s+ _ -> unionJoinList []+ where+ tblt = getTypeAnnotation _tblIannotatedTree+ tbl1t = getTypeAnnotation _tbl1IannotatedTree+ unionJoinList s =+ combineTableTypesWithUsingList _lhsIscope s tblt tbl1t+ _lhsOidens =+ _tblIidens ++ _tbl1Iidens+ _lhsOjoinIdens =+ commonFieldNames (getTypeAnnotation _tblIannotatedTree)+ (getTypeAnnotation _tbl1IannotatedTree)+ _backTree =+ JoinedTref ann_+ _tblIannotatedTree+ _natIannotatedTree+ _joinTypeIannotatedTree+ _tbl1IannotatedTree+ _onExprIannotatedTree+ _annotatedTree =+ JoinedTref ann_ _tblIannotatedTree _natIannotatedTree _joinTypeIannotatedTree _tbl1IannotatedTree _onExprIannotatedTree+ _tblOscope =+ _lhsIscope+ _natOscope =+ _lhsIscope+ _joinTypeOscope =+ _lhsIscope+ _tbl1Oscope =+ _lhsIscope+ _onExprOscope =+ _lhsIscope+ ( _tblIannotatedTree,_tblIidens,_tblIjoinIdens) =+ (tbl_ _tblOscope )+ ( _natIannotatedTree) =+ (nat_ _natOscope )+ ( _joinTypeIannotatedTree) =+ (joinType_ _joinTypeOscope )+ ( _tbl1IannotatedTree,_tbl1Iidens,_tbl1IjoinIdens) =+ (tbl1_ _tbl1Oscope )+ ( _onExprIannotatedTree) =+ (onExpr_ _onExprOscope )+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+sem_TableRef_SubTref :: Annotation ->+ T_SelectExpression ->+ String ->+ T_TableRef +sem_TableRef_SubTref ann_ sel_ alias_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: TableRef+ _lhsOidens :: ([QualifiedScope])+ _lhsOjoinIdens :: ([String])+ _selOscope :: Scope+ _selIannotatedTree :: SelectExpression+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ checkTypes [getTypeAnnotation _selIannotatedTree] $+ Right $ unwrapSetOfComposite $ getTypeAnnotation _selIannotatedTree+ _backTree =+ SubTref ann_ _selIannotatedTree alias_+ _lhsOidens =+ [(alias_, (getTbCols _selIannotatedTree, []))]+ _lhsOjoinIdens =+ []+ _annotatedTree =+ SubTref ann_ _selIannotatedTree alias_+ _selOscope =+ _lhsIscope+ ( _selIannotatedTree) =+ (sel_ _selOscope )+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+sem_TableRef_Tref :: Annotation ->+ String ->+ T_TableRef +sem_TableRef_Tref ann_ tbl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: TableRef+ _lhsOjoinIdens :: ([String])+ _lhsOidens :: ([QualifiedScope])+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ either Left (Right . fst) _relType+ _lhsOjoinIdens =+ []+ _relType =+ getRelationType _lhsIscope tbl_+ _unwrappedRelType =+ either (const ([], [])) (both unwrapComposite) _relType+ _lhsOidens =+ [(tbl_, _unwrappedRelType )]+ _backTree =+ Tref ann_ tbl_+ _annotatedTree =+ Tref ann_ tbl_+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+sem_TableRef_TrefAlias :: Annotation ->+ String ->+ String ->+ T_TableRef +sem_TableRef_TrefAlias ann_ tbl_ alias_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: TableRef+ _lhsOjoinIdens :: ([String])+ _lhsOidens :: ([QualifiedScope])+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ either Left (Right . fst) _relType+ _lhsOjoinIdens =+ []+ _relType =+ getRelationType _lhsIscope tbl_+ _unwrappedRelType =+ either (const ([], [])) (both unwrapComposite) _relType+ _lhsOidens =+ [(alias_, _unwrappedRelType )]+ _backTree =+ TrefAlias ann_ tbl_ alias_+ _annotatedTree =+ TrefAlias ann_ tbl_ alias_+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+sem_TableRef_TrefFun :: Annotation ->+ T_Expression ->+ T_TableRef +sem_TableRef_TrefFun ann_ fn_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: TableRef+ _lhsOjoinIdens :: ([String])+ _lhsOidens :: ([QualifiedScope])+ _fnOscope :: Scope+ _fnIannotatedTree :: Expression+ _fnIliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ getFnType _lhsIscope _alias _fnIannotatedTree+ _lhsOjoinIdens =+ []+ _lhsOidens =+ case getFunIdens+ _lhsIscope _alias+ _fnIannotatedTree of+ Left e -> []+ Right x -> [second (\l -> (unwrapComposite l, [])) x]+ _alias =+ ""+ _backTree =+ TrefFun ann_ _fnIannotatedTree+ _annotatedTree =+ TrefFun ann_ _fnIannotatedTree+ _fnOscope =+ _lhsIscope+ ( _fnIannotatedTree,_fnIliftedColumnName) =+ (fn_ _fnOscope )+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+sem_TableRef_TrefFunAlias :: Annotation ->+ T_Expression ->+ String ->+ T_TableRef +sem_TableRef_TrefFunAlias ann_ fn_ alias_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: TableRef+ _lhsOjoinIdens :: ([String])+ _lhsOidens :: ([QualifiedScope])+ _fnOscope :: Scope+ _fnIannotatedTree :: Expression+ _fnIliftedColumnName :: String+ _lhsOannotatedTree =+ annTypesAndErrors _backTree+ (errorToTypeFail _tpe )+ (getErrors _tpe )+ Nothing+ _tpe =+ getFnType _lhsIscope alias_ _fnIannotatedTree+ _lhsOjoinIdens =+ []+ _lhsOidens =+ case getFunIdens+ _lhsIscope _alias+ _fnIannotatedTree of+ Left e -> []+ Right x -> [second (\l -> (unwrapComposite l, [])) x]+ _alias =+ alias_+ _backTree =+ TrefFunAlias ann_ _fnIannotatedTree alias_+ _annotatedTree =+ TrefFunAlias ann_ _fnIannotatedTree _alias+ _fnOscope =+ _lhsIscope+ ( _fnIannotatedTree,_fnIliftedColumnName) =+ (fn_ _fnOscope )+ in ( _lhsOannotatedTree,_lhsOidens,_lhsOjoinIdens)))+-- TypeAttributeDef --------------------------------------------+data TypeAttributeDef = TypeAttDef (String) (TypeName) + deriving ( Eq,Show)+-- cata+sem_TypeAttributeDef :: TypeAttributeDef ->+ T_TypeAttributeDef +sem_TypeAttributeDef (TypeAttDef _name _typ ) =+ (sem_TypeAttributeDef_TypeAttDef _name (sem_TypeName _typ ) )+-- semantic domain+type T_TypeAttributeDef = Scope ->+ ( TypeAttributeDef,String,(Either [TypeError] Type))+data Inh_TypeAttributeDef = Inh_TypeAttributeDef {scope_Inh_TypeAttributeDef :: Scope}+data Syn_TypeAttributeDef = Syn_TypeAttributeDef {annotatedTree_Syn_TypeAttributeDef :: TypeAttributeDef,attrName_Syn_TypeAttributeDef :: String,namedType_Syn_TypeAttributeDef :: Either [TypeError] Type}+wrap_TypeAttributeDef :: T_TypeAttributeDef ->+ Inh_TypeAttributeDef ->+ Syn_TypeAttributeDef +wrap_TypeAttributeDef sem (Inh_TypeAttributeDef _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType) =+ (sem _lhsIscope )+ in (Syn_TypeAttributeDef _lhsOannotatedTree _lhsOattrName _lhsOnamedType ))+sem_TypeAttributeDef_TypeAttDef :: String ->+ T_TypeName ->+ T_TypeAttributeDef +sem_TypeAttributeDef_TypeAttDef name_ typ_ =+ (\ _lhsIscope ->+ (let _lhsOattrName :: String+ _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: TypeAttributeDef+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _lhsOattrName =+ name_+ _lhsOnamedType =+ _typInamedType+ _annotatedTree =+ TypeAttDef name_ _typIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree,_lhsOattrName,_lhsOnamedType)))+-- TypeAttributeDefList ----------------------------------------+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 = Scope ->+ ( TypeAttributeDefList,([(String, Either [TypeError] Type)]))+data Inh_TypeAttributeDefList = Inh_TypeAttributeDefList {scope_Inh_TypeAttributeDefList :: Scope}+data Syn_TypeAttributeDefList = Syn_TypeAttributeDefList {annotatedTree_Syn_TypeAttributeDefList :: TypeAttributeDefList,attrs_Syn_TypeAttributeDefList :: [(String, Either [TypeError] Type)]}+wrap_TypeAttributeDefList :: T_TypeAttributeDefList ->+ Inh_TypeAttributeDefList ->+ Syn_TypeAttributeDefList +wrap_TypeAttributeDefList sem (Inh_TypeAttributeDefList _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOattrs) =+ (sem _lhsIscope )+ in (Syn_TypeAttributeDefList _lhsOannotatedTree _lhsOattrs ))+sem_TypeAttributeDefList_Cons :: T_TypeAttributeDef ->+ T_TypeAttributeDefList ->+ T_TypeAttributeDefList +sem_TypeAttributeDefList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOattrs :: ([(String, Either [TypeError] Type)])+ _lhsOannotatedTree :: TypeAttributeDefList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: TypeAttributeDef+ _hdIattrName :: String+ _hdInamedType :: (Either [TypeError] Type)+ _tlIannotatedTree :: TypeAttributeDefList+ _tlIattrs :: ([(String, Either [TypeError] Type)])+ _lhsOattrs =+ (_hdIattrName, _hdInamedType) : _tlIattrs+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree,_hdIattrName,_hdInamedType) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree,_tlIattrs) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree,_lhsOattrs)))+sem_TypeAttributeDefList_Nil :: T_TypeAttributeDefList +sem_TypeAttributeDefList_Nil =+ (\ _lhsIscope ->+ (let _lhsOattrs :: ([(String, Either [TypeError] Type)])+ _lhsOannotatedTree :: TypeAttributeDefList+ _lhsOattrs =+ []+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree,_lhsOattrs)))+-- TypeName ----------------------------------------------------+data TypeName = ArrayTypeName (TypeName) + | PrecTypeName (String) (Integer) + | SetOfTypeName (TypeName) + | SimpleTypeName (String) + deriving ( Eq,Show)+-- cata+sem_TypeName :: TypeName ->+ T_TypeName +sem_TypeName (ArrayTypeName _typ ) =+ (sem_TypeName_ArrayTypeName (sem_TypeName _typ ) )+sem_TypeName (PrecTypeName _tn _prec ) =+ (sem_TypeName_PrecTypeName _tn _prec )+sem_TypeName (SetOfTypeName _typ ) =+ (sem_TypeName_SetOfTypeName (sem_TypeName _typ ) )+sem_TypeName (SimpleTypeName _tn ) =+ (sem_TypeName_SimpleTypeName _tn )+-- semantic domain+type T_TypeName = Scope ->+ ( TypeName,(Either [TypeError] Type))+data Inh_TypeName = Inh_TypeName {scope_Inh_TypeName :: Scope}+data Syn_TypeName = Syn_TypeName {annotatedTree_Syn_TypeName :: TypeName,namedType_Syn_TypeName :: Either [TypeError] Type}+wrap_TypeName :: T_TypeName ->+ Inh_TypeName ->+ Syn_TypeName +wrap_TypeName sem (Inh_TypeName _lhsIscope ) =+ (let ( _lhsOannotatedTree,_lhsOnamedType) =+ (sem _lhsIscope )+ in (Syn_TypeName _lhsOannotatedTree _lhsOnamedType ))+sem_TypeName_ArrayTypeName :: T_TypeName ->+ T_TypeName +sem_TypeName_ArrayTypeName typ_ =+ (\ _lhsIscope ->+ (let _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: TypeName+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _lhsOnamedType =+ ArrayType <$> _typInamedType+ _lhsOannotatedTree =+ ArrayTypeName _typIannotatedTree+ _annotatedTree =+ ArrayTypeName _typIannotatedTree+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree,_lhsOnamedType)))+sem_TypeName_PrecTypeName :: String ->+ Integer ->+ T_TypeName +sem_TypeName_PrecTypeName tn_ prec_ =+ (\ _lhsIscope ->+ (let _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: TypeName+ _lhsOnamedType =+ Right TypeCheckFailed+ _lhsOannotatedTree =+ PrecTypeName tn_ prec_+ _annotatedTree =+ PrecTypeName tn_ prec_+ in ( _lhsOannotatedTree,_lhsOnamedType)))+sem_TypeName_SetOfTypeName :: T_TypeName ->+ T_TypeName +sem_TypeName_SetOfTypeName typ_ =+ (\ _lhsIscope ->+ (let _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: TypeName+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _lhsOnamedType =+ SetOfType <$> _typInamedType+ _lhsOannotatedTree =+ SetOfTypeName _typIannotatedTree+ _annotatedTree =+ SetOfTypeName _typIannotatedTree+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree,_lhsOnamedType)))+sem_TypeName_SimpleTypeName :: String ->+ T_TypeName +sem_TypeName_SimpleTypeName tn_ =+ (\ _lhsIscope ->+ (let _lhsOnamedType :: (Either [TypeError] Type)+ _lhsOannotatedTree :: TypeName+ _lhsOnamedType =+ lookupTypeByName _lhsIscope $ canonicalizeTypeName tn_+ _lhsOannotatedTree =+ SimpleTypeName tn_+ _annotatedTree =+ SimpleTypeName tn_+ in ( _lhsOannotatedTree,_lhsOnamedType)))+-- VarDef ------------------------------------------------------+data VarDef = VarDef (String) (TypeName) (Maybe Expression) + deriving ( Eq,Show)+-- cata+sem_VarDef :: VarDef ->+ T_VarDef +sem_VarDef (VarDef _name _typ _value ) =+ (sem_VarDef_VarDef _name (sem_TypeName _typ ) _value )+-- semantic domain+type T_VarDef = Scope ->+ ( VarDef)+data Inh_VarDef = Inh_VarDef {scope_Inh_VarDef :: Scope}+data Syn_VarDef = Syn_VarDef {annotatedTree_Syn_VarDef :: VarDef}+wrap_VarDef :: T_VarDef ->+ Inh_VarDef ->+ Syn_VarDef +wrap_VarDef sem (Inh_VarDef _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_VarDef _lhsOannotatedTree ))+sem_VarDef_VarDef :: String ->+ T_TypeName ->+ (Maybe Expression) ->+ T_VarDef +sem_VarDef_VarDef name_ typ_ value_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: VarDef+ _typOscope :: Scope+ _typIannotatedTree :: TypeName+ _typInamedType :: (Either [TypeError] Type)+ _annotatedTree =+ VarDef name_ _typIannotatedTree value_+ _lhsOannotatedTree =+ _annotatedTree+ _typOscope =+ _lhsIscope+ ( _typIannotatedTree,_typInamedType) =+ (typ_ _typOscope )+ in ( _lhsOannotatedTree)))+-- VarDefList --------------------------------------------------+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 = Scope ->+ ( VarDefList)+data Inh_VarDefList = Inh_VarDefList {scope_Inh_VarDefList :: Scope}+data Syn_VarDefList = Syn_VarDefList {annotatedTree_Syn_VarDefList :: VarDefList}+wrap_VarDefList :: T_VarDefList ->+ Inh_VarDefList ->+ Syn_VarDefList +wrap_VarDefList sem (Inh_VarDefList _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_VarDefList _lhsOannotatedTree ))+sem_VarDefList_Cons :: T_VarDef ->+ T_VarDefList ->+ T_VarDefList +sem_VarDefList_Cons hd_ tl_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: VarDefList+ _hdOscope :: Scope+ _tlOscope :: Scope+ _hdIannotatedTree :: VarDef+ _tlIannotatedTree :: VarDefList+ _annotatedTree =+ (:) _hdIannotatedTree _tlIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _hdOscope =+ _lhsIscope+ _tlOscope =+ _lhsIscope+ ( _hdIannotatedTree) =+ (hd_ _hdOscope )+ ( _tlIannotatedTree) =+ (tl_ _tlOscope )+ in ( _lhsOannotatedTree)))+sem_VarDefList_Nil :: T_VarDefList +sem_VarDefList_Nil =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: VarDefList+ _annotatedTree =+ []+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Volatility --------------------------------------------------+data Volatility = Immutable + | Stable + | Volatile + deriving ( Eq,Show)+-- 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 = Scope ->+ ( Volatility)+data Inh_Volatility = Inh_Volatility {scope_Inh_Volatility :: Scope}+data Syn_Volatility = Syn_Volatility {annotatedTree_Syn_Volatility :: Volatility}+wrap_Volatility :: T_Volatility ->+ Inh_Volatility ->+ Syn_Volatility +wrap_Volatility sem (Inh_Volatility _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Volatility _lhsOannotatedTree ))+sem_Volatility_Immutable :: T_Volatility +sem_Volatility_Immutable =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Volatility+ _annotatedTree =+ Immutable+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Volatility_Stable :: T_Volatility +sem_Volatility_Stable =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Volatility+ _annotatedTree =+ Stable+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+sem_Volatility_Volatile :: T_Volatility +sem_Volatility_Volatile =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Volatility+ _annotatedTree =+ Volatile+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))+-- Where -------------------------------------------------------+type Where = (Maybe (Expression))+-- cata+sem_Where :: Where ->+ T_Where +sem_Where (Prelude.Just x ) =+ (sem_Where_Just (sem_Expression x ) )+sem_Where Prelude.Nothing =+ sem_Where_Nothing+-- semantic domain+type T_Where = Scope ->+ ( Where)+data Inh_Where = Inh_Where {scope_Inh_Where :: Scope}+data Syn_Where = Syn_Where {annotatedTree_Syn_Where :: Where}+wrap_Where :: T_Where ->+ Inh_Where ->+ Syn_Where +wrap_Where sem (Inh_Where _lhsIscope ) =+ (let ( _lhsOannotatedTree) =+ (sem _lhsIscope )+ in (Syn_Where _lhsOannotatedTree ))+sem_Where_Just :: T_Expression ->+ T_Where +sem_Where_Just just_ =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Where+ _justOscope :: Scope+ _justIannotatedTree :: Expression+ _justIliftedColumnName :: String+ _annotatedTree =+ Just _justIannotatedTree+ _lhsOannotatedTree =+ _annotatedTree+ _justOscope =+ _lhsIscope+ ( _justIannotatedTree,_justIliftedColumnName) =+ (just_ _justOscope )+ in ( _lhsOannotatedTree)))+sem_Where_Nothing :: T_Where +sem_Where_Nothing =+ (\ _lhsIscope ->+ (let _lhsOannotatedTree :: Where+ _annotatedTree =+ Nothing+ _lhsOannotatedTree =+ _annotatedTree+ in ( _lhsOannotatedTree)))
+ Database/HsSqlPpp/TypeChecking/AstUtils.lhs view
@@ -0,0 +1,343 @@+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.TypeChecking.AstUtils+> (+> OperatorType(..)+> ,getOperatorType+> ,checkTypes+> ,chainTypeCheckFailed+> ,errorToTypeFail+> ,errorToTypeFailF+> ,checkErrorList+> ,getErrors+> ,typeSmallInt,typeBigInt,typeInt,typeNumeric,typeFloat4+> ,typeFloat8,typeVarChar,typeChar,typeBool+> ,canonicalizeTypeName+> ,checkTypeExists+> ,lookupTypeByName+> ,keywordOperatorTypes+> ,specialFunctionTypes+> ,isArrayType+> ,unwrapArray+> ,unwrapSetOfComposite+> ,unwrapSetOf+> ,unwrapComposite+> ,consComposite+> ,unwrapRowCtor+> ) where++> import Data.Maybe+> import Data.List+> import Control.Monad.Error++> import Database.HsSqlPpp.TypeChecking.TypeType+> import Database.HsSqlPpp.TypeChecking.Scope+> import Database.HsSqlPpp.TypeChecking.DefaultScope++================================================================================++= 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++this is why binary @ operator isn't currently supported++> data OperatorType = BinaryOp | PrefixOp | PostfixOp+> deriving (Eq,Show)++> getOperatorType :: String -> OperatorType+> getOperatorType s = case () of+> _ | any (\(x,_,_) -> x == s) (scopeBinaryOperators defaultScope) ->+> BinaryOp+> | any (\(x,_,_) -> x == s ||+> (x=="-" && s=="u-"))+> (scopePrefixOperators defaultScope) ->+> PrefixOp+> | any (\(x,_,_) -> x == s) (scopePostfixOperators defaultScope) ->+> PostfixOp+> | s `elem` ["!and", "!or","!like"] -> BinaryOp+> | s `elem` ["!not"] -> PrefixOp+> | s `elem` ["!isNull", "!isNotNull"] -> PostfixOp+> | otherwise ->+> error $ "don't know flavour of operator " ++ s++================================================================================++= type checking utils++== checkErrors++if we find a typecheckfailed in the list, then propagate that, else+use the final argument.++> checkTypes :: [Type] -> Either [TypeError] Type -> Either [TypeError] Type+> checkTypes (TypeCheckFailed:_) _ = Right TypeCheckFailed+> checkTypes (_:ts) r = checkTypes ts r+> checkTypes [] r = r++small variant, not sure if both are needed++> chainTypeCheckFailed :: [Type] -> Either a Type -> Either a Type+> chainTypeCheckFailed a b =+> if any (==TypeCheckFailed) a+> then Right TypeCheckFailed+> else b++convert an 'either [typeerror] type' to a type++> errorToTypeFail :: Either [TypeError] Type -> Type+> errorToTypeFail tpe = case tpe of+> Left _ -> TypeCheckFailed+> Right t -> t++convert an 'either [typeerror] x' to a type, using an x->type function++> errorToTypeFailF :: (t -> Type) -> Either [TypeError] t -> Type+> errorToTypeFailF f tpe = case tpe of+> Left _ -> TypeCheckFailed+> Right t -> f t++used to pass a regular type on iff the list of errors is null++> checkErrorList :: [TypeError] -> Type -> Either [TypeError] Type+> checkErrorList es t = if null es+> then Right t+> else Left es++extract errors from an either, gives empty list if right++> getErrors :: Either [TypeError] Type -> [TypeError]+> getErrors e = either id (const []) e++===============================================================================++= basic types++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.++=== 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"]+> bigIntNames = ["int8", "bigint"]+> numericNames = ["numeric", "decimal"]+> float4Names = ["real", "float4"]+> float8Names = ["double precision", "float"]+> varcharNames = ["character varying", "varchar"]+> charNames = ["character", "char"]+> boolNames = ["boolean", "bool"]++> checkTypeExists :: Scope -> Type -> Either [TypeError] Type+> checkTypeExists scope t =+> if t `elem` scopeTypes scope+> then Right t+> else Left [UnknownTypeError t]++> liftME :: a -> Maybe b -> Either a b+> liftME d m = case m of+> Nothing -> Left d+> Just b -> Right b++> lookupTypeByName :: Scope -> String -> Either [TypeError] Type+> lookupTypeByName scope name =+> liftME [UnknownTypeName name] $+> lookup name (scopeTypeNames scope)+++================================================================================++Internal errors++TODO: work out monad transformers and try to use these. Want to throw+an internal error when a programming error is detected (instead of+e.g. letting the haskell runtime throw a pattern match failure), then+catch it in the top level type check routines in ast.ag, convert it to+a regular either style error, all without dropping into IO.++This isn't used at the moment.++> data TInternalError = TInternalError String+> deriving (Eq, Ord, Show)++> instance Error TInternalError where+> noMsg = TInternalError "oh noes!"+> strMsg = TInternalError++================================================================================++types for the keyword operators, for use in findCallMatch. Not sure+where these should live but probably not here.++> keywordOperatorTypes :: [(String,[Type],Type)]+> keywordOperatorTypes = [+> ("!and", [typeBool, typeBool], typeBool)+> ,("!or", [typeBool, typeBool], typeBool)+> ,("!like", [ScalarType "text", ScalarType "text"], typeBool)+> ,("!not", [typeBool], typeBool)+> ,("!isNull", [Pseudo AnyElement], typeBool)+> ,("!isNotNull", [Pseudo AnyElement], typeBool)+> ,("!arrayCtor", [Pseudo AnyElement], Pseudo AnyArray) -- not quite right,+> -- needs variadic support+> -- currently works via a special case+> -- in the type checking code+> ,("!between", [Pseudo AnyElement+> ,Pseudo AnyElement+> ,Pseudo AnyElement], Pseudo AnyElement)+> ,("!substring", [ScalarType "text",typeInt,typeInt], ScalarType "text")+> ,("!arraySub", [Pseudo AnyArray,typeInt], Pseudo AnyElement)+> ]++special functions, stuck in here at random also, these look like+functions, but don't appear in the postgresql catalog.++> specialFunctionTypes :: [(String,[Type],Type)]+> specialFunctionTypes = [+> ("coalesce", [Pseudo AnyElement],+> Pseudo AnyElement) -- needs variadic support to be correct,+> -- uses special case in type checking+> -- currently+> ,("nullif", [Pseudo AnyElement, Pseudo AnyElement], Pseudo AnyElement)+> ,("greatest", [Pseudo AnyElement], Pseudo AnyElement) --variadic, blah+> ,("least", [Pseudo AnyElement], Pseudo AnyElement) --also+> ]+++================================================================================++utilities for working with Types++> isArrayType :: Type -> Bool+> isArrayType (ArrayType _) = True+> isArrayType _ = False++> unwrapArray :: Type -> Type+> unwrapArray (ArrayType t) = t+> unwrapArray x = error $ "internal error: can't get types from non array " ++ show x++> unwrapSetOfComposite :: Type -> Type+> unwrapSetOfComposite (SetOfType a@(UnnamedCompositeType _)) = a+> unwrapSetOfComposite x = error $ "internal error: tried to unwrapSetOfComposite on " ++ show x++> unwrapSetOf :: Type -> Type+> unwrapSetOf (SetOfType a) = a+> unwrapSetOf x = error $ "internal error: tried to unwrapSetOf on " ++ show x++> unwrapComposite :: Type -> [(String,Type)]+> unwrapComposite (UnnamedCompositeType a) = a+> unwrapComposite x = error $ "internal error: cannot unwrapComposite on " ++ show x++> consComposite :: (String,Type) -> Type -> Type+> consComposite l (UnnamedCompositeType a) =+> UnnamedCompositeType (l:a)+> consComposite a b = error $ "internal error: called consComposite on " ++ show (a,b)++> unwrapRowCtor :: Type -> [Type]+> unwrapRowCtor (RowCtor a) = a+> unwrapRowCtor x = error $ "internal error: cannot unwrapRowCtor on " ++ show x
+ Database/HsSqlPpp/TypeChecking/DefaultScope.hs view
@@ -0,0 +1,7 @@+{-# OPTIONS_HADDOCK hide #-}+module Database.HsSqlPpp.TypeChecking.DefaultScope where+import Database.HsSqlPpp.TypeChecking.TypeType+import Database.HsSqlPpp.TypeChecking.ScopeData+-- | Scope value representing the catalog from a default template1 database+defaultScope :: Scope+defaultScope = Scope {scopeTypes = [ArrayType (ScalarType "abstime"),ScalarType "abstime",ArrayType (ScalarType "aclitem"),ScalarType "aclitem",Pseudo Any,Pseudo AnyArray,Pseudo AnyElement,Pseudo AnyEnum,Pseudo AnyNonArray,ArrayType (ScalarType "bit"),ScalarType "bit",ArrayType (ScalarType "bool"),ScalarType "bool",ArrayType (ScalarType "box"),ScalarType "box",ArrayType (ScalarType "bpchar"),ScalarType "bpchar",ArrayType (ScalarType "bytea"),ScalarType "bytea",ArrayType (ScalarType "char"),ScalarType "char",ArrayType (ScalarType "cid"),ScalarType "cid",ArrayType (ScalarType "cidr"),ScalarType "cidr",ArrayType (ScalarType "circle"),ScalarType "circle",ArrayType (Pseudo Cstring),Pseudo Cstring,ArrayType (ScalarType "date"),ScalarType "date",ArrayType (ScalarType "float4"),ScalarType "float4",ArrayType (ScalarType "float8"),ScalarType "float8",ArrayType (ScalarType "gtsvector"),ScalarType "gtsvector",ArrayType (ScalarType "inet"),ScalarType "inet",ArrayType (ScalarType "int2"),ScalarType "int2",ArrayType (ScalarType "int2vector"),ScalarType "int2vector",ArrayType (ScalarType "int4"),ScalarType "int4",ArrayType (ScalarType "int8"),ScalarType "int8",Pseudo Internal,ArrayType (ScalarType "interval"),ScalarType "interval",Pseudo LanguageHandler,ArrayType (ScalarType "line"),ScalarType "line",ArrayType (ScalarType "lseg"),ScalarType "lseg",ArrayType (ScalarType "macaddr"),ScalarType "macaddr",ArrayType (ScalarType "money"),ScalarType "money",ArrayType (ScalarType "name"),ScalarType "name",ArrayType (ScalarType "numeric"),ScalarType "numeric",ArrayType (ScalarType "oid"),ScalarType "oid",ArrayType (ScalarType "oidvector"),ScalarType "oidvector",Pseudo Opaque,ArrayType (ScalarType "path"),ScalarType "path",CompositeType "pg_aggregate",CompositeType "pg_am",CompositeType "pg_amop",CompositeType "pg_amproc",CompositeType "pg_attrdef",CompositeType "pg_attribute",CompositeType "pg_auth_members",CompositeType "pg_authid",CompositeType "pg_cast",CompositeType "pg_class",CompositeType "pg_constraint",CompositeType "pg_conversion",CompositeType "pg_cursors",CompositeType "pg_database",CompositeType "pg_depend",CompositeType "pg_description",CompositeType "pg_enum",CompositeType "pg_foreign_data_wrapper",CompositeType "pg_foreign_server",CompositeType "pg_group",CompositeType "pg_index",CompositeType "pg_indexes",CompositeType "pg_inherits",CompositeType "pg_language",CompositeType "pg_largeobject",CompositeType "pg_listener",CompositeType "pg_locks",CompositeType "pg_namespace",CompositeType "pg_opclass",CompositeType "pg_operator",CompositeType "pg_opfamily",CompositeType "pg_pltemplate",CompositeType "pg_prepared_statements",CompositeType "pg_prepared_xacts",CompositeType "pg_proc",CompositeType "pg_rewrite",CompositeType "pg_roles",CompositeType "pg_rules",CompositeType "pg_settings",CompositeType "pg_shadow",CompositeType "pg_shdepend",CompositeType "pg_shdescription",CompositeType "pg_stat_activity",CompositeType "pg_stat_all_indexes",CompositeType "pg_stat_all_tables",CompositeType "pg_stat_bgwriter",CompositeType "pg_stat_database",CompositeType "pg_stat_sys_indexes",CompositeType "pg_stat_sys_tables",CompositeType "pg_stat_user_functions",CompositeType "pg_stat_user_indexes",CompositeType "pg_stat_user_tables",CompositeType "pg_statio_all_indexes",CompositeType "pg_statio_all_sequences",CompositeType "pg_statio_all_tables",CompositeType "pg_statio_sys_indexes",CompositeType "pg_statio_sys_sequences",CompositeType "pg_statio_sys_tables",CompositeType "pg_statio_user_indexes",CompositeType "pg_statio_user_sequences",CompositeType "pg_statio_user_tables",CompositeType "pg_statistic",CompositeType "pg_stats",CompositeType "pg_tables",CompositeType "pg_tablespace",CompositeType "pg_timezone_abbrevs",CompositeType "pg_timezone_names",CompositeType "pg_trigger",CompositeType "pg_ts_config",CompositeType "pg_ts_config_map",CompositeType "pg_ts_dict",CompositeType "pg_ts_parser",CompositeType "pg_ts_template",CompositeType "pg_type",CompositeType "pg_user",CompositeType "pg_user_mapping",CompositeType "pg_user_mappings",CompositeType "pg_views",ArrayType (ScalarType "point"),ScalarType "point",ArrayType (ScalarType "polygon"),ScalarType "polygon",ArrayType (Pseudo Record),Pseudo Record,ArrayType (ScalarType "refcursor"),ScalarType "refcursor",ArrayType (ScalarType "regclass"),ScalarType "regclass",ArrayType (ScalarType "regconfig"),ScalarType "regconfig",ArrayType (ScalarType "regdictionary"),ScalarType "regdictionary",ArrayType (ScalarType "regoper"),ScalarType "regoper",ArrayType (ScalarType "regoperator"),ScalarType "regoperator",ArrayType (ScalarType "regproc"),ScalarType "regproc",ArrayType (ScalarType "regprocedure"),ScalarType "regprocedure",ArrayType (ScalarType "regtype"),ScalarType "regtype",ArrayType (ScalarType "reltime"),ScalarType "reltime",ScalarType "smgr",ArrayType (ScalarType "text"),ScalarType "text",ArrayType (ScalarType "tid"),ScalarType "tid",ArrayType (ScalarType "time"),ScalarType "time",ArrayType (ScalarType "timestamp"),ScalarType "timestamp",ArrayType (ScalarType "timestamptz"),ScalarType "timestamptz",ArrayType (ScalarType "timetz"),ScalarType "timetz",ArrayType (ScalarType "tinterval"),ScalarType "tinterval",Pseudo Trigger,ArrayType (ScalarType "tsquery"),ScalarType "tsquery",ArrayType (ScalarType "tsvector"),ScalarType "tsvector",ArrayType (ScalarType "txid_snapshot"),ScalarType "txid_snapshot",ScalarType "unknown",ArrayType (ScalarType "uuid"),ScalarType "uuid",ArrayType (ScalarType "varbit"),ScalarType "varbit",ArrayType (ScalarType "varchar"),ScalarType "varchar",Pseudo Void,ArrayType (ScalarType "xid"),ScalarType "xid",ArrayType (ScalarType "xml"),ScalarType "xml"], scopeTypeNames = [("_abstime",ArrayType (ScalarType "abstime")),("abstime",ScalarType "abstime"),("_aclitem",ArrayType (ScalarType "aclitem")),("aclitem",ScalarType "aclitem"),("any",Pseudo Any),("anyarray",Pseudo AnyArray),("anyelement",Pseudo AnyElement),("anyenum",Pseudo AnyEnum),("anynonarray",Pseudo AnyNonArray),("_bit",ArrayType (ScalarType "bit")),("bit",ScalarType "bit"),("_bool",ArrayType (ScalarType "bool")),("bool",ScalarType "bool"),("_box",ArrayType (ScalarType "box")),("box",ScalarType "box"),("_bpchar",ArrayType (ScalarType "bpchar")),("bpchar",ScalarType "bpchar"),("_bytea",ArrayType (ScalarType "bytea")),("bytea",ScalarType "bytea"),("_char",ArrayType (ScalarType "char")),("char",ScalarType "char"),("_cid",ArrayType (ScalarType "cid")),("cid",ScalarType "cid"),("_cidr",ArrayType (ScalarType "cidr")),("cidr",ScalarType "cidr"),("_circle",ArrayType (ScalarType "circle")),("circle",ScalarType "circle"),("_cstring",ArrayType (Pseudo Cstring)),("cstring",Pseudo Cstring),("_date",ArrayType (ScalarType "date")),("date",ScalarType "date"),("_float4",ArrayType (ScalarType "float4")),("float4",ScalarType "float4"),("_float8",ArrayType (ScalarType "float8")),("float8",ScalarType "float8"),("_gtsvector",ArrayType (ScalarType "gtsvector")),("gtsvector",ScalarType "gtsvector"),("_inet",ArrayType (ScalarType "inet")),("inet",ScalarType "inet"),("_int2",ArrayType (ScalarType "int2")),("int2",ScalarType "int2"),("_int2vector",ArrayType (ScalarType "int2vector")),("int2vector",ScalarType "int2vector"),("_int4",ArrayType (ScalarType "int4")),("int4",ScalarType "int4"),("_int8",ArrayType (ScalarType "int8")),("int8",ScalarType "int8"),("internal",Pseudo Internal),("_interval",ArrayType (ScalarType "interval")),("interval",ScalarType "interval"),("language_handler",Pseudo LanguageHandler),("_line",ArrayType (ScalarType "line")),("line",ScalarType "line"),("_lseg",ArrayType (ScalarType "lseg")),("lseg",ScalarType "lseg"),("_macaddr",ArrayType (ScalarType "macaddr")),("macaddr",ScalarType "macaddr"),("_money",ArrayType (ScalarType "money")),("money",ScalarType "money"),("_name",ArrayType (ScalarType "name")),("name",ScalarType "name"),("_numeric",ArrayType (ScalarType "numeric")),("numeric",ScalarType "numeric"),("_oid",ArrayType (ScalarType "oid")),("oid",ScalarType "oid"),("_oidvector",ArrayType (ScalarType "oidvector")),("oidvector",ScalarType "oidvector"),("opaque",Pseudo Opaque),("_path",ArrayType (ScalarType "path")),("path",ScalarType "path"),("pg_aggregate",CompositeType "pg_aggregate"),("pg_am",CompositeType "pg_am"),("pg_amop",CompositeType "pg_amop"),("pg_amproc",CompositeType "pg_amproc"),("pg_attrdef",CompositeType "pg_attrdef"),("pg_attribute",CompositeType "pg_attribute"),("pg_auth_members",CompositeType "pg_auth_members"),("pg_authid",CompositeType "pg_authid"),("pg_cast",CompositeType "pg_cast"),("pg_class",CompositeType "pg_class"),("pg_constraint",CompositeType "pg_constraint"),("pg_conversion",CompositeType "pg_conversion"),("pg_cursors",CompositeType "pg_cursors"),("pg_database",CompositeType "pg_database"),("pg_depend",CompositeType "pg_depend"),("pg_description",CompositeType "pg_description"),("pg_enum",CompositeType "pg_enum"),("pg_foreign_data_wrapper",CompositeType "pg_foreign_data_wrapper"),("pg_foreign_server",CompositeType "pg_foreign_server"),("pg_group",CompositeType "pg_group"),("pg_index",CompositeType "pg_index"),("pg_indexes",CompositeType "pg_indexes"),("pg_inherits",CompositeType "pg_inherits"),("pg_language",CompositeType "pg_language"),("pg_largeobject",CompositeType "pg_largeobject"),("pg_listener",CompositeType "pg_listener"),("pg_locks",CompositeType "pg_locks"),("pg_namespace",CompositeType "pg_namespace"),("pg_opclass",CompositeType "pg_opclass"),("pg_operator",CompositeType "pg_operator"),("pg_opfamily",CompositeType "pg_opfamily"),("pg_pltemplate",CompositeType "pg_pltemplate"),("pg_prepared_statements",CompositeType "pg_prepared_statements"),("pg_prepared_xacts",CompositeType "pg_prepared_xacts"),("pg_proc",CompositeType "pg_proc"),("pg_rewrite",CompositeType "pg_rewrite"),("pg_roles",CompositeType "pg_roles"),("pg_rules",CompositeType "pg_rules"),("pg_settings",CompositeType "pg_settings"),("pg_shadow",CompositeType "pg_shadow"),("pg_shdepend",CompositeType "pg_shdepend"),("pg_shdescription",CompositeType "pg_shdescription"),("pg_stat_activity",CompositeType "pg_stat_activity"),("pg_stat_all_indexes",CompositeType "pg_stat_all_indexes"),("pg_stat_all_tables",CompositeType "pg_stat_all_tables"),("pg_stat_bgwriter",CompositeType "pg_stat_bgwriter"),("pg_stat_database",CompositeType "pg_stat_database"),("pg_stat_sys_indexes",CompositeType "pg_stat_sys_indexes"),("pg_stat_sys_tables",CompositeType "pg_stat_sys_tables"),("pg_stat_user_functions",CompositeType "pg_stat_user_functions"),("pg_stat_user_indexes",CompositeType "pg_stat_user_indexes"),("pg_stat_user_tables",CompositeType "pg_stat_user_tables"),("pg_statio_all_indexes",CompositeType "pg_statio_all_indexes"),("pg_statio_all_sequences",CompositeType "pg_statio_all_sequences"),("pg_statio_all_tables",CompositeType "pg_statio_all_tables"),("pg_statio_sys_indexes",CompositeType "pg_statio_sys_indexes"),("pg_statio_sys_sequences",CompositeType "pg_statio_sys_sequences"),("pg_statio_sys_tables",CompositeType "pg_statio_sys_tables"),("pg_statio_user_indexes",CompositeType "pg_statio_user_indexes"),("pg_statio_user_sequences",CompositeType "pg_statio_user_sequences"),("pg_statio_user_tables",CompositeType "pg_statio_user_tables"),("pg_statistic",CompositeType "pg_statistic"),("pg_stats",CompositeType "pg_stats"),("pg_tables",CompositeType "pg_tables"),("pg_tablespace",CompositeType "pg_tablespace"),("pg_timezone_abbrevs",CompositeType "pg_timezone_abbrevs"),("pg_timezone_names",CompositeType "pg_timezone_names"),("pg_trigger",CompositeType "pg_trigger"),("pg_ts_config",CompositeType "pg_ts_config"),("pg_ts_config_map",CompositeType "pg_ts_config_map"),("pg_ts_dict",CompositeType "pg_ts_dict"),("pg_ts_parser",CompositeType "pg_ts_parser"),("pg_ts_template",CompositeType "pg_ts_template"),("pg_type",CompositeType "pg_type"),("pg_user",CompositeType "pg_user"),("pg_user_mapping",CompositeType "pg_user_mapping"),("pg_user_mappings",CompositeType "pg_user_mappings"),("pg_views",CompositeType "pg_views"),("_point",ArrayType (ScalarType "point")),("point",ScalarType "point"),("_polygon",ArrayType (ScalarType "polygon")),("polygon",ScalarType "polygon"),("_record",ArrayType (Pseudo Record)),("record",Pseudo Record),("_refcursor",ArrayType (ScalarType "refcursor")),("refcursor",ScalarType "refcursor"),("_regclass",ArrayType (ScalarType "regclass")),("regclass",ScalarType "regclass"),("_regconfig",ArrayType (ScalarType "regconfig")),("regconfig",ScalarType "regconfig"),("_regdictionary",ArrayType (ScalarType "regdictionary")),("regdictionary",ScalarType "regdictionary"),("_regoper",ArrayType (ScalarType "regoper")),("regoper",ScalarType "regoper"),("_regoperator",ArrayType (ScalarType "regoperator")),("regoperator",ScalarType "regoperator"),("_regproc",ArrayType (ScalarType "regproc")),("regproc",ScalarType "regproc"),("_regprocedure",ArrayType (ScalarType "regprocedure")),("regprocedure",ScalarType "regprocedure"),("_regtype",ArrayType (ScalarType "regtype")),("regtype",ScalarType "regtype"),("_reltime",ArrayType (ScalarType "reltime")),("reltime",ScalarType "reltime"),("smgr",ScalarType "smgr"),("_text",ArrayType (ScalarType "text")),("text",ScalarType "text"),("_tid",ArrayType (ScalarType "tid")),("tid",ScalarType "tid"),("_time",ArrayType (ScalarType "time")),("time",ScalarType "time"),("_timestamp",ArrayType (ScalarType "timestamp")),("timestamp",ScalarType "timestamp"),("_timestamptz",ArrayType (ScalarType "timestamptz")),("timestamptz",ScalarType "timestamptz"),("_timetz",ArrayType (ScalarType "timetz")),("timetz",ScalarType "timetz"),("_tinterval",ArrayType (ScalarType "tinterval")),("tinterval",ScalarType "tinterval"),("trigger",Pseudo Trigger),("_tsquery",ArrayType (ScalarType "tsquery")),("tsquery",ScalarType "tsquery"),("_tsvector",ArrayType (ScalarType "tsvector")),("tsvector",ScalarType "tsvector"),("_txid_snapshot",ArrayType (ScalarType "txid_snapshot")),("txid_snapshot",ScalarType "txid_snapshot"),("unknown",ScalarType "unknown"),("_uuid",ArrayType (ScalarType "uuid")),("uuid",ScalarType "uuid"),("_varbit",ArrayType (ScalarType "varbit")),("varbit",ScalarType "varbit"),("_varchar",ArrayType (ScalarType "varchar")),("varchar",ScalarType "varchar"),("void",Pseudo Void),("_xid",ArrayType (ScalarType "xid")),("xid",ScalarType "xid"),("_xml",ArrayType (ScalarType "xml")),("xml",ScalarType "xml")], scopeDomainDefs = [], scopeCasts = [(ScalarType "int8",ScalarType "int2",AssignmentCastContext),(ScalarType "int8",ScalarType "int4",AssignmentCastContext),(ScalarType "int8",ScalarType "float4",ImplicitCastContext),(ScalarType "int8",ScalarType "float8",ImplicitCastContext),(ScalarType "int8",ScalarType "numeric",ImplicitCastContext),(ScalarType "int2",ScalarType "int8",ImplicitCastContext),(ScalarType "int2",ScalarType "int4",ImplicitCastContext),(ScalarType "int2",ScalarType "float4",ImplicitCastContext),(ScalarType "int2",ScalarType "float8",ImplicitCastContext),(ScalarType "int2",ScalarType "numeric",ImplicitCastContext),(ScalarType "int4",ScalarType "int8",ImplicitCastContext),(ScalarType "int4",ScalarType "int2",AssignmentCastContext),(ScalarType "int4",ScalarType "float4",ImplicitCastContext),(ScalarType "int4",ScalarType "float8",ImplicitCastContext),(ScalarType "int4",ScalarType "numeric",ImplicitCastContext),(ScalarType "float4",ScalarType "int8",AssignmentCastContext),(ScalarType "float4",ScalarType "int2",AssignmentCastContext),(ScalarType "float4",ScalarType "int4",AssignmentCastContext),(ScalarType "float4",ScalarType "float8",ImplicitCastContext),(ScalarType "float4",ScalarType "numeric",AssignmentCastContext),(ScalarType "float8",ScalarType "int8",AssignmentCastContext),(ScalarType "float8",ScalarType "int2",AssignmentCastContext),(ScalarType "float8",ScalarType "int4",AssignmentCastContext),(ScalarType "float8",ScalarType "float4",AssignmentCastContext),(ScalarType "float8",ScalarType "numeric",AssignmentCastContext),(ScalarType "numeric",ScalarType "int8",AssignmentCastContext),(ScalarType "numeric",ScalarType "int2",AssignmentCastContext),(ScalarType "numeric",ScalarType "int4",AssignmentCastContext),(ScalarType "numeric",ScalarType "float4",ImplicitCastContext),(ScalarType "numeric",ScalarType "float8",ImplicitCastContext),(ScalarType "int4",ScalarType "bool",ExplicitCastContext),(ScalarType "bool",ScalarType "int4",ExplicitCastContext),(ScalarType "int8",ScalarType "oid",ImplicitCastContext),(ScalarType "int2",ScalarType "oid",ImplicitCastContext),(ScalarType "int4",ScalarType "oid",ImplicitCastContext),(ScalarType "oid",ScalarType "int8",AssignmentCastContext),(ScalarType "oid",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regproc",ImplicitCastContext),(ScalarType "regproc",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regproc",ImplicitCastContext),(ScalarType "int2",ScalarType "regproc",ImplicitCastContext),(ScalarType "int4",ScalarType "regproc",ImplicitCastContext),(ScalarType "regproc",ScalarType "int8",AssignmentCastContext),(ScalarType "regproc",ScalarType "int4",AssignmentCastContext),(ScalarType "regproc",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "regprocedure",ScalarType "regproc",ImplicitCastContext),(ScalarType "oid",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "regprocedure",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "int2",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "int4",ScalarType "regprocedure",ImplicitCastContext),(ScalarType "regprocedure",ScalarType "int8",AssignmentCastContext),(ScalarType "regprocedure",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regoper",ImplicitCastContext),(ScalarType "regoper",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regoper",ImplicitCastContext),(ScalarType "int2",ScalarType "regoper",ImplicitCastContext),(ScalarType "int4",ScalarType "regoper",ImplicitCastContext),(ScalarType "regoper",ScalarType "int8",AssignmentCastContext),(ScalarType "regoper",ScalarType "int4",AssignmentCastContext),(ScalarType "regoper",ScalarType "regoperator",ImplicitCastContext),(ScalarType "regoperator",ScalarType "regoper",ImplicitCastContext),(ScalarType "oid",ScalarType "regoperator",ImplicitCastContext),(ScalarType "regoperator",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regoperator",ImplicitCastContext),(ScalarType "int2",ScalarType "regoperator",ImplicitCastContext),(ScalarType "int4",ScalarType "regoperator",ImplicitCastContext),(ScalarType "regoperator",ScalarType "int8",AssignmentCastContext),(ScalarType "regoperator",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regclass",ImplicitCastContext),(ScalarType "regclass",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regclass",ImplicitCastContext),(ScalarType "int2",ScalarType "regclass",ImplicitCastContext),(ScalarType "int4",ScalarType "regclass",ImplicitCastContext),(ScalarType "regclass",ScalarType "int8",AssignmentCastContext),(ScalarType "regclass",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regtype",ImplicitCastContext),(ScalarType "regtype",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regtype",ImplicitCastContext),(ScalarType "int2",ScalarType "regtype",ImplicitCastContext),(ScalarType "int4",ScalarType "regtype",ImplicitCastContext),(ScalarType "regtype",ScalarType "int8",AssignmentCastContext),(ScalarType "regtype",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regconfig",ImplicitCastContext),(ScalarType "regconfig",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regconfig",ImplicitCastContext),(ScalarType "int2",ScalarType "regconfig",ImplicitCastContext),(ScalarType "int4",ScalarType "regconfig",ImplicitCastContext),(ScalarType "regconfig",ScalarType "int8",AssignmentCastContext),(ScalarType "regconfig",ScalarType "int4",AssignmentCastContext),(ScalarType "oid",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "regdictionary",ScalarType "oid",ImplicitCastContext),(ScalarType "int8",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "int2",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "int4",ScalarType "regdictionary",ImplicitCastContext),(ScalarType "regdictionary",ScalarType "int8",AssignmentCastContext),(ScalarType "regdictionary",ScalarType "int4",AssignmentCastContext),(ScalarType "text",ScalarType "regclass",ImplicitCastContext),(ScalarType "varchar",ScalarType "regclass",ImplicitCastContext),(ScalarType "text",ScalarType "bpchar",ImplicitCastContext),(ScalarType "text",ScalarType "varchar",ImplicitCastContext),(ScalarType "bpchar",ScalarType "text",ImplicitCastContext),(ScalarType "bpchar",ScalarType "varchar",ImplicitCastContext),(ScalarType "varchar",ScalarType "text",ImplicitCastContext),(ScalarType "varchar",ScalarType "bpchar",ImplicitCastContext),(ScalarType "char",ScalarType "text",ImplicitCastContext),(ScalarType "char",ScalarType "bpchar",AssignmentCastContext),(ScalarType "char",ScalarType "varchar",AssignmentCastContext),(ScalarType "name",ScalarType "text",ImplicitCastContext),(ScalarType "name",ScalarType "bpchar",AssignmentCastContext),(ScalarType "name",ScalarType "varchar",AssignmentCastContext),(ScalarType "text",ScalarType "char",AssignmentCastContext),(ScalarType "bpchar",ScalarType "char",AssignmentCastContext),(ScalarType "varchar",ScalarType "char",AssignmentCastContext),(ScalarType "text",ScalarType "name",ImplicitCastContext),(ScalarType "bpchar",ScalarType "name",ImplicitCastContext),(ScalarType "varchar",ScalarType "name",ImplicitCastContext),(ScalarType "char",ScalarType "int4",ExplicitCastContext),(ScalarType "int4",ScalarType "char",ExplicitCastContext),(ScalarType "abstime",ScalarType "date",AssignmentCastContext),(ScalarType "abstime",ScalarType "time",AssignmentCastContext),(ScalarType "abstime",ScalarType "timestamp",ImplicitCastContext),(ScalarType "abstime",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "reltime",ScalarType "interval",ImplicitCastContext),(ScalarType "date",ScalarType "timestamp",ImplicitCastContext),(ScalarType "date",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "time",ScalarType "interval",ImplicitCastContext),(ScalarType "time",ScalarType "timetz",ImplicitCastContext),(ScalarType "timestamp",ScalarType "abstime",AssignmentCastContext),(ScalarType "timestamp",ScalarType "date",AssignmentCastContext),(ScalarType "timestamp",ScalarType "time",AssignmentCastContext),(ScalarType "timestamp",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "timestamptz",ScalarType "abstime",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "date",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "time",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "timestamp",AssignmentCastContext),(ScalarType "timestamptz",ScalarType "timetz",AssignmentCastContext),(ScalarType "interval",ScalarType "reltime",AssignmentCastContext),(ScalarType "interval",ScalarType "time",AssignmentCastContext),(ScalarType "timetz",ScalarType "time",AssignmentCastContext),(ScalarType "int4",ScalarType "abstime",ExplicitCastContext),(ScalarType "abstime",ScalarType "int4",ExplicitCastContext),(ScalarType "int4",ScalarType "reltime",ExplicitCastContext),(ScalarType "reltime",ScalarType "int4",ExplicitCastContext),(ScalarType "lseg",ScalarType "point",ExplicitCastContext),(ScalarType "path",ScalarType "point",ExplicitCastContext),(ScalarType "path",ScalarType "polygon",AssignmentCastContext),(ScalarType "box",ScalarType "point",ExplicitCastContext),(ScalarType "box",ScalarType "lseg",ExplicitCastContext),(ScalarType "box",ScalarType "polygon",AssignmentCastContext),(ScalarType "box",ScalarType "circle",ExplicitCastContext),(ScalarType "polygon",ScalarType "point",ExplicitCastContext),(ScalarType "polygon",ScalarType "path",AssignmentCastContext),(ScalarType "polygon",ScalarType "box",ExplicitCastContext),(ScalarType "polygon",ScalarType "circle",ExplicitCastContext),(ScalarType "circle",ScalarType "point",ExplicitCastContext),(ScalarType "circle",ScalarType "box",ExplicitCastContext),(ScalarType "circle",ScalarType "polygon",ExplicitCastContext),(ScalarType "cidr",ScalarType "inet",ImplicitCastContext),(ScalarType "inet",ScalarType "cidr",AssignmentCastContext),(ScalarType "bit",ScalarType "varbit",ImplicitCastContext),(ScalarType "varbit",ScalarType "bit",ImplicitCastContext),(ScalarType "int8",ScalarType "bit",ExplicitCastContext),(ScalarType "int4",ScalarType "bit",ExplicitCastContext),(ScalarType "bit",ScalarType "int8",ExplicitCastContext),(ScalarType "bit",ScalarType "int4",ExplicitCastContext),(ScalarType "cidr",ScalarType "text",AssignmentCastContext),(ScalarType "inet",ScalarType "text",AssignmentCastContext),(ScalarType "bool",ScalarType "text",AssignmentCastContext),(ScalarType "xml",ScalarType "text",AssignmentCastContext),(ScalarType "text",ScalarType "xml",ExplicitCastContext),(ScalarType "cidr",ScalarType "varchar",AssignmentCastContext),(ScalarType "inet",ScalarType "varchar",AssignmentCastContext),(ScalarType "bool",ScalarType "varchar",AssignmentCastContext),(ScalarType "xml",ScalarType "varchar",AssignmentCastContext),(ScalarType "varchar",ScalarType "xml",ExplicitCastContext),(ScalarType "cidr",ScalarType "bpchar",AssignmentCastContext),(ScalarType "inet",ScalarType "bpchar",AssignmentCastContext),(ScalarType "bool",ScalarType "bpchar",AssignmentCastContext),(ScalarType "xml",ScalarType "bpchar",AssignmentCastContext),(ScalarType "bpchar",ScalarType "xml",ExplicitCastContext),(ScalarType "bpchar",ScalarType "bpchar",ImplicitCastContext),(ScalarType "varchar",ScalarType "varchar",ImplicitCastContext),(ScalarType "time",ScalarType "time",ImplicitCastContext),(ScalarType "timestamp",ScalarType "timestamp",ImplicitCastContext),(ScalarType "timestamptz",ScalarType "timestamptz",ImplicitCastContext),(ScalarType "interval",ScalarType "interval",ImplicitCastContext),(ScalarType "timetz",ScalarType "timetz",ImplicitCastContext),(ScalarType "bit",ScalarType "bit",ImplicitCastContext),(ScalarType "varbit",ScalarType "varbit",ImplicitCastContext),(ScalarType "numeric",ScalarType "numeric",ImplicitCastContext)], scopeTypeCategories = [(ScalarType "bool","B",True),(ScalarType "bytea","U",False),(ScalarType "char","S",False),(ScalarType "name","S",False),(ScalarType "int8","N",False),(ScalarType "int2","N",False),(ScalarType "int2vector","A",False),(ScalarType "int4","N",False),(ScalarType "regproc","N",False),(ScalarType "text","S",True),(ScalarType "oid","N",True),(ScalarType "tid","U",False),(ScalarType "xid","U",False),(ScalarType "cid","U",False),(ScalarType "oidvector","A",False),(CompositeType "pg_type","C",False),(CompositeType "pg_attribute","C",False),(CompositeType "pg_proc","C",False),(CompositeType "pg_class","C",False),(ScalarType "xml","U",False),(ArrayType (ScalarType "xml"),"A",False),(ScalarType "smgr","U",False),(ScalarType "point","G",False),(ScalarType "lseg","G",False),(ScalarType "path","G",False),(ScalarType "box","G",False),(ScalarType "polygon","G",False),(ScalarType "line","G",False),(ArrayType (ScalarType "line"),"A",False),(ScalarType "float4","N",False),(ScalarType "float8","N",True),(ScalarType "abstime","D",False),(ScalarType "reltime","T",False),(ScalarType "tinterval","T",False),(ScalarType "unknown","X",False),(ScalarType "circle","G",False),(ArrayType (ScalarType "circle"),"A",False),(ScalarType "money","N",False),(ArrayType (ScalarType "money"),"A",False),(ScalarType "macaddr","U",False),(ScalarType "inet","I",True),(ScalarType "cidr","I",False),(ArrayType (ScalarType "bool"),"A",False),(ArrayType (ScalarType "bytea"),"A",False),(ArrayType (ScalarType "char"),"A",False),(ArrayType (ScalarType "name"),"A",False),(ArrayType (ScalarType "int2"),"A",False),(ArrayType (ScalarType "int2vector"),"A",False),(ArrayType (ScalarType "int4"),"A",False),(ArrayType (ScalarType "regproc"),"A",False),(ArrayType (ScalarType "text"),"A",False),(ArrayType (ScalarType "oid"),"A",False),(ArrayType (ScalarType "tid"),"A",False),(ArrayType (ScalarType "xid"),"A",False),(ArrayType (ScalarType "cid"),"A",False),(ArrayType (ScalarType "oidvector"),"A",False),(ArrayType (ScalarType "bpchar"),"A",False),(ArrayType (ScalarType "varchar"),"A",False),(ArrayType (ScalarType "int8"),"A",False),(ArrayType (ScalarType "point"),"A",False),(ArrayType (ScalarType "lseg"),"A",False),(ArrayType (ScalarType "path"),"A",False),(ArrayType (ScalarType "box"),"A",False),(ArrayType (ScalarType "float4"),"A",False),(ArrayType (ScalarType "float8"),"A",False),(ArrayType (ScalarType "abstime"),"A",False),(ArrayType (ScalarType "reltime"),"A",False),(ArrayType (ScalarType "tinterval"),"A",False),(ArrayType (ScalarType "polygon"),"A",False),(ScalarType "aclitem","U",False),(ArrayType (ScalarType "aclitem"),"A",False),(ArrayType (ScalarType "macaddr"),"A",False),(ArrayType (ScalarType "inet"),"A",False),(ArrayType (ScalarType "cidr"),"A",False),(ArrayType (Pseudo Cstring),"A",False),(ScalarType "bpchar","S",False),(ScalarType "varchar","S",False),(ScalarType "date","D",False),(ScalarType "time","D",False),(ScalarType "timestamp","D",False),(ArrayType (ScalarType "timestamp"),"A",False),(ArrayType (ScalarType "date"),"A",False),(ArrayType (ScalarType "time"),"A",False),(ScalarType "timestamptz","D",True),(ArrayType (ScalarType "timestamptz"),"A",False),(ScalarType "interval","T",True),(ArrayType (ScalarType "interval"),"A",False),(ArrayType (ScalarType "numeric"),"A",False),(ScalarType "timetz","D",False),(ArrayType (ScalarType "timetz"),"A",False),(ScalarType "bit","V",False),(ArrayType (ScalarType "bit"),"A",False),(ScalarType "varbit","V",True),(ArrayType (ScalarType "varbit"),"A",False),(ScalarType "numeric","N",False),(ScalarType "refcursor","U",False),(ArrayType (ScalarType "refcursor"),"A",False),(ScalarType "regprocedure","N",False),(ScalarType "regoper","N",False),(ScalarType "regoperator","N",False),(ScalarType "regclass","N",False),(ScalarType "regtype","N",False),(ArrayType (ScalarType "regprocedure"),"A",False),(ArrayType (ScalarType "regoper"),"A",False),(ArrayType (ScalarType "regoperator"),"A",False),(ArrayType (ScalarType "regclass"),"A",False),(ArrayType (ScalarType "regtype"),"A",False),(ScalarType "uuid","U",False),(ArrayType (ScalarType "uuid"),"A",False),(ScalarType "tsvector","U",False),(ScalarType "gtsvector","U",False),(ScalarType "tsquery","U",False),(ScalarType "regconfig","N",False),(ScalarType "regdictionary","N",False),(ArrayType (ScalarType "tsvector"),"A",False),(ArrayType (ScalarType "gtsvector"),"A",False),(ArrayType (ScalarType "tsquery"),"A",False),(ArrayType (ScalarType "regconfig"),"A",False),(ArrayType (ScalarType "regdictionary"),"A",False),(ScalarType "txid_snapshot","U",False),(ArrayType (ScalarType "txid_snapshot"),"A",False),(Pseudo Record,"P",False),(ArrayType (Pseudo Record),"P",False),(Pseudo Cstring,"P",False),(Pseudo Any,"P",False),(Pseudo AnyArray,"P",False),(Pseudo Void,"P",False),(Pseudo Trigger,"P",False),(Pseudo LanguageHandler,"P",False),(Pseudo Internal,"P",False),(Pseudo Opaque,"P",False),(Pseudo AnyElement,"P",False),(Pseudo AnyNonArray,"P",False),(Pseudo AnyEnum,"P",False),(CompositeType "pg_attrdef","C",False),(CompositeType "pg_constraint","C",False),(CompositeType "pg_inherits","C",False),(CompositeType "pg_index","C",False),(CompositeType "pg_operator","C",False),(CompositeType "pg_opfamily","C",False),(CompositeType "pg_opclass","C",False),(CompositeType "pg_am","C",False),(CompositeType "pg_amop","C",False),(CompositeType "pg_amproc","C",False),(CompositeType "pg_language","C",False),(CompositeType "pg_largeobject","C",False),(CompositeType "pg_aggregate","C",False),(CompositeType "pg_statistic","C",False),(CompositeType "pg_rewrite","C",False),(CompositeType "pg_trigger","C",False),(CompositeType "pg_listener","C",False),(CompositeType "pg_description","C",False),(CompositeType "pg_cast","C",False),(CompositeType "pg_enum","C",False),(CompositeType "pg_namespace","C",False),(CompositeType "pg_conversion","C",False),(CompositeType "pg_depend","C",False),(CompositeType "pg_database","C",False),(CompositeType "pg_tablespace","C",False),(CompositeType "pg_pltemplate","C",False),(CompositeType "pg_authid","C",False),(CompositeType "pg_auth_members","C",False),(CompositeType "pg_shdepend","C",False),(CompositeType "pg_shdescription","C",False),(CompositeType "pg_ts_config","C",False),(CompositeType "pg_ts_config_map","C",False),(CompositeType "pg_ts_dict","C",False),(CompositeType "pg_ts_parser","C",False),(CompositeType "pg_ts_template","C",False),(CompositeType "pg_foreign_data_wrapper","C",False),(CompositeType "pg_foreign_server","C",False),(CompositeType "pg_user_mapping","C",False),(CompositeType "pg_roles","C",False),(CompositeType "pg_shadow","C",False),(CompositeType "pg_group","C",False),(CompositeType "pg_user","C",False),(CompositeType "pg_rules","C",False),(CompositeType "pg_views","C",False),(CompositeType "pg_tables","C",False),(CompositeType "pg_indexes","C",False),(CompositeType "pg_stats","C",False),(CompositeType "pg_locks","C",False),(CompositeType "pg_cursors","C",False),(CompositeType "pg_prepared_xacts","C",False),(CompositeType "pg_prepared_statements","C",False),(CompositeType "pg_settings","C",False),(CompositeType "pg_timezone_abbrevs","C",False),(CompositeType "pg_timezone_names","C",False),(CompositeType "pg_stat_all_tables","C",False),(CompositeType "pg_stat_sys_tables","C",False),(CompositeType "pg_stat_user_tables","C",False),(CompositeType "pg_statio_all_tables","C",False),(CompositeType "pg_statio_sys_tables","C",False),(CompositeType "pg_statio_user_tables","C",False),(CompositeType "pg_stat_all_indexes","C",False),(CompositeType "pg_stat_sys_indexes","C",False),(CompositeType "pg_stat_user_indexes","C",False),(CompositeType "pg_statio_all_indexes","C",False),(CompositeType "pg_statio_sys_indexes","C",False),(CompositeType "pg_statio_user_indexes","C",False),(CompositeType "pg_statio_all_sequences","C",False),(CompositeType "pg_statio_sys_sequences","C",False),(CompositeType "pg_statio_user_sequences","C",False),(CompositeType "pg_stat_activity","C",False),(CompositeType "pg_stat_database","C",False),(CompositeType "pg_stat_user_functions","C",False),(CompositeType "pg_stat_bgwriter","C",False),(CompositeType "pg_user_mappings","C",False)], scopePrefixOperators = [("~",[ScalarType "int8"],ScalarType "int8"),("~",[ScalarType "int4"],ScalarType "int4"),("~",[ScalarType "int2"],ScalarType "int2"),("~",[ScalarType "bit"],ScalarType "bit"),("~",[ScalarType "inet"],ScalarType "inet"),("||/",[ScalarType "float8"],ScalarType "float8"),("|/",[ScalarType "float8"],ScalarType "float8"),("|",[ScalarType "tinterval"],ScalarType "abstime"),("@@",[ScalarType "circle"],ScalarType "point"),("@@",[ScalarType "lseg"],ScalarType "point"),("@@",[ScalarType "path"],ScalarType "point"),("@@",[ScalarType "polygon"],ScalarType "point"),("@@",[ScalarType "box"],ScalarType "point"),("@-@",[ScalarType "path"],ScalarType "float8"),("@-@",[ScalarType "lseg"],ScalarType "float8"),("@",[ScalarType "int8"],ScalarType "int8"),("@",[ScalarType "int4"],ScalarType "int4"),("@",[ScalarType "int2"],ScalarType "int2"),("@",[ScalarType "float8"],ScalarType "float8"),("@",[ScalarType "float4"],ScalarType "float4"),("@",[ScalarType "numeric"],ScalarType "numeric"),("?|",[ScalarType "line"],ScalarType "bool"),("?|",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "line"],ScalarType "bool"),("-",[ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "path"],ScalarType "int4"),("#",[ScalarType "polygon"],ScalarType "int4"),("!!",[ScalarType "int8"],ScalarType "numeric"),("!!",[ScalarType "tsquery"],ScalarType "tsquery")], scopePostfixOperators = [("!",[ScalarType "int8"],ScalarType "numeric")], scopeBinaryOperators = [("~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("~=",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~=",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("~<~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~<=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("||",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "text",ScalarType "text"],ScalarType "text"),("||",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("||",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("||",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("||",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("||",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("||",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("||",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("|>>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|>>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|>>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("|",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("|",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("|",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("|",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("^",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("^",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("@@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("@>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("@>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("@>",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("@>",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("?||",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?||",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?|",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?-|",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?-|",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?#",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("?#",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "box"],ScalarType "bool"),(">^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),(">>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">>",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),(">>",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),(">>",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),(">>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),(">=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">=",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),(">=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("=",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("=",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("=",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("=",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<@",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("<?>",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<>",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<>",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<>",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<>",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<>",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<>",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<>",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<>",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<>",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<>",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<>",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<>",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<>",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<>",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<>",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<>",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("<<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("<<",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("<<",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("<<",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<->",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("<#>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("<",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("/",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("/",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("/",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("/",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("/",[ScalarType "point",ScalarType "point"],ScalarType "point"),("/",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("/",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("/",[ScalarType "path",ScalarType "point"],ScalarType "path"),("/",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("/",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("/",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("/",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("/",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("/",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("/",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("-",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("-",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("-",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("-",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("-",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("-",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("-",[ScalarType "money",ScalarType "money"],ScalarType "money"),("-",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("-",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("-",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "path",ScalarType "point"],ScalarType "path"),("-",[ScalarType "point",ScalarType "point"],ScalarType "point"),("-",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("-",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("-",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("-",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("-",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("-",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("-",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("+",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("+",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("+",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("+",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("+",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("+",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("+",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("+",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "point",ScalarType "point"],ScalarType "point"),("+",[ScalarType "path",ScalarType "path"],ScalarType "path"),("+",[ScalarType "path",ScalarType "point"],ScalarType "path"),("+",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "box",ScalarType "point"],ScalarType "box"),("+",[ScalarType "money",ScalarType "money"],ScalarType "money"),("+",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("+",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("+",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("+",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("+",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("+",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("+",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("+",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("+",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("+",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("+",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("+",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("*",[ScalarType "point",ScalarType "point"],ScalarType "point"),("*",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("*",[ScalarType "path",ScalarType "point"],ScalarType "path"),("*",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("*",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "box",ScalarType "point"],ScalarType "box"),("*",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("*",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("*",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("*",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("*",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("*",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("*",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("*",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("*",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("*",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("*",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("&&",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("&&",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&&",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&&",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("&",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("&",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("&",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("&",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("&",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("%",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("%",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#>=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("##",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "box"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("##",[ScalarType "line",ScalarType "box"],ScalarType "point"),("##",[ScalarType "point",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("#",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("#",[ScalarType "line",ScalarType "line"],ScalarType "point"),("#",[ScalarType "box",ScalarType "box"],ScalarType "box"),("#",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("#",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("!~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("!~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool")], scopeFunctions = [("RI_FKey_cascade_del",[],Pseudo Trigger),("RI_FKey_cascade_upd",[],Pseudo Trigger),("RI_FKey_check_ins",[],Pseudo Trigger),("RI_FKey_check_upd",[],Pseudo Trigger),("RI_FKey_noaction_del",[],Pseudo Trigger),("RI_FKey_noaction_upd",[],Pseudo Trigger),("RI_FKey_restrict_del",[],Pseudo Trigger),("RI_FKey_restrict_upd",[],Pseudo Trigger),("RI_FKey_setdefault_del",[],Pseudo Trigger),("RI_FKey_setdefault_upd",[],Pseudo Trigger),("RI_FKey_setnull_del",[],Pseudo Trigger),("RI_FKey_setnull_upd",[],Pseudo Trigger),("abbrev",[ScalarType "cidr"],ScalarType "text"),("abbrev",[ScalarType "inet"],ScalarType "text"),("abs",[ScalarType "int8"],ScalarType "int8"),("abs",[ScalarType "int2"],ScalarType "int2"),("abs",[ScalarType "int4"],ScalarType "int4"),("abs",[ScalarType "float4"],ScalarType "float4"),("abs",[ScalarType "float8"],ScalarType "float8"),("abs",[ScalarType "numeric"],ScalarType "numeric"),("abstime",[ScalarType "timestamp"],ScalarType "abstime"),("abstime",[ScalarType "timestamptz"],ScalarType "abstime"),("abstimeeq",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimege",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimegt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimein",[Pseudo Cstring],ScalarType "abstime"),("abstimele",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimelt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimene",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimeout",[ScalarType "abstime"],Pseudo Cstring),("abstimerecv",[Pseudo Internal],ScalarType "abstime"),("abstimesend",[ScalarType "abstime"],ScalarType "bytea"),("aclcontains",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("aclinsert",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("aclitemeq",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("aclitemin",[Pseudo Cstring],ScalarType "aclitem"),("aclitemout",[ScalarType "aclitem"],Pseudo Cstring),("aclremove",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("acos",[ScalarType "float8"],ScalarType "float8"),("age",[ScalarType "xid"],ScalarType "int4"),("age",[ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz"],ScalarType "interval"),("age",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("any_in",[Pseudo Cstring],Pseudo Any),("any_out",[Pseudo Any],Pseudo Cstring),("anyarray_in",[Pseudo Cstring],Pseudo AnyArray),("anyarray_out",[Pseudo AnyArray],Pseudo Cstring),("anyarray_recv",[Pseudo Internal],Pseudo AnyArray),("anyarray_send",[Pseudo AnyArray],ScalarType "bytea"),("anyelement_in",[Pseudo Cstring],Pseudo AnyElement),("anyelement_out",[Pseudo AnyElement],Pseudo Cstring),("anyenum_in",[Pseudo Cstring],Pseudo AnyEnum),("anyenum_out",[Pseudo AnyEnum],Pseudo Cstring),("anynonarray_in",[Pseudo Cstring],Pseudo AnyNonArray),("anynonarray_out",[Pseudo AnyNonArray],Pseudo Cstring),("anytextcat",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("area",[ScalarType "path"],ScalarType "float8"),("area",[ScalarType "box"],ScalarType "float8"),("area",[ScalarType "circle"],ScalarType "float8"),("areajoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("areasel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("array_agg_finalfn",[Pseudo Internal],Pseudo AnyArray),("array_agg_transfn",[Pseudo Internal,Pseudo AnyElement],Pseudo Internal),("array_append",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("array_cat",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_dims",[Pseudo AnyArray],ScalarType "text"),("array_eq",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4"),ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_ge",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_gt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_larger",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_le",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_length",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lower",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_ndims",[Pseudo AnyArray],ScalarType "int4"),("array_ne",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_out",[Pseudo AnyArray],Pseudo Cstring),("array_prepend",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("array_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_send",[Pseudo AnyArray],ScalarType "bytea"),("array_smaller",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_to_string",[Pseudo AnyArray,ScalarType "text"],ScalarType "text"),("array_upper",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("arraycontained",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arraycontains",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arrayoverlap",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("ascii",[ScalarType "text"],ScalarType "int4"),("ascii_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("ascii_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("asin",[ScalarType "float8"],ScalarType "float8"),("atan",[ScalarType "float8"],ScalarType "float8"),("atan2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("big5_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("bit",[ScalarType "int8",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "bit",ScalarType "int4",ScalarType "bool"],ScalarType "bit"),("bit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_length",[ScalarType "bytea"],ScalarType "int4"),("bit_length",[ScalarType "text"],ScalarType "int4"),("bit_length",[ScalarType "bit"],ScalarType "int4"),("bit_out",[ScalarType "bit"],Pseudo Cstring),("bit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_send",[ScalarType "bit"],ScalarType "bytea"),("bitand",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitcat",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("bitcmp",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("biteq",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitge",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitgt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitle",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitlt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitne",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitnot",[ScalarType "bit"],ScalarType "bit"),("bitor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitshiftleft",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bitshiftright",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bittypmodout",[ScalarType "int4"],Pseudo Cstring),("bitxor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bool",[ScalarType "int4"],ScalarType "bool"),("booland_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("booleq",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolge",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolgt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolin",[Pseudo Cstring],ScalarType "bool"),("boolle",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boollt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolne",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolor_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolout",[ScalarType "bool"],Pseudo Cstring),("boolrecv",[Pseudo Internal],ScalarType "bool"),("boolsend",[ScalarType "bool"],ScalarType "bytea"),("box",[ScalarType "polygon"],ScalarType "box"),("box",[ScalarType "circle"],ScalarType "box"),("box",[ScalarType "point",ScalarType "point"],ScalarType "box"),("box_above",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_above_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_add",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_below",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_below_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_center",[ScalarType "box"],ScalarType "point"),("box_contain",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_contained",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_distance",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("box_div",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_ge",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_gt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_in",[Pseudo Cstring],ScalarType "box"),("box_intersect",[ScalarType "box",ScalarType "box"],ScalarType "box"),("box_le",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_left",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_lt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_mul",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_out",[ScalarType "box"],Pseudo Cstring),("box_overabove",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overbelow",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overlap",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overleft",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overright",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_recv",[Pseudo Internal],ScalarType "box"),("box_right",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_same",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_send",[ScalarType "box"],ScalarType "bytea"),("box_sub",[ScalarType "box",ScalarType "point"],ScalarType "box"),("bpchar",[ScalarType "char"],ScalarType "bpchar"),("bpchar",[ScalarType "name"],ScalarType "bpchar"),("bpchar",[ScalarType "bpchar",ScalarType "int4",ScalarType "bool"],ScalarType "bpchar"),("bpchar_larger",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpchar_pattern_ge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_gt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_le",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_lt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_smaller",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpcharcmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("bpchareq",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchargt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchariclike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharle",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharlt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharne",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharout",[ScalarType "bpchar"],Pseudo Cstring),("bpcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharsend",[ScalarType "bpchar"],ScalarType "bytea"),("bpchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bpchartypmodout",[ScalarType "int4"],Pseudo Cstring),("broadcast",[ScalarType "inet"],ScalarType "inet"),("btabstimecmp",[ScalarType "abstime",ScalarType "abstime"],ScalarType "int4"),("btarraycmp",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "int4"),("btbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btboolcmp",[ScalarType "bool",ScalarType "bool"],ScalarType "int4"),("btbpchar_pattern_cmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("btbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btcharcmp",[ScalarType "char",ScalarType "char"],ScalarType "int4"),("btcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("btendscan",[Pseudo Internal],Pseudo Void),("btfloat48cmp",[ScalarType "float4",ScalarType "float8"],ScalarType "int4"),("btfloat4cmp",[ScalarType "float4",ScalarType "float4"],ScalarType "int4"),("btfloat84cmp",[ScalarType "float8",ScalarType "float4"],ScalarType "int4"),("btfloat8cmp",[ScalarType "float8",ScalarType "float8"],ScalarType "int4"),("btgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("btgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btint24cmp",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("btint28cmp",[ScalarType "int2",ScalarType "int8"],ScalarType "int4"),("btint2cmp",[ScalarType "int2",ScalarType "int2"],ScalarType "int4"),("btint42cmp",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("btint48cmp",[ScalarType "int4",ScalarType "int8"],ScalarType "int4"),("btint4cmp",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("btint82cmp",[ScalarType "int8",ScalarType "int2"],ScalarType "int4"),("btint84cmp",[ScalarType "int8",ScalarType "int4"],ScalarType "int4"),("btint8cmp",[ScalarType "int8",ScalarType "int8"],ScalarType "int4"),("btmarkpos",[Pseudo Internal],Pseudo Void),("btnamecmp",[ScalarType "name",ScalarType "name"],ScalarType "int4"),("btoidcmp",[ScalarType "oid",ScalarType "oid"],ScalarType "int4"),("btoidvectorcmp",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "int4"),("btoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("btrecordcmp",[Pseudo Record,Pseudo Record],ScalarType "int4"),("btreltimecmp",[ScalarType "reltime",ScalarType "reltime"],ScalarType "int4"),("btrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("btrestrpos",[Pseudo Internal],Pseudo Void),("btrim",[ScalarType "text"],ScalarType "text"),("btrim",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("btrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("bttext_pattern_cmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttextcmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttidcmp",[ScalarType "tid",ScalarType "tid"],ScalarType "int4"),("bttintervalcmp",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "int4"),("btvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("byteacat",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("byteacmp",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("byteaeq",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteage",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteagt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteain",[Pseudo Cstring],ScalarType "bytea"),("byteale",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteane",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteanlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteaout",[ScalarType "bytea"],Pseudo Cstring),("bytearecv",[Pseudo Internal],ScalarType "bytea"),("byteasend",[ScalarType "bytea"],ScalarType "bytea"),("cash_cmp",[ScalarType "money",ScalarType "money"],ScalarType "int4"),("cash_div_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_div_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_div_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_div_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_eq",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_ge",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_gt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_in",[Pseudo Cstring],ScalarType "money"),("cash_le",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_lt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_mi",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_mul_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_mul_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_mul_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_mul_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_ne",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_out",[ScalarType "money"],Pseudo Cstring),("cash_pl",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_recv",[Pseudo Internal],ScalarType "money"),("cash_send",[ScalarType "money"],ScalarType "bytea"),("cash_words",[ScalarType "money"],ScalarType "text"),("cashlarger",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cashsmaller",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cbrt",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "numeric"],ScalarType "numeric"),("ceiling",[ScalarType "float8"],ScalarType "float8"),("ceiling",[ScalarType "numeric"],ScalarType "numeric"),("center",[ScalarType "box"],ScalarType "point"),("center",[ScalarType "circle"],ScalarType "point"),("char",[ScalarType "int4"],ScalarType "char"),("char",[ScalarType "text"],ScalarType "char"),("char_length",[ScalarType "text"],ScalarType "int4"),("char_length",[ScalarType "bpchar"],ScalarType "int4"),("character_length",[ScalarType "text"],ScalarType "int4"),("character_length",[ScalarType "bpchar"],ScalarType "int4"),("chareq",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charge",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("chargt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charin",[Pseudo Cstring],ScalarType "char"),("charle",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charlt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charne",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charout",[ScalarType "char"],Pseudo Cstring),("charrecv",[Pseudo Internal],ScalarType "char"),("charsend",[ScalarType "char"],ScalarType "bytea"),("chr",[ScalarType "int4"],ScalarType "text"),("cideq",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("cidin",[Pseudo Cstring],ScalarType "cid"),("cidout",[ScalarType "cid"],Pseudo Cstring),("cidr",[ScalarType "inet"],ScalarType "cidr"),("cidr_in",[Pseudo Cstring],ScalarType "cidr"),("cidr_out",[ScalarType "cidr"],Pseudo Cstring),("cidr_recv",[Pseudo Internal],ScalarType "cidr"),("cidr_send",[ScalarType "cidr"],ScalarType "bytea"),("cidrecv",[Pseudo Internal],ScalarType "cid"),("cidsend",[ScalarType "cid"],ScalarType "bytea"),("circle",[ScalarType "box"],ScalarType "circle"),("circle",[ScalarType "polygon"],ScalarType "circle"),("circle",[ScalarType "point",ScalarType "float8"],ScalarType "circle"),("circle_above",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_add_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_below",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_center",[ScalarType "circle"],ScalarType "point"),("circle_contain",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_contain_pt",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("circle_contained",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_distance",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("circle_div_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_eq",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_ge",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_gt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_in",[Pseudo Cstring],ScalarType "circle"),("circle_le",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_left",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_lt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_mul_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_ne",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_out",[ScalarType "circle"],Pseudo Cstring),("circle_overabove",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overbelow",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overlap",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overleft",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overright",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_recv",[Pseudo Internal],ScalarType "circle"),("circle_right",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_same",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_send",[ScalarType "circle"],ScalarType "bytea"),("circle_sub_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("clock_timestamp",[],ScalarType "timestamptz"),("close_lb",[ScalarType "line",ScalarType "box"],ScalarType "point"),("close_ls",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("close_lseg",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("close_pb",[ScalarType "point",ScalarType "box"],ScalarType "point"),("close_pl",[ScalarType "point",ScalarType "line"],ScalarType "point"),("close_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("close_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("close_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("col_description",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("contjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("contsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("convert",[ScalarType "bytea",ScalarType "name",ScalarType "name"],ScalarType "bytea"),("convert_from",[ScalarType "bytea",ScalarType "name"],ScalarType "text"),("convert_to",[ScalarType "text",ScalarType "name"],ScalarType "bytea"),("cos",[ScalarType "float8"],ScalarType "float8"),("cot",[ScalarType "float8"],ScalarType "float8"),("cstring_in",[Pseudo Cstring],Pseudo Cstring),("cstring_out",[Pseudo Cstring],Pseudo Cstring),("cstring_recv",[Pseudo Internal],Pseudo Cstring),("cstring_send",[Pseudo Cstring],ScalarType "bytea"),("current_database",[],ScalarType "name"),("current_query",[],ScalarType "text"),("current_schema",[],ScalarType "name"),("current_schemas",[ScalarType "bool"],ArrayType (ScalarType "name")),("current_setting",[ScalarType "text"],ScalarType "text"),("current_user",[],ScalarType "name"),("currtid",[ScalarType "oid",ScalarType "tid"],ScalarType "tid"),("currtid2",[ScalarType "text",ScalarType "tid"],ScalarType "tid"),("currval",[ScalarType "regclass"],ScalarType "int8"),("cursor_to_xml",[ScalarType "refcursor",ScalarType "int4",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("cursor_to_xmlschema",[ScalarType "refcursor",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml_and_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("date",[ScalarType "abstime"],ScalarType "date"),("date",[ScalarType "timestamp"],ScalarType "date"),("date",[ScalarType "timestamptz"],ScalarType "date"),("date_cmp",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_cmp_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "int4"),("date_cmp_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "int4"),("date_eq",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_eq_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_eq_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_ge",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ge_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ge_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_gt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_gt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_gt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_in",[Pseudo Cstring],ScalarType "date"),("date_larger",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_le",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_le_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_le_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_lt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_lt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_lt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_mi",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_mi_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_mii",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_ne",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ne_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ne_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_out",[ScalarType "date"],Pseudo Cstring),("date_part",[ScalarType "text",ScalarType "abstime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "reltime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "date"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "time"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamp"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamptz"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "interval"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timetz"],ScalarType "float8"),("date_pl_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_pli",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_recv",[Pseudo Internal],ScalarType "date"),("date_send",[ScalarType "date"],ScalarType "bytea"),("date_smaller",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_trunc",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamp"),("date_trunc",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamptz"),("date_trunc",[ScalarType "text",ScalarType "interval"],ScalarType "interval"),("datetime_pl",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("datetimetz_pl",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("dcbrt",[ScalarType "float8"],ScalarType "float8"),("decode",[ScalarType "text",ScalarType "text"],ScalarType "bytea"),("degrees",[ScalarType "float8"],ScalarType "float8"),("dexp",[ScalarType "float8"],ScalarType "float8"),("diagonal",[ScalarType "box"],ScalarType "lseg"),("diameter",[ScalarType "circle"],ScalarType "float8"),("dispell_init",[Pseudo Internal],Pseudo Internal),("dispell_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dist_cpoly",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("dist_lb",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("dist_pb",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("dist_pc",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("dist_pl",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("dist_ppath",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("dist_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("dist_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("dist_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("dlog1",[ScalarType "float8"],ScalarType "float8"),("dlog10",[ScalarType "float8"],ScalarType "float8"),("domain_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Any),("domain_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Any),("dpow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("dround",[ScalarType "float8"],ScalarType "float8"),("dsimple_init",[Pseudo Internal],Pseudo Internal),("dsimple_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsnowball_init",[Pseudo Internal],Pseudo Internal),("dsnowball_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsqrt",[ScalarType "float8"],ScalarType "float8"),("dsynonym_init",[Pseudo Internal],Pseudo Internal),("dsynonym_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dtrunc",[ScalarType "float8"],ScalarType "float8"),("encode",[ScalarType "bytea",ScalarType "text"],ScalarType "text"),("enum_cmp",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "int4"),("enum_eq",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_first",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_ge",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_gt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_in",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_larger",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("enum_last",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_le",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_lt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_ne",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_out",[Pseudo AnyEnum],Pseudo Cstring),("enum_range",[Pseudo AnyEnum],Pseudo AnyArray),("enum_range",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyArray),("enum_recv",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_send",[Pseudo AnyEnum],ScalarType "bytea"),("enum_smaller",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("eqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("eqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("euc_cn_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_cn_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("exp",[ScalarType "float8"],ScalarType "float8"),("exp",[ScalarType "numeric"],ScalarType "numeric"),("factorial",[ScalarType "int8"],ScalarType "numeric"),("family",[ScalarType "inet"],ScalarType "int4"),("flatfile_update_trigger",[],Pseudo Trigger),("float4",[ScalarType "int8"],ScalarType "float4"),("float4",[ScalarType "int2"],ScalarType "float4"),("float4",[ScalarType "int4"],ScalarType "float4"),("float4",[ScalarType "float8"],ScalarType "float4"),("float4",[ScalarType "numeric"],ScalarType "float4"),("float48div",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48eq",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48ge",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48gt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48le",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48lt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48mi",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48mul",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48ne",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48pl",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float4_accum",[ArrayType (ScalarType "float8"),ScalarType "float4"],ArrayType (ScalarType "float8")),("float4abs",[ScalarType "float4"],ScalarType "float4"),("float4div",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4eq",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4ge",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4gt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4in",[Pseudo Cstring],ScalarType "float4"),("float4larger",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4le",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4lt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4mi",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4mul",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4ne",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4out",[ScalarType "float4"],Pseudo Cstring),("float4pl",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4recv",[Pseudo Internal],ScalarType "float4"),("float4send",[ScalarType "float4"],ScalarType "bytea"),("float4smaller",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4um",[ScalarType "float4"],ScalarType "float4"),("float4up",[ScalarType "float4"],ScalarType "float4"),("float8",[ScalarType "int8"],ScalarType "float8"),("float8",[ScalarType "int2"],ScalarType "float8"),("float8",[ScalarType "int4"],ScalarType "float8"),("float8",[ScalarType "float4"],ScalarType "float8"),("float8",[ScalarType "numeric"],ScalarType "float8"),("float84div",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84eq",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84ge",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84gt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84le",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84lt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84mi",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84mul",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84ne",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84pl",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float8_accum",[ArrayType (ScalarType "float8"),ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_avg",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_corr",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_accum",[ArrayType (ScalarType "float8"),ScalarType "float8",ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_regr_avgx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_avgy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_intercept",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_r2",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_slope",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_syy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8abs",[ScalarType "float8"],ScalarType "float8"),("float8div",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8eq",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8ge",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8gt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8in",[Pseudo Cstring],ScalarType "float8"),("float8larger",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8le",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8lt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8mi",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8mul",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8ne",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8out",[ScalarType "float8"],Pseudo Cstring),("float8pl",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8recv",[Pseudo Internal],ScalarType "float8"),("float8send",[ScalarType "float8"],ScalarType "bytea"),("float8smaller",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8um",[ScalarType "float8"],ScalarType "float8"),("float8up",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "numeric"],ScalarType "numeric"),("flt4_mul_cash",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("flt8_mul_cash",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("fmgr_c_validator",[ScalarType "oid"],Pseudo Void),("fmgr_internal_validator",[ScalarType "oid"],Pseudo Void),("fmgr_sql_validator",[ScalarType "oid"],Pseudo Void),("format_type",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("gb18030_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("gbk_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("generate_series",[ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "int8",ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],SetOfType (ScalarType "timestamp")),("generate_series",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],SetOfType (ScalarType "timestamptz")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4",ScalarType "bool"],SetOfType (ScalarType "int4")),("get_bit",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_byte",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_current_ts_config",[],ScalarType "regconfig"),("getdatabaseencoding",[],ScalarType "name"),("getpgusername",[],ScalarType "name"),("gin_cmp_prefix",[ScalarType "text",ScalarType "text",ScalarType "int2",Pseudo Internal],ScalarType "int4"),("gin_cmp_tslexeme",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("gin_extract_tsquery",[ScalarType "tsquery",Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("gin_extract_tsvector",[ScalarType "tsvector",Pseudo Internal],Pseudo Internal),("gin_tsquery_consistent",[Pseudo Internal,ScalarType "int2",ScalarType "tsquery",ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayconsistent",[Pseudo Internal,ScalarType "int2",Pseudo AnyArray,ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayextract",[Pseudo AnyArray,Pseudo Internal],Pseudo Internal),("ginbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gincostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("ginendscan",[Pseudo Internal],Pseudo Void),("gingetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gininsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginmarkpos",[Pseudo Internal],Pseudo Void),("ginoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("ginqueryarrayextract",[Pseudo AnyArray,Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("ginrestrpos",[Pseudo Internal],Pseudo Void),("ginvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_compress",[Pseudo Internal],Pseudo Internal),("gist_box_consistent",[Pseudo Internal,ScalarType "box",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_box_decompress",[Pseudo Internal],Pseudo Internal),("gist_box_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_same",[ScalarType "box",ScalarType "box",Pseudo Internal],Pseudo Internal),("gist_box_union",[Pseudo Internal,Pseudo Internal],ScalarType "box"),("gist_circle_compress",[Pseudo Internal],Pseudo Internal),("gist_circle_consistent",[Pseudo Internal,ScalarType "circle",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_poly_compress",[Pseudo Internal],Pseudo Internal),("gist_poly_consistent",[Pseudo Internal,ScalarType "polygon",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gistbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("gistendscan",[Pseudo Internal],Pseudo Void),("gistgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gistgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistmarkpos",[Pseudo Internal],Pseudo Void),("gistoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("gistrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("gistrestrpos",[Pseudo Internal],Pseudo Void),("gistvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_compress",[Pseudo Internal],Pseudo Internal),("gtsquery_consistent",[Pseudo Internal,Pseudo Internal,ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsquery_decompress",[Pseudo Internal],Pseudo Internal),("gtsquery_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_same",[ScalarType "int8",ScalarType "int8",Pseudo Internal],Pseudo Internal),("gtsquery_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_compress",[Pseudo Internal],Pseudo Internal),("gtsvector_consistent",[Pseudo Internal,ScalarType "gtsvector",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsvector_decompress",[Pseudo Internal],Pseudo Internal),("gtsvector_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_same",[ScalarType "gtsvector",ScalarType "gtsvector",Pseudo Internal],Pseudo Internal),("gtsvector_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvectorin",[Pseudo Cstring],ScalarType "gtsvector"),("gtsvectorout",[ScalarType "gtsvector"],Pseudo Cstring),("has_any_column_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("hash_aclitem",[ScalarType "aclitem"],ScalarType "int4"),("hash_numeric",[ScalarType "numeric"],ScalarType "int4"),("hashbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbpchar",[ScalarType "bpchar"],ScalarType "int4"),("hashbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashchar",[ScalarType "char"],ScalarType "int4"),("hashcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("hashendscan",[Pseudo Internal],Pseudo Void),("hashenum",[Pseudo AnyEnum],ScalarType "int4"),("hashfloat4",[ScalarType "float4"],ScalarType "int4"),("hashfloat8",[ScalarType "float8"],ScalarType "int4"),("hashgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("hashgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashinet",[ScalarType "inet"],ScalarType "int4"),("hashinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashint2",[ScalarType "int2"],ScalarType "int4"),("hashint2vector",[ScalarType "int2vector"],ScalarType "int4"),("hashint4",[ScalarType "int4"],ScalarType "int4"),("hashint8",[ScalarType "int8"],ScalarType "int4"),("hashmacaddr",[ScalarType "macaddr"],ScalarType "int4"),("hashmarkpos",[Pseudo Internal],Pseudo Void),("hashname",[ScalarType "name"],ScalarType "int4"),("hashoid",[ScalarType "oid"],ScalarType "int4"),("hashoidvector",[ScalarType "oidvector"],ScalarType "int4"),("hashoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("hashrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("hashrestrpos",[Pseudo Internal],Pseudo Void),("hashtext",[ScalarType "text"],ScalarType "int4"),("hashvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashvarlena",[Pseudo Internal],ScalarType "int4"),("height",[ScalarType "box"],ScalarType "float8"),("host",[ScalarType "inet"],ScalarType "text"),("hostmask",[ScalarType "inet"],ScalarType "inet"),("iclikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("iclikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icnlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icnlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("inet_client_addr",[],ScalarType "inet"),("inet_client_port",[],ScalarType "int4"),("inet_in",[Pseudo Cstring],ScalarType "inet"),("inet_out",[ScalarType "inet"],Pseudo Cstring),("inet_recv",[Pseudo Internal],ScalarType "inet"),("inet_send",[ScalarType "inet"],ScalarType "bytea"),("inet_server_addr",[],ScalarType "inet"),("inet_server_port",[],ScalarType "int4"),("inetand",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetmi",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("inetmi_int8",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("inetnot",[ScalarType "inet"],ScalarType "inet"),("inetor",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetpl",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("initcap",[ScalarType "text"],ScalarType "text"),("int2",[ScalarType "int8"],ScalarType "int2"),("int2",[ScalarType "int4"],ScalarType "int2"),("int2",[ScalarType "float4"],ScalarType "int2"),("int2",[ScalarType "float8"],ScalarType "int2"),("int2",[ScalarType "numeric"],ScalarType "int2"),("int24div",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24eq",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24ge",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24gt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24le",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24lt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24mi",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24mul",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24ne",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24pl",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int28div",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28eq",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28ge",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28gt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28le",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28lt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28mi",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28mul",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28ne",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28pl",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int2_accum",[ArrayType (ScalarType "numeric"),ScalarType "int2"],ArrayType (ScalarType "numeric")),("int2_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int2"],ArrayType (ScalarType "int8")),("int2_mul_cash",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("int2_sum",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int2abs",[ScalarType "int2"],ScalarType "int2"),("int2and",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2div",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2eq",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2ge",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2gt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2in",[Pseudo Cstring],ScalarType "int2"),("int2larger",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2le",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2lt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2mi",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mul",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2ne",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2not",[ScalarType "int2"],ScalarType "int2"),("int2or",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2out",[ScalarType "int2"],Pseudo Cstring),("int2pl",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2recv",[Pseudo Internal],ScalarType "int2"),("int2send",[ScalarType "int2"],ScalarType "bytea"),("int2shl",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2shr",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2smaller",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2um",[ScalarType "int2"],ScalarType "int2"),("int2up",[ScalarType "int2"],ScalarType "int2"),("int2vectoreq",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("int2vectorin",[Pseudo Cstring],ScalarType "int2vector"),("int2vectorout",[ScalarType "int2vector"],Pseudo Cstring),("int2vectorrecv",[Pseudo Internal],ScalarType "int2vector"),("int2vectorsend",[ScalarType "int2vector"],ScalarType "bytea"),("int2xor",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int4",[ScalarType "bool"],ScalarType "int4"),("int4",[ScalarType "char"],ScalarType "int4"),("int4",[ScalarType "int8"],ScalarType "int4"),("int4",[ScalarType "int2"],ScalarType "int4"),("int4",[ScalarType "float4"],ScalarType "int4"),("int4",[ScalarType "float8"],ScalarType "int4"),("int4",[ScalarType "bit"],ScalarType "int4"),("int4",[ScalarType "numeric"],ScalarType "int4"),("int42div",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42eq",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42ge",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42gt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42le",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42lt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42mi",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42mul",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42ne",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42pl",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int48div",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48eq",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48ge",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48gt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48le",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48lt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48mi",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48mul",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48ne",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48pl",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int4_accum",[ArrayType (ScalarType "numeric"),ScalarType "int4"],ArrayType (ScalarType "numeric")),("int4_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int4"],ArrayType (ScalarType "int8")),("int4_mul_cash",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("int4_sum",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int4abs",[ScalarType "int4"],ScalarType "int4"),("int4and",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4div",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4eq",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4ge",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4gt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4in",[Pseudo Cstring],ScalarType "int4"),("int4inc",[ScalarType "int4"],ScalarType "int4"),("int4larger",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4le",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4lt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4mi",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mul",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4ne",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4not",[ScalarType "int4"],ScalarType "int4"),("int4or",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4out",[ScalarType "int4"],Pseudo Cstring),("int4pl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4recv",[Pseudo Internal],ScalarType "int4"),("int4send",[ScalarType "int4"],ScalarType "bytea"),("int4shl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4shr",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4smaller",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4um",[ScalarType "int4"],ScalarType "int4"),("int4up",[ScalarType "int4"],ScalarType "int4"),("int4xor",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int8",[ScalarType "int2"],ScalarType "int8"),("int8",[ScalarType "int4"],ScalarType "int8"),("int8",[ScalarType "oid"],ScalarType "int8"),("int8",[ScalarType "float4"],ScalarType "int8"),("int8",[ScalarType "float8"],ScalarType "int8"),("int8",[ScalarType "bit"],ScalarType "int8"),("int8",[ScalarType "numeric"],ScalarType "int8"),("int82div",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82eq",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82ge",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82gt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82le",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82lt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82mi",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82mul",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82ne",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82pl",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int84div",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84eq",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84ge",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84gt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84le",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84lt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84mi",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84mul",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84ne",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84pl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_avg",[ArrayType (ScalarType "int8")],ScalarType "numeric"),("int8_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_sum",[ScalarType "numeric",ScalarType "int8"],ScalarType "numeric"),("int8abs",[ScalarType "int8"],ScalarType "int8"),("int8and",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8div",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8eq",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8ge",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8gt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8in",[Pseudo Cstring],ScalarType "int8"),("int8inc",[ScalarType "int8"],ScalarType "int8"),("int8inc_any",[ScalarType "int8",Pseudo Any],ScalarType "int8"),("int8inc_float8_float8",[ScalarType "int8",ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("int8larger",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8le",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8lt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8mi",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mul",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8ne",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8not",[ScalarType "int8"],ScalarType "int8"),("int8or",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8out",[ScalarType "int8"],Pseudo Cstring),("int8pl",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8pl_inet",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("int8recv",[Pseudo Internal],ScalarType "int8"),("int8send",[ScalarType "int8"],ScalarType "bytea"),("int8shl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8shr",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8smaller",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8um",[ScalarType "int8"],ScalarType "int8"),("int8up",[ScalarType "int8"],ScalarType "int8"),("int8xor",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("integer_pl_date",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("inter_lb",[ScalarType "line",ScalarType "box"],ScalarType "bool"),("inter_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("inter_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("internal_in",[Pseudo Cstring],Pseudo Internal),("internal_out",[Pseudo Internal],Pseudo Cstring),("interval",[ScalarType "reltime"],ScalarType "interval"),("interval",[ScalarType "time"],ScalarType "interval"),("interval",[ScalarType "interval",ScalarType "int4"],ScalarType "interval"),("interval_accum",[ArrayType (ScalarType "interval"),ScalarType "interval"],ArrayType (ScalarType "interval")),("interval_avg",[ArrayType (ScalarType "interval")],ScalarType "interval"),("interval_cmp",[ScalarType "interval",ScalarType "interval"],ScalarType "int4"),("interval_div",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_eq",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_ge",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_gt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_hash",[ScalarType "interval"],ScalarType "int4"),("interval_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_larger",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_le",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_lt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_mi",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_mul",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_ne",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_out",[ScalarType "interval"],Pseudo Cstring),("interval_pl",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_pl_date",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("interval_pl_time",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("interval_pl_timestamp",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("interval_pl_timestamptz",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("interval_pl_timetz",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("interval_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_send",[ScalarType "interval"],ScalarType "bytea"),("interval_smaller",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_um",[ScalarType "interval"],ScalarType "interval"),("intervaltypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("intervaltypmodout",[ScalarType "int4"],Pseudo Cstring),("intinterval",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("isclosed",[ScalarType "path"],ScalarType "bool"),("isfinite",[ScalarType "abstime"],ScalarType "bool"),("isfinite",[ScalarType "date"],ScalarType "bool"),("isfinite",[ScalarType "timestamp"],ScalarType "bool"),("isfinite",[ScalarType "timestamptz"],ScalarType "bool"),("isfinite",[ScalarType "interval"],ScalarType "bool"),("ishorizontal",[ScalarType "lseg"],ScalarType "bool"),("ishorizontal",[ScalarType "line"],ScalarType "bool"),("ishorizontal",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("iso8859_1_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso8859_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("isopen",[ScalarType "path"],ScalarType "bool"),("isparallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isparallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isperp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isperp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "lseg"],ScalarType "bool"),("isvertical",[ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("johab_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("justify_days",[ScalarType "interval"],ScalarType "interval"),("justify_hours",[ScalarType "interval"],ScalarType "interval"),("justify_interval",[ScalarType "interval"],ScalarType "interval"),("koi8r_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8u_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("language_handler_in",[Pseudo Cstring],Pseudo LanguageHandler),("language_handler_out",[Pseudo LanguageHandler],Pseudo Cstring),("lastval",[],ScalarType "int8"),("latin1_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin3_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin4_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("length",[ScalarType "bytea"],ScalarType "int4"),("length",[ScalarType "text"],ScalarType "int4"),("length",[ScalarType "lseg"],ScalarType "float8"),("length",[ScalarType "path"],ScalarType "float8"),("length",[ScalarType "bpchar"],ScalarType "int4"),("length",[ScalarType "bit"],ScalarType "int4"),("length",[ScalarType "tsvector"],ScalarType "int4"),("length",[ScalarType "bytea",ScalarType "name"],ScalarType "int4"),("like",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("like",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("like",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("like_escape",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("like_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("likejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("likesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("line",[ScalarType "point",ScalarType "point"],ScalarType "line"),("line_distance",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("line_eq",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_horizontal",[ScalarType "line"],ScalarType "bool"),("line_in",[Pseudo Cstring],ScalarType "line"),("line_interpt",[ScalarType "line",ScalarType "line"],ScalarType "point"),("line_intersect",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_out",[ScalarType "line"],Pseudo Cstring),("line_parallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_perp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_recv",[Pseudo Internal],ScalarType "line"),("line_send",[ScalarType "line"],ScalarType "bytea"),("line_vertical",[ScalarType "line"],ScalarType "bool"),("ln",[ScalarType "float8"],ScalarType "float8"),("ln",[ScalarType "numeric"],ScalarType "numeric"),("lo_close",[ScalarType "int4"],ScalarType "int4"),("lo_creat",[ScalarType "int4"],ScalarType "oid"),("lo_create",[ScalarType "oid"],ScalarType "oid"),("lo_export",[ScalarType "oid",ScalarType "text"],ScalarType "int4"),("lo_import",[ScalarType "text"],ScalarType "oid"),("lo_import",[ScalarType "text",ScalarType "oid"],ScalarType "oid"),("lo_lseek",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_open",[ScalarType "oid",ScalarType "int4"],ScalarType "int4"),("lo_tell",[ScalarType "int4"],ScalarType "int4"),("lo_truncate",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_unlink",[ScalarType "oid"],ScalarType "int4"),("log",[ScalarType "float8"],ScalarType "float8"),("log",[ScalarType "numeric"],ScalarType "numeric"),("log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("loread",[ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("lower",[ScalarType "text"],ScalarType "text"),("lowrite",[ScalarType "int4",ScalarType "bytea"],ScalarType "int4"),("lpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("lpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("lseg",[ScalarType "box"],ScalarType "lseg"),("lseg",[ScalarType "point",ScalarType "point"],ScalarType "lseg"),("lseg_center",[ScalarType "lseg"],ScalarType "point"),("lseg_distance",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("lseg_eq",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ge",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_gt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_horizontal",[ScalarType "lseg"],ScalarType "bool"),("lseg_in",[Pseudo Cstring],ScalarType "lseg"),("lseg_interpt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("lseg_intersect",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_le",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_length",[ScalarType "lseg"],ScalarType "float8"),("lseg_lt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ne",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_out",[ScalarType "lseg"],Pseudo Cstring),("lseg_parallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_perp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_recv",[Pseudo Internal],ScalarType "lseg"),("lseg_send",[ScalarType "lseg"],ScalarType "bytea"),("lseg_vertical",[ScalarType "lseg"],ScalarType "bool"),("ltrim",[ScalarType "text"],ScalarType "text"),("ltrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("macaddr_cmp",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "int4"),("macaddr_eq",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ge",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_gt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_in",[Pseudo Cstring],ScalarType "macaddr"),("macaddr_le",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_lt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ne",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_out",[ScalarType "macaddr"],Pseudo Cstring),("macaddr_recv",[Pseudo Internal],ScalarType "macaddr"),("macaddr_send",[ScalarType "macaddr"],ScalarType "bytea"),("makeaclitem",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "bool"],ScalarType "aclitem"),("masklen",[ScalarType "inet"],ScalarType "int4"),("md5",[ScalarType "bytea"],ScalarType "text"),("md5",[ScalarType "text"],ScalarType "text"),("mic_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin3",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin4",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mktinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("mul_d_interval",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("name",[ScalarType "text"],ScalarType "name"),("name",[ScalarType "bpchar"],ScalarType "name"),("name",[ScalarType "varchar"],ScalarType "name"),("nameeq",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namege",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namegt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("nameiclike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicnlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namein",[Pseudo Cstring],ScalarType "name"),("namele",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namelike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namelt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namene",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namenlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameout",[ScalarType "name"],Pseudo Cstring),("namerecv",[Pseudo Internal],ScalarType "name"),("nameregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namesend",[ScalarType "name"],ScalarType "bytea"),("neqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("neqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("netmask",[ScalarType "inet"],ScalarType "inet"),("network",[ScalarType "inet"],ScalarType "cidr"),("network_cmp",[ScalarType "inet",ScalarType "inet"],ScalarType "int4"),("network_eq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ge",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_gt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_le",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_lt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ne",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sub",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_subeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sup",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_supeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("nextval",[ScalarType "regclass"],ScalarType "int8"),("nlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("nlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("notlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("notlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("notlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("now",[],ScalarType "timestamptz"),("npoints",[ScalarType "path"],ScalarType "int4"),("npoints",[ScalarType "polygon"],ScalarType "int4"),("numeric",[ScalarType "int8"],ScalarType "numeric"),("numeric",[ScalarType "int2"],ScalarType "numeric"),("numeric",[ScalarType "int4"],ScalarType "numeric"),("numeric",[ScalarType "float4"],ScalarType "numeric"),("numeric",[ScalarType "float8"],ScalarType "numeric"),("numeric",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("numeric_abs",[ScalarType "numeric"],ScalarType "numeric"),("numeric_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_add",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_avg",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_cmp",[ScalarType "numeric",ScalarType "numeric"],ScalarType "int4"),("numeric_div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_div_trunc",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_eq",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_exp",[ScalarType "numeric"],ScalarType "numeric"),("numeric_fac",[ScalarType "int8"],ScalarType "numeric"),("numeric_ge",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_gt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_inc",[ScalarType "numeric"],ScalarType "numeric"),("numeric_larger",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_le",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_ln",[ScalarType "numeric"],ScalarType "numeric"),("numeric_log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_lt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_mul",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_ne",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_out",[ScalarType "numeric"],Pseudo Cstring),("numeric_power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_send",[ScalarType "numeric"],ScalarType "bytea"),("numeric_smaller",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_sqrt",[ScalarType "numeric"],ScalarType "numeric"),("numeric_stddev_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_stddev_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_sub",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_uminus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_uplus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_var_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_var_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numerictypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("numerictypmodout",[ScalarType "int4"],Pseudo Cstring),("numnode",[ScalarType "tsquery"],ScalarType "int4"),("obj_description",[ScalarType "oid"],ScalarType "text"),("obj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("octet_length",[ScalarType "bytea"],ScalarType "int4"),("octet_length",[ScalarType "text"],ScalarType "int4"),("octet_length",[ScalarType "bpchar"],ScalarType "int4"),("octet_length",[ScalarType "bit"],ScalarType "int4"),("oid",[ScalarType "int8"],ScalarType "oid"),("oideq",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidge",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidgt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidin",[Pseudo Cstring],ScalarType "oid"),("oidlarger",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidle",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidlt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidne",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidout",[ScalarType "oid"],Pseudo Cstring),("oidrecv",[Pseudo Internal],ScalarType "oid"),("oidsend",[ScalarType "oid"],ScalarType "bytea"),("oidsmaller",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidvectoreq",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorge",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorgt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorin",[Pseudo Cstring],ScalarType "oidvector"),("oidvectorle",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorlt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorne",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorout",[ScalarType "oidvector"],Pseudo Cstring),("oidvectorrecv",[Pseudo Internal],ScalarType "oidvector"),("oidvectorsend",[ScalarType "oidvector"],ScalarType "bytea"),("oidvectortypes",[ScalarType "oidvector"],ScalarType "text"),("on_pb",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("on_pl",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("on_ppath",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("on_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("on_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("on_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("opaque_in",[Pseudo Cstring],Pseudo Opaque),("opaque_out",[Pseudo Opaque],Pseudo Cstring),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timetz",ScalarType "timetz",ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("path",[ScalarType "polygon"],ScalarType "path"),("path_add",[ScalarType "path",ScalarType "path"],ScalarType "path"),("path_add_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_center",[ScalarType "path"],ScalarType "point"),("path_contain_pt",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("path_distance",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("path_div_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_in",[Pseudo Cstring],ScalarType "path"),("path_inter",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_length",[ScalarType "path"],ScalarType "float8"),("path_mul_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_n_eq",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_ge",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_gt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_le",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_lt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_npoints",[ScalarType "path"],ScalarType "int4"),("path_out",[ScalarType "path"],Pseudo Cstring),("path_recv",[Pseudo Internal],ScalarType "path"),("path_send",[ScalarType "path"],ScalarType "bytea"),("path_sub_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("pclose",[ScalarType "path"],ScalarType "path"),("pg_advisory_lock",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_unlock",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_advisory_unlock_all",[],Pseudo Void),("pg_advisory_unlock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_backend_pid",[],ScalarType "int4"),("pg_cancel_backend",[ScalarType "int4"],ScalarType "bool"),("pg_char_to_encoding",[ScalarType "name"],ScalarType "int4"),("pg_client_encoding",[],ScalarType "name"),("pg_column_size",[Pseudo Any],ScalarType "int4"),("pg_conf_load_time",[],ScalarType "timestamptz"),("pg_conversion_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_current_xlog_insert_location",[],ScalarType "text"),("pg_current_xlog_location",[],ScalarType "text"),("pg_cursor",[],SetOfType (Pseudo Record)),("pg_database_size",[ScalarType "name"],ScalarType "int8"),("pg_database_size",[ScalarType "oid"],ScalarType "int8"),("pg_encoding_to_char",[ScalarType "int4"],ScalarType "name"),("pg_function_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_get_constraintdef",[ScalarType "oid"],ScalarType "text"),("pg_get_constraintdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_function_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_identity_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_result",[ScalarType "oid"],ScalarType "text"),("pg_get_functiondef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid",ScalarType "int4",ScalarType "bool"],ScalarType "text"),("pg_get_keywords",[],SetOfType (Pseudo Record)),("pg_get_ruledef",[ScalarType "oid"],ScalarType "text"),("pg_get_ruledef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_serial_sequence",[ScalarType "text",ScalarType "text"],ScalarType "text"),("pg_get_triggerdef",[ScalarType "oid"],ScalarType "text"),("pg_get_userbyid",[ScalarType "oid"],ScalarType "name"),("pg_get_viewdef",[ScalarType "text"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid"],ScalarType "text"),("pg_get_viewdef",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_has_role",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_is_other_temp_schema",[ScalarType "oid"],ScalarType "bool"),("pg_lock_status",[],SetOfType (Pseudo Record)),("pg_ls_dir",[ScalarType "text"],SetOfType (ScalarType "text")),("pg_my_temp_schema",[],ScalarType "oid"),("pg_opclass_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_operator_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_options_to_table",[ArrayType (ScalarType "text")],SetOfType (Pseudo Record)),("pg_postmaster_start_time",[],ScalarType "timestamptz"),("pg_prepared_statement",[],SetOfType (Pseudo Record)),("pg_prepared_xact",[],SetOfType (Pseudo Record)),("pg_read_file",[ScalarType "text",ScalarType "int8",ScalarType "int8"],ScalarType "text"),("pg_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_relation_size",[ScalarType "regclass",ScalarType "text"],ScalarType "int8"),("pg_reload_conf",[],ScalarType "bool"),("pg_rotate_logfile",[],ScalarType "bool"),("pg_show_all_settings",[],SetOfType (Pseudo Record)),("pg_size_pretty",[ScalarType "int8"],ScalarType "text"),("pg_sleep",[ScalarType "float8"],Pseudo Void),("pg_start_backup",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_stat_clear_snapshot",[],Pseudo Void),("pg_stat_file",[ScalarType "text"],Pseudo Record),("pg_stat_get_activity",[ScalarType "int4"],SetOfType (Pseudo Record)),("pg_stat_get_backend_activity",[ScalarType "int4"],ScalarType "text"),("pg_stat_get_backend_activity_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_client_addr",[ScalarType "int4"],ScalarType "inet"),("pg_stat_get_backend_client_port",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_dbid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_idset",[],SetOfType (ScalarType "int4")),("pg_stat_get_backend_pid",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_userid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_waiting",[ScalarType "int4"],ScalarType "bool"),("pg_stat_get_backend_xact_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_bgwriter_buf_written_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_buf_written_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_maxwritten_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_requested_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_timed_checkpoints",[],ScalarType "int8"),("pg_stat_get_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_buf_alloc",[],ScalarType "int8"),("pg_stat_get_buf_written_backend",[],ScalarType "int8"),("pg_stat_get_db_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_numbackends",[ScalarType "oid"],ScalarType "int4"),("pg_stat_get_db_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_commit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_rollback",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_dead_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_calls",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_self_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_last_analyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autoanalyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autovacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_vacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_live_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_numscans",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_hot_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_reset",[],Pseudo Void),("pg_stop_backup",[],ScalarType "text"),("pg_switch_xlog",[],ScalarType "text"),("pg_table_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_tablespace_databases",[ScalarType "oid"],SetOfType (ScalarType "oid")),("pg_tablespace_size",[ScalarType "name"],ScalarType "int8"),("pg_tablespace_size",[ScalarType "oid"],ScalarType "int8"),("pg_terminate_backend",[ScalarType "int4"],ScalarType "bool"),("pg_timezone_abbrevs",[],SetOfType (Pseudo Record)),("pg_timezone_names",[],SetOfType (Pseudo Record)),("pg_total_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_try_advisory_lock",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_ts_config_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_dict_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_parser_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_template_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_type_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_typeof",[Pseudo Any],ScalarType "regtype"),("pg_xlogfile_name",[ScalarType "text"],ScalarType "text"),("pg_xlogfile_name_offset",[ScalarType "text"],Pseudo Record),("pi",[],ScalarType "float8"),("plainto_tsquery",[ScalarType "text"],ScalarType "tsquery"),("plainto_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("point",[ScalarType "lseg"],ScalarType "point"),("point",[ScalarType "path"],ScalarType "point"),("point",[ScalarType "box"],ScalarType "point"),("point",[ScalarType "polygon"],ScalarType "point"),("point",[ScalarType "circle"],ScalarType "point"),("point",[ScalarType "float8",ScalarType "float8"],ScalarType "point"),("point_above",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_add",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_below",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_distance",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("point_div",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_eq",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_horiz",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_in",[Pseudo Cstring],ScalarType "point"),("point_left",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_mul",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_ne",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_out",[ScalarType "point"],Pseudo Cstring),("point_recv",[Pseudo Internal],ScalarType "point"),("point_right",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_send",[ScalarType "point"],ScalarType "bytea"),("point_sub",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_vert",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("poly_above",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_below",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_center",[ScalarType "polygon"],ScalarType "point"),("poly_contain",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_contain_pt",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("poly_contained",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_distance",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("poly_in",[Pseudo Cstring],ScalarType "polygon"),("poly_left",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_npoints",[ScalarType "polygon"],ScalarType "int4"),("poly_out",[ScalarType "polygon"],Pseudo Cstring),("poly_overabove",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overbelow",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overlap",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overleft",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overright",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_recv",[Pseudo Internal],ScalarType "polygon"),("poly_right",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_same",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_send",[ScalarType "polygon"],ScalarType "bytea"),("polygon",[ScalarType "path"],ScalarType "polygon"),("polygon",[ScalarType "box"],ScalarType "polygon"),("polygon",[ScalarType "circle"],ScalarType "polygon"),("polygon",[ScalarType "int4",ScalarType "circle"],ScalarType "polygon"),("popen",[ScalarType "path"],ScalarType "path"),("position",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("position",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("position",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("positionjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("positionsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("postgresql_fdw_validator",[ArrayType (ScalarType "text"),ScalarType "oid"],ScalarType "bool"),("pow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("pow",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("power",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("prsd_end",[Pseudo Internal],Pseudo Void),("prsd_headline",[Pseudo Internal,Pseudo Internal,ScalarType "tsquery"],Pseudo Internal),("prsd_lextype",[Pseudo Internal],Pseudo Internal),("prsd_nexttoken",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("prsd_start",[Pseudo Internal,ScalarType "int4"],Pseudo Internal),("pt_contained_circle",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("pt_contained_poly",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("query_to_xml",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xml_and_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("querytree",[ScalarType "tsquery"],ScalarType "text"),("quote_ident",[ScalarType "text"],ScalarType "text"),("quote_literal",[ScalarType "text"],ScalarType "text"),("quote_literal",[Pseudo AnyElement],ScalarType "text"),("quote_nullable",[ScalarType "text"],ScalarType "text"),("quote_nullable",[Pseudo AnyElement],ScalarType "text"),("radians",[ScalarType "float8"],ScalarType "float8"),("radius",[ScalarType "circle"],ScalarType "float8"),("random",[],ScalarType "float8"),("record_eq",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ge",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_gt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_le",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_lt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ne",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_out",[Pseudo Record],Pseudo Cstring),("record_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_send",[Pseudo Record],ScalarType "bytea"),("regclass",[ScalarType "text"],ScalarType "regclass"),("regclassin",[Pseudo Cstring],ScalarType "regclass"),("regclassout",[ScalarType "regclass"],Pseudo Cstring),("regclassrecv",[Pseudo Internal],ScalarType "regclass"),("regclasssend",[ScalarType "regclass"],ScalarType "bytea"),("regconfigin",[Pseudo Cstring],ScalarType "regconfig"),("regconfigout",[ScalarType "regconfig"],Pseudo Cstring),("regconfigrecv",[Pseudo Internal],ScalarType "regconfig"),("regconfigsend",[ScalarType "regconfig"],ScalarType "bytea"),("regdictionaryin",[Pseudo Cstring],ScalarType "regdictionary"),("regdictionaryout",[ScalarType "regdictionary"],Pseudo Cstring),("regdictionaryrecv",[Pseudo Internal],ScalarType "regdictionary"),("regdictionarysend",[ScalarType "regdictionary"],ScalarType "bytea"),("regexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexp_matches",[ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_matches",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_split_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_array",[ScalarType "text",ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regoperatorin",[Pseudo Cstring],ScalarType "regoperator"),("regoperatorout",[ScalarType "regoperator"],Pseudo Cstring),("regoperatorrecv",[Pseudo Internal],ScalarType "regoperator"),("regoperatorsend",[ScalarType "regoperator"],ScalarType "bytea"),("regoperin",[Pseudo Cstring],ScalarType "regoper"),("regoperout",[ScalarType "regoper"],Pseudo Cstring),("regoperrecv",[Pseudo Internal],ScalarType "regoper"),("regopersend",[ScalarType "regoper"],ScalarType "bytea"),("regprocedurein",[Pseudo Cstring],ScalarType "regprocedure"),("regprocedureout",[ScalarType "regprocedure"],Pseudo Cstring),("regprocedurerecv",[Pseudo Internal],ScalarType "regprocedure"),("regproceduresend",[ScalarType "regprocedure"],ScalarType "bytea"),("regprocin",[Pseudo Cstring],ScalarType "regproc"),("regprocout",[ScalarType "regproc"],Pseudo Cstring),("regprocrecv",[Pseudo Internal],ScalarType "regproc"),("regprocsend",[ScalarType "regproc"],ScalarType "bytea"),("regtypein",[Pseudo Cstring],ScalarType "regtype"),("regtypeout",[ScalarType "regtype"],Pseudo Cstring),("regtyperecv",[Pseudo Internal],ScalarType "regtype"),("regtypesend",[ScalarType "regtype"],ScalarType "bytea"),("reltime",[ScalarType "interval"],ScalarType "reltime"),("reltimeeq",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimege",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimegt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimein",[Pseudo Cstring],ScalarType "reltime"),("reltimele",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimelt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimene",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimeout",[ScalarType "reltime"],Pseudo Cstring),("reltimerecv",[Pseudo Internal],ScalarType "reltime"),("reltimesend",[ScalarType "reltime"],ScalarType "bytea"),("repeat",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("round",[ScalarType "float8"],ScalarType "float8"),("round",[ScalarType "numeric"],ScalarType "numeric"),("round",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("rpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("rpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("scalargtjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalargtsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("scalarltjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalarltsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("schema_to_xml",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xml_and_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("session_user",[],ScalarType "name"),("set_bit",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_byte",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_config",[ScalarType "text",ScalarType "text",ScalarType "bool"],ScalarType "text"),("set_masklen",[ScalarType "cidr",ScalarType "int4"],ScalarType "cidr"),("set_masklen",[ScalarType "inet",ScalarType "int4"],ScalarType "inet"),("setseed",[ScalarType "float8"],Pseudo Void),("setval",[ScalarType "regclass",ScalarType "int8"],ScalarType "int8"),("setval",[ScalarType "regclass",ScalarType "int8",ScalarType "bool"],ScalarType "int8"),("setweight",[ScalarType "tsvector",ScalarType "char"],ScalarType "tsvector"),("shell_in",[Pseudo Cstring],Pseudo Opaque),("shell_out",[Pseudo Opaque],Pseudo Cstring),("shift_jis_2004_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shift_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shobj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("sign",[ScalarType "float8"],ScalarType "float8"),("sign",[ScalarType "numeric"],ScalarType "numeric"),("similar_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("sin",[ScalarType "float8"],ScalarType "float8"),("sjis_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("slope",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("smgreq",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrin",[Pseudo Cstring],ScalarType "smgr"),("smgrne",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrout",[ScalarType "smgr"],Pseudo Cstring),("split_part",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("sqrt",[ScalarType "float8"],ScalarType "float8"),("sqrt",[ScalarType "numeric"],ScalarType "numeric"),("statement_timestamp",[],ScalarType "timestamptz"),("string_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("strip",[ScalarType "tsvector"],ScalarType "tsvector"),("strpos",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("substr",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substr",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("substring",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("suppress_redundant_updates_trigger",[],Pseudo Trigger),("table_to_xml",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xml_and_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("tan",[ScalarType "float8"],ScalarType "float8"),("text",[ScalarType "bool"],ScalarType "text"),("text",[ScalarType "char"],ScalarType "text"),("text",[ScalarType "name"],ScalarType "text"),("text",[ScalarType "xml"],ScalarType "text"),("text",[ScalarType "inet"],ScalarType "text"),("text",[ScalarType "bpchar"],ScalarType "text"),("text_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_larger",[ScalarType "text",ScalarType "text"],ScalarType "text"),("text_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_smaller",[ScalarType "text",ScalarType "text"],ScalarType "text"),("textanycat",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("textcat",[ScalarType "text",ScalarType "text"],ScalarType "text"),("texteq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textin",[Pseudo Cstring],ScalarType "text"),("textlen",[ScalarType "text"],ScalarType "int4"),("textlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textout",[ScalarType "text"],Pseudo Cstring),("textrecv",[Pseudo Internal],ScalarType "text"),("textregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textsend",[ScalarType "text"],ScalarType "bytea"),("thesaurus_init",[Pseudo Internal],Pseudo Internal),("thesaurus_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("tideq",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidge",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidgt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidin",[Pseudo Cstring],ScalarType "tid"),("tidlarger",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("tidle",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidlt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidne",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidout",[ScalarType "tid"],Pseudo Cstring),("tidrecv",[Pseudo Internal],ScalarType "tid"),("tidsend",[ScalarType "tid"],ScalarType "bytea"),("tidsmaller",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("time",[ScalarType "abstime"],ScalarType "time"),("time",[ScalarType "timestamp"],ScalarType "time"),("time",[ScalarType "timestamptz"],ScalarType "time"),("time",[ScalarType "interval"],ScalarType "time"),("time",[ScalarType "timetz"],ScalarType "time"),("time",[ScalarType "time",ScalarType "int4"],ScalarType "time"),("time_cmp",[ScalarType "time",ScalarType "time"],ScalarType "int4"),("time_eq",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_ge",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_gt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_hash",[ScalarType "time"],ScalarType "int4"),("time_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_larger",[ScalarType "time",ScalarType "time"],ScalarType "time"),("time_le",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_lt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_mi_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_mi_time",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("time_ne",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_out",[ScalarType "time"],Pseudo Cstring),("time_pl_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_send",[ScalarType "time"],ScalarType "bytea"),("time_smaller",[ScalarType "time",ScalarType "time"],ScalarType "time"),("timedate_pl",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("timemi",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timenow",[],ScalarType "abstime"),("timeofday",[],ScalarType "text"),("timepl",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timestamp",[ScalarType "abstime"],ScalarType "timestamp"),("timestamp",[ScalarType "date"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamptz"],ScalarType "timestamp"),("timestamp",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamp",ScalarType "int4"],ScalarType "timestamp"),("timestamp_cmp",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "int4"),("timestamp_cmp_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "int4"),("timestamp_cmp_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "int4"),("timestamp_eq",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_eq_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_eq_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_ge",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ge_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ge_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_gt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_gt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_gt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_hash",[ScalarType "timestamp"],ScalarType "int4"),("timestamp_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_larger",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamp_le",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_le_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_le_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_lt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_lt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_lt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_mi",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("timestamp_mi_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_ne",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ne_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ne_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_out",[ScalarType "timestamp"],Pseudo Cstring),("timestamp_pl_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_send",[ScalarType "timestamp"],ScalarType "bytea"),("timestamp_smaller",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamptypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptypmodout",[ScalarType "int4"],Pseudo Cstring),("timestamptz",[ScalarType "abstime"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamp"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "time"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamptz",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_cmp",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "int4"),("timestamptz_cmp_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "int4"),("timestamptz_cmp_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "int4"),("timestamptz_eq",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_eq_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_eq_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_ge",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ge_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ge_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_gt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_gt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_gt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_larger",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptz_le",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_le_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_le_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_lt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_lt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_lt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_mi",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("timestamptz_mi_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_ne",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ne_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ne_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_out",[ScalarType "timestamptz"],Pseudo Cstring),("timestamptz_pl_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_send",[ScalarType "timestamptz"],ScalarType "bytea"),("timestamptz_smaller",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptztypmodout",[ScalarType "int4"],Pseudo Cstring),("timetypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetypmodout",[ScalarType "int4"],Pseudo Cstring),("timetz",[ScalarType "time"],ScalarType "timetz"),("timetz",[ScalarType "timestamptz"],ScalarType "timetz"),("timetz",[ScalarType "timetz",ScalarType "int4"],ScalarType "timetz"),("timetz_cmp",[ScalarType "timetz",ScalarType "timetz"],ScalarType "int4"),("timetz_eq",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_ge",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_gt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_hash",[ScalarType "timetz"],ScalarType "int4"),("timetz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_larger",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetz_le",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_lt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_mi_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_ne",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_out",[ScalarType "timetz"],Pseudo Cstring),("timetz_pl_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_send",[ScalarType "timetz"],ScalarType "bytea"),("timetz_smaller",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetzdate_pl",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("timetztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetztypmodout",[ScalarType "int4"],Pseudo Cstring),("timezone",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "text",ScalarType "timetz"],ScalarType "timetz"),("timezone",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("tinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("tintervalct",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalend",[ScalarType "tinterval"],ScalarType "abstime"),("tintervaleq",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalge",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalgt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalin",[Pseudo Cstring],ScalarType "tinterval"),("tintervalle",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalleneq",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenge",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallengt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenle",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenlt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenne",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalne",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalout",[ScalarType "tinterval"],Pseudo Cstring),("tintervalov",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalrecv",[Pseudo Internal],ScalarType "tinterval"),("tintervalrel",[ScalarType "tinterval"],ScalarType "reltime"),("tintervalsame",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalsend",[ScalarType "tinterval"],ScalarType "bytea"),("tintervalstart",[ScalarType "tinterval"],ScalarType "abstime"),("to_ascii",[ScalarType "text"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "name"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("to_char",[ScalarType "int8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "int4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamp",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamptz",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "interval",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "numeric",ScalarType "text"],ScalarType "text"),("to_date",[ScalarType "text",ScalarType "text"],ScalarType "date"),("to_hex",[ScalarType "int8"],ScalarType "text"),("to_hex",[ScalarType "int4"],ScalarType "text"),("to_number",[ScalarType "text",ScalarType "text"],ScalarType "numeric"),("to_timestamp",[ScalarType "float8"],ScalarType "timestamptz"),("to_timestamp",[ScalarType "text",ScalarType "text"],ScalarType "timestamptz"),("to_tsquery",[ScalarType "text"],ScalarType "tsquery"),("to_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("to_tsvector",[ScalarType "text"],ScalarType "tsvector"),("to_tsvector",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsvector"),("transaction_timestamp",[],ScalarType "timestamptz"),("translate",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("trigger_in",[Pseudo Cstring],Pseudo Trigger),("trigger_out",[Pseudo Trigger],Pseudo Cstring),("trunc",[ScalarType "float8"],ScalarType "float8"),("trunc",[ScalarType "macaddr"],ScalarType "macaddr"),("trunc",[ScalarType "numeric"],ScalarType "numeric"),("trunc",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("ts_debug",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_debug",[ScalarType "regconfig",ScalarType "text"],SetOfType (Pseudo Record)),("ts_headline",[ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_lexize",[ScalarType "regdictionary",ScalarType "text"],ArrayType (ScalarType "text")),("ts_match_qv",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("ts_match_tq",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("ts_match_tt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("ts_match_vq",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("ts_parse",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_parse",[ScalarType "oid",ScalarType "text"],SetOfType (Pseudo Record)),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rewrite",[ScalarType "tsquery",ScalarType "text"],ScalarType "tsquery"),("ts_rewrite",[ScalarType "tsquery",ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("ts_stat",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_stat",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "oid"],SetOfType (Pseudo Record)),("ts_typanalyze",[Pseudo Internal],ScalarType "bool"),("tsmatchjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("tsmatchsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("tsq_mcontained",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsq_mcontains",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_and",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_cmp",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "int4"),("tsquery_eq",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ge",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_gt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_le",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_lt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ne",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_not",[ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_or",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsqueryin",[Pseudo Cstring],ScalarType "tsquery"),("tsqueryout",[ScalarType "tsquery"],Pseudo Cstring),("tsqueryrecv",[Pseudo Internal],ScalarType "tsquery"),("tsquerysend",[ScalarType "tsquery"],ScalarType "bytea"),("tsvector_cmp",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "int4"),("tsvector_concat",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("tsvector_eq",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ge",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_gt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_le",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_lt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ne",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_update_trigger",[],Pseudo Trigger),("tsvector_update_trigger_column",[],Pseudo Trigger),("tsvectorin",[Pseudo Cstring],ScalarType "tsvector"),("tsvectorout",[ScalarType "tsvector"],Pseudo Cstring),("tsvectorrecv",[Pseudo Internal],ScalarType "tsvector"),("tsvectorsend",[ScalarType "tsvector"],ScalarType "bytea"),("txid_current",[],ScalarType "int8"),("txid_current_snapshot",[],ScalarType "txid_snapshot"),("txid_snapshot_in",[Pseudo Cstring],ScalarType "txid_snapshot"),("txid_snapshot_out",[ScalarType "txid_snapshot"],Pseudo Cstring),("txid_snapshot_recv",[Pseudo Internal],ScalarType "txid_snapshot"),("txid_snapshot_send",[ScalarType "txid_snapshot"],ScalarType "bytea"),("txid_snapshot_xip",[ScalarType "txid_snapshot"],SetOfType (ScalarType "int8")),("txid_snapshot_xmax",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_snapshot_xmin",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_visible_in_snapshot",[ScalarType "int8",ScalarType "txid_snapshot"],ScalarType "bool"),("uhc_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("unknownin",[Pseudo Cstring],ScalarType "unknown"),("unknownout",[ScalarType "unknown"],Pseudo Cstring),("unknownrecv",[Pseudo Internal],ScalarType "unknown"),("unknownsend",[ScalarType "unknown"],ScalarType "bytea"),("unnest",[Pseudo AnyArray],SetOfType (Pseudo AnyElement)),("upper",[ScalarType "text"],ScalarType "text"),("utf8_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gb18030",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gbk",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859_1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_johab",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8u",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_uhc",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_win",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("uuid_cmp",[ScalarType "uuid",ScalarType "uuid"],ScalarType "int4"),("uuid_eq",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ge",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_gt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_hash",[ScalarType "uuid"],ScalarType "int4"),("uuid_in",[Pseudo Cstring],ScalarType "uuid"),("uuid_le",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_lt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ne",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_out",[ScalarType "uuid"],Pseudo Cstring),("uuid_recv",[Pseudo Internal],ScalarType "uuid"),("uuid_send",[ScalarType "uuid"],ScalarType "bytea"),("varbit",[ScalarType "varbit",ScalarType "int4",ScalarType "bool"],ScalarType "varbit"),("varbit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_out",[ScalarType "varbit"],Pseudo Cstring),("varbit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_send",[ScalarType "varbit"],ScalarType "bytea"),("varbitcmp",[ScalarType "varbit",ScalarType "varbit"],ScalarType "int4"),("varbiteq",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitge",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitgt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitle",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitlt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitne",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varbittypmodout",[ScalarType "int4"],Pseudo Cstring),("varchar",[ScalarType "name"],ScalarType "varchar"),("varchar",[ScalarType "varchar",ScalarType "int4",ScalarType "bool"],ScalarType "varchar"),("varcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharout",[ScalarType "varchar"],Pseudo Cstring),("varcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharsend",[ScalarType "varchar"],ScalarType "bytea"),("varchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varchartypmodout",[ScalarType "int4"],Pseudo Cstring),("version",[],ScalarType "text"),("void_in",[Pseudo Cstring],Pseudo Void),("void_out",[Pseudo Void],Pseudo Cstring),("width",[ScalarType "box"],ScalarType "float8"),("width_bucket",[ScalarType "float8",ScalarType "float8",ScalarType "float8",ScalarType "int4"],ScalarType "int4"),("width_bucket",[ScalarType "numeric",ScalarType "numeric",ScalarType "numeric",ScalarType "int4"],ScalarType "int4"),("win1250_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1250_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("xideq",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("xideqint4",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("xidin",[Pseudo Cstring],ScalarType "xid"),("xidout",[ScalarType "xid"],Pseudo Cstring),("xidrecv",[Pseudo Internal],ScalarType "xid"),("xidsend",[ScalarType "xid"],ScalarType "bytea"),("xml",[ScalarType "text"],ScalarType "xml"),("xml_in",[Pseudo Cstring],ScalarType "xml"),("xml_out",[ScalarType "xml"],Pseudo Cstring),("xml_recv",[Pseudo Internal],ScalarType "xml"),("xml_send",[ScalarType "xml"],ScalarType "bytea"),("xmlcomment",[ScalarType "text"],ScalarType "xml"),("xmlconcat2",[ScalarType "xml",ScalarType "xml"],ScalarType "xml"),("xmlvalidate",[ScalarType "xml",ScalarType "text"],ScalarType "bool"),("xpath",[ScalarType "text",ScalarType "xml"],ArrayType (ScalarType "xml")),("xpath",[ScalarType "text",ScalarType "xml",ArrayType (ScalarType "text")],ArrayType (ScalarType "xml"))], scopeAggregates = [("array_agg",[Pseudo AnyElement],Pseudo AnyArray),("avg",[ScalarType "int8"],ScalarType "numeric"),("avg",[ScalarType "int2"],ScalarType "numeric"),("avg",[ScalarType "int4"],ScalarType "numeric"),("avg",[ScalarType "float4"],ScalarType "float8"),("avg",[ScalarType "float8"],ScalarType "float8"),("avg",[ScalarType "interval"],ScalarType "interval"),("avg",[ScalarType "numeric"],ScalarType "numeric"),("bit_and",[ScalarType "int8"],ScalarType "int8"),("bit_and",[ScalarType "int2"],ScalarType "int2"),("bit_and",[ScalarType "int4"],ScalarType "int4"),("bit_and",[ScalarType "bit"],ScalarType "bit"),("bit_or",[ScalarType "int8"],ScalarType "int8"),("bit_or",[ScalarType "int2"],ScalarType "int2"),("bit_or",[ScalarType "int4"],ScalarType "int4"),("bit_or",[ScalarType "bit"],ScalarType "bit"),("bool_and",[ScalarType "bool"],ScalarType "bool"),("bool_or",[ScalarType "bool"],ScalarType "bool"),("corr",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("count",[],ScalarType "int8"),("count",[Pseudo Any],ScalarType "int8"),("covar_pop",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("covar_samp",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("every",[ScalarType "bool"],ScalarType "bool"),("max",[ScalarType "int8"],ScalarType "int8"),("max",[ScalarType "int2"],ScalarType "int2"),("max",[ScalarType "int4"],ScalarType "int4"),("max",[ScalarType "text"],ScalarType "text"),("max",[ScalarType "oid"],ScalarType "oid"),("max",[ScalarType "tid"],ScalarType "tid"),("max",[ScalarType "float4"],ScalarType "float4"),("max",[ScalarType "float8"],ScalarType "float8"),("max",[ScalarType "abstime"],ScalarType "abstime"),("max",[ScalarType "money"],ScalarType "money"),("max",[ScalarType "bpchar"],ScalarType "bpchar"),("max",[ScalarType "date"],ScalarType "date"),("max",[ScalarType "time"],ScalarType "time"),("max",[ScalarType "timestamp"],ScalarType "timestamp"),("max",[ScalarType "timestamptz"],ScalarType "timestamptz"),("max",[ScalarType "interval"],ScalarType "interval"),("max",[ScalarType "timetz"],ScalarType "timetz"),("max",[ScalarType "numeric"],ScalarType "numeric"),("max",[Pseudo AnyArray],Pseudo AnyArray),("max",[Pseudo AnyEnum],Pseudo AnyEnum),("min",[ScalarType "int8"],ScalarType "int8"),("min",[ScalarType "int2"],ScalarType "int2"),("min",[ScalarType "int4"],ScalarType "int4"),("min",[ScalarType "text"],ScalarType "text"),("min",[ScalarType "oid"],ScalarType "oid"),("min",[ScalarType "tid"],ScalarType "tid"),("min",[ScalarType "float4"],ScalarType "float4"),("min",[ScalarType "float8"],ScalarType "float8"),("min",[ScalarType "abstime"],ScalarType "abstime"),("min",[ScalarType "money"],ScalarType "money"),("min",[ScalarType "bpchar"],ScalarType "bpchar"),("min",[ScalarType "date"],ScalarType "date"),("min",[ScalarType "time"],ScalarType "time"),("min",[ScalarType "timestamp"],ScalarType "timestamp"),("min",[ScalarType "timestamptz"],ScalarType "timestamptz"),("min",[ScalarType "interval"],ScalarType "interval"),("min",[ScalarType "timetz"],ScalarType "timetz"),("min",[ScalarType "numeric"],ScalarType "numeric"),("min",[Pseudo AnyArray],Pseudo AnyArray),("min",[Pseudo AnyEnum],Pseudo AnyEnum),("regr_avgx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_avgy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_count",[ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("regr_intercept",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_r2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_slope",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_syy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "int8"],ScalarType "numeric"),("stddev",[ScalarType "int2"],ScalarType "numeric"),("stddev",[ScalarType "int4"],ScalarType "numeric"),("stddev",[ScalarType "float4"],ScalarType "float8"),("stddev",[ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "numeric"],ScalarType "numeric"),("stddev_pop",[ScalarType "int8"],ScalarType "numeric"),("stddev_pop",[ScalarType "int2"],ScalarType "numeric"),("stddev_pop",[ScalarType "int4"],ScalarType "numeric"),("stddev_pop",[ScalarType "float4"],ScalarType "float8"),("stddev_pop",[ScalarType "float8"],ScalarType "float8"),("stddev_pop",[ScalarType "numeric"],ScalarType "numeric"),("stddev_samp",[ScalarType "int8"],ScalarType "numeric"),("stddev_samp",[ScalarType "int2"],ScalarType "numeric"),("stddev_samp",[ScalarType "int4"],ScalarType "numeric"),("stddev_samp",[ScalarType "float4"],ScalarType "float8"),("stddev_samp",[ScalarType "float8"],ScalarType "float8"),("stddev_samp",[ScalarType "numeric"],ScalarType "numeric"),("sum",[ScalarType "int8"],ScalarType "numeric"),("sum",[ScalarType "int2"],ScalarType "int8"),("sum",[ScalarType "int4"],ScalarType "int8"),("sum",[ScalarType "float4"],ScalarType "float4"),("sum",[ScalarType "float8"],ScalarType "float8"),("sum",[ScalarType "money"],ScalarType "money"),("sum",[ScalarType "interval"],ScalarType "interval"),("sum",[ScalarType "numeric"],ScalarType "numeric"),("var_pop",[ScalarType "int8"],ScalarType "numeric"),("var_pop",[ScalarType "int2"],ScalarType "numeric"),("var_pop",[ScalarType "int4"],ScalarType "numeric"),("var_pop",[ScalarType "float4"],ScalarType "float8"),("var_pop",[ScalarType "float8"],ScalarType "float8"),("var_pop",[ScalarType "numeric"],ScalarType "numeric"),("var_samp",[ScalarType "int8"],ScalarType "numeric"),("var_samp",[ScalarType "int2"],ScalarType "numeric"),("var_samp",[ScalarType "int4"],ScalarType "numeric"),("var_samp",[ScalarType "float4"],ScalarType "float8"),("var_samp",[ScalarType "float8"],ScalarType "float8"),("var_samp",[ScalarType "numeric"],ScalarType "numeric"),("variance",[ScalarType "int8"],ScalarType "numeric"),("variance",[ScalarType "int2"],ScalarType "numeric"),("variance",[ScalarType "int4"],ScalarType "numeric"),("variance",[ScalarType "float4"],ScalarType "float8"),("variance",[ScalarType "float8"],ScalarType "float8"),("variance",[ScalarType "numeric"],ScalarType "numeric"),("xmlagg",[ScalarType "xml"],ScalarType "xml")], scopeAllFns = [("~",[ScalarType "int8"],ScalarType "int8"),("~",[ScalarType "int4"],ScalarType "int4"),("~",[ScalarType "int2"],ScalarType "int2"),("~",[ScalarType "bit"],ScalarType "bit"),("~",[ScalarType "inet"],ScalarType "inet"),("||/",[ScalarType "float8"],ScalarType "float8"),("|/",[ScalarType "float8"],ScalarType "float8"),("|",[ScalarType "tinterval"],ScalarType "abstime"),("@@",[ScalarType "circle"],ScalarType "point"),("@@",[ScalarType "lseg"],ScalarType "point"),("@@",[ScalarType "path"],ScalarType "point"),("@@",[ScalarType "polygon"],ScalarType "point"),("@@",[ScalarType "box"],ScalarType "point"),("@-@",[ScalarType "path"],ScalarType "float8"),("@-@",[ScalarType "lseg"],ScalarType "float8"),("@",[ScalarType "int8"],ScalarType "int8"),("@",[ScalarType "int4"],ScalarType "int4"),("@",[ScalarType "int2"],ScalarType "int2"),("@",[ScalarType "float8"],ScalarType "float8"),("@",[ScalarType "float4"],ScalarType "float4"),("@",[ScalarType "numeric"],ScalarType "numeric"),("?|",[ScalarType "line"],ScalarType "bool"),("?|",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "line"],ScalarType "bool"),("-",[ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "path"],ScalarType "int4"),("#",[ScalarType "polygon"],ScalarType "int4"),("!!",[ScalarType "int8"],ScalarType "numeric"),("!!",[ScalarType "tsquery"],ScalarType "tsquery"),("!",[ScalarType "int8"],ScalarType "numeric"),("~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~>~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~>=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("~=",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~=",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("~<~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~<=~",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("~<=~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("~",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("~",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("~",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("~",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("||",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "text",ScalarType "text"],ScalarType "text"),("||",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("||",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("||",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("||",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("||",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("||",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("||",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("||",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("|>>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|>>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|>>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("|&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("|&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("|",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("|",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("|",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("|",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("|",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("^",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("^",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("@@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("@@",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("@@",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("@@",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("@>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("@>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("@>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("@>",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("@>",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("@>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("@>",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("?||",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?||",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?|",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?-|",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?-|",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?-",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("?#",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("?#",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("?#",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("?#",[ScalarType "line",ScalarType "box"],ScalarType "bool"),(">^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),(">>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),(">>",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),(">>",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),(">>",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),(">>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">>",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),(">=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">=",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),(">=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),(">",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),(">",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "char",ScalarType "char"],ScalarType "bool"),(">",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),(">",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),(">",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "box",ScalarType "box"],ScalarType "bool"),(">",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),(">",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),(">",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),(">",[ScalarType "time",ScalarType "time"],ScalarType "bool"),(">",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),(">",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),(">",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),(">",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),(">",[ScalarType "name",ScalarType "name"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),(">",[ScalarType "path",ScalarType "path"],ScalarType "bool"),(">",[Pseudo Record,Pseudo Record],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),(">",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),(">",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),(">",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),(">",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "text",ScalarType "text"],ScalarType "bool"),(">",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),(">",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),(">",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),(">",[ScalarType "money",ScalarType "money"],ScalarType "bool"),(">",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),(">",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),(">",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),(">",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),(">",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),(">",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),(">",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("=",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("=",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("=",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("=",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("=",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<^",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<^",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<@",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("<@",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<@",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<@",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("<?>",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<>",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<>",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<>",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<>",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<>",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<>",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<>",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<>",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<>",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<>",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<>",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<>",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<>",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<>",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<>",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<>",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<>",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<>",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<>",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<>",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<>",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<>",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<>",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<>",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<>",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<>",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<=",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<=",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<=",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<=",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<=",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<=",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<=",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<=",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<=",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<=",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<=",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<=",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<=",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<=",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<=",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<=",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<=",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<=",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<=",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<=",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<=",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<=",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<=",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<=",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<=",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<=",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<=",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<=",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<=",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("<<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("<<",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("<<",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("<<",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("<<",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("<->",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("<->",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("<->",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("<->",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("<->",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("<#>",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("<",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("<",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("<",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("<",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("<",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("<",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("<",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("<",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("<",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("<",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("<",[Pseudo Record,Pseudo Record],ScalarType "bool"),("<",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("<",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("<",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("<",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("<",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("<",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("<",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("<",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("<",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("<",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("<",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("<",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("<",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("<",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("<",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("<",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("<",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("<",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("/",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("/",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("/",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("/",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("/",[ScalarType "point",ScalarType "point"],ScalarType "point"),("/",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("/",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("/",[ScalarType "path",ScalarType "point"],ScalarType "path"),("/",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("/",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("/",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("/",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("/",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("/",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("/",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("/",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("/",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("/",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("-",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("-",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("-",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("-",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("-",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("-",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("-",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("-",[ScalarType "money",ScalarType "money"],ScalarType "money"),("-",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("-",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("-",[ScalarType "box",ScalarType "point"],ScalarType "box"),("-",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("-",[ScalarType "path",ScalarType "point"],ScalarType "path"),("-",[ScalarType "point",ScalarType "point"],ScalarType "point"),("-",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("-",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("-",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("-",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("-",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("-",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("-",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("-",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("-",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("-",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("-",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("-",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("-",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("+",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("+",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("+",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("+",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("+",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("+",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("+",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("+",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("+",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("+",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("+",[ScalarType "point",ScalarType "point"],ScalarType "point"),("+",[ScalarType "path",ScalarType "path"],ScalarType "path"),("+",[ScalarType "path",ScalarType "point"],ScalarType "path"),("+",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("+",[ScalarType "box",ScalarType "point"],ScalarType "box"),("+",[ScalarType "money",ScalarType "money"],ScalarType "money"),("+",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("+",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("+",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("+",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("+",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("+",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("+",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("+",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("+",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("+",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("+",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("+",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("+",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("+",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("+",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("+",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("+",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("*",[ScalarType "point",ScalarType "point"],ScalarType "point"),("*",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("*",[ScalarType "path",ScalarType "point"],ScalarType "path"),("*",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("*",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "box",ScalarType "point"],ScalarType "box"),("*",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("*",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("*",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("*",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("*",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("*",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("*",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("*",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("*",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("*",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("*",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("*",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("*",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("*",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("*",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("*",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("&>",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&>",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&>",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<|",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<|",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&<",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&<",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&<",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("&&",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("&&",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("&&",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("&&",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("&&",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("&",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("&",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("&",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("&",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("&",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("%",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("%",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("%",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#>=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<>",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<=",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("#<",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("##",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "box"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("##",[ScalarType "line",ScalarType "box"],ScalarType "point"),("##",[ScalarType "point",ScalarType "line"],ScalarType "point"),("##",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("##",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("#",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("#",[ScalarType "line",ScalarType "line"],ScalarType "point"),("#",[ScalarType "box",ScalarType "box"],ScalarType "box"),("#",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("#",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("#",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("#",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("!~~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("!~~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~*",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("!~",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("RI_FKey_cascade_del",[],Pseudo Trigger),("RI_FKey_cascade_upd",[],Pseudo Trigger),("RI_FKey_check_ins",[],Pseudo Trigger),("RI_FKey_check_upd",[],Pseudo Trigger),("RI_FKey_noaction_del",[],Pseudo Trigger),("RI_FKey_noaction_upd",[],Pseudo Trigger),("RI_FKey_restrict_del",[],Pseudo Trigger),("RI_FKey_restrict_upd",[],Pseudo Trigger),("RI_FKey_setdefault_del",[],Pseudo Trigger),("RI_FKey_setdefault_upd",[],Pseudo Trigger),("RI_FKey_setnull_del",[],Pseudo Trigger),("RI_FKey_setnull_upd",[],Pseudo Trigger),("abbrev",[ScalarType "cidr"],ScalarType "text"),("abbrev",[ScalarType "inet"],ScalarType "text"),("abs",[ScalarType "int8"],ScalarType "int8"),("abs",[ScalarType "int2"],ScalarType "int2"),("abs",[ScalarType "int4"],ScalarType "int4"),("abs",[ScalarType "float4"],ScalarType "float4"),("abs",[ScalarType "float8"],ScalarType "float8"),("abs",[ScalarType "numeric"],ScalarType "numeric"),("abstime",[ScalarType "timestamp"],ScalarType "abstime"),("abstime",[ScalarType "timestamptz"],ScalarType "abstime"),("abstimeeq",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimege",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimegt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimein",[Pseudo Cstring],ScalarType "abstime"),("abstimele",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimelt",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimene",[ScalarType "abstime",ScalarType "abstime"],ScalarType "bool"),("abstimeout",[ScalarType "abstime"],Pseudo Cstring),("abstimerecv",[Pseudo Internal],ScalarType "abstime"),("abstimesend",[ScalarType "abstime"],ScalarType "bytea"),("aclcontains",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ScalarType "bool"),("aclinsert",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("aclitemeq",[ScalarType "aclitem",ScalarType "aclitem"],ScalarType "bool"),("aclitemin",[Pseudo Cstring],ScalarType "aclitem"),("aclitemout",[ScalarType "aclitem"],Pseudo Cstring),("aclremove",[ArrayType (ScalarType "aclitem"),ScalarType "aclitem"],ArrayType (ScalarType "aclitem")),("acos",[ScalarType "float8"],ScalarType "float8"),("age",[ScalarType "xid"],ScalarType "int4"),("age",[ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz"],ScalarType "interval"),("age",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("age",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("any_in",[Pseudo Cstring],Pseudo Any),("any_out",[Pseudo Any],Pseudo Cstring),("anyarray_in",[Pseudo Cstring],Pseudo AnyArray),("anyarray_out",[Pseudo AnyArray],Pseudo Cstring),("anyarray_recv",[Pseudo Internal],Pseudo AnyArray),("anyarray_send",[Pseudo AnyArray],ScalarType "bytea"),("anyelement_in",[Pseudo Cstring],Pseudo AnyElement),("anyelement_out",[Pseudo AnyElement],Pseudo Cstring),("anyenum_in",[Pseudo Cstring],Pseudo AnyEnum),("anyenum_out",[Pseudo AnyEnum],Pseudo Cstring),("anynonarray_in",[Pseudo Cstring],Pseudo AnyNonArray),("anynonarray_out",[Pseudo AnyNonArray],Pseudo Cstring),("anytextcat",[Pseudo AnyNonArray,ScalarType "text"],ScalarType "text"),("area",[ScalarType "path"],ScalarType "float8"),("area",[ScalarType "box"],ScalarType "float8"),("area",[ScalarType "circle"],ScalarType "float8"),("areajoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("areasel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("array_agg_finalfn",[Pseudo Internal],Pseudo AnyArray),("array_agg_transfn",[Pseudo Internal,Pseudo AnyElement],Pseudo Internal),("array_append",[Pseudo AnyArray,Pseudo AnyElement],Pseudo AnyArray),("array_cat",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_dims",[Pseudo AnyArray],ScalarType "text"),("array_eq",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_fill",[Pseudo AnyElement,ArrayType (ScalarType "int4"),ArrayType (ScalarType "int4")],Pseudo AnyArray),("array_ge",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_gt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_larger",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_le",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_length",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lower",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("array_lt",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_ndims",[Pseudo AnyArray],ScalarType "int4"),("array_ne",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("array_out",[Pseudo AnyArray],Pseudo Cstring),("array_prepend",[Pseudo AnyElement,Pseudo AnyArray],Pseudo AnyArray),("array_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo AnyArray),("array_send",[Pseudo AnyArray],ScalarType "bytea"),("array_smaller",[Pseudo AnyArray,Pseudo AnyArray],Pseudo AnyArray),("array_to_string",[Pseudo AnyArray,ScalarType "text"],ScalarType "text"),("array_upper",[Pseudo AnyArray,ScalarType "int4"],ScalarType "int4"),("arraycontained",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arraycontains",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("arrayoverlap",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "bool"),("ascii",[ScalarType "text"],ScalarType "int4"),("ascii_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("ascii_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("asin",[ScalarType "float8"],ScalarType "float8"),("atan",[ScalarType "float8"],ScalarType "float8"),("atan2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("big5_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("big5_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("bit",[ScalarType "int8",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("bit",[ScalarType "bit",ScalarType "int4",ScalarType "bool"],ScalarType "bit"),("bit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_length",[ScalarType "bytea"],ScalarType "int4"),("bit_length",[ScalarType "text"],ScalarType "int4"),("bit_length",[ScalarType "bit"],ScalarType "int4"),("bit_out",[ScalarType "bit"],Pseudo Cstring),("bit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bit"),("bit_send",[ScalarType "bit"],ScalarType "bytea"),("bitand",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitcat",[ScalarType "varbit",ScalarType "varbit"],ScalarType "varbit"),("bitcmp",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("biteq",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitge",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitgt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitle",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitlt",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitne",[ScalarType "bit",ScalarType "bit"],ScalarType "bool"),("bitnot",[ScalarType "bit"],ScalarType "bit"),("bitor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bitshiftleft",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bitshiftright",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("bittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bittypmodout",[ScalarType "int4"],Pseudo Cstring),("bitxor",[ScalarType "bit",ScalarType "bit"],ScalarType "bit"),("bool",[ScalarType "int4"],ScalarType "bool"),("booland_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("booleq",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolge",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolgt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolin",[Pseudo Cstring],ScalarType "bool"),("boolle",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boollt",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolne",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolor_statefunc",[ScalarType "bool",ScalarType "bool"],ScalarType "bool"),("boolout",[ScalarType "bool"],Pseudo Cstring),("boolrecv",[Pseudo Internal],ScalarType "bool"),("boolsend",[ScalarType "bool"],ScalarType "bytea"),("box",[ScalarType "polygon"],ScalarType "box"),("box",[ScalarType "circle"],ScalarType "box"),("box",[ScalarType "point",ScalarType "point"],ScalarType "box"),("box_above",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_above_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_add",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_below",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_below_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_center",[ScalarType "box"],ScalarType "point"),("box_contain",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_contained",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_distance",[ScalarType "box",ScalarType "box"],ScalarType "float8"),("box_div",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_eq",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_ge",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_gt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_in",[Pseudo Cstring],ScalarType "box"),("box_intersect",[ScalarType "box",ScalarType "box"],ScalarType "box"),("box_le",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_left",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_lt",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_mul",[ScalarType "box",ScalarType "point"],ScalarType "box"),("box_out",[ScalarType "box"],Pseudo Cstring),("box_overabove",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overbelow",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overlap",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overleft",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_overright",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_recv",[Pseudo Internal],ScalarType "box"),("box_right",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_same",[ScalarType "box",ScalarType "box"],ScalarType "bool"),("box_send",[ScalarType "box"],ScalarType "bytea"),("box_sub",[ScalarType "box",ScalarType "point"],ScalarType "box"),("bpchar",[ScalarType "char"],ScalarType "bpchar"),("bpchar",[ScalarType "name"],ScalarType "bpchar"),("bpchar",[ScalarType "bpchar",ScalarType "int4",ScalarType "bool"],ScalarType "bpchar"),("bpchar_larger",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpchar_pattern_ge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_gt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_le",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_pattern_lt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchar_smaller",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bpchar"),("bpcharcmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("bpchareq",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharge",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchargt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpchariclike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharicregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharle",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharlt",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharne",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "bool"),("bpcharnlike",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharout",[ScalarType "bpchar"],Pseudo Cstring),("bpcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "bpchar"),("bpcharregexeq",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharregexne",[ScalarType "bpchar",ScalarType "text"],ScalarType "bool"),("bpcharsend",[ScalarType "bpchar"],ScalarType "bytea"),("bpchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("bpchartypmodout",[ScalarType "int4"],Pseudo Cstring),("broadcast",[ScalarType "inet"],ScalarType "inet"),("btabstimecmp",[ScalarType "abstime",ScalarType "abstime"],ScalarType "int4"),("btarraycmp",[Pseudo AnyArray,Pseudo AnyArray],ScalarType "int4"),("btbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btboolcmp",[ScalarType "bool",ScalarType "bool"],ScalarType "int4"),("btbpchar_pattern_cmp",[ScalarType "bpchar",ScalarType "bpchar"],ScalarType "int4"),("btbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("btcharcmp",[ScalarType "char",ScalarType "char"],ScalarType "int4"),("btcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("btendscan",[Pseudo Internal],Pseudo Void),("btfloat48cmp",[ScalarType "float4",ScalarType "float8"],ScalarType "int4"),("btfloat4cmp",[ScalarType "float4",ScalarType "float4"],ScalarType "int4"),("btfloat84cmp",[ScalarType "float8",ScalarType "float4"],ScalarType "int4"),("btfloat8cmp",[ScalarType "float8",ScalarType "float8"],ScalarType "int4"),("btgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("btgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("btint24cmp",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("btint28cmp",[ScalarType "int2",ScalarType "int8"],ScalarType "int4"),("btint2cmp",[ScalarType "int2",ScalarType "int2"],ScalarType "int4"),("btint42cmp",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("btint48cmp",[ScalarType "int4",ScalarType "int8"],ScalarType "int4"),("btint4cmp",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("btint82cmp",[ScalarType "int8",ScalarType "int2"],ScalarType "int4"),("btint84cmp",[ScalarType "int8",ScalarType "int4"],ScalarType "int4"),("btint8cmp",[ScalarType "int8",ScalarType "int8"],ScalarType "int4"),("btmarkpos",[Pseudo Internal],Pseudo Void),("btnamecmp",[ScalarType "name",ScalarType "name"],ScalarType "int4"),("btoidcmp",[ScalarType "oid",ScalarType "oid"],ScalarType "int4"),("btoidvectorcmp",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "int4"),("btoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("btrecordcmp",[Pseudo Record,Pseudo Record],ScalarType "int4"),("btreltimecmp",[ScalarType "reltime",ScalarType "reltime"],ScalarType "int4"),("btrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("btrestrpos",[Pseudo Internal],Pseudo Void),("btrim",[ScalarType "text"],ScalarType "text"),("btrim",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("btrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("bttext_pattern_cmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttextcmp",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("bttidcmp",[ScalarType "tid",ScalarType "tid"],ScalarType "int4"),("bttintervalcmp",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "int4"),("btvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("byteacat",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("byteacmp",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("byteaeq",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteage",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteagt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteain",[Pseudo Cstring],ScalarType "bytea"),("byteale",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("bytealt",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteane",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteanlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("byteaout",[ScalarType "bytea"],Pseudo Cstring),("bytearecv",[Pseudo Internal],ScalarType "bytea"),("byteasend",[ScalarType "bytea"],ScalarType "bytea"),("cash_cmp",[ScalarType "money",ScalarType "money"],ScalarType "int4"),("cash_div_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_div_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_div_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_div_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_eq",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_ge",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_gt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_in",[Pseudo Cstring],ScalarType "money"),("cash_le",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_lt",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_mi",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_mul_flt4",[ScalarType "money",ScalarType "float4"],ScalarType "money"),("cash_mul_flt8",[ScalarType "money",ScalarType "float8"],ScalarType "money"),("cash_mul_int2",[ScalarType "money",ScalarType "int2"],ScalarType "money"),("cash_mul_int4",[ScalarType "money",ScalarType "int4"],ScalarType "money"),("cash_ne",[ScalarType "money",ScalarType "money"],ScalarType "bool"),("cash_out",[ScalarType "money"],Pseudo Cstring),("cash_pl",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cash_recv",[Pseudo Internal],ScalarType "money"),("cash_send",[ScalarType "money"],ScalarType "bytea"),("cash_words",[ScalarType "money"],ScalarType "text"),("cashlarger",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cashsmaller",[ScalarType "money",ScalarType "money"],ScalarType "money"),("cbrt",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "float8"],ScalarType "float8"),("ceil",[ScalarType "numeric"],ScalarType "numeric"),("ceiling",[ScalarType "float8"],ScalarType "float8"),("ceiling",[ScalarType "numeric"],ScalarType "numeric"),("center",[ScalarType "box"],ScalarType "point"),("center",[ScalarType "circle"],ScalarType "point"),("char",[ScalarType "int4"],ScalarType "char"),("char",[ScalarType "text"],ScalarType "char"),("char_length",[ScalarType "text"],ScalarType "int4"),("char_length",[ScalarType "bpchar"],ScalarType "int4"),("character_length",[ScalarType "text"],ScalarType "int4"),("character_length",[ScalarType "bpchar"],ScalarType "int4"),("chareq",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charge",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("chargt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charin",[Pseudo Cstring],ScalarType "char"),("charle",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charlt",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charne",[ScalarType "char",ScalarType "char"],ScalarType "bool"),("charout",[ScalarType "char"],Pseudo Cstring),("charrecv",[Pseudo Internal],ScalarType "char"),("charsend",[ScalarType "char"],ScalarType "bytea"),("chr",[ScalarType "int4"],ScalarType "text"),("cideq",[ScalarType "cid",ScalarType "cid"],ScalarType "bool"),("cidin",[Pseudo Cstring],ScalarType "cid"),("cidout",[ScalarType "cid"],Pseudo Cstring),("cidr",[ScalarType "inet"],ScalarType "cidr"),("cidr_in",[Pseudo Cstring],ScalarType "cidr"),("cidr_out",[ScalarType "cidr"],Pseudo Cstring),("cidr_recv",[Pseudo Internal],ScalarType "cidr"),("cidr_send",[ScalarType "cidr"],ScalarType "bytea"),("cidrecv",[Pseudo Internal],ScalarType "cid"),("cidsend",[ScalarType "cid"],ScalarType "bytea"),("circle",[ScalarType "box"],ScalarType "circle"),("circle",[ScalarType "polygon"],ScalarType "circle"),("circle",[ScalarType "point",ScalarType "float8"],ScalarType "circle"),("circle_above",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_add_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_below",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_center",[ScalarType "circle"],ScalarType "point"),("circle_contain",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_contain_pt",[ScalarType "circle",ScalarType "point"],ScalarType "bool"),("circle_contained",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_distance",[ScalarType "circle",ScalarType "circle"],ScalarType "float8"),("circle_div_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_eq",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_ge",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_gt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_in",[Pseudo Cstring],ScalarType "circle"),("circle_le",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_left",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_lt",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_mul_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("circle_ne",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_out",[ScalarType "circle"],Pseudo Cstring),("circle_overabove",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overbelow",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overlap",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overleft",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_overright",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_recv",[Pseudo Internal],ScalarType "circle"),("circle_right",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_same",[ScalarType "circle",ScalarType "circle"],ScalarType "bool"),("circle_send",[ScalarType "circle"],ScalarType "bytea"),("circle_sub_pt",[ScalarType "circle",ScalarType "point"],ScalarType "circle"),("clock_timestamp",[],ScalarType "timestamptz"),("close_lb",[ScalarType "line",ScalarType "box"],ScalarType "point"),("close_ls",[ScalarType "line",ScalarType "lseg"],ScalarType "point"),("close_lseg",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("close_pb",[ScalarType "point",ScalarType "box"],ScalarType "point"),("close_pl",[ScalarType "point",ScalarType "line"],ScalarType "point"),("close_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "point"),("close_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "point"),("close_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "point"),("col_description",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("contjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("contsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("convert",[ScalarType "bytea",ScalarType "name",ScalarType "name"],ScalarType "bytea"),("convert_from",[ScalarType "bytea",ScalarType "name"],ScalarType "text"),("convert_to",[ScalarType "text",ScalarType "name"],ScalarType "bytea"),("cos",[ScalarType "float8"],ScalarType "float8"),("cot",[ScalarType "float8"],ScalarType "float8"),("cstring_in",[Pseudo Cstring],Pseudo Cstring),("cstring_out",[Pseudo Cstring],Pseudo Cstring),("cstring_recv",[Pseudo Internal],Pseudo Cstring),("cstring_send",[Pseudo Cstring],ScalarType "bytea"),("current_database",[],ScalarType "name"),("current_query",[],ScalarType "text"),("current_schema",[],ScalarType "name"),("current_schemas",[ScalarType "bool"],ArrayType (ScalarType "name")),("current_setting",[ScalarType "text"],ScalarType "text"),("current_user",[],ScalarType "name"),("currtid",[ScalarType "oid",ScalarType "tid"],ScalarType "tid"),("currtid2",[ScalarType "text",ScalarType "tid"],ScalarType "tid"),("currval",[ScalarType "regclass"],ScalarType "int8"),("cursor_to_xml",[ScalarType "refcursor",ScalarType "int4",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("cursor_to_xmlschema",[ScalarType "refcursor",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xml_and_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("database_to_xmlschema",[ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("date",[ScalarType "abstime"],ScalarType "date"),("date",[ScalarType "timestamp"],ScalarType "date"),("date",[ScalarType "timestamptz"],ScalarType "date"),("date_cmp",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_cmp_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "int4"),("date_cmp_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "int4"),("date_eq",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_eq_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_eq_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_ge",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ge_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ge_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_gt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_gt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_gt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_in",[Pseudo Cstring],ScalarType "date"),("date_larger",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_le",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_le_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_le_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_lt",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_lt_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_lt_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_mi",[ScalarType "date",ScalarType "date"],ScalarType "int4"),("date_mi_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_mii",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_ne",[ScalarType "date",ScalarType "date"],ScalarType "bool"),("date_ne_timestamp",[ScalarType "date",ScalarType "timestamp"],ScalarType "bool"),("date_ne_timestamptz",[ScalarType "date",ScalarType "timestamptz"],ScalarType "bool"),("date_out",[ScalarType "date"],Pseudo Cstring),("date_part",[ScalarType "text",ScalarType "abstime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "reltime"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "date"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "time"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamp"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timestamptz"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "interval"],ScalarType "float8"),("date_part",[ScalarType "text",ScalarType "timetz"],ScalarType "float8"),("date_pl_interval",[ScalarType "date",ScalarType "interval"],ScalarType "timestamp"),("date_pli",[ScalarType "date",ScalarType "int4"],ScalarType "date"),("date_recv",[Pseudo Internal],ScalarType "date"),("date_send",[ScalarType "date"],ScalarType "bytea"),("date_smaller",[ScalarType "date",ScalarType "date"],ScalarType "date"),("date_trunc",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamp"),("date_trunc",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamptz"),("date_trunc",[ScalarType "text",ScalarType "interval"],ScalarType "interval"),("datetime_pl",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("datetimetz_pl",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("dcbrt",[ScalarType "float8"],ScalarType "float8"),("decode",[ScalarType "text",ScalarType "text"],ScalarType "bytea"),("degrees",[ScalarType "float8"],ScalarType "float8"),("dexp",[ScalarType "float8"],ScalarType "float8"),("diagonal",[ScalarType "box"],ScalarType "lseg"),("diameter",[ScalarType "circle"],ScalarType "float8"),("dispell_init",[Pseudo Internal],Pseudo Internal),("dispell_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dist_cpoly",[ScalarType "circle",ScalarType "polygon"],ScalarType "float8"),("dist_lb",[ScalarType "line",ScalarType "box"],ScalarType "float8"),("dist_pb",[ScalarType "point",ScalarType "box"],ScalarType "float8"),("dist_pc",[ScalarType "point",ScalarType "circle"],ScalarType "float8"),("dist_pl",[ScalarType "point",ScalarType "line"],ScalarType "float8"),("dist_ppath",[ScalarType "point",ScalarType "path"],ScalarType "float8"),("dist_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "float8"),("dist_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "float8"),("dist_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "float8"),("div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("dlog1",[ScalarType "float8"],ScalarType "float8"),("dlog10",[ScalarType "float8"],ScalarType "float8"),("domain_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Any),("domain_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Any),("dpow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("dround",[ScalarType "float8"],ScalarType "float8"),("dsimple_init",[Pseudo Internal],Pseudo Internal),("dsimple_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsnowball_init",[Pseudo Internal],Pseudo Internal),("dsnowball_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dsqrt",[ScalarType "float8"],ScalarType "float8"),("dsynonym_init",[Pseudo Internal],Pseudo Internal),("dsynonym_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("dtrunc",[ScalarType "float8"],ScalarType "float8"),("encode",[ScalarType "bytea",ScalarType "text"],ScalarType "text"),("enum_cmp",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "int4"),("enum_eq",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_first",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_ge",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_gt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_in",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_larger",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("enum_last",[Pseudo AnyEnum],Pseudo AnyEnum),("enum_le",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_lt",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_ne",[Pseudo AnyEnum,Pseudo AnyEnum],ScalarType "bool"),("enum_out",[Pseudo AnyEnum],Pseudo Cstring),("enum_range",[Pseudo AnyEnum],Pseudo AnyArray),("enum_range",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyArray),("enum_recv",[Pseudo Cstring,ScalarType "oid"],Pseudo AnyEnum),("enum_send",[Pseudo AnyEnum],ScalarType "bytea"),("enum_smaller",[Pseudo AnyEnum,Pseudo AnyEnum],Pseudo AnyEnum),("eqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("eqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("euc_cn_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_cn_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_jp_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_kr_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("euc_tw_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("exp",[ScalarType "float8"],ScalarType "float8"),("exp",[ScalarType "numeric"],ScalarType "numeric"),("factorial",[ScalarType "int8"],ScalarType "numeric"),("family",[ScalarType "inet"],ScalarType "int4"),("flatfile_update_trigger",[],Pseudo Trigger),("float4",[ScalarType "int8"],ScalarType "float4"),("float4",[ScalarType "int2"],ScalarType "float4"),("float4",[ScalarType "int4"],ScalarType "float4"),("float4",[ScalarType "float8"],ScalarType "float4"),("float4",[ScalarType "numeric"],ScalarType "float4"),("float48div",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48eq",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48ge",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48gt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48le",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48lt",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48mi",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48mul",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float48ne",[ScalarType "float4",ScalarType "float8"],ScalarType "bool"),("float48pl",[ScalarType "float4",ScalarType "float8"],ScalarType "float8"),("float4_accum",[ArrayType (ScalarType "float8"),ScalarType "float4"],ArrayType (ScalarType "float8")),("float4abs",[ScalarType "float4"],ScalarType "float4"),("float4div",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4eq",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4ge",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4gt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4in",[Pseudo Cstring],ScalarType "float4"),("float4larger",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4le",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4lt",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4mi",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4mul",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4ne",[ScalarType "float4",ScalarType "float4"],ScalarType "bool"),("float4out",[ScalarType "float4"],Pseudo Cstring),("float4pl",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4recv",[Pseudo Internal],ScalarType "float4"),("float4send",[ScalarType "float4"],ScalarType "bytea"),("float4smaller",[ScalarType "float4",ScalarType "float4"],ScalarType "float4"),("float4um",[ScalarType "float4"],ScalarType "float4"),("float4up",[ScalarType "float4"],ScalarType "float4"),("float8",[ScalarType "int8"],ScalarType "float8"),("float8",[ScalarType "int2"],ScalarType "float8"),("float8",[ScalarType "int4"],ScalarType "float8"),("float8",[ScalarType "float4"],ScalarType "float8"),("float8",[ScalarType "numeric"],ScalarType "float8"),("float84div",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84eq",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84ge",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84gt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84le",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84lt",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84mi",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84mul",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float84ne",[ScalarType "float8",ScalarType "float4"],ScalarType "bool"),("float84pl",[ScalarType "float8",ScalarType "float4"],ScalarType "float8"),("float8_accum",[ArrayType (ScalarType "float8"),ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_avg",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_corr",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_covar_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_accum",[ArrayType (ScalarType "float8"),ScalarType "float8",ScalarType "float8"],ArrayType (ScalarType "float8")),("float8_regr_avgx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_avgy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_intercept",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_r2",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_slope",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxx",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_sxy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_regr_syy",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_stddev_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_pop",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8_var_samp",[ArrayType (ScalarType "float8")],ScalarType "float8"),("float8abs",[ScalarType "float8"],ScalarType "float8"),("float8div",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8eq",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8ge",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8gt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8in",[Pseudo Cstring],ScalarType "float8"),("float8larger",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8le",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8lt",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8mi",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8mul",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8ne",[ScalarType "float8",ScalarType "float8"],ScalarType "bool"),("float8out",[ScalarType "float8"],Pseudo Cstring),("float8pl",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8recv",[Pseudo Internal],ScalarType "float8"),("float8send",[ScalarType "float8"],ScalarType "bytea"),("float8smaller",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("float8um",[ScalarType "float8"],ScalarType "float8"),("float8up",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "float8"],ScalarType "float8"),("floor",[ScalarType "numeric"],ScalarType "numeric"),("flt4_mul_cash",[ScalarType "float4",ScalarType "money"],ScalarType "money"),("flt8_mul_cash",[ScalarType "float8",ScalarType "money"],ScalarType "money"),("fmgr_c_validator",[ScalarType "oid"],Pseudo Void),("fmgr_internal_validator",[ScalarType "oid"],Pseudo Void),("fmgr_sql_validator",[ScalarType "oid"],Pseudo Void),("format_type",[ScalarType "oid",ScalarType "int4"],ScalarType "text"),("gb18030_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("gbk_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("generate_series",[ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "int8",ScalarType "int8",ScalarType "int8"],SetOfType (ScalarType "int8")),("generate_series",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_series",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],SetOfType (ScalarType "timestamp")),("generate_series",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],SetOfType (ScalarType "timestamptz")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4"],SetOfType (ScalarType "int4")),("generate_subscripts",[Pseudo AnyArray,ScalarType "int4",ScalarType "bool"],SetOfType (ScalarType "int4")),("get_bit",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_byte",[ScalarType "bytea",ScalarType "int4"],ScalarType "int4"),("get_current_ts_config",[],ScalarType "regconfig"),("getdatabaseencoding",[],ScalarType "name"),("getpgusername",[],ScalarType "name"),("gin_cmp_prefix",[ScalarType "text",ScalarType "text",ScalarType "int2",Pseudo Internal],ScalarType "int4"),("gin_cmp_tslexeme",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("gin_extract_tsquery",[ScalarType "tsquery",Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("gin_extract_tsvector",[ScalarType "tsvector",Pseudo Internal],Pseudo Internal),("gin_tsquery_consistent",[Pseudo Internal,ScalarType "int2",ScalarType "tsquery",ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayconsistent",[Pseudo Internal,ScalarType "int2",Pseudo AnyArray,ScalarType "int4",Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginarrayextract",[Pseudo AnyArray,Pseudo Internal],Pseudo Internal),("ginbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gincostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("ginendscan",[Pseudo Internal],Pseudo Void),("gingetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gininsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("ginmarkpos",[Pseudo Internal],Pseudo Void),("ginoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("ginqueryarrayextract",[Pseudo AnyArray,Pseudo Internal,ScalarType "int2",Pseudo Internal,Pseudo Internal],Pseudo Internal),("ginrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("ginrestrpos",[Pseudo Internal],Pseudo Void),("ginvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_compress",[Pseudo Internal],Pseudo Internal),("gist_box_consistent",[Pseudo Internal,ScalarType "box",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_box_decompress",[Pseudo Internal],Pseudo Internal),("gist_box_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gist_box_same",[ScalarType "box",ScalarType "box",Pseudo Internal],Pseudo Internal),("gist_box_union",[Pseudo Internal,Pseudo Internal],ScalarType "box"),("gist_circle_compress",[Pseudo Internal],Pseudo Internal),("gist_circle_consistent",[Pseudo Internal,ScalarType "circle",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gist_poly_compress",[Pseudo Internal],Pseudo Internal),("gist_poly_consistent",[Pseudo Internal,ScalarType "polygon",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gistbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gistcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("gistendscan",[Pseudo Internal],Pseudo Void),("gistgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("gistgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("gistmarkpos",[Pseudo Internal],Pseudo Void),("gistoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("gistrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("gistrestrpos",[Pseudo Internal],Pseudo Void),("gistvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_compress",[Pseudo Internal],Pseudo Internal),("gtsquery_consistent",[Pseudo Internal,Pseudo Internal,ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsquery_decompress",[Pseudo Internal],Pseudo Internal),("gtsquery_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsquery_same",[ScalarType "int8",ScalarType "int8",Pseudo Internal],Pseudo Internal),("gtsquery_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_compress",[Pseudo Internal],Pseudo Internal),("gtsvector_consistent",[Pseudo Internal,ScalarType "gtsvector",ScalarType "int4",ScalarType "oid",Pseudo Internal],ScalarType "bool"),("gtsvector_decompress",[Pseudo Internal],Pseudo Internal),("gtsvector_penalty",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_picksplit",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvector_same",[ScalarType "gtsvector",ScalarType "gtsvector",Pseudo Internal],Pseudo Internal),("gtsvector_union",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("gtsvectorin",[Pseudo Cstring],ScalarType "gtsvector"),("gtsvectorout",[ScalarType "gtsvector"],Pseudo Cstring),("has_any_column_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_any_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "int2",ScalarType "text"],ScalarType "bool"),("has_column_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_database_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_foreign_data_wrapper_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_function_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_language_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_schema_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_server_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_table_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "text",ScalarType "text"],ScalarType "bool"),("has_tablespace_privilege",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("hash_aclitem",[ScalarType "aclitem"],ScalarType "int4"),("hash_numeric",[ScalarType "numeric"],ScalarType "int4"),("hashbeginscan",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbpchar",[ScalarType "bpchar"],ScalarType "int4"),("hashbuild",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashbulkdelete",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashchar",[ScalarType "char"],ScalarType "int4"),("hashcostestimate",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Void),("hashendscan",[Pseudo Internal],Pseudo Void),("hashenum",[Pseudo AnyEnum],ScalarType "int4"),("hashfloat4",[ScalarType "float4"],ScalarType "int4"),("hashfloat8",[ScalarType "float8"],ScalarType "int4"),("hashgetbitmap",[Pseudo Internal,Pseudo Internal],ScalarType "int8"),("hashgettuple",[Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashinet",[ScalarType "inet"],ScalarType "int4"),("hashinsert",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],ScalarType "bool"),("hashint2",[ScalarType "int2"],ScalarType "int4"),("hashint2vector",[ScalarType "int2vector"],ScalarType "int4"),("hashint4",[ScalarType "int4"],ScalarType "int4"),("hashint8",[ScalarType "int8"],ScalarType "int4"),("hashmacaddr",[ScalarType "macaddr"],ScalarType "int4"),("hashmarkpos",[Pseudo Internal],Pseudo Void),("hashname",[ScalarType "name"],ScalarType "int4"),("hashoid",[ScalarType "oid"],ScalarType "int4"),("hashoidvector",[ScalarType "oidvector"],ScalarType "int4"),("hashoptions",[ArrayType (ScalarType "text"),ScalarType "bool"],ScalarType "bytea"),("hashrescan",[Pseudo Internal,Pseudo Internal],Pseudo Void),("hashrestrpos",[Pseudo Internal],Pseudo Void),("hashtext",[ScalarType "text"],ScalarType "int4"),("hashvacuumcleanup",[Pseudo Internal,Pseudo Internal],Pseudo Internal),("hashvarlena",[Pseudo Internal],ScalarType "int4"),("height",[ScalarType "box"],ScalarType "float8"),("host",[ScalarType "inet"],ScalarType "text"),("hostmask",[ScalarType "inet"],ScalarType "inet"),("iclikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("iclikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icnlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icnlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("icregexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("icregexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("inet_client_addr",[],ScalarType "inet"),("inet_client_port",[],ScalarType "int4"),("inet_in",[Pseudo Cstring],ScalarType "inet"),("inet_out",[ScalarType "inet"],Pseudo Cstring),("inet_recv",[Pseudo Internal],ScalarType "inet"),("inet_send",[ScalarType "inet"],ScalarType "bytea"),("inet_server_addr",[],ScalarType "inet"),("inet_server_port",[],ScalarType "int4"),("inetand",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetmi",[ScalarType "inet",ScalarType "inet"],ScalarType "int8"),("inetmi_int8",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("inetnot",[ScalarType "inet"],ScalarType "inet"),("inetor",[ScalarType "inet",ScalarType "inet"],ScalarType "inet"),("inetpl",[ScalarType "inet",ScalarType "int8"],ScalarType "inet"),("initcap",[ScalarType "text"],ScalarType "text"),("int2",[ScalarType "int8"],ScalarType "int2"),("int2",[ScalarType "int4"],ScalarType "int2"),("int2",[ScalarType "float4"],ScalarType "int2"),("int2",[ScalarType "float8"],ScalarType "int2"),("int2",[ScalarType "numeric"],ScalarType "int2"),("int24div",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24eq",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24ge",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24gt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24le",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24lt",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24mi",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24mul",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int24ne",[ScalarType "int2",ScalarType "int4"],ScalarType "bool"),("int24pl",[ScalarType "int2",ScalarType "int4"],ScalarType "int4"),("int28div",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28eq",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28ge",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28gt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28le",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28lt",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28mi",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28mul",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int28ne",[ScalarType "int2",ScalarType "int8"],ScalarType "bool"),("int28pl",[ScalarType "int2",ScalarType "int8"],ScalarType "int8"),("int2_accum",[ArrayType (ScalarType "numeric"),ScalarType "int2"],ArrayType (ScalarType "numeric")),("int2_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int2"],ArrayType (ScalarType "int8")),("int2_mul_cash",[ScalarType "int2",ScalarType "money"],ScalarType "money"),("int2_sum",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int2abs",[ScalarType "int2"],ScalarType "int2"),("int2and",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2div",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2eq",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2ge",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2gt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2in",[Pseudo Cstring],ScalarType "int2"),("int2larger",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2le",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2lt",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2mi",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2mul",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2ne",[ScalarType "int2",ScalarType "int2"],ScalarType "bool"),("int2not",[ScalarType "int2"],ScalarType "int2"),("int2or",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2out",[ScalarType "int2"],Pseudo Cstring),("int2pl",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2recv",[Pseudo Internal],ScalarType "int2"),("int2send",[ScalarType "int2"],ScalarType "bytea"),("int2shl",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2shr",[ScalarType "int2",ScalarType "int4"],ScalarType "int2"),("int2smaller",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int2um",[ScalarType "int2"],ScalarType "int2"),("int2up",[ScalarType "int2"],ScalarType "int2"),("int2vectoreq",[ScalarType "int2vector",ScalarType "int2vector"],ScalarType "bool"),("int2vectorin",[Pseudo Cstring],ScalarType "int2vector"),("int2vectorout",[ScalarType "int2vector"],Pseudo Cstring),("int2vectorrecv",[Pseudo Internal],ScalarType "int2vector"),("int2vectorsend",[ScalarType "int2vector"],ScalarType "bytea"),("int2xor",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("int4",[ScalarType "bool"],ScalarType "int4"),("int4",[ScalarType "char"],ScalarType "int4"),("int4",[ScalarType "int8"],ScalarType "int4"),("int4",[ScalarType "int2"],ScalarType "int4"),("int4",[ScalarType "float4"],ScalarType "int4"),("int4",[ScalarType "float8"],ScalarType "int4"),("int4",[ScalarType "bit"],ScalarType "int4"),("int4",[ScalarType "numeric"],ScalarType "int4"),("int42div",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42eq",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42ge",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42gt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42le",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42lt",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42mi",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42mul",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int42ne",[ScalarType "int4",ScalarType "int2"],ScalarType "bool"),("int42pl",[ScalarType "int4",ScalarType "int2"],ScalarType "int4"),("int48div",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48eq",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48ge",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48gt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48le",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48lt",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48mi",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48mul",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int48ne",[ScalarType "int4",ScalarType "int8"],ScalarType "bool"),("int48pl",[ScalarType "int4",ScalarType "int8"],ScalarType "int8"),("int4_accum",[ArrayType (ScalarType "numeric"),ScalarType "int4"],ArrayType (ScalarType "numeric")),("int4_avg_accum",[ArrayType (ScalarType "int8"),ScalarType "int4"],ArrayType (ScalarType "int8")),("int4_mul_cash",[ScalarType "int4",ScalarType "money"],ScalarType "money"),("int4_sum",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int4abs",[ScalarType "int4"],ScalarType "int4"),("int4and",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4div",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4eq",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4ge",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4gt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4in",[Pseudo Cstring],ScalarType "int4"),("int4inc",[ScalarType "int4"],ScalarType "int4"),("int4larger",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4le",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4lt",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4mi",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4mul",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4ne",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("int4not",[ScalarType "int4"],ScalarType "int4"),("int4or",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4out",[ScalarType "int4"],Pseudo Cstring),("int4pl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4recv",[Pseudo Internal],ScalarType "int4"),("int4send",[ScalarType "int4"],ScalarType "bytea"),("int4shl",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4shr",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4smaller",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int4um",[ScalarType "int4"],ScalarType "int4"),("int4up",[ScalarType "int4"],ScalarType "int4"),("int4xor",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("int8",[ScalarType "int2"],ScalarType "int8"),("int8",[ScalarType "int4"],ScalarType "int8"),("int8",[ScalarType "oid"],ScalarType "int8"),("int8",[ScalarType "float4"],ScalarType "int8"),("int8",[ScalarType "float8"],ScalarType "int8"),("int8",[ScalarType "bit"],ScalarType "int8"),("int8",[ScalarType "numeric"],ScalarType "int8"),("int82div",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82eq",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82ge",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82gt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82le",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82lt",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82mi",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82mul",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int82ne",[ScalarType "int8",ScalarType "int2"],ScalarType "bool"),("int82pl",[ScalarType "int8",ScalarType "int2"],ScalarType "int8"),("int84div",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84eq",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84ge",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84gt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84le",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84lt",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84mi",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84mul",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int84ne",[ScalarType "int8",ScalarType "int4"],ScalarType "bool"),("int84pl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_avg",[ArrayType (ScalarType "int8")],ScalarType "numeric"),("int8_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "int8"],ArrayType (ScalarType "numeric")),("int8_sum",[ScalarType "numeric",ScalarType "int8"],ScalarType "numeric"),("int8abs",[ScalarType "int8"],ScalarType "int8"),("int8and",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8div",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8eq",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8ge",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8gt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8in",[Pseudo Cstring],ScalarType "int8"),("int8inc",[ScalarType "int8"],ScalarType "int8"),("int8inc_any",[ScalarType "int8",Pseudo Any],ScalarType "int8"),("int8inc_float8_float8",[ScalarType "int8",ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("int8larger",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8le",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8lt",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8mi",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8mul",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8ne",[ScalarType "int8",ScalarType "int8"],ScalarType "bool"),("int8not",[ScalarType "int8"],ScalarType "int8"),("int8or",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8out",[ScalarType "int8"],Pseudo Cstring),("int8pl",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8pl_inet",[ScalarType "int8",ScalarType "inet"],ScalarType "inet"),("int8recv",[Pseudo Internal],ScalarType "int8"),("int8send",[ScalarType "int8"],ScalarType "bytea"),("int8shl",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8shr",[ScalarType "int8",ScalarType "int4"],ScalarType "int8"),("int8smaller",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("int8um",[ScalarType "int8"],ScalarType "int8"),("int8up",[ScalarType "int8"],ScalarType "int8"),("int8xor",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("integer_pl_date",[ScalarType "int4",ScalarType "date"],ScalarType "date"),("inter_lb",[ScalarType "line",ScalarType "box"],ScalarType "bool"),("inter_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("inter_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("internal_in",[Pseudo Cstring],Pseudo Internal),("internal_out",[Pseudo Internal],Pseudo Cstring),("interval",[ScalarType "reltime"],ScalarType "interval"),("interval",[ScalarType "time"],ScalarType "interval"),("interval",[ScalarType "interval",ScalarType "int4"],ScalarType "interval"),("interval_accum",[ArrayType (ScalarType "interval"),ScalarType "interval"],ArrayType (ScalarType "interval")),("interval_avg",[ArrayType (ScalarType "interval")],ScalarType "interval"),("interval_cmp",[ScalarType "interval",ScalarType "interval"],ScalarType "int4"),("interval_div",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_eq",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_ge",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_gt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_hash",[ScalarType "interval"],ScalarType "int4"),("interval_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_larger",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_le",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_lt",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_mi",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_mul",[ScalarType "interval",ScalarType "float8"],ScalarType "interval"),("interval_ne",[ScalarType "interval",ScalarType "interval"],ScalarType "bool"),("interval_out",[ScalarType "interval"],Pseudo Cstring),("interval_pl",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_pl_date",[ScalarType "interval",ScalarType "date"],ScalarType "timestamp"),("interval_pl_time",[ScalarType "interval",ScalarType "time"],ScalarType "time"),("interval_pl_timestamp",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamp"),("interval_pl_timestamptz",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamptz"),("interval_pl_timetz",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("interval_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "interval"),("interval_send",[ScalarType "interval"],ScalarType "bytea"),("interval_smaller",[ScalarType "interval",ScalarType "interval"],ScalarType "interval"),("interval_um",[ScalarType "interval"],ScalarType "interval"),("intervaltypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("intervaltypmodout",[ScalarType "int4"],Pseudo Cstring),("intinterval",[ScalarType "abstime",ScalarType "tinterval"],ScalarType "bool"),("isclosed",[ScalarType "path"],ScalarType "bool"),("isfinite",[ScalarType "abstime"],ScalarType "bool"),("isfinite",[ScalarType "date"],ScalarType "bool"),("isfinite",[ScalarType "timestamp"],ScalarType "bool"),("isfinite",[ScalarType "timestamptz"],ScalarType "bool"),("isfinite",[ScalarType "interval"],ScalarType "bool"),("ishorizontal",[ScalarType "lseg"],ScalarType "bool"),("ishorizontal",[ScalarType "line"],ScalarType "bool"),("ishorizontal",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("iso8859_1_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso8859_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("iso_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("isopen",[ScalarType "path"],ScalarType "bool"),("isparallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isparallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isperp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("isperp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "lseg"],ScalarType "bool"),("isvertical",[ScalarType "line"],ScalarType "bool"),("isvertical",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("johab_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("justify_days",[ScalarType "interval"],ScalarType "interval"),("justify_hours",[ScalarType "interval"],ScalarType "interval"),("justify_interval",[ScalarType "interval"],ScalarType "interval"),("koi8r_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8r_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("koi8u_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("language_handler_in",[Pseudo Cstring],Pseudo LanguageHandler),("language_handler_out",[Pseudo LanguageHandler],Pseudo Cstring),("lastval",[],ScalarType "int8"),("latin1_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin2_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin3_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("latin4_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("length",[ScalarType "bytea"],ScalarType "int4"),("length",[ScalarType "text"],ScalarType "int4"),("length",[ScalarType "lseg"],ScalarType "float8"),("length",[ScalarType "path"],ScalarType "float8"),("length",[ScalarType "bpchar"],ScalarType "int4"),("length",[ScalarType "bit"],ScalarType "int4"),("length",[ScalarType "tsvector"],ScalarType "int4"),("length",[ScalarType "bytea",ScalarType "name"],ScalarType "int4"),("like",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("like",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("like",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("like_escape",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bytea"),("like_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("likejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("likesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("line",[ScalarType "point",ScalarType "point"],ScalarType "line"),("line_distance",[ScalarType "line",ScalarType "line"],ScalarType "float8"),("line_eq",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_horizontal",[ScalarType "line"],ScalarType "bool"),("line_in",[Pseudo Cstring],ScalarType "line"),("line_interpt",[ScalarType "line",ScalarType "line"],ScalarType "point"),("line_intersect",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_out",[ScalarType "line"],Pseudo Cstring),("line_parallel",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_perp",[ScalarType "line",ScalarType "line"],ScalarType "bool"),("line_recv",[Pseudo Internal],ScalarType "line"),("line_send",[ScalarType "line"],ScalarType "bytea"),("line_vertical",[ScalarType "line"],ScalarType "bool"),("ln",[ScalarType "float8"],ScalarType "float8"),("ln",[ScalarType "numeric"],ScalarType "numeric"),("lo_close",[ScalarType "int4"],ScalarType "int4"),("lo_creat",[ScalarType "int4"],ScalarType "oid"),("lo_create",[ScalarType "oid"],ScalarType "oid"),("lo_export",[ScalarType "oid",ScalarType "text"],ScalarType "int4"),("lo_import",[ScalarType "text"],ScalarType "oid"),("lo_import",[ScalarType "text",ScalarType "oid"],ScalarType "oid"),("lo_lseek",[ScalarType "int4",ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_open",[ScalarType "oid",ScalarType "int4"],ScalarType "int4"),("lo_tell",[ScalarType "int4"],ScalarType "int4"),("lo_truncate",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("lo_unlink",[ScalarType "oid"],ScalarType "int4"),("log",[ScalarType "float8"],ScalarType "float8"),("log",[ScalarType "numeric"],ScalarType "numeric"),("log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("loread",[ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("lower",[ScalarType "text"],ScalarType "text"),("lowrite",[ScalarType "int4",ScalarType "bytea"],ScalarType "int4"),("lpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("lpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("lseg",[ScalarType "box"],ScalarType "lseg"),("lseg",[ScalarType "point",ScalarType "point"],ScalarType "lseg"),("lseg_center",[ScalarType "lseg"],ScalarType "point"),("lseg_distance",[ScalarType "lseg",ScalarType "lseg"],ScalarType "float8"),("lseg_eq",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ge",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_gt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_horizontal",[ScalarType "lseg"],ScalarType "bool"),("lseg_in",[Pseudo Cstring],ScalarType "lseg"),("lseg_interpt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "point"),("lseg_intersect",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_le",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_length",[ScalarType "lseg"],ScalarType "float8"),("lseg_lt",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_ne",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_out",[ScalarType "lseg"],Pseudo Cstring),("lseg_parallel",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_perp",[ScalarType "lseg",ScalarType "lseg"],ScalarType "bool"),("lseg_recv",[Pseudo Internal],ScalarType "lseg"),("lseg_send",[ScalarType "lseg"],ScalarType "bytea"),("lseg_vertical",[ScalarType "lseg"],ScalarType "bool"),("ltrim",[ScalarType "text"],ScalarType "text"),("ltrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("macaddr_cmp",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "int4"),("macaddr_eq",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ge",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_gt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_in",[Pseudo Cstring],ScalarType "macaddr"),("macaddr_le",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_lt",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_ne",[ScalarType "macaddr",ScalarType "macaddr"],ScalarType "bool"),("macaddr_out",[ScalarType "macaddr"],Pseudo Cstring),("macaddr_recv",[Pseudo Internal],ScalarType "macaddr"),("macaddr_send",[ScalarType "macaddr"],ScalarType "bytea"),("makeaclitem",[ScalarType "oid",ScalarType "oid",ScalarType "text",ScalarType "bool"],ScalarType "aclitem"),("masklen",[ScalarType "inet"],ScalarType "int4"),("md5",[ScalarType "bytea"],ScalarType "text"),("md5",[ScalarType "text"],ScalarType "text"),("mic_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin3",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_latin4",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1250",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mic_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("mktinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("mod",[ScalarType "int8",ScalarType "int8"],ScalarType "int8"),("mod",[ScalarType "int2",ScalarType "int2"],ScalarType "int2"),("mod",[ScalarType "int4",ScalarType "int4"],ScalarType "int4"),("mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("mul_d_interval",[ScalarType "float8",ScalarType "interval"],ScalarType "interval"),("name",[ScalarType "text"],ScalarType "name"),("name",[ScalarType "bpchar"],ScalarType "name"),("name",[ScalarType "varchar"],ScalarType "name"),("nameeq",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namege",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namegt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("nameiclike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicnlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameicregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namein",[Pseudo Cstring],ScalarType "name"),("namele",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namelike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namelt",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namene",[ScalarType "name",ScalarType "name"],ScalarType "bool"),("namenlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameout",[ScalarType "name"],Pseudo Cstring),("namerecv",[Pseudo Internal],ScalarType "name"),("nameregexeq",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("nameregexne",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("namesend",[ScalarType "name"],ScalarType "bytea"),("neqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("neqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("netmask",[ScalarType "inet"],ScalarType "inet"),("network",[ScalarType "inet"],ScalarType "cidr"),("network_cmp",[ScalarType "inet",ScalarType "inet"],ScalarType "int4"),("network_eq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ge",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_gt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_le",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_lt",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_ne",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sub",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_subeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_sup",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("network_supeq",[ScalarType "inet",ScalarType "inet"],ScalarType "bool"),("nextval",[ScalarType "regclass"],ScalarType "int8"),("nlikejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("nlikesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("notlike",[ScalarType "bytea",ScalarType "bytea"],ScalarType "bool"),("notlike",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("notlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("now",[],ScalarType "timestamptz"),("npoints",[ScalarType "path"],ScalarType "int4"),("npoints",[ScalarType "polygon"],ScalarType "int4"),("numeric",[ScalarType "int8"],ScalarType "numeric"),("numeric",[ScalarType "int2"],ScalarType "numeric"),("numeric",[ScalarType "int4"],ScalarType "numeric"),("numeric",[ScalarType "float4"],ScalarType "numeric"),("numeric",[ScalarType "float8"],ScalarType "numeric"),("numeric",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("numeric_abs",[ScalarType "numeric"],ScalarType "numeric"),("numeric_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_add",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_avg",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_avg_accum",[ArrayType (ScalarType "numeric"),ScalarType "numeric"],ArrayType (ScalarType "numeric")),("numeric_cmp",[ScalarType "numeric",ScalarType "numeric"],ScalarType "int4"),("numeric_div",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_div_trunc",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_eq",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_exp",[ScalarType "numeric"],ScalarType "numeric"),("numeric_fac",[ScalarType "int8"],ScalarType "numeric"),("numeric_ge",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_gt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_inc",[ScalarType "numeric"],ScalarType "numeric"),("numeric_larger",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_le",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_ln",[ScalarType "numeric"],ScalarType "numeric"),("numeric_log",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_lt",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_mod",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_mul",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_ne",[ScalarType "numeric",ScalarType "numeric"],ScalarType "bool"),("numeric_out",[ScalarType "numeric"],Pseudo Cstring),("numeric_power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "numeric"),("numeric_send",[ScalarType "numeric"],ScalarType "bytea"),("numeric_smaller",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_sqrt",[ScalarType "numeric"],ScalarType "numeric"),("numeric_stddev_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_stddev_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_sub",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("numeric_uminus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_uplus",[ScalarType "numeric"],ScalarType "numeric"),("numeric_var_pop",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numeric_var_samp",[ArrayType (ScalarType "numeric")],ScalarType "numeric"),("numerictypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("numerictypmodout",[ScalarType "int4"],Pseudo Cstring),("numnode",[ScalarType "tsquery"],ScalarType "int4"),("obj_description",[ScalarType "oid"],ScalarType "text"),("obj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("octet_length",[ScalarType "bytea"],ScalarType "int4"),("octet_length",[ScalarType "text"],ScalarType "int4"),("octet_length",[ScalarType "bpchar"],ScalarType "int4"),("octet_length",[ScalarType "bit"],ScalarType "int4"),("oid",[ScalarType "int8"],ScalarType "oid"),("oideq",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidge",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidgt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidin",[Pseudo Cstring],ScalarType "oid"),("oidlarger",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidle",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidlt",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidne",[ScalarType "oid",ScalarType "oid"],ScalarType "bool"),("oidout",[ScalarType "oid"],Pseudo Cstring),("oidrecv",[Pseudo Internal],ScalarType "oid"),("oidsend",[ScalarType "oid"],ScalarType "bytea"),("oidsmaller",[ScalarType "oid",ScalarType "oid"],ScalarType "oid"),("oidvectoreq",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorge",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorgt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorin",[Pseudo Cstring],ScalarType "oidvector"),("oidvectorle",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorlt",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorne",[ScalarType "oidvector",ScalarType "oidvector"],ScalarType "bool"),("oidvectorout",[ScalarType "oidvector"],Pseudo Cstring),("oidvectorrecv",[Pseudo Internal],ScalarType "oidvector"),("oidvectorsend",[ScalarType "oidvector"],ScalarType "bytea"),("oidvectortypes",[ScalarType "oidvector"],ScalarType "text"),("on_pb",[ScalarType "point",ScalarType "box"],ScalarType "bool"),("on_pl",[ScalarType "point",ScalarType "line"],ScalarType "bool"),("on_ppath",[ScalarType "point",ScalarType "path"],ScalarType "bool"),("on_ps",[ScalarType "point",ScalarType "lseg"],ScalarType "bool"),("on_sb",[ScalarType "lseg",ScalarType "box"],ScalarType "bool"),("on_sl",[ScalarType "lseg",ScalarType "line"],ScalarType "bool"),("opaque_in",[Pseudo Cstring],Pseudo Opaque),("opaque_out",[Pseudo Opaque],Pseudo Cstring),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "time",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "time"],ScalarType "bool"),("overlaps",[ScalarType "time",ScalarType "interval",ScalarType "time",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "timestamp",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("overlaps",[ScalarType "timestamp",ScalarType "interval",ScalarType "timestamp",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("overlaps",[ScalarType "timestamptz",ScalarType "interval",ScalarType "timestamptz",ScalarType "interval"],ScalarType "bool"),("overlaps",[ScalarType "timetz",ScalarType "timetz",ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("overlay",[ScalarType "text",ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("path",[ScalarType "polygon"],ScalarType "path"),("path_add",[ScalarType "path",ScalarType "path"],ScalarType "path"),("path_add_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_center",[ScalarType "path"],ScalarType "point"),("path_contain_pt",[ScalarType "path",ScalarType "point"],ScalarType "bool"),("path_distance",[ScalarType "path",ScalarType "path"],ScalarType "float8"),("path_div_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_in",[Pseudo Cstring],ScalarType "path"),("path_inter",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_length",[ScalarType "path"],ScalarType "float8"),("path_mul_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("path_n_eq",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_ge",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_gt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_le",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_n_lt",[ScalarType "path",ScalarType "path"],ScalarType "bool"),("path_npoints",[ScalarType "path"],ScalarType "int4"),("path_out",[ScalarType "path"],Pseudo Cstring),("path_recv",[Pseudo Internal],ScalarType "path"),("path_send",[ScalarType "path"],ScalarType "bytea"),("path_sub_pt",[ScalarType "path",ScalarType "point"],ScalarType "path"),("pclose",[ScalarType "path"],ScalarType "path"),("pg_advisory_lock",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int8"],Pseudo Void),("pg_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],Pseudo Void),("pg_advisory_unlock",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_advisory_unlock_all",[],Pseudo Void),("pg_advisory_unlock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_advisory_unlock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_backend_pid",[],ScalarType "int4"),("pg_cancel_backend",[ScalarType "int4"],ScalarType "bool"),("pg_char_to_encoding",[ScalarType "name"],ScalarType "int4"),("pg_client_encoding",[],ScalarType "name"),("pg_column_size",[Pseudo Any],ScalarType "int4"),("pg_conf_load_time",[],ScalarType "timestamptz"),("pg_conversion_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_current_xlog_insert_location",[],ScalarType "text"),("pg_current_xlog_location",[],ScalarType "text"),("pg_cursor",[],SetOfType (Pseudo Record)),("pg_database_size",[ScalarType "name"],ScalarType "int8"),("pg_database_size",[ScalarType "oid"],ScalarType "int8"),("pg_encoding_to_char",[ScalarType "int4"],ScalarType "name"),("pg_function_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_get_constraintdef",[ScalarType "oid"],ScalarType "text"),("pg_get_constraintdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid"],ScalarType "text"),("pg_get_expr",[ScalarType "text",ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_function_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_identity_arguments",[ScalarType "oid"],ScalarType "text"),("pg_get_function_result",[ScalarType "oid"],ScalarType "text"),("pg_get_functiondef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid"],ScalarType "text"),("pg_get_indexdef",[ScalarType "oid",ScalarType "int4",ScalarType "bool"],ScalarType "text"),("pg_get_keywords",[],SetOfType (Pseudo Record)),("pg_get_ruledef",[ScalarType "oid"],ScalarType "text"),("pg_get_ruledef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_get_serial_sequence",[ScalarType "text",ScalarType "text"],ScalarType "text"),("pg_get_triggerdef",[ScalarType "oid"],ScalarType "text"),("pg_get_userbyid",[ScalarType "oid"],ScalarType "name"),("pg_get_viewdef",[ScalarType "text"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid"],ScalarType "text"),("pg_get_viewdef",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_get_viewdef",[ScalarType "oid",ScalarType "bool"],ScalarType "text"),("pg_has_role",[ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "name",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "name",ScalarType "text"],ScalarType "bool"),("pg_has_role",[ScalarType "oid",ScalarType "oid",ScalarType "text"],ScalarType "bool"),("pg_is_other_temp_schema",[ScalarType "oid"],ScalarType "bool"),("pg_lock_status",[],SetOfType (Pseudo Record)),("pg_ls_dir",[ScalarType "text"],SetOfType (ScalarType "text")),("pg_my_temp_schema",[],ScalarType "oid"),("pg_opclass_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_operator_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_options_to_table",[ArrayType (ScalarType "text")],SetOfType (Pseudo Record)),("pg_postmaster_start_time",[],ScalarType "timestamptz"),("pg_prepared_statement",[],SetOfType (Pseudo Record)),("pg_prepared_xact",[],SetOfType (Pseudo Record)),("pg_read_file",[ScalarType "text",ScalarType "int8",ScalarType "int8"],ScalarType "text"),("pg_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_relation_size",[ScalarType "regclass",ScalarType "text"],ScalarType "int8"),("pg_reload_conf",[],ScalarType "bool"),("pg_rotate_logfile",[],ScalarType "bool"),("pg_show_all_settings",[],SetOfType (Pseudo Record)),("pg_size_pretty",[ScalarType "int8"],ScalarType "text"),("pg_sleep",[ScalarType "float8"],Pseudo Void),("pg_start_backup",[ScalarType "text",ScalarType "bool"],ScalarType "text"),("pg_stat_clear_snapshot",[],Pseudo Void),("pg_stat_file",[ScalarType "text"],Pseudo Record),("pg_stat_get_activity",[ScalarType "int4"],SetOfType (Pseudo Record)),("pg_stat_get_backend_activity",[ScalarType "int4"],ScalarType "text"),("pg_stat_get_backend_activity_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_client_addr",[ScalarType "int4"],ScalarType "inet"),("pg_stat_get_backend_client_port",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_dbid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_idset",[],SetOfType (ScalarType "int4")),("pg_stat_get_backend_pid",[ScalarType "int4"],ScalarType "int4"),("pg_stat_get_backend_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_backend_userid",[ScalarType "int4"],ScalarType "oid"),("pg_stat_get_backend_waiting",[ScalarType "int4"],ScalarType "bool"),("pg_stat_get_backend_xact_start",[ScalarType "int4"],ScalarType "timestamptz"),("pg_stat_get_bgwriter_buf_written_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_buf_written_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_maxwritten_clean",[],ScalarType "int8"),("pg_stat_get_bgwriter_requested_checkpoints",[],ScalarType "int8"),("pg_stat_get_bgwriter_timed_checkpoints",[],ScalarType "int8"),("pg_stat_get_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_buf_alloc",[],ScalarType "int8"),("pg_stat_get_buf_written_backend",[],ScalarType "int8"),("pg_stat_get_db_blocks_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_blocks_hit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_numbackends",[ScalarType "oid"],ScalarType "int4"),("pg_stat_get_db_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_commit",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_db_xact_rollback",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_dead_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_calls",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_self_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_function_time",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_last_analyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autoanalyze_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_autovacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_last_vacuum_time",[ScalarType "oid"],ScalarType "timestamptz"),("pg_stat_get_live_tuples",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_numscans",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_deleted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_fetched",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_hot_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_inserted",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_returned",[ScalarType "oid"],ScalarType "int8"),("pg_stat_get_tuples_updated",[ScalarType "oid"],ScalarType "int8"),("pg_stat_reset",[],Pseudo Void),("pg_stop_backup",[],ScalarType "text"),("pg_switch_xlog",[],ScalarType "text"),("pg_table_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_tablespace_databases",[ScalarType "oid"],SetOfType (ScalarType "oid")),("pg_tablespace_size",[ScalarType "name"],ScalarType "int8"),("pg_tablespace_size",[ScalarType "oid"],ScalarType "int8"),("pg_terminate_backend",[ScalarType "int4"],ScalarType "bool"),("pg_timezone_abbrevs",[],SetOfType (Pseudo Record)),("pg_timezone_names",[],SetOfType (Pseudo Record)),("pg_total_relation_size",[ScalarType "regclass"],ScalarType "int8"),("pg_try_advisory_lock",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int8"],ScalarType "bool"),("pg_try_advisory_lock_shared",[ScalarType "int4",ScalarType "int4"],ScalarType "bool"),("pg_ts_config_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_dict_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_parser_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_ts_template_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_type_is_visible",[ScalarType "oid"],ScalarType "bool"),("pg_typeof",[Pseudo Any],ScalarType "regtype"),("pg_xlogfile_name",[ScalarType "text"],ScalarType "text"),("pg_xlogfile_name_offset",[ScalarType "text"],Pseudo Record),("pi",[],ScalarType "float8"),("plainto_tsquery",[ScalarType "text"],ScalarType "tsquery"),("plainto_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("point",[ScalarType "lseg"],ScalarType "point"),("point",[ScalarType "path"],ScalarType "point"),("point",[ScalarType "box"],ScalarType "point"),("point",[ScalarType "polygon"],ScalarType "point"),("point",[ScalarType "circle"],ScalarType "point"),("point",[ScalarType "float8",ScalarType "float8"],ScalarType "point"),("point_above",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_add",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_below",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_distance",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("point_div",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_eq",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_horiz",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_in",[Pseudo Cstring],ScalarType "point"),("point_left",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_mul",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_ne",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_out",[ScalarType "point"],Pseudo Cstring),("point_recv",[Pseudo Internal],ScalarType "point"),("point_right",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("point_send",[ScalarType "point"],ScalarType "bytea"),("point_sub",[ScalarType "point",ScalarType "point"],ScalarType "point"),("point_vert",[ScalarType "point",ScalarType "point"],ScalarType "bool"),("poly_above",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_below",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_center",[ScalarType "polygon"],ScalarType "point"),("poly_contain",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_contain_pt",[ScalarType "polygon",ScalarType "point"],ScalarType "bool"),("poly_contained",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_distance",[ScalarType "polygon",ScalarType "polygon"],ScalarType "float8"),("poly_in",[Pseudo Cstring],ScalarType "polygon"),("poly_left",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_npoints",[ScalarType "polygon"],ScalarType "int4"),("poly_out",[ScalarType "polygon"],Pseudo Cstring),("poly_overabove",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overbelow",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overlap",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overleft",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_overright",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_recv",[Pseudo Internal],ScalarType "polygon"),("poly_right",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_same",[ScalarType "polygon",ScalarType "polygon"],ScalarType "bool"),("poly_send",[ScalarType "polygon"],ScalarType "bytea"),("polygon",[ScalarType "path"],ScalarType "polygon"),("polygon",[ScalarType "box"],ScalarType "polygon"),("polygon",[ScalarType "circle"],ScalarType "polygon"),("polygon",[ScalarType "int4",ScalarType "circle"],ScalarType "polygon"),("popen",[ScalarType "path"],ScalarType "path"),("position",[ScalarType "bytea",ScalarType "bytea"],ScalarType "int4"),("position",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("position",[ScalarType "bit",ScalarType "bit"],ScalarType "int4"),("positionjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("positionsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("postgresql_fdw_validator",[ArrayType (ScalarType "text"),ScalarType "oid"],ScalarType "bool"),("pow",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("pow",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("power",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("power",[ScalarType "numeric",ScalarType "numeric"],ScalarType "numeric"),("prsd_end",[Pseudo Internal],Pseudo Void),("prsd_headline",[Pseudo Internal,Pseudo Internal,ScalarType "tsquery"],Pseudo Internal),("prsd_lextype",[Pseudo Internal],Pseudo Internal),("prsd_nexttoken",[Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("prsd_start",[Pseudo Internal,ScalarType "int4"],Pseudo Internal),("pt_contained_circle",[ScalarType "point",ScalarType "circle"],ScalarType "bool"),("pt_contained_poly",[ScalarType "point",ScalarType "polygon"],ScalarType "bool"),("query_to_xml",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xml_and_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("query_to_xmlschema",[ScalarType "text",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("querytree",[ScalarType "tsquery"],ScalarType "text"),("quote_ident",[ScalarType "text"],ScalarType "text"),("quote_literal",[ScalarType "text"],ScalarType "text"),("quote_literal",[Pseudo AnyElement],ScalarType "text"),("quote_nullable",[ScalarType "text"],ScalarType "text"),("quote_nullable",[Pseudo AnyElement],ScalarType "text"),("radians",[ScalarType "float8"],ScalarType "float8"),("radius",[ScalarType "circle"],ScalarType "float8"),("random",[],ScalarType "float8"),("record_eq",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ge",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_gt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_le",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_lt",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_ne",[Pseudo Record,Pseudo Record],ScalarType "bool"),("record_out",[Pseudo Record],Pseudo Cstring),("record_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],Pseudo Record),("record_send",[Pseudo Record],ScalarType "bytea"),("regclass",[ScalarType "text"],ScalarType "regclass"),("regclassin",[Pseudo Cstring],ScalarType "regclass"),("regclassout",[ScalarType "regclass"],Pseudo Cstring),("regclassrecv",[Pseudo Internal],ScalarType "regclass"),("regclasssend",[ScalarType "regclass"],ScalarType "bytea"),("regconfigin",[Pseudo Cstring],ScalarType "regconfig"),("regconfigout",[ScalarType "regconfig"],Pseudo Cstring),("regconfigrecv",[Pseudo Internal],ScalarType "regconfig"),("regconfigsend",[ScalarType "regconfig"],ScalarType "bytea"),("regdictionaryin",[Pseudo Cstring],ScalarType "regdictionary"),("regdictionaryout",[ScalarType "regdictionary"],Pseudo Cstring),("regdictionaryrecv",[Pseudo Internal],ScalarType "regdictionary"),("regdictionarysend",[ScalarType "regdictionary"],ScalarType "bytea"),("regexeqjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexeqsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexnejoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("regexnesel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("regexp_matches",[ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_matches",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ArrayType (ScalarType "text"))),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_replace",[ScalarType "text",ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("regexp_split_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_array",[ScalarType "text",ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regexp_split_to_table",[ScalarType "text",ScalarType "text",ScalarType "text"],SetOfType (ScalarType "text")),("regoperatorin",[Pseudo Cstring],ScalarType "regoperator"),("regoperatorout",[ScalarType "regoperator"],Pseudo Cstring),("regoperatorrecv",[Pseudo Internal],ScalarType "regoperator"),("regoperatorsend",[ScalarType "regoperator"],ScalarType "bytea"),("regoperin",[Pseudo Cstring],ScalarType "regoper"),("regoperout",[ScalarType "regoper"],Pseudo Cstring),("regoperrecv",[Pseudo Internal],ScalarType "regoper"),("regopersend",[ScalarType "regoper"],ScalarType "bytea"),("regprocedurein",[Pseudo Cstring],ScalarType "regprocedure"),("regprocedureout",[ScalarType "regprocedure"],Pseudo Cstring),("regprocedurerecv",[Pseudo Internal],ScalarType "regprocedure"),("regproceduresend",[ScalarType "regprocedure"],ScalarType "bytea"),("regprocin",[Pseudo Cstring],ScalarType "regproc"),("regprocout",[ScalarType "regproc"],Pseudo Cstring),("regprocrecv",[Pseudo Internal],ScalarType "regproc"),("regprocsend",[ScalarType "regproc"],ScalarType "bytea"),("regtypein",[Pseudo Cstring],ScalarType "regtype"),("regtypeout",[ScalarType "regtype"],Pseudo Cstring),("regtyperecv",[Pseudo Internal],ScalarType "regtype"),("regtypesend",[ScalarType "regtype"],ScalarType "bytea"),("reltime",[ScalarType "interval"],ScalarType "reltime"),("reltimeeq",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimege",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimegt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimein",[Pseudo Cstring],ScalarType "reltime"),("reltimele",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimelt",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimene",[ScalarType "reltime",ScalarType "reltime"],ScalarType "bool"),("reltimeout",[ScalarType "reltime"],Pseudo Cstring),("reltimerecv",[Pseudo Internal],ScalarType "reltime"),("reltimesend",[ScalarType "reltime"],ScalarType "bytea"),("repeat",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("replace",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("round",[ScalarType "float8"],ScalarType "float8"),("round",[ScalarType "numeric"],ScalarType "numeric"),("round",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("rpad",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("rpad",[ScalarType "text",ScalarType "int4",ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text"],ScalarType "text"),("rtrim",[ScalarType "text",ScalarType "text"],ScalarType "text"),("scalargtjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalargtsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("scalarltjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("scalarltsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("schema_to_xml",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xml_and_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("schema_to_xmlschema",[ScalarType "name",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("session_user",[],ScalarType "name"),("set_bit",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_byte",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("set_config",[ScalarType "text",ScalarType "text",ScalarType "bool"],ScalarType "text"),("set_masklen",[ScalarType "cidr",ScalarType "int4"],ScalarType "cidr"),("set_masklen",[ScalarType "inet",ScalarType "int4"],ScalarType "inet"),("setseed",[ScalarType "float8"],Pseudo Void),("setval",[ScalarType "regclass",ScalarType "int8"],ScalarType "int8"),("setval",[ScalarType "regclass",ScalarType "int8",ScalarType "bool"],ScalarType "int8"),("setweight",[ScalarType "tsvector",ScalarType "char"],ScalarType "tsvector"),("shell_in",[Pseudo Cstring],Pseudo Opaque),("shell_out",[Pseudo Opaque],Pseudo Cstring),("shift_jis_2004_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shift_jis_2004_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("shobj_description",[ScalarType "oid",ScalarType "name"],ScalarType "text"),("sign",[ScalarType "float8"],ScalarType "float8"),("sign",[ScalarType "numeric"],ScalarType "numeric"),("similar_escape",[ScalarType "text",ScalarType "text"],ScalarType "text"),("sin",[ScalarType "float8"],ScalarType "float8"),("sjis_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("sjis_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("slope",[ScalarType "point",ScalarType "point"],ScalarType "float8"),("smgreq",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrin",[Pseudo Cstring],ScalarType "smgr"),("smgrne",[ScalarType "smgr",ScalarType "smgr"],ScalarType "bool"),("smgrout",[ScalarType "smgr"],Pseudo Cstring),("split_part",[ScalarType "text",ScalarType "text",ScalarType "int4"],ScalarType "text"),("sqrt",[ScalarType "float8"],ScalarType "float8"),("sqrt",[ScalarType "numeric"],ScalarType "numeric"),("statement_timestamp",[],ScalarType "timestamptz"),("string_to_array",[ScalarType "text",ScalarType "text"],ArrayType (ScalarType "text")),("strip",[ScalarType "tsvector"],ScalarType "tsvector"),("strpos",[ScalarType "text",ScalarType "text"],ScalarType "int4"),("substr",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substr",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substr",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "bytea",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4"],ScalarType "bit"),("substring",[ScalarType "bytea",ScalarType "int4",ScalarType "int4"],ScalarType "bytea"),("substring",[ScalarType "text",ScalarType "int4",ScalarType "int4"],ScalarType "text"),("substring",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("substring",[ScalarType "bit",ScalarType "int4",ScalarType "int4"],ScalarType "bit"),("suppress_redundant_updates_trigger",[],Pseudo Trigger),("table_to_xml",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xml_and_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("table_to_xmlschema",[ScalarType "regclass",ScalarType "bool",ScalarType "bool",ScalarType "text"],ScalarType "xml"),("tan",[ScalarType "float8"],ScalarType "float8"),("text",[ScalarType "bool"],ScalarType "text"),("text",[ScalarType "char"],ScalarType "text"),("text",[ScalarType "name"],ScalarType "text"),("text",[ScalarType "xml"],ScalarType "text"),("text",[ScalarType "inet"],ScalarType "text"),("text",[ScalarType "bpchar"],ScalarType "text"),("text_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_larger",[ScalarType "text",ScalarType "text"],ScalarType "text"),("text_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_ge",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_gt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_le",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_pattern_lt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("text_smaller",[ScalarType "text",ScalarType "text"],ScalarType "text"),("textanycat",[ScalarType "text",Pseudo AnyNonArray],ScalarType "text"),("textcat",[ScalarType "text",ScalarType "text"],ScalarType "text"),("texteq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("texticregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textin",[Pseudo Cstring],ScalarType "text"),("textlen",[ScalarType "text"],ScalarType "int4"),("textlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textnlike",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textout",[ScalarType "text"],Pseudo Cstring),("textrecv",[Pseudo Internal],ScalarType "text"),("textregexeq",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textregexne",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("textsend",[ScalarType "text"],ScalarType "bytea"),("thesaurus_init",[Pseudo Internal],Pseudo Internal),("thesaurus_lexize",[Pseudo Internal,Pseudo Internal,Pseudo Internal,Pseudo Internal],Pseudo Internal),("tideq",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidge",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidgt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidin",[Pseudo Cstring],ScalarType "tid"),("tidlarger",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("tidle",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidlt",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidne",[ScalarType "tid",ScalarType "tid"],ScalarType "bool"),("tidout",[ScalarType "tid"],Pseudo Cstring),("tidrecv",[Pseudo Internal],ScalarType "tid"),("tidsend",[ScalarType "tid"],ScalarType "bytea"),("tidsmaller",[ScalarType "tid",ScalarType "tid"],ScalarType "tid"),("time",[ScalarType "abstime"],ScalarType "time"),("time",[ScalarType "timestamp"],ScalarType "time"),("time",[ScalarType "timestamptz"],ScalarType "time"),("time",[ScalarType "interval"],ScalarType "time"),("time",[ScalarType "timetz"],ScalarType "time"),("time",[ScalarType "time",ScalarType "int4"],ScalarType "time"),("time_cmp",[ScalarType "time",ScalarType "time"],ScalarType "int4"),("time_eq",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_ge",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_gt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_hash",[ScalarType "time"],ScalarType "int4"),("time_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_larger",[ScalarType "time",ScalarType "time"],ScalarType "time"),("time_le",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_lt",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_mi_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_mi_time",[ScalarType "time",ScalarType "time"],ScalarType "interval"),("time_ne",[ScalarType "time",ScalarType "time"],ScalarType "bool"),("time_out",[ScalarType "time"],Pseudo Cstring),("time_pl_interval",[ScalarType "time",ScalarType "interval"],ScalarType "time"),("time_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "time"),("time_send",[ScalarType "time"],ScalarType "bytea"),("time_smaller",[ScalarType "time",ScalarType "time"],ScalarType "time"),("timedate_pl",[ScalarType "time",ScalarType "date"],ScalarType "timestamp"),("timemi",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timenow",[],ScalarType "abstime"),("timeofday",[],ScalarType "text"),("timepl",[ScalarType "abstime",ScalarType "reltime"],ScalarType "abstime"),("timestamp",[ScalarType "abstime"],ScalarType "timestamp"),("timestamp",[ScalarType "date"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamptz"],ScalarType "timestamp"),("timestamp",[ScalarType "date",ScalarType "time"],ScalarType "timestamp"),("timestamp",[ScalarType "timestamp",ScalarType "int4"],ScalarType "timestamp"),("timestamp_cmp",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "int4"),("timestamp_cmp_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "int4"),("timestamp_cmp_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "int4"),("timestamp_eq",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_eq_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_eq_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_ge",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ge_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ge_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_gt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_gt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_gt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_hash",[ScalarType "timestamp"],ScalarType "int4"),("timestamp_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_larger",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamp_le",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_le_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_le_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_lt",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_lt_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_lt_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_mi",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "interval"),("timestamp_mi_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_ne",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "bool"),("timestamp_ne_date",[ScalarType "timestamp",ScalarType "date"],ScalarType "bool"),("timestamp_ne_timestamptz",[ScalarType "timestamp",ScalarType "timestamptz"],ScalarType "bool"),("timestamp_out",[ScalarType "timestamp"],Pseudo Cstring),("timestamp_pl_interval",[ScalarType "timestamp",ScalarType "interval"],ScalarType "timestamp"),("timestamp_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamp"),("timestamp_send",[ScalarType "timestamp"],ScalarType "bytea"),("timestamp_smaller",[ScalarType "timestamp",ScalarType "timestamp"],ScalarType "timestamp"),("timestamptypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptypmodout",[ScalarType "int4"],Pseudo Cstring),("timestamptz",[ScalarType "abstime"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamp"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "time"],ScalarType "timestamptz"),("timestamptz",[ScalarType "date",ScalarType "timetz"],ScalarType "timestamptz"),("timestamptz",[ScalarType "timestamptz",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_cmp",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "int4"),("timestamptz_cmp_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "int4"),("timestamptz_cmp_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "int4"),("timestamptz_eq",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_eq_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_eq_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_ge",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ge_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ge_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_gt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_gt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_gt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_larger",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptz_le",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_le_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_le_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_lt",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_lt_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_lt_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_mi",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "interval"),("timestamptz_mi_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_ne",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "bool"),("timestamptz_ne_date",[ScalarType "timestamptz",ScalarType "date"],ScalarType "bool"),("timestamptz_ne_timestamp",[ScalarType "timestamptz",ScalarType "timestamp"],ScalarType "bool"),("timestamptz_out",[ScalarType "timestamptz"],Pseudo Cstring),("timestamptz_pl_interval",[ScalarType "timestamptz",ScalarType "interval"],ScalarType "timestamptz"),("timestamptz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timestamptz"),("timestamptz_send",[ScalarType "timestamptz"],ScalarType "bytea"),("timestamptz_smaller",[ScalarType "timestamptz",ScalarType "timestamptz"],ScalarType "timestamptz"),("timestamptztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timestamptztypmodout",[ScalarType "int4"],Pseudo Cstring),("timetypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetypmodout",[ScalarType "int4"],Pseudo Cstring),("timetz",[ScalarType "time"],ScalarType "timetz"),("timetz",[ScalarType "timestamptz"],ScalarType "timetz"),("timetz",[ScalarType "timetz",ScalarType "int4"],ScalarType "timetz"),("timetz_cmp",[ScalarType "timetz",ScalarType "timetz"],ScalarType "int4"),("timetz_eq",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_ge",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_gt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_hash",[ScalarType "timetz"],ScalarType "int4"),("timetz_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_larger",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetz_le",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_lt",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_mi_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_ne",[ScalarType "timetz",ScalarType "timetz"],ScalarType "bool"),("timetz_out",[ScalarType "timetz"],Pseudo Cstring),("timetz_pl_interval",[ScalarType "timetz",ScalarType "interval"],ScalarType "timetz"),("timetz_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "timetz"),("timetz_send",[ScalarType "timetz"],ScalarType "bytea"),("timetz_smaller",[ScalarType "timetz",ScalarType "timetz"],ScalarType "timetz"),("timetzdate_pl",[ScalarType "timetz",ScalarType "date"],ScalarType "timestamptz"),("timetztypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("timetztypmodout",[ScalarType "int4"],Pseudo Cstring),("timezone",[ScalarType "text",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "text",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "text",ScalarType "timetz"],ScalarType "timetz"),("timezone",[ScalarType "interval",ScalarType "timestamp"],ScalarType "timestamptz"),("timezone",[ScalarType "interval",ScalarType "timestamptz"],ScalarType "timestamp"),("timezone",[ScalarType "interval",ScalarType "timetz"],ScalarType "timetz"),("tinterval",[ScalarType "abstime",ScalarType "abstime"],ScalarType "tinterval"),("tintervalct",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalend",[ScalarType "tinterval"],ScalarType "abstime"),("tintervaleq",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalge",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalgt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalin",[Pseudo Cstring],ScalarType "tinterval"),("tintervalle",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalleneq",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenge",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallengt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenle",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenlt",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallenne",[ScalarType "tinterval",ScalarType "reltime"],ScalarType "bool"),("tintervallt",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalne",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalout",[ScalarType "tinterval"],Pseudo Cstring),("tintervalov",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalrecv",[Pseudo Internal],ScalarType "tinterval"),("tintervalrel",[ScalarType "tinterval"],ScalarType "reltime"),("tintervalsame",[ScalarType "tinterval",ScalarType "tinterval"],ScalarType "bool"),("tintervalsend",[ScalarType "tinterval"],ScalarType "bytea"),("tintervalstart",[ScalarType "tinterval"],ScalarType "abstime"),("to_ascii",[ScalarType "text"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "name"],ScalarType "text"),("to_ascii",[ScalarType "text",ScalarType "int4"],ScalarType "text"),("to_char",[ScalarType "int8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "int4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float4",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "float8",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamp",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "timestamptz",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "interval",ScalarType "text"],ScalarType "text"),("to_char",[ScalarType "numeric",ScalarType "text"],ScalarType "text"),("to_date",[ScalarType "text",ScalarType "text"],ScalarType "date"),("to_hex",[ScalarType "int8"],ScalarType "text"),("to_hex",[ScalarType "int4"],ScalarType "text"),("to_number",[ScalarType "text",ScalarType "text"],ScalarType "numeric"),("to_timestamp",[ScalarType "float8"],ScalarType "timestamptz"),("to_timestamp",[ScalarType "text",ScalarType "text"],ScalarType "timestamptz"),("to_tsquery",[ScalarType "text"],ScalarType "tsquery"),("to_tsquery",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsquery"),("to_tsvector",[ScalarType "text"],ScalarType "tsvector"),("to_tsvector",[ScalarType "regconfig",ScalarType "text"],ScalarType "tsvector"),("transaction_timestamp",[],ScalarType "timestamptz"),("translate",[ScalarType "text",ScalarType "text",ScalarType "text"],ScalarType "text"),("trigger_in",[Pseudo Cstring],Pseudo Trigger),("trigger_out",[Pseudo Trigger],Pseudo Cstring),("trunc",[ScalarType "float8"],ScalarType "float8"),("trunc",[ScalarType "macaddr"],ScalarType "macaddr"),("trunc",[ScalarType "numeric"],ScalarType "numeric"),("trunc",[ScalarType "numeric",ScalarType "int4"],ScalarType "numeric"),("ts_debug",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_debug",[ScalarType "regconfig",ScalarType "text"],SetOfType (Pseudo Record)),("ts_headline",[ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery"],ScalarType "text"),("ts_headline",[ScalarType "regconfig",ScalarType "text",ScalarType "tsquery",ScalarType "text"],ScalarType "text"),("ts_lexize",[ScalarType "regdictionary",ScalarType "text"],ArrayType (ScalarType "text")),("ts_match_qv",[ScalarType "tsquery",ScalarType "tsvector"],ScalarType "bool"),("ts_match_tq",[ScalarType "text",ScalarType "tsquery"],ScalarType "bool"),("ts_match_tt",[ScalarType "text",ScalarType "text"],ScalarType "bool"),("ts_match_vq",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "bool"),("ts_parse",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_parse",[ScalarType "oid",ScalarType "text"],SetOfType (Pseudo Record)),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery"],ScalarType "float4"),("ts_rank_cd",[ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rank_cd",[ArrayType (ScalarType "float4"),ScalarType "tsvector",ScalarType "tsquery",ScalarType "int4"],ScalarType "float4"),("ts_rewrite",[ScalarType "tsquery",ScalarType "text"],ScalarType "tsquery"),("ts_rewrite",[ScalarType "tsquery",ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("ts_stat",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_stat",[ScalarType "text",ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "text"],SetOfType (Pseudo Record)),("ts_token_type",[ScalarType "oid"],SetOfType (Pseudo Record)),("ts_typanalyze",[Pseudo Internal],ScalarType "bool"),("tsmatchjoinsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int2",Pseudo Internal],ScalarType "float8"),("tsmatchsel",[Pseudo Internal,ScalarType "oid",Pseudo Internal,ScalarType "int4"],ScalarType "float8"),("tsq_mcontained",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsq_mcontains",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_and",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_cmp",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "int4"),("tsquery_eq",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ge",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_gt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_le",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_lt",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_ne",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "bool"),("tsquery_not",[ScalarType "tsquery"],ScalarType "tsquery"),("tsquery_or",[ScalarType "tsquery",ScalarType "tsquery"],ScalarType "tsquery"),("tsqueryin",[Pseudo Cstring],ScalarType "tsquery"),("tsqueryout",[ScalarType "tsquery"],Pseudo Cstring),("tsqueryrecv",[Pseudo Internal],ScalarType "tsquery"),("tsquerysend",[ScalarType "tsquery"],ScalarType "bytea"),("tsvector_cmp",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "int4"),("tsvector_concat",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "tsvector"),("tsvector_eq",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ge",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_gt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_le",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_lt",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_ne",[ScalarType "tsvector",ScalarType "tsvector"],ScalarType "bool"),("tsvector_update_trigger",[],Pseudo Trigger),("tsvector_update_trigger_column",[],Pseudo Trigger),("tsvectorin",[Pseudo Cstring],ScalarType "tsvector"),("tsvectorout",[ScalarType "tsvector"],Pseudo Cstring),("tsvectorrecv",[Pseudo Internal],ScalarType "tsvector"),("tsvectorsend",[ScalarType "tsvector"],ScalarType "bytea"),("txid_current",[],ScalarType "int8"),("txid_current_snapshot",[],ScalarType "txid_snapshot"),("txid_snapshot_in",[Pseudo Cstring],ScalarType "txid_snapshot"),("txid_snapshot_out",[ScalarType "txid_snapshot"],Pseudo Cstring),("txid_snapshot_recv",[Pseudo Internal],ScalarType "txid_snapshot"),("txid_snapshot_send",[ScalarType "txid_snapshot"],ScalarType "bytea"),("txid_snapshot_xip",[ScalarType "txid_snapshot"],SetOfType (ScalarType "int8")),("txid_snapshot_xmax",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_snapshot_xmin",[ScalarType "txid_snapshot"],ScalarType "int8"),("txid_visible_in_snapshot",[ScalarType "int8",ScalarType "txid_snapshot"],ScalarType "bool"),("uhc_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("unknownin",[Pseudo Cstring],ScalarType "unknown"),("unknownout",[ScalarType "unknown"],Pseudo Cstring),("unknownrecv",[Pseudo Internal],ScalarType "unknown"),("unknownsend",[ScalarType "unknown"],ScalarType "bytea"),("unnest",[Pseudo AnyArray],SetOfType (Pseudo AnyElement)),("upper",[ScalarType "text"],ScalarType "text"),("utf8_to_ascii",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_big5",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_cn",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_jp",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_kr",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_euc_tw",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gb18030",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_gbk",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_iso8859_1",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_johab",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_koi8u",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_shift_jis_2004",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_sjis",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_uhc",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("utf8_to_win",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("uuid_cmp",[ScalarType "uuid",ScalarType "uuid"],ScalarType "int4"),("uuid_eq",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ge",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_gt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_hash",[ScalarType "uuid"],ScalarType "int4"),("uuid_in",[Pseudo Cstring],ScalarType "uuid"),("uuid_le",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_lt",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_ne",[ScalarType "uuid",ScalarType "uuid"],ScalarType "bool"),("uuid_out",[ScalarType "uuid"],Pseudo Cstring),("uuid_recv",[Pseudo Internal],ScalarType "uuid"),("uuid_send",[ScalarType "uuid"],ScalarType "bytea"),("varbit",[ScalarType "varbit",ScalarType "int4",ScalarType "bool"],ScalarType "varbit"),("varbit_in",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_out",[ScalarType "varbit"],Pseudo Cstring),("varbit_recv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varbit"),("varbit_send",[ScalarType "varbit"],ScalarType "bytea"),("varbitcmp",[ScalarType "varbit",ScalarType "varbit"],ScalarType "int4"),("varbiteq",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitge",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitgt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitle",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitlt",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbitne",[ScalarType "varbit",ScalarType "varbit"],ScalarType "bool"),("varbittypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varbittypmodout",[ScalarType "int4"],Pseudo Cstring),("varchar",[ScalarType "name"],ScalarType "varchar"),("varchar",[ScalarType "varchar",ScalarType "int4",ScalarType "bool"],ScalarType "varchar"),("varcharin",[Pseudo Cstring,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharout",[ScalarType "varchar"],Pseudo Cstring),("varcharrecv",[Pseudo Internal,ScalarType "oid",ScalarType "int4"],ScalarType "varchar"),("varcharsend",[ScalarType "varchar"],ScalarType "bytea"),("varchartypmodin",[ArrayType (Pseudo Cstring)],ScalarType "int4"),("varchartypmodout",[ScalarType "int4"],Pseudo Cstring),("version",[],ScalarType "text"),("void_in",[Pseudo Cstring],Pseudo Void),("void_out",[Pseudo Void],Pseudo Cstring),("width",[ScalarType "box"],ScalarType "float8"),("width_bucket",[ScalarType "float8",ScalarType "float8",ScalarType "float8",ScalarType "int4"],ScalarType "int4"),("width_bucket",[ScalarType "numeric",ScalarType "numeric",ScalarType "numeric",ScalarType "int4"],ScalarType "int4"),("win1250_to_latin2",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1250_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win1251_to_win866",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_iso",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_koi8r",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_mic",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win866_to_win1251",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("win_to_utf8",[ScalarType "int4",ScalarType "int4",Pseudo Cstring,Pseudo Internal,ScalarType "int4"],Pseudo Void),("xideq",[ScalarType "xid",ScalarType "xid"],ScalarType "bool"),("xideqint4",[ScalarType "xid",ScalarType "int4"],ScalarType "bool"),("xidin",[Pseudo Cstring],ScalarType "xid"),("xidout",[ScalarType "xid"],Pseudo Cstring),("xidrecv",[Pseudo Internal],ScalarType "xid"),("xidsend",[ScalarType "xid"],ScalarType "bytea"),("xml",[ScalarType "text"],ScalarType "xml"),("xml_in",[Pseudo Cstring],ScalarType "xml"),("xml_out",[ScalarType "xml"],Pseudo Cstring),("xml_recv",[Pseudo Internal],ScalarType "xml"),("xml_send",[ScalarType "xml"],ScalarType "bytea"),("xmlcomment",[ScalarType "text"],ScalarType "xml"),("xmlconcat2",[ScalarType "xml",ScalarType "xml"],ScalarType "xml"),("xmlvalidate",[ScalarType "xml",ScalarType "text"],ScalarType "bool"),("xpath",[ScalarType "text",ScalarType "xml"],ArrayType (ScalarType "xml")),("xpath",[ScalarType "text",ScalarType "xml",ArrayType (ScalarType "text")],ArrayType (ScalarType "xml")),("array_agg",[Pseudo AnyElement],Pseudo AnyArray),("avg",[ScalarType "int8"],ScalarType "numeric"),("avg",[ScalarType "int2"],ScalarType "numeric"),("avg",[ScalarType "int4"],ScalarType "numeric"),("avg",[ScalarType "float4"],ScalarType "float8"),("avg",[ScalarType "float8"],ScalarType "float8"),("avg",[ScalarType "interval"],ScalarType "interval"),("avg",[ScalarType "numeric"],ScalarType "numeric"),("bit_and",[ScalarType "int8"],ScalarType "int8"),("bit_and",[ScalarType "int2"],ScalarType "int2"),("bit_and",[ScalarType "int4"],ScalarType "int4"),("bit_and",[ScalarType "bit"],ScalarType "bit"),("bit_or",[ScalarType "int8"],ScalarType "int8"),("bit_or",[ScalarType "int2"],ScalarType "int2"),("bit_or",[ScalarType "int4"],ScalarType "int4"),("bit_or",[ScalarType "bit"],ScalarType "bit"),("bool_and",[ScalarType "bool"],ScalarType "bool"),("bool_or",[ScalarType "bool"],ScalarType "bool"),("corr",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("count",[],ScalarType "int8"),("count",[Pseudo Any],ScalarType "int8"),("covar_pop",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("covar_samp",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("every",[ScalarType "bool"],ScalarType "bool"),("max",[ScalarType "int8"],ScalarType "int8"),("max",[ScalarType "int2"],ScalarType "int2"),("max",[ScalarType "int4"],ScalarType "int4"),("max",[ScalarType "text"],ScalarType "text"),("max",[ScalarType "oid"],ScalarType "oid"),("max",[ScalarType "tid"],ScalarType "tid"),("max",[ScalarType "float4"],ScalarType "float4"),("max",[ScalarType "float8"],ScalarType "float8"),("max",[ScalarType "abstime"],ScalarType "abstime"),("max",[ScalarType "money"],ScalarType "money"),("max",[ScalarType "bpchar"],ScalarType "bpchar"),("max",[ScalarType "date"],ScalarType "date"),("max",[ScalarType "time"],ScalarType "time"),("max",[ScalarType "timestamp"],ScalarType "timestamp"),("max",[ScalarType "timestamptz"],ScalarType "timestamptz"),("max",[ScalarType "interval"],ScalarType "interval"),("max",[ScalarType "timetz"],ScalarType "timetz"),("max",[ScalarType "numeric"],ScalarType "numeric"),("max",[Pseudo AnyArray],Pseudo AnyArray),("max",[Pseudo AnyEnum],Pseudo AnyEnum),("min",[ScalarType "int8"],ScalarType "int8"),("min",[ScalarType "int2"],ScalarType "int2"),("min",[ScalarType "int4"],ScalarType "int4"),("min",[ScalarType "text"],ScalarType "text"),("min",[ScalarType "oid"],ScalarType "oid"),("min",[ScalarType "tid"],ScalarType "tid"),("min",[ScalarType "float4"],ScalarType "float4"),("min",[ScalarType "float8"],ScalarType "float8"),("min",[ScalarType "abstime"],ScalarType "abstime"),("min",[ScalarType "money"],ScalarType "money"),("min",[ScalarType "bpchar"],ScalarType "bpchar"),("min",[ScalarType "date"],ScalarType "date"),("min",[ScalarType "time"],ScalarType "time"),("min",[ScalarType "timestamp"],ScalarType "timestamp"),("min",[ScalarType "timestamptz"],ScalarType "timestamptz"),("min",[ScalarType "interval"],ScalarType "interval"),("min",[ScalarType "timetz"],ScalarType "timetz"),("min",[ScalarType "numeric"],ScalarType "numeric"),("min",[Pseudo AnyArray],Pseudo AnyArray),("min",[Pseudo AnyEnum],Pseudo AnyEnum),("regr_avgx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_avgy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_count",[ScalarType "float8",ScalarType "float8"],ScalarType "int8"),("regr_intercept",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_r2",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_slope",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxx",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_sxy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("regr_syy",[ScalarType "float8",ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "int8"],ScalarType "numeric"),("stddev",[ScalarType "int2"],ScalarType "numeric"),("stddev",[ScalarType "int4"],ScalarType "numeric"),("stddev",[ScalarType "float4"],ScalarType "float8"),("stddev",[ScalarType "float8"],ScalarType "float8"),("stddev",[ScalarType "numeric"],ScalarType "numeric"),("stddev_pop",[ScalarType "int8"],ScalarType "numeric"),("stddev_pop",[ScalarType "int2"],ScalarType "numeric"),("stddev_pop",[ScalarType "int4"],ScalarType "numeric"),("stddev_pop",[ScalarType "float4"],ScalarType "float8"),("stddev_pop",[ScalarType "float8"],ScalarType "float8"),("stddev_pop",[ScalarType "numeric"],ScalarType "numeric"),("stddev_samp",[ScalarType "int8"],ScalarType "numeric"),("stddev_samp",[ScalarType "int2"],ScalarType "numeric"),("stddev_samp",[ScalarType "int4"],ScalarType "numeric"),("stddev_samp",[ScalarType "float4"],ScalarType "float8"),("stddev_samp",[ScalarType "float8"],ScalarType "float8"),("stddev_samp",[ScalarType "numeric"],ScalarType "numeric"),("sum",[ScalarType "int8"],ScalarType "numeric"),("sum",[ScalarType "int2"],ScalarType "int8"),("sum",[ScalarType "int4"],ScalarType "int8"),("sum",[ScalarType "float4"],ScalarType "float4"),("sum",[ScalarType "float8"],ScalarType "float8"),("sum",[ScalarType "money"],ScalarType "money"),("sum",[ScalarType "interval"],ScalarType "interval"),("sum",[ScalarType "numeric"],ScalarType "numeric"),("var_pop",[ScalarType "int8"],ScalarType "numeric"),("var_pop",[ScalarType "int2"],ScalarType "numeric"),("var_pop",[ScalarType "int4"],ScalarType "numeric"),("var_pop",[ScalarType "float4"],ScalarType "float8"),("var_pop",[ScalarType "float8"],ScalarType "float8"),("var_pop",[ScalarType "numeric"],ScalarType "numeric"),("var_samp",[ScalarType "int8"],ScalarType "numeric"),("var_samp",[ScalarType "int2"],ScalarType "numeric"),("var_samp",[ScalarType "int4"],ScalarType "numeric"),("var_samp",[ScalarType "float4"],ScalarType "float8"),("var_samp",[ScalarType "float8"],ScalarType "float8"),("var_samp",[ScalarType "numeric"],ScalarType "numeric"),("variance",[ScalarType "int8"],ScalarType "numeric"),("variance",[ScalarType "int2"],ScalarType "numeric"),("variance",[ScalarType "int4"],ScalarType "numeric"),("variance",[ScalarType "float4"],ScalarType "float8"),("variance",[ScalarType "float8"],ScalarType "float8"),("variance",[ScalarType "numeric"],ScalarType "numeric"),("xmlagg",[ScalarType "xml"],ScalarType "xml")], scopeAttrDefs = [("pg_aggregate",TableComposite,UnnamedCompositeType [("aggfnoid",ScalarType "regproc"),("aggtransfn",ScalarType "regproc"),("aggfinalfn",ScalarType "regproc"),("aggsortop",ScalarType "oid"),("aggtranstype",ScalarType "oid"),("agginitval",ScalarType "text")]),("pg_am",TableComposite,UnnamedCompositeType [("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")]),("pg_amop",TableComposite,UnnamedCompositeType [("amopfamily",ScalarType "oid"),("amoplefttype",ScalarType "oid"),("amoprighttype",ScalarType "oid"),("amopstrategy",ScalarType "int2"),("amopopr",ScalarType "oid"),("amopmethod",ScalarType "oid")]),("pg_amproc",TableComposite,UnnamedCompositeType [("amprocfamily",ScalarType "oid"),("amproclefttype",ScalarType "oid"),("amprocrighttype",ScalarType "oid"),("amprocnum",ScalarType "int2"),("amproc",ScalarType "regproc")]),("pg_attrdef",TableComposite,UnnamedCompositeType [("adrelid",ScalarType "oid"),("adnum",ScalarType "int2"),("adbin",ScalarType "text"),("adsrc",ScalarType "text")]),("pg_attribute",TableComposite,UnnamedCompositeType [("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"))]),("pg_auth_members",TableComposite,UnnamedCompositeType [("roleid",ScalarType "oid"),("member",ScalarType "oid"),("grantor",ScalarType "oid"),("admin_option",ScalarType "bool")]),("pg_authid",TableComposite,UnnamedCompositeType [("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"))]),("pg_cast",TableComposite,UnnamedCompositeType [("castsource",ScalarType "oid"),("casttarget",ScalarType "oid"),("castfunc",ScalarType "oid"),("castcontext",ScalarType "char"),("castmethod",ScalarType "char")]),("pg_class",TableComposite,UnnamedCompositeType [("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"))]),("pg_constraint",TableComposite,UnnamedCompositeType [("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")]),("pg_conversion",TableComposite,UnnamedCompositeType [("conname",ScalarType "name"),("connamespace",ScalarType "oid"),("conowner",ScalarType "oid"),("conforencoding",ScalarType "int4"),("contoencoding",ScalarType "int4"),("conproc",ScalarType "regproc"),("condefault",ScalarType "bool")]),("pg_database",TableComposite,UnnamedCompositeType [("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"))]),("pg_depend",TableComposite,UnnamedCompositeType [("classid",ScalarType "oid"),("objid",ScalarType "oid"),("objsubid",ScalarType "int4"),("refclassid",ScalarType "oid"),("refobjid",ScalarType "oid"),("refobjsubid",ScalarType "int4"),("deptype",ScalarType "char")]),("pg_description",TableComposite,UnnamedCompositeType [("objoid",ScalarType "oid"),("classoid",ScalarType "oid"),("objsubid",ScalarType "int4"),("description",ScalarType "text")]),("pg_enum",TableComposite,UnnamedCompositeType [("enumtypid",ScalarType "oid"),("enumlabel",ScalarType "name")]),("pg_foreign_data_wrapper",TableComposite,UnnamedCompositeType [("fdwname",ScalarType "name"),("fdwowner",ScalarType "oid"),("fdwvalidator",ScalarType "oid"),("fdwacl",ArrayType (ScalarType "aclitem")),("fdwoptions",ArrayType (ScalarType "text"))]),("pg_foreign_server",TableComposite,UnnamedCompositeType [("srvname",ScalarType "name"),("srvowner",ScalarType "oid"),("srvfdw",ScalarType "oid"),("srvtype",ScalarType "text"),("srvversion",ScalarType "text"),("srvacl",ArrayType (ScalarType "aclitem")),("srvoptions",ArrayType (ScalarType "text"))]),("pg_index",TableComposite,UnnamedCompositeType [("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")]),("pg_inherits",TableComposite,UnnamedCompositeType [("inhrelid",ScalarType "oid"),("inhparent",ScalarType "oid"),("inhseqno",ScalarType "int4")]),("pg_language",TableComposite,UnnamedCompositeType [("lanname",ScalarType "name"),("lanowner",ScalarType "oid"),("lanispl",ScalarType "bool"),("lanpltrusted",ScalarType "bool"),("lanplcallfoid",ScalarType "oid"),("lanvalidator",ScalarType "oid"),("lanacl",ArrayType (ScalarType "aclitem"))]),("pg_largeobject",TableComposite,UnnamedCompositeType [("loid",ScalarType "oid"),("pageno",ScalarType "int4"),("data",ScalarType "bytea")]),("pg_listener",TableComposite,UnnamedCompositeType [("relname",ScalarType "name"),("listenerpid",ScalarType "int4"),("notification",ScalarType "int4")]),("pg_namespace",TableComposite,UnnamedCompositeType [("nspname",ScalarType "name"),("nspowner",ScalarType "oid"),("nspacl",ArrayType (ScalarType "aclitem"))]),("pg_opclass",TableComposite,UnnamedCompositeType [("opcmethod",ScalarType "oid"),("opcname",ScalarType "name"),("opcnamespace",ScalarType "oid"),("opcowner",ScalarType "oid"),("opcfamily",ScalarType "oid"),("opcintype",ScalarType "oid"),("opcdefault",ScalarType "bool"),("opckeytype",ScalarType "oid")]),("pg_operator",TableComposite,UnnamedCompositeType [("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")]),("pg_opfamily",TableComposite,UnnamedCompositeType [("opfmethod",ScalarType "oid"),("opfname",ScalarType "name"),("opfnamespace",ScalarType "oid"),("opfowner",ScalarType "oid")]),("pg_pltemplate",TableComposite,UnnamedCompositeType [("tmplname",ScalarType "name"),("tmpltrusted",ScalarType "bool"),("tmpldbacreate",ScalarType "bool"),("tmplhandler",ScalarType "text"),("tmplvalidator",ScalarType "text"),("tmpllibrary",ScalarType "text"),("tmplacl",ArrayType (ScalarType "aclitem"))]),("pg_proc",TableComposite,UnnamedCompositeType [("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"))]),("pg_rewrite",TableComposite,UnnamedCompositeType [("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")]),("pg_shdepend",TableComposite,UnnamedCompositeType [("dbid",ScalarType "oid"),("classid",ScalarType "oid"),("objid",ScalarType "oid"),("objsubid",ScalarType "int4"),("refclassid",ScalarType "oid"),("refobjid",ScalarType "oid"),("deptype",ScalarType "char")]),("pg_shdescription",TableComposite,UnnamedCompositeType [("objoid",ScalarType "oid"),("classoid",ScalarType "oid"),("description",ScalarType "text")]),("pg_statistic",TableComposite,UnnamedCompositeType [("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)]),("pg_tablespace",TableComposite,UnnamedCompositeType [("spcname",ScalarType "name"),("spcowner",ScalarType "oid"),("spclocation",ScalarType "text"),("spcacl",ArrayType (ScalarType "aclitem"))]),("pg_trigger",TableComposite,UnnamedCompositeType [("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")]),("pg_ts_config",TableComposite,UnnamedCompositeType [("cfgname",ScalarType "name"),("cfgnamespace",ScalarType "oid"),("cfgowner",ScalarType "oid"),("cfgparser",ScalarType "oid")]),("pg_ts_config_map",TableComposite,UnnamedCompositeType [("mapcfg",ScalarType "oid"),("maptokentype",ScalarType "int4"),("mapseqno",ScalarType "int4"),("mapdict",ScalarType "oid")]),("pg_ts_dict",TableComposite,UnnamedCompositeType [("dictname",ScalarType "name"),("dictnamespace",ScalarType "oid"),("dictowner",ScalarType "oid"),("dicttemplate",ScalarType "oid"),("dictinitoption",ScalarType "text")]),("pg_ts_parser",TableComposite,UnnamedCompositeType [("prsname",ScalarType "name"),("prsnamespace",ScalarType "oid"),("prsstart",ScalarType "regproc"),("prstoken",ScalarType "regproc"),("prsend",ScalarType "regproc"),("prsheadline",ScalarType "regproc"),("prslextype",ScalarType "regproc")]),("pg_ts_template",TableComposite,UnnamedCompositeType [("tmplname",ScalarType "name"),("tmplnamespace",ScalarType "oid"),("tmplinit",ScalarType "regproc"),("tmpllexize",ScalarType "regproc")]),("pg_type",TableComposite,UnnamedCompositeType [("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")]),("pg_user_mapping",TableComposite,UnnamedCompositeType [("umuser",ScalarType "oid"),("umserver",ScalarType "oid"),("umoptions",ArrayType (ScalarType "text"))]),("pg_cursors",ViewComposite,UnnamedCompositeType [("name",ScalarType "text"),("statement",ScalarType "text"),("is_holdable",ScalarType "bool"),("is_binary",ScalarType "bool"),("is_scrollable",ScalarType "bool"),("creation_time",ScalarType "timestamptz")]),("pg_group",ViewComposite,UnnamedCompositeType [("groname",ScalarType "name"),("grosysid",ScalarType "oid"),("grolist",ArrayType (ScalarType "oid"))]),("pg_indexes",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("tablename",ScalarType "name"),("indexname",ScalarType "name"),("tablespace",ScalarType "name"),("indexdef",ScalarType "text")]),("pg_locks",ViewComposite,UnnamedCompositeType [("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")]),("pg_prepared_statements",ViewComposite,UnnamedCompositeType [("name",ScalarType "text"),("statement",ScalarType "text"),("prepare_time",ScalarType "timestamptz"),("parameter_types",ArrayType (ScalarType "regtype")),("from_sql",ScalarType "bool")]),("pg_prepared_xacts",ViewComposite,UnnamedCompositeType [("transaction",ScalarType "xid"),("gid",ScalarType "text"),("prepared",ScalarType "timestamptz"),("owner",ScalarType "name"),("database",ScalarType "name")]),("pg_roles",ViewComposite,UnnamedCompositeType [("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")]),("pg_rules",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("tablename",ScalarType "name"),("rulename",ScalarType "name"),("definition",ScalarType "text")]),("pg_settings",ViewComposite,UnnamedCompositeType [("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")]),("pg_shadow",ViewComposite,UnnamedCompositeType [("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"))]),("pg_stat_activity",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_all_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_all_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_bgwriter",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_database",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_sys_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_sys_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_user_functions",ViewComposite,UnnamedCompositeType [("funcid",ScalarType "oid"),("schemaname",ScalarType "name"),("funcname",ScalarType "name"),("calls",ScalarType "int8"),("total_time",ScalarType "int8"),("self_time",ScalarType "int8")]),("pg_stat_user_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_stat_user_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_all_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_all_sequences",ViewComposite,UnnamedCompositeType [("relid",ScalarType "oid"),("schemaname",ScalarType "name"),("relname",ScalarType "name"),("blks_read",ScalarType "int8"),("blks_hit",ScalarType "int8")]),("pg_statio_all_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_sys_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_sys_sequences",ViewComposite,UnnamedCompositeType [("relid",ScalarType "oid"),("schemaname",ScalarType "name"),("relname",ScalarType "name"),("blks_read",ScalarType "int8"),("blks_hit",ScalarType "int8")]),("pg_statio_sys_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_user_indexes",ViewComposite,UnnamedCompositeType [("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")]),("pg_statio_user_sequences",ViewComposite,UnnamedCompositeType [("relid",ScalarType "oid"),("schemaname",ScalarType "name"),("relname",ScalarType "name"),("blks_read",ScalarType "int8"),("blks_hit",ScalarType "int8")]),("pg_statio_user_tables",ViewComposite,UnnamedCompositeType [("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")]),("pg_stats",ViewComposite,UnnamedCompositeType [("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")]),("pg_tables",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("tablename",ScalarType "name"),("tableowner",ScalarType "name"),("tablespace",ScalarType "name"),("hasindexes",ScalarType "bool"),("hasrules",ScalarType "bool"),("hastriggers",ScalarType "bool")]),("pg_timezone_abbrevs",ViewComposite,UnnamedCompositeType [("abbrev",ScalarType "text"),("utc_offset",ScalarType "interval"),("is_dst",ScalarType "bool")]),("pg_timezone_names",ViewComposite,UnnamedCompositeType [("name",ScalarType "text"),("abbrev",ScalarType "text"),("utc_offset",ScalarType "interval"),("is_dst",ScalarType "bool")]),("pg_user",ViewComposite,UnnamedCompositeType [("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"))]),("pg_user_mappings",ViewComposite,UnnamedCompositeType [("umid",ScalarType "oid"),("srvid",ScalarType "oid"),("srvname",ScalarType "name"),("umuser",ScalarType "oid"),("usename",ScalarType "name"),("umoptions",ArrayType (ScalarType "text"))]),("pg_views",ViewComposite,UnnamedCompositeType [("schemaname",ScalarType "name"),("viewname",ScalarType "name"),("viewowner",ScalarType "name"),("definition",ScalarType "text")])], scopeAttrSystemColumns = [("pg_aggregate",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_am",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_amop",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_amproc",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_attrdef",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_attribute",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_auth_members",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_authid",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_cast",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_class",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_constraint",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_conversion",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_database",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_depend",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_description",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_enum",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_foreign_data_wrapper",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_foreign_server",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_index",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_inherits",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_language",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_largeobject",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_listener",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_namespace",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_opclass",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_operator",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_opfamily",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_pltemplate",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_proc",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_rewrite",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_shdepend",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_shdescription",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_statistic",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_tablespace",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_trigger",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_config",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_config_map",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("ctid",ScalarType "tid")]),("pg_ts_dict",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_parser",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_ts_template",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_type",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")]),("pg_user_mapping",TableComposite,UnnamedCompositeType [("tableoid",ScalarType "oid"),("cmax",ScalarType "cid"),("xmax",ScalarType "xid"),("cmin",ScalarType "cid"),("xmin",ScalarType "xid"),("oid",ScalarType "oid"),("ctid",ScalarType "tid")])], scopeIdentifierTypes = [], scopeJoinIdentifiers = []}
+ Database/HsSqlPpp/TypeChecking/DefaultScopeEmpty.hs view
@@ -0,0 +1,23 @@+{-# OPTIONS_HADDOCK hide #-}+{-+Copyright 2009 Jake Wheat++If you change the scope datatype, the DefaultScope.hs file will be+invalid, and you can't use HsSqlSystem to generate a new one since it+depends on DefaultScope. The solution is to copy this file over+DefaultScope. You can then use HsSqlSystem to generate a new default+scope file.++TODO: don't use show to save and load the default scope, use+data.binary to serialize and unserialize it.++-}++module Database.HsSqlPpp.TypeChecking.DefaultScope where++import Database.HsSqlPpp.TypeChecking.TypeType+import Database.HsSqlPpp.TypeChecking.ScopeData+++defaultScope :: Scope+defaultScope = emptyScope
+ Database/HsSqlPpp/TypeChecking/Scope.lhs view
@@ -0,0 +1,37 @@+Copyright 2009 Jake Wheat++This module just forwards the public components of ScopeData,+ScopeReader and DefaultScope. Some of the exported functions in+ScopeData are only used by the type checker and are not fowarded.+Don't really know if using the word scope for this is correct English?++> {- | This module contains the scope data type and a few helper functions,+> not really ready for public consumption yet. It 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 - 'defaultScope', at some point this will allow typechecking+> sql code against this catalog without having an available+> postgresql install .+>+> * it is also used internally in the type checker to hold identifiers+> valid and their types in a given context, and to build the+> additional catalog information so that e.g. a sql file containing+> a create table followed by a select from that table will type+> check ok. (This isn't quite working yet but it's almost there.)+> -}+> module Database.HsSqlPpp.TypeChecking.Scope+> (+> --fowarded scopedata+> Scope(..)+> ,QualifiedScope+> ,emptyScope+> ,combineScopes+> ,readScope+> ,defaultScope+> ) where++> import Database.HsSqlPpp.TypeChecking.ScopeData+> import Database.HsSqlPpp.TypeChecking.ScopeReader+> import Database.HsSqlPpp.TypeChecking.DefaultScope
+ Database/HsSqlPpp/TypeChecking/ScopeData.lhs view
@@ -0,0 +1,148 @@+Copyright 2009 Jake Wheat++Represents the types, identifiers, etc available. Used internally for+static and changing scopes in the type checker, as well as the input+to the type checking routines if you want to supply different/extra+definitions before type checking something, and you're not getting the+extra definitions from an accessible database.++> {-# OPTIONS_HADDOCK hide #-}++> module Database.HsSqlPpp.TypeChecking.ScopeData+> (+> Scope(..)+> ,QualifiedScope+> ,emptyScope+> ,scopeReplaceIds+> ,scopeLookupID+> ,scopeExpandStar+> ,combineScopes+> ) where++> import Data.List+> import Debug.Trace++> import Database.HsSqlPpp.TypeChecking.TypeType++> data Scope = Scope {scopeTypes :: [Type]+> ,scopeTypeNames :: [(String, Type)]+> ,scopeDomainDefs :: [DomainDefinition]+> ,scopeCasts :: [(Type,Type,CastContext)]+> ,scopeTypeCategories :: [(Type,String,Bool)]+> ,scopePrefixOperators :: [FunctionPrototype]+> ,scopePostfixOperators :: [FunctionPrototype]+> ,scopeBinaryOperators :: [FunctionPrototype]+> ,scopeFunctions :: [FunctionPrototype]+> ,scopeAggregates :: [FunctionPrototype]+> --this should be done better:+> ,scopeAllFns :: [FunctionPrototype]+> ,scopeAttrDefs :: [CompositeDef]+> ,scopeAttrSystemColumns :: [CompositeDef]+> ,scopeIdentifierTypes :: [QualifiedScope]+> ,scopeJoinIdentifiers :: [String]}+> deriving (Eq,Show)++= 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.++scopeIdentifierTypes 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.++> type QualifiedScope = (String, ([(String,Type)], [(String,Type)]))++> -- | scope containing nothing+> emptyScope :: Scope+> emptyScope = Scope [] [] [] [] [] [] [] [] [] [] [] [] [] [] []++> scopeReplaceIds :: Scope -> [QualifiedScope] -> [String] -> Scope+> scopeReplaceIds scope ids commonJoinFields =+> scope { scopeIdentifierTypes = ids+> ,scopeJoinIdentifiers = commonJoinFields }++> catPair :: ([a],[a]) -> [a]+> catPair = uncurry (++)++> scopeLookupID :: Scope -> String -> String -> Either [TypeError] Type+> scopeLookupID scope correlationName iden =+> if correlationName == ""+> then let types = concatMap (filter (\ (s, _) -> s == iden))+> (map (catPair.snd) $ scopeIdentifierTypes scope)+> in case length types of+> 0 -> Left [UnrecognisedIdentifier iden]+> 1 -> Right $ (snd . head) types+> _ -> --see if this identifier is in the join list+> if iden `elem` scopeJoinIdentifiers scope+> then Right $ (snd . head) types+> else Left [AmbiguousIdentifier iden]+> else case lookup correlationName (scopeIdentifierTypes scope) of+> Nothing -> Left [UnrecognisedCorrelationName correlationName]+> Just s -> case lookup iden (catPair s) of+> Nothing -> Left [UnrecognisedIdentifier $ correlationName ++ "." ++ iden]+> Just t -> Right t++> scopeExpandStar :: Scope -> String -> Either [TypeError] [(String,Type)]+> scopeExpandStar scope correlationName =+> if correlationName == ""+> then let allFields = concatMap (fst.snd) $ scopeIdentifierTypes scope+> (commonFields,uncommonFields) =+> partition (\(a,_) -> a `elem` scopeJoinIdentifiers scope) allFields+> in Right $ nub commonFields ++ uncommonFields+> else+> case lookup correlationName $ scopeIdentifierTypes scope of+> Nothing -> Left [UnrecognisedCorrelationName correlationName]+> Just s -> Right $ fst s+++> -- | combine two scopes, e.g. this can be used to take the default scope and+> -- add a few definitions to it before type checking an ast+> combineScopes :: Scope -- ^ base scope+> -> Scope -- ^ additional scope - this adds to and overrides items in the base scope+> -> Scope+> --base, overrides+> combineScopes (Scope bt btn bdod bc btc bpre bpost bbin bf bagg baf bcd basc _ _)+> (Scope ot otn odod oc otc opre opost obin off oagg oaf ocd oasc oi oji) =+> Scope (funion ot bt)+> (funion otn btn)+> (funion odod bdod)+> (funion oc bc)+> (funion otc btc)+> (funion opre bpre)+> (funion opost bpost)+> (funion obin bbin)+> (funion off bf)+> (funion oagg bagg)+> (funion oaf baf)+> (funion ocd bcd)+> (funion oasc basc)+> oi -- overwrites old scopes, might need to be looked at again+> oji+> where+> --without this it runs very slowly - guessing because it creates+> --a lot of garbage+> funion a b = case () of+> _ | a == [] -> b+> | b == [] -> a+> | otherwise -> union a b++combine scopes still seems to run slowly, so change it so that it+chains scope lookups along a list of scopes instead of unioning the+individual lists.
+ Database/HsSqlPpp/TypeChecking/ScopeReader.lhs view
@@ -0,0 +1,233 @@+Copyright 2009 Jake Wheat++This file contains the code to read all the scope data from a+postgresql database catalog. This is used to generate the default+scope, and to type check against a database schema in a live database.++It basically runs through each field in the Scope data type and reads+the values for that field out of the database, and turns it into the+appropriate data types.++Maps are use to hold oids during this process to e.g. hook up the+types of table columns (which are read as oids which refer to the+pg_type table) to the haskell values represent those types. These maps+are discarded after the Scope value is created.++> {-# OPTIONS_HADDOCK hide #-}++> module Database.HsSqlPpp.TypeChecking.ScopeReader (readScope) where++> import qualified Data.Map as M+> import Data.Maybe++> import Debug.Trace++> import Database.HsSqlPpp.Dbms.DBAccess+> import Database.HsSqlPpp.TypeChecking.ScopeData+> import Database.HsSqlPpp.TypeChecking.TypeType++> -- | creates a scope value from the database given+> readScope :: String -- ^ name of the database to read+> -> IO Scope+> readScope dbName = withConn ("dbname=" ++ dbName) $ \conn -> do+> typeInfo <- selectRelation conn+> "select t.oid as oid,\n\+> \ t.typtype,\n\+> \ t.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\+> \ 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+> types = map snd typeAssoc+> typeNames = map (\(_,a,b) -> (b,a)) typeStuff++> domainDefInfo <- selectRelation conn+> "select oid, typbasetype\n\+> \from pg_type 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)))+> typeCatInfo <- selectRelation conn+> "select pg_type.oid, typcategory, typispreferred from pg_type\n\+> \where pg_catalog.pg_type_is_visible(pg_type.oid);" []+> let typeCats = flip map typeCatInfo+> (\l -> (jlt (l!!0), l!!1, read (l!!2)::Bool))+> 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+++> attrInfo <- selectRelation conn+> "select distinct\n\+> \ cls.relkind,\n\+> \ cls.relname,\n\+> \ array_to_string(\n\+> \ array_agg(attname || ';' || atttypid)\n\+> \ over (partition by relname order by attnum\n\+> \ range between unbounded preceding\n\+> \ and unbounded following)\n\+> \ ,',')\n\+> \ from pg_attribute att\n\+> \ inner join pg_class cls\n\+> \ on cls.oid = attrelid\n\+> \ where\n\+> \ pg_catalog.pg_table_is_visible(cls.oid)\n\+> \ and cls.relkind in ('r','v','c')\n\+> \ and not attisdropped\n\+> \ and attnum > 0\n\+> \ order by relkind, relname;" []+> let attrs = map (convAttrRow jlt) attrInfo++> systemAttrInfo <- selectRelation conn+> "select distinct\n\+> \ cls.relkind,\n\+> \ cls.relname,\n\+> \ array_to_string(\n\+> \ array_agg(attname || ';' || atttypid)\n\+> \ over (partition by relname order by attnum\n\+> \ range between unbounded preceding\n\+> \ and unbounded following)\n\+> \ ,',')\n\+> \ from pg_attribute att\n\+> \ inner join pg_class cls\n\+> \ on cls.oid = attrelid\n\+> \ where\n\+> \ pg_catalog.pg_table_is_visible(cls.oid)\n\+> \ and cls.relkind in ('r','v','c')\n\+> \ and not attisdropped\n\+> \ and attnum < 0\n\+> \ order by relkind, relname;" []+> let systemAttrs = map (convAttrRow jlt) systemAttrInfo++> return Scope {scopeTypes = types+> ,scopeTypeNames = typeNames+> ,scopeDomainDefs = domainDefs+> ,scopeCasts = casts+> ,scopeTypeCategories = typeCats+> ,scopePrefixOperators = prefixOps+> ,scopePostfixOperators = postfixOps+> ,scopeBinaryOperators = binaryOps+> ,scopeFunctions = fnProts+> ,scopeAggregates = aggProts+> ,scopeAllFns = (prefixOps ++ postfixOps +++> binaryOps ++ fnProts ++ aggProts)+> ,scopeAttrDefs = attrs+> ,scopeAttrSystemColumns = systemAttrs+> ,scopeIdentifierTypes = []+> ,scopeJoinIdentifiers = []}++> where+> convAttrRow jlt l =+> (l!!1, ty, atts)+> where+> ty = case l!!0 of+> "r" -> TableComposite+> "v" -> ViewComposite+> "c" -> Composite+> x -> error $ "internal error: unknown composite type: " ++ x+> atts = let ps = split ',' (l!!2)+> ps1 = map (split ';') ps+> in UnnamedCompositeType $ 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" -> CompositeType+> "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]+++> split :: Char -> String -> [String]+> split _ "" = []+> split c s = let (l, s') = break (== c) s+> in l : case s' of+> [] -> []+> (_:s'') -> split c s''
+ Database/HsSqlPpp/TypeChecking/TypeChecker.lhs view
@@ -0,0 +1,61 @@+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 some of the ast node data types, but not all of them (yet?);+>+> * types annotations are attached to most nodes;+>+> * 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 nodes, but doesn't do a great job yet.+>+> -}+> module Database.HsSqlPpp.TypeChecking.TypeChecker+> (+> -- * Annotation type+> Annotation+> ,AnnotationElement(..)+> -- * SQL types+> ,Type (..)+> ,PseudoType (..)+> -- * Type errors+> ,TypeError (..)+> -- * Statement info+> -- | This is the main annotation attached to each statement. Early days at the moment+> -- but will be expanded to provide any type errors lurking inside a statement, any useful+> -- types, e.g. the types of each select and subselect/sub query in a statement,+> -- any changes to the catalog the statement makes, and possibly much more information.+> ,StatementInfo(..)+> -- * Additional types+> -- | Used in Scope and type checking.+> ,DomainDefinition+> ,FunctionPrototype+> ,CastContext+> ,CompositeDef+> ,CompositeFlavour+> -- * Annotation functions+> ,annotateAst+> ,annotateAstScope+> ,annotateExpression+> -- * Annotated tree utils+> ,getTopLevelTypes+> ,getTopLevelInfos+> ,getTypeErrors+> ,stripAnnotations+> ) where++> import Database.HsSqlPpp.TypeChecking.AstInternal+> import Database.HsSqlPpp.TypeChecking.TypeType+> import Database.HsSqlPpp.TypeChecking.AstAnnotation
+ Database/HsSqlPpp/TypeChecking/TypeChecking.ag view
@@ -0,0 +1,1086 @@+{-+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...).++The main current limitation is that the ddl statements aren't passed+on in the scope so e.g. it doesn't type check a create table followed+by a select from that table. The support for this is nearly complete+and it should be working very soon.++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 Monad and TypeCheckFailed+is used to do error handling.++TODO: document pattern of typecheckfailed propagation, loc.tpe usage.++================================================================================++= main attributes used++Here are the main attributes used in the type checking:++scope is used to chain the scopes up and down the tree, to allow+access to the catalog information, and to store the in scope+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+ [ scope : Scope+ |+ | annotatedTree : SELF+ ]++{-+================================================================================++= expressions++-}++{+annTypesAndErrors :: Annotated a => a -> Type -> [TypeError]+ -> Maybe AnnotationElement -> a+annTypesAndErrors item nt errs add =+ changeAnn item $+ (([TypeAnnotation nt] ++ maybeToList add +++ map TypeErrorA errs) ++)+}+SEM Expression+ | IntegerLit StringLit FloatLit BooleanLit NullLit FunCall Identifier+ Exists Case CaseSimple Cast InPredicate ScalarSubQuery+ --PositionalArg WindowFn+ lhs.annotatedTree = annTypesAndErrors @loc.backTree+ (errorToTypeFail @loc.tpe)+ (getErrors @loc.tpe)+ Nothing++{-+== literals+-}++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++SEM Expression+ | IntegerLit loc.tpe = Right typeInt+ | StringLit loc.tpe = Right UnknownStringLit+ | FloatLit loc.tpe = Right typeNumeric+ | BooleanLit loc.tpe = Right typeBool+ -- I think a null types like an unknown string lit+ | NullLit loc.tpe = Right UnknownStringLit+++{-++== cast expression++-}++SEM Expression+ | Cast loc.tpe = @tn.namedType+ loc.backTree = Cast @ann @expr.annotatedTree @tn.annotatedTree++{-++== type names++Types with type modifiers (called PrecTypeName here, to be changed),+are not supported at the moment.++-}++ATTR TypeName+ [+ |+ | namedType : {Either [TypeError] Type}+ ]++SEM TypeName+ | SimpleTypeName+ lhs.namedType = lookupTypeByName @lhs.scope $ canonicalizeTypeName @tn+ lhs.annotatedTree = SimpleTypeName @tn+ | ArrayTypeName+ lhs.namedType = ArrayType <$> @typ.namedType+ lhs.annotatedTree = ArrayTypeName @typ.annotatedTree+ | SetOfTypeName+ lhs.namedType = SetOfType <$> @typ.namedType+ lhs.annotatedTree = SetOfTypeName @typ.annotatedTree+ | PrecTypeName+ lhs.namedType = Right TypeCheckFailed+ lhs.annotatedTree = PrecTypeName @tn @prec++{-+== operators and functions+-}+SEM Expression+ | FunCall+ loc.tpe = checkTypes @args.typeList $+ typeCheckFunCall+ @lhs.scope+ @funName+ @args.typeList+ loc.backTree = FunCall @ann @funName @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 =+ checkTypes @loc.whenTypes $ do+ when (any (/= typeBool) @loc.whenTypes) $+ Left [WrongTypes typeBool @loc.whenTypes]+ checkTypes @loc.thenTypes $+ resolveResultSetType+ @lhs.scope+ @loc.thenTypes+ loc.backTree = Case @ann @cases.annotatedTree @els.annotatedTree+++SEM Expression+ | CaseSimple+ loc.tpe =+ checkTypes @loc.whenTypes $ do+ checkWhenTypes <- resolveResultSetType+ @lhs.scope+ (getTypeAnnotation @value.annotatedTree: @loc.whenTypes)+ checkTypes @loc.thenTypes $+ resolveResultSetType+ @lhs.scope+ @loc.thenTypes+ loc.backTree = CaseSimple @ann @value.annotatedTree @cases.annotatedTree @els.annotatedTree++{-+== identifiers+pull id types out of scope for identifiers++-}++SEM Expression+ | Identifier+ loc.tpe = let (correlationName,iden) = splitIdentifier @i+ in scopeLookupID @lhs.scope correlationName iden+ loc.backTree = Identifier @ann @i++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 = let selType = getTypeAnnotation @sel.annotatedTree+ in checkTypes [selType]+ $ let f = map snd $ unwrapComposite $ unwrapSetOf selType+ in case length f of+ 0 -> error "internal error: no columns in scalar subquery?"+ 1 -> Right $ head f+ _ -> Right $ RowCtor f++ loc.backTree = ScalarSubQuery @ann @sel.annotatedTree+{-+== inlist+-}++SEM Expression+ | InPredicate+ loc.tpe = do+ lt <- @list.listType+ ty <- resolveResultSetType+ @lhs.scope+ [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.scope+ @exprs.typeList+ | InSelect+ lhs.listType =+ let attrs = map snd $ unwrapComposite $ unwrapSetOf $ getTypeAnnotation @sel.annotatedTree+ typ = case length attrs of+ 0 -> error "internal error - got subquery with no columns? in inselect"+ 1 -> head attrs+ _ -> RowCtor attrs+ in checkTypes attrs $ Right typ++++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 = []+++{-+================================================================================++= statements++-}++SEM Statement+ | SelectStatement Insert Update Delete CreateView CreateDomain+ CreateFunction CreateType CreateTable+ lhs.annotatedTree = annTypesAndErrors @loc.backTree+ (errorToTypeFail @loc.tpe)+ (getErrors @loc.tpe)+ $ Just $ StatementInfoA @loc.statementInfo+{-++================================================================================++= basic select statements++== nodeTypes++-}++SEM Statement+ | SelectStatement+ loc.tpe = checkTypes [getTypeAnnotation @ex.annotatedTree] $ Right $ Pseudo Void+ loc.statementInfo = SelectInfo $ getTypeAnnotation @ex.annotatedTree+ loc.backTree = SelectStatement @ann @ex.annotatedTree+++SEM SelectExpression+ | Values Select CombineSelect+ lhs.annotatedTree = annTypesAndErrors @loc.backTree+ (errorToTypeFail @loc.tpe)+ (getErrors @loc.tpe)+ Nothing++{+checkExpressionBool :: Maybe Expression -> Either [TypeError] Type+checkExpressionBool whr = do+ let ty = fromMaybe typeBool $ fmap getTypeAnnotation whr+ when (ty `notElem` [typeBool, TypeCheckFailed]) $+ Left [ExpressionMustBeBool]+ return ty+}++SEM SelectExpression+ | Values+ loc.tpe = typeCheckValuesExpr+ @lhs.scope+ @vll.typeListList+ loc.backTree = Values @ann @vll.annotatedTree+ | Select+ loc.tpe =+ do+ whereType <- checkExpressionBool @selWhere.annotatedTree+ let trefType = fromMaybe typeBool $ fmap getTypeAnnotation+ @selTref.annotatedTree+ slType = @selSelectList.listType+ chainTypeCheckFailed [trefType, whereType, slType] $+ Right $ case slType of+ UnnamedCompositeType [(_,Pseudo Void)] -> Pseudo Void+ _ -> SetOfType slType+ loc.backTree = Select @ann+ @selDistinct.annotatedTree+ @selSelectList.annotatedTree+ @selTref.annotatedTree+ @selWhere.annotatedTree+ @selGroupBy.annotatedTree+ @selHaving.annotatedTree+ @selOrderBy.annotatedTree+ @selDir.annotatedTree+ @selLimit.annotatedTree+ @selOffset.annotatedTree+ | CombineSelect+ loc.tpe =+ let sel1t = getTypeAnnotation @sel1.annotatedTree+ sel2t = getTypeAnnotation @sel2.annotatedTree+ in checkTypes [sel1t, sel2t] $+ typeCheckCombineSelect @lhs.scope sel1t sel2t+ loc.backTree = CombineSelect @ann @ctype.annotatedTree+ @sel1.annotatedTree+ @sel2.annotatedTree++{+getTbCols = unwrapComposite . unwrapSetOf . getTypeAnnotation+}++ATTR TableRef MTableRef+ [+ |+ | idens : {[QualifiedScope]}+ joinIdens : {[String]}+ ]++SEM TableRef+ | SubTref TrefAlias Tref TrefFun TrefFunAlias JoinedTref+ lhs.annotatedTree = annTypesAndErrors @loc.backTree+ (errorToTypeFail @loc.tpe)+ (getErrors @loc.tpe)+ Nothing++SEM TableRef+ | SubTref loc.tpe = checkTypes [getTypeAnnotation @sel.annotatedTree] $+ Right $ unwrapSetOfComposite $ getTypeAnnotation @sel.annotatedTree+ loc.backTree = SubTref @ann @sel.annotatedTree @alias+ lhs.idens = [(@alias, (getTbCols @sel.annotatedTree, []))]+ lhs.joinIdens = []+ | TrefAlias Tref+ loc.tpe = either Left (Right . fst) @loc.relType+ lhs.joinIdens = []+ loc.relType = getRelationType @lhs.scope @tbl+ loc.unwrappedRelType = either (const ([], [])) (both unwrapComposite) @loc.relType+ | Tref+ lhs.idens = [(@tbl, @loc.unwrappedRelType)]+ loc.backTree = Tref @ann @tbl+ | TrefAlias+ lhs.idens = [(@alias, @loc.unwrappedRelType)]+ loc.backTree = TrefAlias @ann @tbl @alias+ | TrefFun TrefFunAlias+ loc.tpe = getFnType @lhs.scope @alias @fn.annotatedTree+ lhs.joinIdens = []+ lhs.idens = case getFunIdens+ @lhs.scope @loc.alias+ @fn.annotatedTree of+ Left e -> []+ Right x -> [second (\l -> (unwrapComposite l, [])) x]+ | TrefFun+ loc.alias = ""+ loc.backTree = TrefFun @ann @fn.annotatedTree+ | TrefFunAlias+ loc.alias = @alias+ loc.backTree = TrefFunAlias @ann @fn.annotatedTree @alias+ | JoinedTref+ loc.tpe =+ checkTypes [tblt+ ,tbl1t] $+ case (@nat.annotatedTree, @onExpr.annotatedTree) of+ (Natural, _) -> unionJoinList $+ commonFieldNames tblt tbl1t+ (_,Just (JoinUsing s)) -> unionJoinList s+ _ -> unionJoinList []+ where+ tblt = getTypeAnnotation @tbl.annotatedTree+ tbl1t = getTypeAnnotation @tbl1.annotatedTree+ unionJoinList s =+ combineTableTypesWithUsingList @lhs.scope s tblt tbl1t+ lhs.idens = @tbl.idens ++ @tbl1.idens+ lhs.joinIdens = commonFieldNames (getTypeAnnotation @tbl.annotatedTree)+ (getTypeAnnotation @tbl1.annotatedTree)+ loc.backTree = JoinedTref @ann+ @tbl.annotatedTree+ @nat.annotatedTree+ @joinType.annotatedTree+ @tbl1.annotatedTree+ @onExpr.annotatedTree++{++getFnType :: Scope -> String -> Expression -> Either [TypeError] Type+getFnType scope alias =+ either Left (Right . snd) . getFunIdens scope alias++getFunIdens :: Scope -> String -> Expression -> Either [TypeError] (String,Type)+getFunIdens scope alias fnVal =+ case fnVal of+ FunCall _ f _ ->+ let correlationName = if alias /= ""+ then alias+ else f+ in Right (correlationName, case getTypeAnnotation fnVal of+ SetOfType (CompositeType t) -> getCompositeType t+ SetOfType x -> UnnamedCompositeType [(correlationName,x)]+ y -> UnnamedCompositeType [(correlationName,y)])+ x -> Left [ContextError "FunCall"]+ where+ getCompositeType t =+ case getAttrs scope [Composite+ ,TableComposite+ ,ViewComposite] t of+ Just ((_,_,a@(UnnamedCompositeType _)), _) -> a+ _ -> UnnamedCompositeType []+}++SEM MTableRef+ | Nothing+ lhs.idens = []+ lhs.joinIdens = []++ATTR SelectItemList SelectList+ [+ |+ | listType : Type+ ]++SEM SelectItemList+ | Cons lhs.listType = doSelectItemListTpe @lhs.scope @hd.columnName @hd.itemType @tl.listType+ | Nil lhs.listType = UnnamedCompositeType []++ATTR SelectItem+ [+ |+ | itemType : Type+ ]++SEM SelectItem+ | SelExp SelectItem+ lhs.itemType = getTypeAnnotation @ex.annotatedTree++-- hack to fix up for errors for ok *+SEM SelectItem+ | SelExp+ loc.annotatedTree = SelExp $ fixStar @ex.annotatedTree+ | SelectItem+ loc.backTree = SelectItem (fixStar @ex.annotatedTree) @name++{+fixStar ex =+ changeAnnRecurse fs ex+ where+ fs 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+}++--[TypeAnnotation TypeCheckFailed,TypeErrorA (UnrecognisedIdentifier "*")]++SEM SelectList+ | SelectList+ lhs.listType = @items.listType+++{-++== scope passing++scope 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)++ 1. from+ 2. where+ 3. group by+ 4. having+ 5. select++-}++SEM SelectExpression+ | Select+ selSelectList.scope = scopeReplaceIds @lhs.scope @selTref.idens @selTref.joinIdens+ selWhere.scope = scopeReplaceIds @lhs.scope @selTref.idens @selTref.joinIdens++{-++== attributes++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++ATTR Expression+ [+ |+ | liftedColumnName USE {`(fixedValue "")`} {""}: String+ ]++{+fixedValue :: a -> a -> a -> a+fixedValue a _ _ = a+}++{-+override for identifier nodes, this only makes it out to the selectitem+node if the identifier is not wrapped in parens, function calls, etc.+-}++SEM Expression+ | Identifier lhs.liftedColumnName = @i+ | FunCall lhs.liftedColumnName =+ if isOperator @funName+ then ""+ else @funName+ | Cast lhs.liftedColumnName = case @tn.annotatedTree of+ SimpleTypeName tn -> tn+ _ -> ""++-- 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+++{-+================================================================================++= insert++-}++SEM Statement+ | Insert+ loc.columnStuff =+ checkColumnConsistency @lhs.scope+ @table+ @targetCols.strings+ (unwrapComposite $ unwrapSetOf $+ getTypeAnnotation @insData.annotatedTree)+ loc.tpe =+ checkTypes [getTypeAnnotation @insData.annotatedTree] $ do+ @loc.columnStuff+ Right $ Pseudo Void+ loc.statementInfo =+ InsertInfo @table $ errorToTypeFailF UnnamedCompositeType @loc.columnStuff+ loc.backTree = Insert @ann @table @targetCols.annotatedTree+ @insData.annotatedTree @returning+++ATTR StringList+ [+ |+ | strings : {[String]}+ ]++SEM StringList+ | Cons lhs.strings = @hd : @tl.strings+ | Nil lhs.strings = []++{-+================================================================================++= update++-}++{++}++SEM Statement+ | Update+ loc.tpe =+ do+ let re = checkRelationExists @lhs.scope @table+ when (isJust re) $+ Left [fromJust $ re]+ whereType <- checkExpressionBool @whr.annotatedTree+ chainTypeCheckFailed (whereType:map snd @assigns.pairs) $ do+ @loc.columnsConsistent+ checkErrorList @assigns.rowSetErrors $ Pseudo Void+ loc.columnsConsistent =+ checkColumnConsistency @lhs.scope @table (map fst @assigns.pairs) @assigns.pairs+ loc.statementInfo =+ UpdateInfo @table $ flip errorToTypeFailF @loc.columnsConsistent $+ \c -> let colNames = map fst @assigns.pairs+ in UnnamedCompositeType $ map (\t -> (t,getType c t)) colNames++ where+ getType cols t = fromJust $ lookup t cols+ loc.backTree = Update @ann @table @assigns.annotatedTree @whr.annotatedTree @returning++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 [RowCtor ts] = ts+getRowTypes ts = ts+}++{-+================================================================================++= delete+-}++SEM Statement+ | Delete+ loc.tpe =+ case checkRelationExists @lhs.scope @table of+ Just e -> Left [e]+ Nothing -> do+ whereType <- checkExpressionBool @whr.annotatedTree+ return $ Pseudo Void+ loc.statementInfo = DeleteInfo @table+ loc.backTree = Delete @ann @table @whr.annotatedTree @returning++{-+================================================================================++= create table++scope needs to be modified:+types, typenames, typecats, attrdefs, systemcolumns++produces a compositedef: (name, tablecomposite, unnamedcomp [(attrname, type)])++-}+ATTR AttributeDef+ [+ |+ | attrName : String+ namedType : {Either [TypeError] Type}+ ]++SEM AttributeDef+ | AttributeDef+ lhs.attrName = @name+ lhs.namedType = @typ.namedType++ATTR AttributeDefList+ [+ |+ | attrs : {[(String, Either [TypeError] Type)]}+ ]++SEM AttributeDefList+ | Cons lhs.attrs = (@hd.attrName, @hd.namedType) : @tl.attrs+ | Nil lhs.attrs = []++SEM Statement+ | CreateTable+ loc.attrTypes = map snd @atts.attrs+ loc.tpe = checkErrorList (concat $ lefts @loc.attrTypes) $ Pseudo Void+ loc.compositeType =+ errorToTypeFailF (const $ UnnamedCompositeType doneAtts) @loc.tpe+ where+ doneAtts = map (second errorToTypeFail) @atts.attrs+ loc.backTree = CreateTable @ann @name @atts.annotatedTree @cons.annotatedTree+ loc.statementInfo = RelvarInfo (@name, TableComposite, @loc.compositeType)++SEM Statement+ | CreateTableAs+ loc.selType = getTypeAnnotation @expr.annotatedTree+ loc.tpe = Right @loc.selType+ loc.backTree = CreateTableAs @ann @name @expr.annotatedTree+ loc.statementInfo = RelvarInfo (@name, TableComposite, @loc.selType)+{-+================================================================================++= create view++-}++SEM Statement+ | CreateView+ loc.tpe = checkTypes [getTypeAnnotation @expr.annotatedTree] $ Right $ Pseudo Void+ loc.backTree = CreateView @ann @name @expr.annotatedTree+ loc.statementInfo = RelvarInfo (@name, ViewComposite, getTypeAnnotation @expr.annotatedTree)+++{-+================================================================================++= create type++-}+ATTR TypeAttributeDef+ [+ |+ | attrName : String+ namedType : {Either [TypeError] Type}+ ]+++SEM TypeAttributeDef+ | TypeAttDef+ lhs.attrName = @name+ lhs.namedType = @typ.namedType++ATTR TypeAttributeDefList+ [+ |+ | attrs : {[(String, Either [TypeError] Type)]}+ ]++SEM TypeAttributeDefList+ | Cons lhs.attrs = (@hd.attrName, @hd.namedType) : @tl.attrs+ | Nil lhs.attrs = []++SEM Statement+ | CreateType+ loc.attrTypes = map snd @atts.attrs+ loc.tpe =+ checkErrorList (concat $ lefts @loc.attrTypes) $ Pseudo Void+ loc.compositeType =+ errorToTypeFailF (const $ UnnamedCompositeType doneAtts) @loc.tpe+ where+ doneAtts = map (second errorToTypeFail) @atts.attrs+ loc.backTree = CreateType @ann @name @atts.annotatedTree+ loc.statementInfo = RelvarInfo (@name, Composite, @loc.compositeType)+{-++================================================================================++= create domain++-}++SEM Statement+ | CreateDomain+ loc.namedTypeType = case @typ.namedType of+ Left _ -> TypeCheckFailed+ Right x -> x+ loc.tpe = checkTypes [@loc.namedTypeType] $ Right $ Pseudo Void+ loc.backTree = CreateDomain @ann @name @typ.annotatedTree @check+ loc.statementInfo = CreateDomainInfo @name @loc.namedTypeType+{-+================================================================================++= create function++ignore body for now, just get the signature+-}++ATTR ParamDef+ [+ |+ | paramName : String+ ]++ATTR ParamDefList+ [+ |+ | params : {[(String,Either [TypeError] Type)]}+ ]++ATTR ParamDef+ [+ |+ | namedType : {Either [TypeError] 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)++SEM Statement+ | CreateFunction+ loc.retTypeType = errorToTypeFail @rettype.namedType+ loc.paramTypes =+ let tpes = map snd @params.params+ in if null $ concat $ lefts tpes+ then rights tpes+ else [TypeCheckFailed]+ loc.tpe =+ do+ @rettype.namedType+ let tpes = map snd @params.params+ checkErrorList (concat $ lefts tpes) $ Pseudo Void+ loc.backTree = CreateFunction @ann+ @lang.annotatedTree+ @name+ @params.annotatedTree+ @rettype.annotatedTree+ @bodyQuote+ @body.annotatedTree+ @vol.annotatedTree+ loc.statementInfo = CreateFunctionInfo (@name,@loc.paramTypes,@loc.retTypeType)++{-+================================================================================++= 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.++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.++Both the workarounds to these seem a bit tedious and error prone, and+will make the code much less readable. Maybe need a preprocessor to+produce the ag file? Alternatively, just attach the messages to each+node (so this appears in the data types and isn't an attribute, then+have a tree walker collect them all). Since an annotation field in+each node is going to be added anyway, so each node can be labelled+with a type, will probably do this at some point.++================================================================================++= 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/TypeChecking/TypeCheckingH.lhs view
@@ -0,0 +1,231 @@+Copyright 2009 Jake Wheat++This file contains some utility functions for working with types and+type checking.++> {-# OPTIONS_HADDOCK hide #-}+> {-# LANGUAGE FlexibleInstances #-}++> module Database.HsSqlPpp.TypeChecking.TypeCheckingH where++> import Data.Maybe+> import Data.List+> import Debug.Trace+> import Data.Either+> import Control.Monad.Error+> import Control.Applicative++> import Database.HsSqlPpp.TypeChecking.TypeType+> import Database.HsSqlPpp.TypeChecking.AstUtils+> import Database.HsSqlPpp.TypeChecking.TypeConversion+> import Database.HsSqlPpp.TypeChecking.ScopeData++================================================================================++= type check code++idea is to move these here from TypeChecking.ag if they get a bit big,+not very consistently applied at the moment.++> typeCheckFunCall :: Scope -> String -> [Type] -> Either [TypeError] Type+> typeCheckFunCall scope fnName argsType = do+> chainTypeCheckFailed argsType $+> case fnName of+> -- do the special cases first, some of these will use+> -- the variadic support when it is done and no longer+> -- be special cases.+> "!arrayCtor" ->+> ArrayType <$> resolveResultSetType scope argsType+> "!between" -> do+> f1 <- lookupFn ">=" [argsType !! 0, argsType !! 1]+> f2 <- lookupFn "<=" [argsType !! 0, argsType !! 2]+> lookupFn "!and" [f1,f2]+> "coalesce" -> resolveResultSetType scope argsType+> "greatest" -> do+> t <- resolveResultSetType scope argsType+> lookupFn ">=" [t,t]+> return t+> "least" -> do+> t <- resolveResultSetType scope argsType+> lookupFn "<=" [t,t]+> return t+> "!rowCtor" -> return $ RowCtor argsType+> -- special case the row comparison ops+> _ | let isRowCtor t = case t of+> RowCtor _ -> True+> _ -> False+> in fnName `elem` ["=", "<>", "<=", ">=", "<", ">"]+> && length argsType == 2+> && all isRowCtor argsType ->+> checkRowTypesMatch (head argsType) (head $ tail argsType)+> s -> lookupFn s argsType+> where+> lookupFn :: String -> [Type] -> Either [TypeError] Type+> lookupFn s1 args = do+> (_,_,r) <- findCallMatch scope+> (if s1 == "u-" then "-" else s1) args+> return r+> checkRowTypesMatch (RowCtor t1s) (RowCtor t2s) = do+> when (length t1s /= length t2s) $ Left [ValuesListsMustBeSameLength]+> mapM_ (resolveResultSetType scope . (\(a,b) -> [a,b])) $ zip t1s t2s+> return typeBool+> checkRowTypesMatch x y =+> error $ "internal error: checkRowTypesMatch called with " ++ show x ++ "," ++ show y+++> typeCheckValuesExpr :: Scope -> [[Type]] -> Either [TypeError] Type+> typeCheckValuesExpr scope rowsTs =+> let colNames = zipWith (++)+> (repeat "column")+> (map show [1..length $ head rowsTs])+> in unionRelTypes scope rowsTs colNames++> typeCheckCombineSelect :: Scope -> Type -> Type -> Either [TypeError] Type+> typeCheckCombineSelect scope v1 v2 =+> let colNames = map fst $ unwrapComposite $ unwrapSetOf v1+> in unionRelTypes scope+> (map (map snd . unwrapComposite . unwrapSetOf) [v1,v2])+> colNames++> unionRelTypes :: Scope -> [[Type]] -> [String] -> Either [TypeError] Type+> unionRelTypes scope rowsTs colNames =+> let lengths = map length rowsTs+> in case () of+> _ | null rowsTs ->+> Left [NoRowsGivenForValues]+> | not (all (==head lengths) lengths) ->+> Left [ValuesListsMustBeSameLength]+> | otherwise -> do+> mapM (resolveResultSetType scope) (transpose rowsTs) >>=+> (return . SetOfType . UnnamedCompositeType . zip colNames)++================================================================================++= utils++lookup a composite type name, restricting it to only certain kinds of+composite type, returns the composite definition which you can get the+attributes out of which is a pair with the normal columns first, then+the system columns second++> getAttrs :: Scope -> [CompositeFlavour] -> String -> Maybe (CompositeDef, CompositeDef)+> getAttrs scope f n =+> let a = find (\(nm,fl,_) -> fl `elem` f && nm == n)+> (scopeAttrDefs scope)+> b = find (\(nm,_,_) -> nm == n)+> (scopeAttrSystemColumns scope)+> in case (a,b) of+> (Nothing,_) -> Nothing+> (Just x,Nothing) -> Just (x, (n,TableComposite,UnnamedCompositeType []))+> (Just x,Just y) -> Just (x,y)++combine two relvar types when being joined, pass in a using list and+it checks the types in the using list are compatible, and eliminates+duplicate columns of the attrs in the using list, returns the relvar+type of the joined tables.++> combineTableTypesWithUsingList :: Scope -> [String] -> Type -> Type -> Either [TypeError] Type+> combineTableTypesWithUsingList scope l t1c t2c = do+> --check t1 and t2 have l+> let t1 = unwrapComposite t1c+> t2 = unwrapComposite t2c+> names1 = getNames t1+> names2 = getNames t2+> when (not (contained l names1) ||+> not (contained l names2)) $+> Left [MissingJoinAttribute]+> --check the types+> joinColumnTypes <- mapM (getColumnType t1 t2) l+> let nonJoinColumns =+> let notJoin = (\(s,_) -> s `notElem` l)+> in filter notJoin t1 ++ filter notJoin t2+> return $ UnnamedCompositeType $ zip l joinColumnTypes ++ nonJoinColumns+> where+> getNames :: [(String,Type)] -> [String]+> getNames = map fst+> contained l1 l2 = all (`elem` l2) l1+> getColumnType :: [(String,Type)] -> [(String,Type)] -> String -> Either [TypeError] Type+> getColumnType t1 t2 f =+> let ct1 = getFieldType t1 f+> ct2 = getFieldType t2 f+> in resolveResultSetType scope [ct1,ct2]+> getFieldType t f = snd $ fromJust $ find (\(s,_) -> s == f) t++> doSelectItemListTpe :: Scope+> -> String+> -> Type+> -> Type+> -> Type+> doSelectItemListTpe scope colName colType types =+> if types == TypeCheckFailed+> then types+> else+> let (correlationName,iden) = splitIdentifier colName+> newCols = if iden == "*"+> then scopeExpandStar scope correlationName+> else return [(iden, colType)]+> in errorToTypeFailF (foldr consComposite types) newCols++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)+++returns the type of the relation, and the system columns also++> getRelationType :: Scope -> String -> Either [TypeError] (Type,Type)+> getRelationType scope tbl =+> case getAttrs scope [TableComposite, ViewComposite] tbl of+> Just ((_,_,a@(UnnamedCompositeType _))+> ,(_,_,s@(UnnamedCompositeType _))) -> Right (a,s)+> _ -> Left [UnrecognisedRelation tbl]++> commonFieldNames :: Type -> Type -> [String]+> commonFieldNames t1 t2 =+> intersect (fn t1) (fn t2)+> where+> fn (UnnamedCompositeType s) = map fst s+> fn _ = []++> instance Error ([TypeError]) where+> noMsg = [MiscError "Unknown error"]+> strMsg str = [MiscError str]++> checkColumnConsistency :: Scope -> String -> [String] -> [(String,Type)]+> -> Either [TypeError] [(String,Type)]+> checkColumnConsistency scope tbl cols' insNameTypePairs = do+> rt <- getRelationType scope tbl+> let ttcols :: [(String,Type)]+> ttcols = unwrapComposite $ fst rt+> cols :: [String]+> cols = if null cols'+> then map fst ttcols+> else cols'+> when (length insNameTypePairs /= length cols) $+> Left [WrongNumberOfColumns]+> let nonMatchingColumns = cols \\ map fst ttcols+> when (not $ null nonMatchingColumns) $+> Left $ 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 scope c b) typeTriples+> unless (null errs) $ Left errs+> return ttcols++> checkRelationExists :: Scope -> String -> Maybe TypeError+> checkRelationExists scope tbl =+> case getAttrs scope [TableComposite, ViewComposite] tbl of+> Just _ -> Nothing+> _ -> Just $ UnrecognisedRelation tbl++> both :: (a->b) -> (a,a) -> (b,b)+> both fn (x,y) = (fn x, fn y)
+ Database/HsSqlPpp/TypeChecking/TypeConversion.lhs view
@@ -0,0 +1,513 @@+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.TypeChecking.TypeConversion (+> findCallMatch+> ,resolveResultSetType+> ,checkAssignmentValid+> ) where++> import Data.Maybe+> import Data.List++> import Database.HsSqlPpp.TypeChecking.TypeType+> import Database.HsSqlPpp.TypeChecking.Scope+> import Database.HsSqlPpp.TypeChecking.AstUtils+++= 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++> type ProtArgCast = (FunctionPrototype, [ArgCastFlavour])++> findCallMatch :: Scope -> String -> [Type] -> Either [TypeError] FunctionPrototype+> findCallMatch scope 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 (\(candf,candArgs,_) ->+> (candf,length candArgs) == (f,length inArgs))+> allFns+>+> -- record what casts are needed for each candidate+> castPairs :: [[ArgCastFlavour]]+> castPairs = map (listCastPairs . getFnArgs) initialCandList+>+> candCastPairs :: [ProtArgCast]+> 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 scope) inArgs+> exactCounts :: [Int]+> exactCounts =+> map ((length+> . filter (\(a1,a2) -> a1==replaceWithBase scope 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+> | implicitlyCastableFromTo scope ia ca ->+> if isPreferredType scope 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 (isOperator f &&+> length inArgs == 2 &&+> count (==UnknownStringLit) inArgs == 1)+> then []+> else let newInArgs =+> replicate 2 (if head inArgs == UnknownStringLit+> 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 = catMaybes $ flip map argPairs+> (\(ia,fa) -> case fa of+> Pseudo Any -> if isArrayType ia+> then Just $ unwrapArray ia+> else Just ia+> Pseudo AnyArray -> Just $ unwrapArray ia+> Pseudo AnyElement -> if isArrayType ia+> then Just $ unwrapArray ia+> else Just ia+> Pseudo AnyEnum -> Nothing+> Pseudo AnyNonArray -> Just ia+> _ -> Nothing)+> in {-trace ("\nresolve types: " ++ show typeList ++ "\n") $-}+> case resolveResultSetType scope typeList of+> Left _ -> Nothing+> Right t -> Just t+> instantiatePolyType :: ProtArgCast -> Type -> ProtArgCast+> instantiatePolyType pac t =+> let ((fn,a,r),_) = pac+> instArgs = swapPolys t a+> p1 = (fn, instArgs, swapPoly t r)+> 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 /= UnknownStringLit+> then Left ()+> else getCandsCatAt n) : filterArgN (n+1))+> where+> getCandsCatAt :: Int -> Either () String+> getCandsCatAt n' =+> let typesAtN = map (!!n') candArgLists+> catsAtN = map (getTypeCategory scope) 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) /= UnknownStringLit -> getMatches cands (n + 1)+> | otherwise ->+> let catMatches :: [ProtArgCast]+> catMatches = filter (\c -> Right (getCatForArgN n c) ==+> (cats !! n)) cands+> prefMatches :: [ProtArgCast]+> prefMatches = filter (isPreferredType scope .+> 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 = getTypeCategory scope . 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+> allFns = keywordOperatorTypes ++ specialFunctionTypes ++ scopeAllFns scope++> none p = not . any p+> count p = length . filter p+>+> data ArgCastFlavour = ExactMatch+> | CannotCast+> | ImplicitToPreferred+> | ImplicitToNonPreferred+> deriving (Eq,Show)+>+> isPreferredType :: Scope -> Type -> Bool+> isPreferredType scope t = case find (\(t1,_,_)-> t1==t) (scopeTypeCategories scope) of+> Nothing -> error $ "internal error: couldn't find type category information: " ++ show t+> Just (_,_,p) -> p+>+> getTypeCategory :: Scope -> Type -> String+> getTypeCategory scope t = case find (\(t1,_,_)-> t1==t) (scopeTypeCategories scope) of+> Nothing -> error $ "internal error: couldn't find type category information: " ++ show t+> Just (_,c,_) -> c+>+>+> implicitlyCastableFromTo :: Scope -> Type -> Type -> Bool+> implicitlyCastableFromTo scope from to = from == UnknownStringLit ||+> any (==(from,to,ImplicitCastContext)) (scopeCasts scope)+>+++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 :: Scope -> [Type] -> Either [TypeError] Type+> resolveResultSetType scope inArgs =+> chainTypeCheckFailed inArgs $ do+> case () of+> _ | null inArgs -> Left [TypelessEmptyArray]+> | allSameType -> Right $ head inArgs+> | allSameBaseType -> Right $ head inArgsBase+> --todo: do domains+> | allUnknown -> Right $ ScalarType "text"+> | not allSameCat ->+> Left [IncompatibleTypeSet inArgs]+> | isJust targetType &&+> allConvertibleToFrom (fromJust targetType) inArgs ->+> Right $ fromJust targetType+> | otherwise -> Left [IncompatibleTypeSet inArgs]+> where+> allSameType = all (== head inArgs) inArgs &&+> head inArgs /= UnknownStringLit+> allSameBaseType = all (== head inArgsBase) inArgsBase &&+> head inArgsBase /= UnknownStringLit+> inArgsBase = map (replaceWithBase scope) inArgs+> allUnknown = all (==UnknownStringLit) inArgsBase+> allSameCat = let firstCat = getTypeCategory scope (head knownTypes)+> in all (\t -> getTypeCategory scope t == firstCat)+> knownTypes+> targetType = case catMaybes [firstPreferred, lastAllConvertibleTo] of+> [] -> Nothing+> (x:_) -> Just x+> firstPreferred = find (isPreferredType scope) knownTypes+> lastAllConvertibleTo = firstAllConvertibleTo (reverse knownTypes)+> firstAllConvertibleTo (x:xs) = if allConvertibleToFrom x xs+> then Just x+> else firstAllConvertibleTo xs+> firstAllConvertibleTo [] = Nothing+> matchOrImplicitToFrom t t1 = t == t1 ||+> implicitlyCastableFromTo scope t1 t+> knownTypes = filter (/=UnknownStringLit) inArgsBase+> allConvertibleToFrom = all . matchOrImplicitToFrom++> replaceWithBase :: Scope -> Type -> Type+> replaceWithBase scope t@(DomainType _) =+> case lookup t (scopeDomainDefs scope) of+> Nothing -> error $ "internal error - couldn't find base type for " ++ show t+> Just u -> replaceWithBase scope u+> replaceWithBase _ t = t++todo:+row ctor implicitly and explicitly cast to a composite type+cast empty array, where else can an empty array work?++================================================================================++= checkAssignmentValue++assignment is ok if:+types are equal+there is a cast from src to target++> checkAssignmentValid :: Scope -> Type -> Type -> Either [TypeError] ()+> checkAssignmentValid scope src tgt =+> case () of+> _ | src == tgt -> Right()+> | assignCastableFromTo scope src tgt -> Right ()+> | otherwise -> Left [IncompatibleTypes tgt src]++> assignCastableFromTo :: Scope -> Type -> Type -> Bool+> assignCastableFromTo scope from to = from == UnknownStringLit ||+> any (`elem` [(from,to,ImplicitCastContext)+> ,(from,to,AssignmentCastContext)]) (scopeCasts scope)
+ Database/HsSqlPpp/TypeChecking/TypeType.lhs view
@@ -0,0 +1,136 @@+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 should disappear at some+point++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...++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 #-}++> module Database.HsSqlPpp.TypeChecking.TypeType where++> data Type = ScalarType String+> | ArrayType Type+> | SetOfType Type+> | CompositeType String+> | UnnamedCompositeType [(String,Type)]+> | DomainType String+> | EnumType String+> | RowCtor [Type]+> | 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+> | UnknownStringLit -- represents a string literal+> -- token whose type isn't yet+> -- determined+> deriving (Eq,Show)++> data PseudoType = Any+> | AnyArray+> | AnyElement+> | AnyEnum+> | AnyNonArray+> | Cstring+> | Record+> | Trigger+> | Void+> | Internal+> | LanguageHandler+> | Opaque+> deriving (Eq,Show)++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+> --shoved in to humour the Either Monad+> | MiscError String+> deriving (Eq,Show)++some random stuff needed here because of compilation orders++cast context - used in the casts catalog++> data CastContext = ImplicitCastContext+> | AssignmentCastContext+> | ExplicitCastContext+> deriving (Eq,Show)++used in the attribute catalog which holds the attribute names and+types of tables, views and other composite types.++> data CompositeFlavour = Composite | TableComposite | ViewComposite+> deriving (Eq,Show)++type is always an UnnamedCompositeType:++> type CompositeDef = (String, CompositeFlavour, Type)++> isOperator :: String -> Bool+> isOperator = any (`elem` "+-*/<>=~!@#%^&|`?")++> type FunctionPrototype = (String, [Type], Type)+> type DomainDefinition = (Type,Type)
− Database/HsSqlPpp/TypeCheckingH.lhs
@@ -1,158 +0,0 @@-Copyright 2009 Jake Wheat--This file contains some utility functions for working with types and-type checking.--> module Database.HsSqlPpp.TypeCheckingH where--> import Data.Maybe-> import Data.List-> import Debug.Trace--> import Database.HsSqlPpp.TypeType-> import Database.HsSqlPpp.Scope-> import Database.HsSqlPpp.AstUtils-> import Database.HsSqlPpp.TypeConversion--================================================================================--= type check code--idea is to move these here from TypeChecking.ag if they get a bit big,-not very consistently applied at the moment.--> typeCheckFunCall :: Scope -> MySourcePos -> String -> Type -> Type-> typeCheckFunCall scope sp fnName argsType' =-> checkErrors [argsType'] ret-> where-> argsType = unwrapTypeList argsType'-> ret = case fnName of--do the special cases first, some of these will use the variadic support-when it is done and no longer be special cases.--> "!arrayCtor" -> let t = resolveResultSetType scope sp argsType-> in checkErrors [t] $ ArrayType t-> "!between" -> let f1 = lookupFn ">=" [argsType !! 0, argsType !! 1]-> f2 = lookupFn "<=" [argsType !! 0, argsType !! 2]-> f3 = lookupFn "!and" [f1,f2]-> in checkErrors [f1,f2] f3-> "coalesce" -> let t = resolveResultSetType scope sp argsType-> in checkErrors [t] t-> "greatest" -> let t = resolveResultSetType scope sp argsType-> f1 = lookupFn ">=" [t,t]-> in checkErrors [t, f1] t-> "least" -> let t = resolveResultSetType scope sp argsType-> f1 = lookupFn "<=" [t,t]-> in checkErrors [t, f1] t-> "!rowCtor" -> RowCtor argsType--special case the row comparison ops--> _ | let isRowCtor t = case t of-> RowCtor _ -> True-> _ -> False-> in fnName `elem` ["=", "<>", "<=", ">=", "<", ">"]-> && length argsType == 2-> && all isRowCtor argsType ->-> checkRowTypesMatch (head argsType) (head $ tail argsType)--> s -> lookupFn s argsType-> lookupFn s1 args = case findCallMatch scope sp-> (if s1 == "u-" then "-" else s1) args of-> Left te -> te-> Right (_,_,r) -> r-> checkRowTypesMatch (RowCtor t1s) (RowCtor t2s) =-> let e1 = if length t1s /= length t2s-> then TypeError sp ValuesListsMustBeSameLength-> else TypeList []-> t3s = map (resolveResultSetType scope sp . (\(a,b) -> [a,b])) $ zip t1s t2s-> in checkErrors (e1:t3s) typeBool-> checkRowTypesMatch x y =-> error $ "internal error: checkRowTypesMatch called with " ++ show x ++ "," ++ show y---> typeCheckValuesExpr :: Scope -> MySourcePos -> Type -> Type-> typeCheckValuesExpr scope sp vll =-> let rowsTs1 = unwrapTypeList vll-> --convert into [[Type]]-> rowsTs = map unwrapTypeList rowsTs1-> colNames = zipWith (++)-> (repeat "column")-> (map show [1..length $ head rowsTs])-> in unionRelTypes scope sp rowsTs colNames--> typeCheckCombineSelect :: Scope -> MySourcePos -> Type -> Type -> Type-> typeCheckCombineSelect scope sp v1 v2 =-> let colNames = map fst $ unwrapComposite $ unwrapSetOf v1-> in unionRelTypes scope sp-> (map (map snd . unwrapComposite . unwrapSetOf) [v1,v2])-> colNames--> unionRelTypes :: Scope -> MySourcePos -> [[Type]] -> [String] -> Type-> unionRelTypes scope sp rowsTs colNames =-> let lengths = map length rowsTs-> error1 = case () of-> _ | null rowsTs ->-> TypeError sp NoRowsGivenForValues-> | not (all (==head lengths) lengths) ->-> TypeError sp-> ValuesListsMustBeSameLength-> | otherwise -> TypeList []-> colTypeLists = transpose rowsTs-> colTypes = map (resolveResultSetType scope sp) colTypeLists-> ty = SetOfType $ UnnamedCompositeType $ zip colNames colTypes-> in checkErrors (error1:colTypes) ty--================================================================================--= utils--lookup a composite type name, restricting it to only certain kinds of-composite type, returns the composite definition which you can get the-attributes out of which is a pair with the normal columns first, then-the system columns second--> getAttrs :: Scope -> [CompositeFlavour] -> String -> Maybe (CompositeDef, CompositeDef)-> getAttrs scope f n =-> let a = find (\(nm,fl,_) -> fl `elem` f && nm == n)-> (scopeAttrDefs scope)-> b = find (\(nm,_,_) -> nm == n)-> (scopeAttrSystemColumns scope)-> in case (a,b) of-> (Nothing,_) -> Nothing-> (Just x,Nothing) -> Just (x, (n,TableComposite,UnnamedCompositeType []))-> (Just x,Just y) -> Just (x,y)--combine two relvar types when being joined, pass in a using list and-it checks the types in the using list are compatible, and eliminates-duplicate columns of the attrs in the using list, returns the relvar-type of the joined tables.--> combineTableTypesWithUsingList :: Scope -> MySourcePos -> [String] -> Type -> Type -> Type-> combineTableTypesWithUsingList scope sp l t1c t2c =-> --check t1 and t2 have l-> let t1 = unwrapComposite t1c-> t2 = unwrapComposite t2c-> names1 = getNames t1-> names2 = getNames t2-> error1 = if not (contained l names1) ||-> not (contained l names2)-> then TypeError sp MissingJoinAttribute-> else TypeList []-> --check the types-> joinColumns = map (getColumnType t1 t2) l-> nonJoinColumns =-> let notJoin = (\(s,_) -> s `notElem` l)-> in filter notJoin t1 ++ filter notJoin t2-> in checkErrors [error1]-> (UnnamedCompositeType $ joinColumns ++ nonJoinColumns)-> where-> getNames :: [(String,Type)] -> [String]-> getNames = map fst-> contained l1 l2 = all (`elem` l2) l1-> getColumnType t1 t2 f =-> let ct1 = getFieldType t1 f-> ct2 = getFieldType t2 f-> in (f, resolveResultSetType scope sp [ct1,ct2])-> getFieldType t f = snd $ fromJust $ find (\(s,_) -> s == f) t
− Database/HsSqlPpp/TypeConversion.lhs
@@ -1,513 +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--> module Database.HsSqlPpp.TypeConversion (-> findCallMatch-> ,resolveResultSetType-> ,checkAssignmentValid-> ) where--> import Data.Maybe-> import Data.List--> import Database.HsSqlPpp.TypeType-> import Database.HsSqlPpp.Scope-> import Database.HsSqlPpp.AstUtils---= 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--> type ProtArgCast = (FunctionPrototype, [ArgCastFlavour])--> findCallMatch :: Scope -> MySourcePos -> String -> [Type] -> Either Type FunctionPrototype-> findCallMatch scope sp f inArgs =-> returnIfOnne [-> exactMatch-> ,binOp1UnknownMatch-> ,polymorpicExactMatches-> ,reachable-> ,mostExactMatches-> ,filteredForPreferred-> ,unknownMatchesByCat]-> (TypeError sp (NoMatchingOperator f inArgs))-> where-> -- basic lists which roughly mirror algo-> -- get the possibly matching candidates-> initialCandList :: [FunctionPrototype]-> initialCandList = filter (\(candf,candArgs,_) ->-> (candf,length candArgs) == (f,length inArgs))-> allFns->-> -- record what casts are needed for each candidate-> castPairs :: [[ArgCastFlavour]]-> castPairs = map (listCastPairs . getFnArgs) initialCandList->-> candCastPairs :: [ProtArgCast]-> 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 scope) inArgs-> exactCounts :: [Int]-> exactCounts =-> map ((length-> . filter (\(a1,a2) -> a1==replaceWithBase scope 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-> | implicitlyCastableFromTo scope ia ca ->-> if isPreferredType scope 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 (isOperator f &&-> length inArgs == 2 &&-> count (==UnknownStringLit) inArgs == 1)-> then []-> else let newInArgs =-> replicate 2 (if head inArgs == UnknownStringLit-> 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 = catMaybes $ flip map argPairs-> (\(ia,fa) -> case fa of-> Pseudo Any -> if isArrayType ia-> then Just $ unwrapArray ia-> else Just ia-> Pseudo AnyArray -> Just $ unwrapArray ia-> Pseudo AnyElement -> if isArrayType ia-> then Just $ unwrapArray ia-> else Just ia-> Pseudo AnyEnum -> Nothing-> Pseudo AnyNonArray -> Just ia-> _ -> Nothing)-> in {-trace ("\nresolve types: " ++ show typeList ++ "\n") $-}-> case resolveResultSetType scope sp typeList of-> UnknownType -> Nothing-> TypeError _ _ -> Nothing-> x -> Just x-> instantiatePolyType :: ProtArgCast -> Type -> ProtArgCast-> instantiatePolyType pac t =-> let ((fn,a,r),_) = pac-> instArgs = swapPolys t a-> p1 = (fn, instArgs, swapPoly t r)-> 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 /= UnknownStringLit-> then Left ()-> else getCandsCatAt n) : filterArgN (n+1))-> where-> getCandsCatAt :: Int -> Either () String-> getCandsCatAt n' =-> let typesAtN = map (!!n') candArgLists-> catsAtN = map (getTypeCategory scope) 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) /= UnknownStringLit -> getMatches cands (n + 1)-> | otherwise ->-> let catMatches :: [ProtArgCast]-> catMatches = filter (\c -> Right (getCatForArgN n c) ==-> (cats !! n)) cands-> prefMatches :: [ProtArgCast]-> prefMatches = filter (isPreferredType scope .-> 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 = getTypeCategory scope . 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-> allFns = keywordOperatorTypes ++ specialFunctionTypes ++ scopeAllFns scope--> none p = not . any p-> count p = length . filter p->-> data ArgCastFlavour = ExactMatch-> | CannotCast-> | ImplicitToPreferred-> | ImplicitToNonPreferred-> deriving (Eq,Show)->-> isPreferredType :: Scope -> Type -> Bool-> isPreferredType scope t = case find (\(t1,_,_)-> t1==t) (scopeTypeCategories scope) of-> Nothing -> error $ "internal error: couldn't find type category information: " ++ show t-> Just (_,_,p) -> p->-> getTypeCategory :: Scope -> Type -> String-> getTypeCategory scope t = case find (\(t1,_,_)-> t1==t) (scopeTypeCategories scope) of-> Nothing -> error $ "internal error: couldn't find type category information: " ++ show t-> Just (_,c,_) -> c->->-> implicitlyCastableFromTo :: Scope -> Type -> Type -> Bool-> implicitlyCastableFromTo scope from to = from == UnknownStringLit ||-> any (==(from,to,ImplicitCastContext)) (scopeCasts scope)->---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 :: Scope -> MySourcePos -> [Type] -> Type-> resolveResultSetType scope sp inArgs =-> checkErrors [TypeList inArgs] ret-> where-> ret = case () of-> _ | null inArgs -> TypeError sp TypelessEmptyArray-> | allSameType -> head inArgs-> | allSameBaseType -> head inArgsBase-> --todo: do domains-> | allUnknown -> ScalarType "text"-> | not allSameCat ->-> TypeError sp (IncompatibleTypeSet inArgs)-> | isJust targetType &&-> allConvertibleToFrom (fromJust targetType) inArgs ->-> fromJust targetType-> | otherwise -> TypeError sp (IncompatibleTypeSet inArgs)-> allSameType = all (== head inArgs) inArgs &&-> head inArgs /= UnknownStringLit-> allSameBaseType = all (== head inArgsBase) inArgsBase &&-> head inArgsBase /= UnknownStringLit-> inArgsBase = map (replaceWithBase scope) inArgs-> allUnknown = all (==UnknownStringLit) inArgsBase-> allSameCat = let firstCat = getTypeCategory scope (head knownTypes)-> in all (\t -> getTypeCategory scope t == firstCat)-> knownTypes-> targetType = case catMaybes [firstPreferred, lastAllConvertibleTo] of-> [] -> Nothing-> (x:_) -> Just x-> firstPreferred = find (isPreferredType scope) knownTypes-> lastAllConvertibleTo = firstAllConvertibleTo (reverse knownTypes)-> firstAllConvertibleTo (x:xs) = if allConvertibleToFrom x xs-> then Just x-> else firstAllConvertibleTo xs-> firstAllConvertibleTo [] = Nothing-> matchOrImplicitToFrom t t1 = t == t1 ||-> implicitlyCastableFromTo scope t1 t-> knownTypes = filter (/=UnknownStringLit) inArgsBase-> allConvertibleToFrom = all . matchOrImplicitToFrom--> replaceWithBase :: Scope -> Type -> Type-> replaceWithBase scope t@(DomainType _) =-> case lookup t (scopeDomainDefs scope) of-> Nothing -> error $ "internal error - couldn't find base type for " ++ show t-> Just u -> replaceWithBase scope u-> replaceWithBase _ t = t--todo:-row ctor implicitly and explicitly cast to a composite type-cast empty array, where else can an empty array work?--================================================================================--= checkAssignmentValue--assignment is ok if:-types are equal-there is a cast from src to target--> checkAssignmentValid :: Scope -> MySourcePos -> Type -> Type -> Type-> checkAssignmentValid scope sp src tgt =-> case () of-> _ | src == tgt -> TypeList []-> | assignCastableFromTo scope src tgt -> TypeList []-> | otherwise -> TypeError sp (IncompatibleTypes tgt src)--> assignCastableFromTo :: Scope -> Type -> Type -> Bool-> assignCastableFromTo scope from to = from == UnknownStringLit ||-> any (`elem` [(from,to,ImplicitCastContext)-> ,(from,to,AssignmentCastContext)]) (scopeCasts scope)
− Database/HsSqlPpp/TypeType.lhs
@@ -1,149 +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 Ast.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-typelist is an internal type (not a pg type) used during type checking-typeerror represents something which has failed to typecheck-unknowntype is used to represent the type of anything which the code-is currently unable to type check, this should disappear at some-point--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...--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.--> module Database.HsSqlPpp.TypeType where--> data Type = ScalarType String-> | ArrayType Type-> | SetOfType Type-> | CompositeType String-> | UnnamedCompositeType [(String,Type)]-> | DomainType String-> | EnumType String-> | RowCtor [Type]-> -- type list is used internally in the type checking.-> | TypeList [Type]-> | Pseudo PseudoType-> | TypeError MySourcePos TypeErrorInfo-> | UnknownType -- represents something which the type checker-> -- doesn't know how to type check-> | UnknownStringLit -- represents a string literal-> -- token whose type isn't yet-> -- determined-> deriving (Eq,Show)--> data PseudoType = Any-> | AnyArray-> | AnyElement-> | AnyEnum-> | AnyNonArray-> | Cstring-> | Record-> | Trigger-> | Void-> | Internal-> | LanguageHandler-> | Opaque-> deriving (Eq,Show)--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 TypeErrorInfo = WrongTypes Type [Type]-> -- | WrongTypeList [Type] [Type]-> -- | WrongNumArgs Int Int-> -- | WrongType Type Type-> -- | NotArrayType Type-> -- | NeedOneOrMoreArgs-> -- | OtherTypeError String-> | UnknownTypeError Type-> | UnknownTypeName String-> -- | OperatorNeeds1Or2Args Int-> | NoMatchingOperator String [Type]-> -- | MultipleMatchingOperators String [Type]-> | TypelessEmptyArray-> | IncompatibleTypeSet [Type]-> | IncompatibleTypes Type Type-> | ValuesListsMustBeSameLength-> | NoRowsGivenForValues-> | UnrecognisedIdentifier String-> | UnrecognisedRelation String-> | UnrecognisedCorrelationName String-> | AmbiguousIdentifier String-> | ContextError String-> | MissingJoinAttribute-> | ExpressionMustBeBool-> | WrongNumberOfColumns-> -- | InternalError String-> deriving (Eq,Show)--need this here because it is used in type errors - this should be-fixed, so a typeerror type doesn't hold location info, we use-(SourcePosInfo, TypeError), not going to worry about this until focus-is on good error messages.--> type MySourcePos = (String, Int, Int)--some random stuff needed here because of compilation orders--cast context - used in the casts catalog--> data CastContext = ImplicitCastContext-> | AssignmentCastContext-> | ExplicitCastContext-> deriving (Eq,Show)--used in the attribute catalog which holds the attribute names and-types of tables, views and other composite types.--> data CompositeFlavour = Composite | TableComposite | ViewComposite-> deriving (Eq,Show)--type is always an UnnamedCompositeType:--> type CompositeDef = (String, CompositeFlavour, Type)--> isOperator :: String -> Bool-> isOperator = any (`elem` "+-*/<>=~!@#%^&|`?")
HsSqlPppTests.lhs view
@@ -7,14 +7,14 @@ > import Test.Framework-> import Database.HsSqlPpp.ParserTests-> import Database.HsSqlPpp.DatabaseLoaderTests-> import Database.HsSqlPpp.AstCheckTests+> import Database.HsSqlPpp.Tests.ParserTests+> --import Database.HsSqlPpp.Tests.DatabaseLoaderTests+> import Database.HsSqlPpp.Tests.AstCheckTests > main :: IO () > main = > defaultMain [ > parserTests > ,astCheckTests-> ,databaseLoaderTests+> --,databaseLoaderTests > ]
HsSqlSystem.lhs view
@@ -20,13 +20,14 @@ > import System.Directory > import Data.List -> import Database.HsSqlPpp.Parser-> import Database.HsSqlPpp.DatabaseLoader-> import Database.HsSqlPpp.Lexer-> import Database.HsSqlPpp.Ast-> import Database.HsSqlPpp.PrettyPrinter-> import Database.HsSqlPpp.DBAccess-> import Database.HsSqlPpp.ScopeReader+> import Database.HsSqlPpp.Parsing.Parser+> import Database.HsSqlPpp.Dbms.DatabaseLoader+> import Database.HsSqlPpp.Parsing.Lexer+> --import Database.HsSqlPpp.TypeChecking.Ast+> import Database.HsSqlPpp.TypeChecking.TypeChecker+> import Database.HsSqlPpp.PrettyPrinter.PrettyPrinter+> import Database.HsSqlPpp.Dbms.DBAccess+> import Database.HsSqlPpp.TypeChecking.Scope ================================================================================ @@ -40,46 +41,55 @@ > hSetBuffering stdout NoBuffering > args <- getArgs > case () of-> _ | null args -> putStrLn "no command given" >> help False-> | args == ["help"] -> help False-> | args == ["help", "all"] -> help True-> | head args == "help" -> helpCommand (args !! 1)+> _ | null args -> putStrLn "no command given" >> help [] > | otherwise -> case lookupCaller commands (head args) of-> Nothing -> putStrLn "unrecognised command" >> help False+> Nothing -> putStrLn "unrecognised command" >> help [] > Just c -> call c $ tail args > commands :: [CallEntry]-> commands = [clearDBCommand+> commands = [helpCommand+> ,clearDBCommand > ,loadSqlCommand > ,clearAndLoadSqlCommand > ,lexFileCommand-> ,showFileAttsCommand > ,parseFileCommand > ,roundTripCommand > ,getScopeCommand-> ,showTypesCommand-> ,showTypesDBCommand > ,showInfoCommand > ,showInfoDBCommand] > lookupCaller :: [CallEntry] -> String -> Maybe CallEntry > lookupCaller ce name = find (\(CallEntry nm _ _) -> name == nm) ce -> help :: Bool -> IO ()-> help full = do-> putStrLn "commands available"-> putStrLn "use 'help' to see a list of commands"-> putStrLn "use 'help all' to see a list of commands with descriptions"-> putStrLn "use 'help [command]' to see the description for that command\n"-> mapM_ putStrLn $ flip map commands (\(CallEntry nm desc _) ->+================================================================================++> helpCommand :: CallEntry+> helpCommand = CallEntry+> "help"+> "use 'help' to see a list of commands\n\+> \use 'help all' to see a list of commands with descriptions\n\+> \use 'help [command]' to see the description for that command"+> (Multiple help)+++> help :: [String] -> IO ()+> help args =+> case args of+> ["all"] -> showCommands True+> [x] -> helpForCommand x+> _ -> showCommands False+> where+> showCommands full = do+> putStrLn "commands available"+> mapM_ putStrLn $ flip map commands (\(CallEntry nm desc _) -> > if full > then nm ++ "\n" ++ desc ++ "\n" > else nm ++ "\n") -> helpCommand :: String -> IO ()-> helpCommand c =+> helpForCommand :: String -> IO ()+> helpForCommand c = > case lookupCaller commands c of-> Nothing -> putStrLn "unrecognised command" >> help False+> Nothing -> putStrLn "unrecognised command" >> help [] > Just (CallEntry nm desc _) -> putStrLn $ nm ++ "\n" ++ desc ================================================================================@@ -97,7 +107,7 @@ > loadSql args = > let (db:fns) = args > in forM_ fns $ \fn -> do-> res <- parseSqlFileWithState fn+> res <- parseSqlFile fn > case res of > Left er -> error $ show er > Right ast -> putStrLn ("loading " ++ fn)@@ -151,29 +161,6 @@ ================================================================================ -> showFileAttsCommand :: CallEntry-> showFileAttsCommand = CallEntry-> "showFileAtts"-> "run the ag over the given files and return all the attributes computed"-> (Multiple showfileatts)--> showfileatts :: [String] -> IO ()-> showfileatts = mapM_ pf-> where-> pf f = do-> putStrLn $ "parsing " ++ show f-> x <- parseSqlFileWithState f-> case x of-> Left er -> print er-> Right st -> do-> mapM_ print st-> putStrLn "\nchecking ast"-> let y = checkAst st-> print y-> return ()--================================================================================- > parseFileCommand :: CallEntry > parseFileCommand = CallEntry > "parsefile"@@ -191,7 +178,7 @@ > where > pf f = do > putStrLn $ "parsing " ++ show f-> x <- parseSqlFileWithState f+> x <- parseSqlFile f > case x of > Left er -> print er > Right st -> do@@ -204,66 +191,13 @@ > --check roundtrip > case parseSql pp of > Left er -> error $ "roundtrip failed: " ++ show er-> Right st' -> if resetSps' st == resetSps' st'+> Right st' -> if map stripAnnotations st == map stripAnnotations st' > then putStrLn "roundtrip ok" > else putStrLn "roundtrip failed: different ast" > return () ================================================================================ -> showTypesCommand :: CallEntry-> showTypesCommand = CallEntry-> "showtypes"-> "reads each file, parses, type checks, then outputs the types \-> \interspersed with the pretty printed statements"-> -- todo: modify this so that is inserts the types as comments into the-> -- original source, get it to work correctly when run multiple times or-> -- the types have changed between runs (i.e. add or update the comments)-> (Multiple showTypes)--> showTypes :: [FilePath] -> IO ()-> showTypes = mapM_ pt-> where-> pt f = do-> x <- parseSqlFileWithState f-> case x of-> Left er -> print er-> Right sts -> do-> let types = zip (getStatementsType sts) sts-> mapM_ (\(t,st) -> putStrLn ("/*\n" ++ show t ++ "*/\n") >>-> putStrLn (printSql [st])) types--================================================================================--> showTypesDBCommand :: CallEntry-> showTypesDBCommand = CallEntry-> "showtypesdb"-> "pass the name of a database first, then \-> \filenames, reads each file, parses, type checks, \-> \then outputs the types interspersed with the \-> \pretty printed statements, will type check \-> \against the given database schema"-> (Multiple showTypesDB)---> showTypesDB :: [FilePath] -> IO ()-> showTypesDB args = do-> let dbName = head args-> scope <- readScope dbName-> mapM_ (pt scope) $ tail args-> where-> pt scope f = do-> x <- parseSqlFileWithState f-> case x of-> Left er -> print er-> Right sts -> do-> let types = zip (getStatementsTypeScope scope sts) sts-> mapM_ (\(t,st) -> putStrLn ("/*\n" ++ show t ++ "*/\n") >>-> putStrLn (printSql [st])) types---================================================================================- > showInfoCommand :: CallEntry > showInfoCommand = CallEntry > "showinfo"@@ -275,13 +209,12 @@ > showInfo = mapM_ pt > where > pt f = do-> x <- parseSqlFileWithState f+> x <- parseSqlFile f > case x of > Left er -> print er > Right sts -> do-> let info = zip (getStatementsInfo sts) sts-> mapM_ (\(t,st) -> putStrLn ("/*\n" ++ show t ++ "*/\n") >>-> putStrLn (printSql [st])) info+> let aast = annotateAst sts+> mapM_ (putStrLn . printSqlAnn show . (:[])) aast ================================================================================ @@ -303,14 +236,14 @@ > mapM_ (pt scope) $ tail args > where > pt scope f = do-> x <- parseSqlFileWithState f+> x <- parseSqlFile f > case x of > Left er -> print er > Right sts -> do-> let info = zip (getStatementsInfoScope scope sts) sts-> mapM_ (\(t,st) -> putStrLn ("/*\n" ++ show t ++ "*/\n") >>-> putStrLn (printSql [st])) info-+> let aast = annotateAstScope scope sts+> mapM_ (putStrLn . printSqlAnn annotToS . (:[])) aast+> annotToS :: Annotation -> String+> annotToS = concat . intersperse "\n" . map show ================================================================================ @@ -351,9 +284,11 @@ > getScope :: String -> IO () > getScope dbName = do > s <- readScope dbName-> putStrLn "module Database.HsSqlPpp.DefaultScope where"-> putStrLn "import Database.HsSqlPpp.TypeType"-> putStrLn "import Database.HsSqlPpp.Scope"+> putStrLn "{-# OPTIONS_HADDOCK hide #-}"+> putStrLn "module Database.HsSqlPpp.TypeChecking.DefaultScope where"+> putStrLn "import Database.HsSqlPpp.TypeChecking.TypeType"+> putStrLn "import Database.HsSqlPpp.TypeChecking.ScopeData"+> putStrLn "-- | Scope value representing the catalog from a default template1 database" > putStrLn "defaultScope :: Scope" > putStr "defaultScope = " > print s
README view
@@ -23,12 +23,16 @@ where there are instructions on how to parse files, and type check them to see how well the code supports your SQL source. -Most of the source files have plenty of comments, hopefully they can-provide some illumination.+It is Cabal-installable, run:+cabal update+then+cabal install hssqlppp+to install the libraries and HsSqlSystem executable (and the test+runner executable), if you want to try the utilities out, or run+cabal unpack hssqlppp+to download and view the source code easily. -It comes with a Cabal file, so you can compile it by unzipping and-using cabal configure && cabal build in the usual way. I think it-should work on all GHC 6.10.x and possibly also GHC 6.8.x.+I think it should work on all GHC 6.10.x and possibly also GHC 6.8.x. See the file 'development' for some notes on how to work with the source.@@ -46,6 +50,11 @@ You can get the latest code using Bazaar: bzr branch lp:~jakewheat/hssqlppp/trunk +HackageDB page:+http://hackage.haskell.org/package/hssqlppp+This should hopefully have some basic Haddock documentation to view+when version 0.0.6 is uploaded.+ Contact Let me know if you're using/ interesting in using the library, if you@@ -54,12 +63,7 @@ jakewheatmail@gmail.com -You can also report problems on the bug tracker on Launchpad. Let me-know if you have any problems trying out the stuff in the 'usage'-file, if you come across some SQL which doesn't parse or type check,-and I'm also interested in surveying what other dialects of SQL you-would be interested in using or contributing code for, and if you want-to fork the project (which is something I have nothing against).+You can also report problems on the bug tracker on Launchpad. ================================================================================ @@ -131,18 +135,21 @@ = Other current downsides: The AST node types aren't well designed, in particular they contain-almost no location information, and no other annotations. This is due-to be fixed and is near the top of the TODO list.+patchy location information, and limited other annotations. This is+being worked on. -Not much work has been done on correctly rejecting invalid SQL 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.+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. Supporting other SQL dialects: I think it might be realistic to support portable select, insert, update and delete with ? placeholders. I think cross platform DDL isn't ever going to be sensible in non toy databases, and if you wanted to use this utility-e.g. support MySQL or MS SQL Server, start by forking the code.+e.g. support MySQL or MS SQL Server, it might be best to start by+forking the code, I would be happy to help support this in any way I+can. Future plans: @@ -150,7 +157,7 @@ * support type checking simple SQL statements that you'd embed in Haskell code, including with ? placeholders, to support generating- type safe wrappers;+ type safe wrappers - could integrate with MetaHDBC?; * possibly a lightweight code generation/ simple macro support to help with developing more robust PL/pgSQL code.
TODO view
@@ -1,56 +1,62 @@-Annotation planning-add an annotation field to most nodes in the ast-something like-data Annotation = NonAnnotation- | SourcePosAnnotation SourcePos- | CheckedAnnotation SourcePos Type [Messages] -alter the parser to add sourcepositions to these nodes - assume that- one source position per node will be enough for now (not- necessarily a good assumption with weird sql syntax), and see if- this gives us enough for good error messages, etc..--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?--The way the type checking will then work is that instead of producing- some attribute values it will produce a transformed ast tree with- the type and message fields filled in. Then supply some utility- functions to e.g. extract all the messages, extract all the type- errors, extract the top level types, etc. Use some sort of tree- walker to implement these utils--The way types and type errors will work is that instead of / in- addition to the types being passed in attributes, they'll be saved- in the transformed tree. Type errors won't percolate up to the top- level, but sit with the node that is in error. Any parent nodes- which need this type to calculate their own type, will use a- separate error to say type unknown. If they can calculate their- type without depending on a type erroring child node, then they do- that, so e.g. typing a set of statements with create functions and- views which use those functions: if the statements inside the- functions have type errors, we can still find the types of the- views, assuming that the function params and return type check- properly, and are correct.- = Current TODO list TODOs in rough order that they are intended to be done -stage 1: do some stuff patchily to try to get a bunch of common sql- partially type-checking (focus is on getting the result types of- most select statements)+provide type check errors with source positions+sort out source position collection in parser+investigate syb for annotation instances+use f :: Annotation -> Doc for pretty printing annotations+work on statement info+get scope updating whilst checking+start work on type checking inside functions - start with params,+ return types, non plpgsql statements, stuff with selects (e.g. for).+work on parsing and type checking pg_dump output, then do a util to+ dump and type check a live database (this will lead to being able+ to run the lint process on a live database rather than source)+sort out api + do haddock+provide installation instructions for non haskell programmers+chain scopes when typechecking multiple files from util, provide api+ to do this from code -todos for this stage:-integrate create types into scope, plus do drops with scope-chain scopes when showinfo-ing multiple files-Pretty printer for statementinfo +parse and/or type check todo list:+"identifier"+6.5e-5+type 'string' style type cast+[:] slice+missing keyword ops+default template1 operators should all parse+composite field selection+agg(all expr) agg(distinct expr), agg(*)+window frame clauses, named windows+parse inside string literals when cast, for common types+multidimensional arrays+implicit casting row values to composites+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+upto datatypes ch 8 in pg manual+ stage 2: make this useful by working on the showinfodb function: instead of interspersing the statementinfo with the pretty printed@@ -72,7 +78,7 @@ * do null inference * some selective fixups here and there to the typing (e.g. type checking constraints in create tables)-* selectively add some missing syntax, to cover the most glaring hole+* selectively add some missing syntax, to cover the most glaring holes * schema qualification * type check statements inside create function * something else from the todo for milestone 0.1 below
+ changelog view
@@ -0,0 +1,33 @@+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
development view
@@ -3,28 +3,27 @@ The project comes with a working cabal file. UUAGC is used in the type checking, there are some links at the top of-Ast.ag for more information.+AstInternal.ag for more information. Two of the files are generated: -DefaultScope.hs -> generated using ./HsSqlSystem.lhs getscope- template1 (make a backup of this file if you want to regenerate it -- you can get trapped without being able to run HsSqlSystem if the new- file doesn't compile). You shouldn't need to regenerate this file- unless you change the Scope data type, in which case you'll need to- use the DefaultScopeEmpty.hs file to be able to generate a new- scope. There is some info in the DefaultScopeEmpty.hs file along- these lines.+DefaultScope.hs -> generated using+ ./HsSqlSystem.lhs getscope template1 > something && cp something ...+ You shouldn't need to regenerate this file unless you change the+ Scope data type, in which case you'll need to use the+ DefaultScopeEmpty.hs file to be able to generate a new scope. There+ is some info in the DefaultScopeEmpty.hs file along these lines. -Ast.hs -> this is generated from Ast.ag and Typechecking.ag using- uuagc, see Ast.ag for instructions on how to do this.+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 files directly you're probably-doing something wrong.+If you are editing either of these generated files directly you're+probably doing something wrong. -See the file usage which gives some information on helper functions-you can try from ghci, and documents a bunch of utility functions you-can run from the command line.+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@@ -40,9 +39,29 @@ TypeCheckingH.lhs and TypeType.lhs. (The little libs also used in the type checking are Scope.lhs, ScopeReader.lhs and TypeConversion.lhs.)) -Ast.ag: uuagc source for the ast data types and the api functions for+Executables:++HsSqlSystem.lhs: program to expose some functionality on the command+ line, mainly utilities to help with developing the+ source. Run './HsSqlSystem.lhs help' to list the+ commands.++HsSqlPppTests.lhs: small file to pull together the tests from other test+ suites, and make them into an executable.++Other source files, under Database/HsSqlppp/++AstInternal.ag: uuagc source for the ast data types and the api functions for type checking asts. +Ast.hs, TypeChecker.hs: forwarder modules for the generated+ AstInternal.hs and additional utility+ modules. These are the public APIs for the+ Ast, and the type checking.++AstAnnotation.lhs: data types for the annotation, and some utilities+ for working with annotated stuff+ AstCheckTests.lhs: hunit tests for type checking AstUtils.lhs: some utilities used mainly in type checking@@ -69,11 +88,6 @@ useful. It's definitely quick enough to read this information from a database at type checking time. -HsSqlSystem.lhs: program to expose some functionality on the command- line, mainly utilities to help with developing the- source. Run './HsSqlSystem.lhs help' to list the- commands.- Lexer.lhs: small file to lex sql source code. ParseErrors.lhs: small utility to add a bit of extra value to parsec errors.@@ -93,9 +107,6 @@ database. Can access this function from HsSqlSystem.lhs. -Tests.lhs: small file to pull together the tests from other test- suites, and make them into an executable.- TypeChecking.ag: the uuagc ATTR and SEM constructs used in type checking, plus the smaller bits of type checking code inline.@@ -117,8 +128,3 @@ TypeCheckingH.lhs exists. These files all have (hopefully) useful comments.--You'll find the jargon in this project easier to follow if you're-familiar with SQL and with the work of Date, Darwen, et al.. I plan to-add a glossary at some point, and to try to make the usage more-consistent.
hssqlppp.cabal view
@@ -1,7 +1,35 @@ Name: hssqlppp-Version: 0.0.5-Synopsis: Sql parser, pretty printer and type checker-Description: Sql parser, pretty printer and type checker, targets PostGreSQL SQL and PL/pgSQL, uses Parsec and UUAGC.+Version: 0.0.6+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 'Database.HsSqlPpp.TypeChecking.Ast' for the ast types;++ 'Parser' for converting text to asts;++ 'PrettyPrinter' for converting asts to text;++ 'TypeChecker' for annotating asts (this does the+ type checking), and working with annotated trees;++ 'Scope' 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.++ Comes with a HUnit test suite which you can run using the HsSqlPppTests+ executable, and command line access to some functions via a exe called+ HsSqlSystem. See the project page <https://launchpad.net/hssqlppp>+ for more information and documentation links.+ License: BSD3 License-file: LICENSE Author: Jake Wheat@@ -20,24 +48,30 @@ questions, usage, LICENSE,- Database/HsSqlPpp/Ast.ag- Database/HsSqlPpp/TypeChecking.ag- Database/HsSqlPpp/DefaultScopeEmpty.hs+ changelog,+ Database/HsSqlPpp/TypeChecking/AstInternal.ag+ Database/HsSqlPpp/TypeChecking/TypeChecking.ag+ Database/HsSqlPpp/TypeChecking/DefaultScopeEmpty.hs+ sqltestfiles/system.sql+ sqltestfiles/server.sql+ sqltestfiles/client.sql Library Build-Depends: base >= 3 && < 5, mtl, parsec >= 3, pretty,- containers- Exposed-modules: Database.HsSqlPpp.Ast,- Database.HsSqlPpp.DefaultScope,- Database.HsSqlPpp.Lexer,- Database.HsSqlPpp.ParseErrors,- Database.HsSqlPpp.Parser,- Database.HsSqlPpp.PrettyPrinter,- Database.HsSqlPpp.Scope,- Database.HsSqlPpp.ScopeReader+ containers,+ regex-posix,+ HDBC,+ HDBC-postgresql,+ directory+ Exposed-modules: Database.HsSqlPpp.TypeChecking.Ast,+ Database.HsSqlPpp.Parsing.Parser,+ Database.HsSqlPpp.PrettyPrinter.PrettyPrinter,+ Database.HsSqlPpp.TypeChecking.TypeChecker,+ Database.HsSqlPpp.TypeChecking.Scope,+ Database.HsSqlPpp.Dbms.DatabaseLoader Executable HsSqlSystem Main-is: HsSqlSystem.lhs@@ -47,42 +81,54 @@ HDBC, HDBC-postgresql, directory- Other-Modules: Database.HsSqlPpp.Ast,- Database.HsSqlPpp.AstUtils,- Database.HsSqlPpp.DatabaseLoader,- Database.HsSqlPpp.DBAccess,- Database.HsSqlPpp.DefaultScope,- Database.HsSqlPpp.Lexer,- Database.HsSqlPpp.ParseErrors,- Database.HsSqlPpp.Parser,- Database.HsSqlPpp.PrettyPrinter,- Database.HsSqlPpp.Scope,- Database.HsSqlPpp.ScopeReader,- Database.HsSqlPpp.TypeCheckingH,- Database.HsSqlPpp.TypeConversion,- Database.HsSqlPpp.TypeType+ Other-Modules: Database.HsSqlPpp.TypeChecking.AstAnnotation,+ Database.HsSqlPpp.TypeChecking.Ast,+ Database.HsSqlPpp.TypeChecking.AstInternal,+ Database.HsSqlPpp.TypeChecking.TypeChecker,+ Database.HsSqlPpp.TypeChecking.AstUtils,+ Database.HsSqlPpp.Dbms.DatabaseLoader,+ Database.HsSqlPpp.Dbms.DBAccess,+ Database.HsSqlPpp.TypeChecking.DefaultScope,+ Database.HsSqlPpp.Parsing.Lexer,+ Database.HsSqlPpp.Parsing.ParseErrors,+ Database.HsSqlPpp.Parsing.Parser,+ Database.HsSqlPpp.PrettyPrinter.PrettyPrinter,+ Database.HsSqlPpp.TypeChecking.ScopeData,+ Database.HsSqlPpp.TypeChecking.Scope,+ Database.HsSqlPpp.TypeChecking.ScopeReader,+ Database.HsSqlPpp.TypeChecking.TypeCheckingH,+ Database.HsSqlPpp.TypeChecking.TypeConversion,+ Database.HsSqlPpp.TypeChecking.TypeType Executable HsSqlPppTests Main-is: HsSqlPppTests.lhs Build-Depends: base, HUnit, test-framework,- test-framework-hunit+ test-framework-hunit,+ regex-posix,+ HDBC,+ HDBC-postgresql,+ directory - Other-Modules: Database.HsSqlPpp.AstCheckTests,- Database.HsSqlPpp.Ast,- Database.HsSqlPpp.AstUtils,- Database.HsSqlPpp.DatabaseLoader,- Database.HsSqlPpp.DatabaseLoaderTests,- Database.HsSqlPpp.DBAccess,- Database.HsSqlPpp.DefaultScope,- Database.HsSqlPpp.Lexer,- Database.HsSqlPpp.ParseErrors,- Database.HsSqlPpp.Parser,- Database.HsSqlPpp.ParserTests,- Database.HsSqlPpp.PrettyPrinter,- Database.HsSqlPpp.Scope,- Database.HsSqlPpp.ScopeReader,- Database.HsSqlPpp.TypeCheckingH,- Database.HsSqlPpp.TypeConversion,- Database.HsSqlPpp.TypeType+ Other-Modules: Database.HsSqlPpp.TypeChecking.AstAnnotation,+ Database.HsSqlPpp.Tests.AstCheckTests,+ Database.HsSqlPpp.TypeChecking.Ast,+ Database.HsSqlPpp.TypeChecking.AstInternal,+ Database.HsSqlPpp.TypeChecking.TypeChecker,+ Database.HsSqlPpp.TypeChecking.AstUtils,+ Database.HsSqlPpp.Dbms.DatabaseLoader,+ Database.HsSqlPpp.Tests.DatabaseLoaderTests,+ Database.HsSqlPpp.Dbms.DBAccess,+ Database.HsSqlPpp.TypeChecking.DefaultScope,+ Database.HsSqlPpp.Parsing.Lexer,+ Database.HsSqlPpp.Parsing.ParseErrors,+ Database.HsSqlPpp.Parsing.Parser,+ Database.HsSqlPpp.Tests.ParserTests,+ Database.HsSqlPpp.PrettyPrinter.PrettyPrinter,+ Database.HsSqlPpp.TypeChecking.ScopeData,+ Database.HsSqlPpp.TypeChecking.Scope,+ Database.HsSqlPpp.TypeChecking.ScopeReader,+ Database.HsSqlPpp.TypeChecking.TypeCheckingH,+ Database.HsSqlPpp.TypeChecking.TypeConversion,+ Database.HsSqlPpp.TypeChecking.TypeType
questions view
@@ -6,7 +6,7 @@ generating the default scope, the layout is awful when saved to a file. Is there an easy way to Show this value, with nice formatting? Is there a better way to serialize this value rather than as a haskell-source file?+source file? Todo - try Data.Binary = ghc questions @@ -28,19 +28,20 @@ = cabal when tried to install profiling, is there a short cut to reinstall all-the dependent libs with the profiling option on, had to do this one or+the dependent libs with the profiling option on? had to do this one or two libs at a time and it took ages. after cabal stop complaining about libs without profiling on, tried to build the code and got errors like HSHunit_p library not found, this was fixed by re-cabal installing some libraries with profiling on that-cabal had missed - why did it pick up on some libs, and not others?+cabal had missed - it picked up on some libs, and not others? +cabal haddock - top level documentation from cabal file appears to+have whitespace stripping, destroying paragraphs and lists+ = uuagc -compare with aspectag - what are the upsides/downsides? Hypothetically-speaking, could ehc be changed to use aspectag, if not, what are the-limitations which would prevent this?+compare with aspectag - what are the upsides/downsides? = postgresql questions
+ sqltestfiles/client.sql view
@@ -0,0 +1,1720 @@+/*++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();
+ sqltestfiles/server.sql view
@@ -0,0 +1,4645 @@+/*++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 error.++ */++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, imaginary+ 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 %',+ flavours;+ 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 view
@@ -0,0 +1,1308 @@+/*++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.+++================================================================================++= 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');
usage view
@@ -45,10 +45,11 @@ == showinfodb This command will take a sql file, parse it, type check it and then-pretty print the lines interspersed with comments containing some-information for each command, either type errors, or some other-information tailored to the statement type (e.g. create function shows-function prototype, create view shows column names and types in view).+pretty print the lines interspersed with comments containing+annotation information gathered during type checking (including type+errors), and other information tailored to the statement type+(e.g. create function shows function prototype, create view shows+column names and types in view). You pass a database in as the first arg, and it type checks against the catalog of that database. It currently doesn't type check against@@ -58,10 +59,12 @@ some example output of showinfodb: -/*-RelvarInfo ("base_relvar_attributes",ViewComposite,SetOfType (UnnamedCompositeType [("attribute_name",ScalarType "name"),("type_name",ScalarType "name"),("relvar_name",ScalarType "name")]))*/ -create view base_relvar_attributes as+/*+ TypeAnnotation (Pseudo Void)+StatementInfoA (RelvarInfo ("base_relvar_attributes",ViewComposite,SetOfType (UnnamedCompositeType [("attribute_name",ScalarType "name"),("type_name",ScalarType "name"),("relvar_name",ScalarType "name")])))+SourcePos "sqltestfiles/system.sql" 67 13 */+ 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)@@ -69,13 +72,14 @@ inner join base_relvars on (relname = base_relvars.relvar_name) where (attnum >= 1); -A pretty printer for the StatementInfo type is planned, to make this+Pretty printers for the Annotation types are planned, to make this comment 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@@ -93,9 +97,6 @@ lexfile lex the file given and output the tokens on separate lines -showFileAtts-run the ag over the given files and return all the attributes computed- 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@@ -112,16 +113,6 @@ read the catalogs for the given db and dump a scope variable source text to stdout -showtypes-reads each file, parses, type checks, then outputs the types-interspersed with the pretty printed statements--showtypesdb-pass the name of a database first, then filenames, reads each file,-parses, type checks, then outputs the types interspersed with the-pretty printed statements, will type check against the given database-schema- showinfo reads each file, parses, type checks, then outputs info on each statement interspersed with the pretty printed statements@@ -132,42 +123,19 @@ with the pretty printed statements, will type check against the given database schema - ================================================================================ -= Using ghci--by loading different files into ghci, you can try commands out-interactively, here are some highlights:--load Parser.lhs, use parseSql:--Prelude Parser> parseSql "select a from b;"-Right [(("",1,1),SelectStatement (Select Dupes (SelectList [SelExp (Identifier "a")] []) (Just (Tref "b")) Nothing [] Nothing [] Asc Nothing Nothing))]-Prelude Parser> parseSql "select a b c from d;"-Left -----------------------(line 1, column 10):-unexpected IdStringTok "b"-expecting operator-FILENAMESTUFF:-:1:10--------------Check it out:-select a b c from d;- ^-ERROR HERE---------------------load AstCheckTests.lhs, use parseAndGetType:+= library usage -*AstCheckTests> parseAndGetType "select * from pg_attribute inner join pg_type on pg_attribute.atttypid = pg_type.oid;"-[SetOfType (UnnamedCompositeType [("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")),("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")])]+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. Hopefully, haddock docs will be online at+http://hackage.haskell.org/package/hssqlppp+when 0.0.6 is uploaded. ================================================================================ = run the automated tests -To run the test suite run ./Tests.lhs. This will run the tests for parsing-and pretty printing, and for type checking.+To run the test suite run ./HsSqlPppTests.lhs. This will run the tests+for parsing and pretty printing, and for type checking.