View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors.
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   * 
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.sequencer.ddl.dialect.postgres;
25  
26  import java.util.Arrays;
27  import java.util.List;
28  
29  import org.modeshape.graph.property.Name;
30  import org.modeshape.sequencer.ddl.DdlConstants;
31  import org.modeshape.sequencer.ddl.DdlTokenStream;
32  import org.modeshape.sequencer.ddl.StandardDdlLexicon;
33  
34  /**
35   *
36   */
37  public interface PostgresDdlConstants extends DdlConstants {
38  	public static final String[] CUSTOM_KEYWORDS = {
39  		"SHOW", "LISTEN", "UNLISTEN", "REINDEX", "MOVE", "ABORT", "ANALYZE", "TRUNCATE", "REASSIGN", "RELEASE",
40  		"RESET", "REVOKE", "ROLLBACK", "FETCH", "EXPLAIN", "DISCARD", "COPY", "CLUSTER", "NOTIFY", "LOAD", "COMMENT", "LOCK",
41  		"SERVER", "SEARCH", "PARSER", "DICTIONARY", "WRAPPER", "PROCEDURAL", "CONVERSION", "AGGREGATE", "TEMPLATE", 
42  		"MAPPING", "TRUSTED", "TRIGGER", "VACUUM", "FAMILTY",
43  		"BIGSERIAL", "BOX", "BOOLEAN", "BOX", "BYTEA", "CIDR", "CIRCLE", "FLOAT4", "FLOAT8", "INET", "INT2", "INT4", "INT8",
44          "LINE", "LSEG", "MACADDR", "MONEY", "PATH", "POINT", "POLYGON",
45          "SERIAL", "SERIAL4", "SERIAL8", "TEXT", "TIMESTAMPZ", "TSQUERY",
46          "TSVECTOR", "TXID_SNAPSHOT", "UUID", "XML"
47  	};
48  
49  	interface PostgresStatementStartPhrases {
50  		static final String[] STMT_ALTER_AGGREGATE = {ALTER, "AGGREGATE"};
51  		static final String[] STMT_ALTER_CONVERSION = {ALTER, "CONVERSION"};
52  		static final String[] STMT_ALTER_DATABASE = {ALTER, "DATABASE"};
53  		static final String[] STMT_ALTER_FOREIGN_DATA_WRAPPER = {ALTER, "FOREIGN", "DATA", "WRAPPER"};
54  		static final String[] STMT_ALTER_FUNCTION = {ALTER, "FUNCTION"};
55  		static final String[] STMT_ALTER_GROUP = {ALTER, "GROUP", DdlTokenStream.ANY_VALUE, DdlTokenStream.ANY_VALUE, DdlTokenStream.ANY_VALUE };
56  		static final String[] STMT_ALTER_INDEX = {ALTER, "INDEX"};
57  		static final String[] STMT_ALTER_LANGUAGE = {ALTER, "LANGUAGE"};
58  		static final String[] STMT_ALTER_PROCEDURAL_LANGUAGE = {ALTER, "PROCEDURAL", "LANGUAGE"};
59  		static final String[] STMT_ALTER_OPERATOR = {ALTER, "OPERATOR"};
60  		static final String[] STMT_ALTER_OPERATOR_CLASS = {
61  			ALTER, "OPERATOR", "CLASS", DdlTokenStream.ANY_VALUE, 
62  			DdlTokenStream.ANY_VALUE, DdlTokenStream.ANY_VALUE, DdlTokenStream.ANY_VALUE
63  		};
64  		static final String[] STMT_ALTER_OPERATOR_FAMILY = {
65  			ALTER, "OPERATOR", "FAMILY", DdlTokenStream.ANY_VALUE, 
66  			DdlTokenStream.ANY_VALUE, DdlTokenStream.ANY_VALUE, DdlTokenStream.ANY_VALUE
67  		};
68  		static final String[] STMT_ALTER_ROLE = {ALTER, "ROLE"};
69  		static final String[] STMT_ALTER_SCHEMA = {ALTER, "SCHEMA"};
70  		static final String[] STMT_ALTER_SEQUENCE = {ALTER, "SEQUENCE"};
71  		static final String[] STMT_ALTER_SERVER = {ALTER, "SERVER"};
72  		static final String[] STMT_ALTER_TABLESPACE = {ALTER, "TABLESPACE"};
73  		static final String[] STMT_ALTER_TEXT_SEARCH_CONFIGURATION = {ALTER, "TEXT", "SEARCH", "CONFIGURATION"};
74  		static final String[] STMT_ALTER_TEXT_SEARCH_DICTIONARY = {ALTER, "TEXT", "SEARCH", "DICTIONARY"};
75  		static final String[] STMT_ALTER_TEXT_SEARCH_PARSER = {ALTER, "TEXT", "SEARCH", "PARSER"};
76  		static final String[] STMT_ALTER_TEXT_SEARCH_TEMPLATE = {ALTER, "TEXT", "SEARCH", "TEMPLATE"};
77  		static final String[] STMT_ALTER_TEXT_SEARCH = {ALTER, "TEXT", "SEARCH"};
78  		static final String[] STMT_ALTER_TRIGGER = {ALTER, "TRIGGER"};
79  		static final String[] STMT_ALTER_TYPE = {ALTER, "TYPE"};
80  		static final String[] STMT_ALTER_USER = {ALTER, "USER"};
81  		static final String[] STMT_ALTER_USER_MAPPING = {ALTER, "USER", "MAPPING"};
82  		static final String[] STMT_ALTER_VIEW = {ALTER, "VIEW"};
83  		
84  	    static final String[][] ALTER_PHRASES = { 
85  	    	STMT_ALTER_AGGREGATE, STMT_ALTER_CONVERSION, STMT_ALTER_DATABASE, STMT_ALTER_FOREIGN_DATA_WRAPPER, STMT_ALTER_FUNCTION,
86  	    	STMT_ALTER_GROUP, STMT_ALTER_INDEX, STMT_ALTER_PROCEDURAL_LANGUAGE, STMT_ALTER_LANGUAGE, STMT_ALTER_OPERATOR_CLASS, 
87  	    	STMT_ALTER_OPERATOR_FAMILY, STMT_ALTER_OPERATOR,
88  	    	STMT_ALTER_ROLE, STMT_ALTER_SCHEMA, STMT_ALTER_SEQUENCE, STMT_ALTER_SERVER, STMT_ALTER_TABLESPACE,
89  	    	STMT_ALTER_TEXT_SEARCH_CONFIGURATION, STMT_ALTER_TEXT_SEARCH_DICTIONARY, STMT_ALTER_TEXT_SEARCH_PARSER,
90  	    	STMT_ALTER_TEXT_SEARCH_TEMPLATE, STMT_ALTER_TEXT_SEARCH, STMT_ALTER_TRIGGER, STMT_ALTER_TYPE, STMT_ALTER_USER_MAPPING, STMT_ALTER_USER,
91  	    	STMT_ALTER_VIEW
92  		};
93  	    
94  	    static final String[] STMT_CREATE_AGGREGATE = {CREATE, "AGGREGATE"};
95  	    static final String[] STMT_CREATE_CAST = {CREATE, "CAST"};
96  	    static final String[] STMT_CREATE_CONSTRAINT_TRIGGER = {CREATE, "CONSTRAINT", "TRIGGER"};
97  	    static final String[] STMT_CREATE_CONVERSION = {CREATE, "CONVERSION"};
98  	    static final String[] STMT_CREATE_DATABASE = {CREATE, "DATABASE"};
99  	    static final String[] STMT_CREATE_FOREIGN_DATA_WRAPPER = {CREATE, "FOREIGN", "DATA", "WRAPPER"};
100 	    static final String[] STMT_CREATE_FUNCTION = {CREATE, "FUNCTION"};
101 	    static final String[] STMT_CREATE_OR_REPLACE_FUNCTION = {CREATE, "OR", "REPLACE", "FUNCTION"};
102 	    static final String[] STMT_CREATE_GROUP = {CREATE, "GROUP"};
103 	    static final String[] STMT_CREATE_INDEX = {CREATE, "INDEX"};
104 	    static final String[] STMT_CREATE_UNIQUE_INDEX = {CREATE, "UNIQUE", "INDEX"};
105 	    static final String[] STMT_CREATE_LANGUAGE = {CREATE, "LANGUAGE"};
106 	    static final String[] STMT_CREATE_PROCEDURAL_LANGUAGE = {CREATE, "PROCEDURAL", "LANGUAGE"};
107 	    static final String[] STMT_CREATE_TRUSTED_PROCEDURAL_LANGUAGE = {CREATE, "TRUSTED", "PROCEDURAL", "LANGUAGE"};
108 	    static final String[] STMT_CREATE_OPERATOR = {CREATE, "OPERATOR"};
109 	    static final String[] STMT_CREATE_OPERATOR_CLASS = {CREATE, "OPERATOR", "CLASS"};
110 	    static final String[] STMT_CREATE_OPERATOR_FAMILY = {CREATE, "OPERATOR", "FAMILY"};
111 	    static final String[] STMT_CREATE_ROLE = {CREATE, "ROLE"};
112 	    static final String[] STMT_CREATE_RULE = {CREATE, "RULE"};
113 	    static final String[] STMT_CREATE_OR_REPLACE_RULE = {CREATE, "OR", "REPLACE", "RULE"};
114 	    static final String[] STMT_CREATE_TEMP_TABLE = {CREATE, "TEMP", TABLE};
115 	  	static final String[] STMT_CREATE_GLOBAL_TEMP_TABLE = {CREATE, "GLOBAL", "TEMP", TABLE};
116 	  	static final String[] STMT_CREATE_LOCAL_TEMP_TABLE = {CREATE, "LOCAL", "TEMP", TABLE};
117 	    static final String[] STMT_CREATE_SEQUENCE = {CREATE, "SEQUENCE"};
118 	    static final String[] STMT_CREATE_TEMP_SEQUENCE = {CREATE, "TEMP", "SEQUENCE"};
119 	    static final String[] STMT_CREATE_TEMPORARY_SEQUENCE = {CREATE, "TEMPORARY", "SEQUENCE"};
120 	    static final String[] STMT_CREATE_SERVER = {CREATE, "SERVER"};
121 	    static final String[] STMT_CREATE_TABLESPACE = {CREATE, "TABLESPACE"};
122 		static final String[] STMT_CREATE_TEXT_SEARCH_CONFIGURATION = {CREATE, "TEXT", "SEARCH", "CONFIGURATION"};
123 		static final String[] STMT_CREATE_TEXT_SEARCH_DICTIONARY = {CREATE, "TEXT", "SEARCH", "DICTIONARY"};
124 		static final String[] STMT_CREATE_TEXT_SEARCH_PARSER = {CREATE, "TEXT", "SEARCH", "PARSER"};
125 		static final String[] STMT_CREATE_TEXT_SEARCH_TEMPLATE = {CREATE, "TEXT", "SEARCH", "TEMPLATE"};
126 		static final String[] STMT_CREATE_TEXT_SEARCH = {CREATE, "TEXT", "SEARCH"};
127 		static final String[] STMT_CREATE_TRIGGER = {CREATE, "TRIGGER"};
128 	    static final String[] STMT_CREATE_TYPE = {CREATE, "TYPE"};
129 	    static final String[] STMT_CREATE_USER = {CREATE, "USER"};
130 	    static final String[] STMT_CREATE_USER_MAPPING = {CREATE, "USER", "MAPPING"};
131 
132 	    
133 	    static final String[][] CREATE_PHRASES = { 
134 	    	STMT_CREATE_AGGREGATE, STMT_CREATE_CAST, STMT_CREATE_CONSTRAINT_TRIGGER, STMT_CREATE_CONVERSION,
135 	    	STMT_CREATE_DATABASE, STMT_CREATE_FOREIGN_DATA_WRAPPER, STMT_CREATE_FUNCTION, STMT_CREATE_OR_REPLACE_FUNCTION,
136 	    	STMT_CREATE_GROUP, STMT_CREATE_INDEX, STMT_CREATE_UNIQUE_INDEX, STMT_CREATE_PROCEDURAL_LANGUAGE, 
137 	    	STMT_CREATE_TRUSTED_PROCEDURAL_LANGUAGE,
138 	    	STMT_CREATE_LANGUAGE, STMT_CREATE_OPERATOR_CLASS, STMT_CREATE_OPERATOR_FAMILY,
139 	    	STMT_CREATE_OPERATOR, STMT_CREATE_ROLE, STMT_CREATE_RULE, STMT_CREATE_OR_REPLACE_RULE,  
140 	    	STMT_CREATE_TEMP_TABLE, STMT_CREATE_GLOBAL_TEMP_TABLE, STMT_CREATE_LOCAL_TEMP_TABLE,
141 	    	STMT_CREATE_SEQUENCE, STMT_CREATE_TEMP_SEQUENCE, STMT_CREATE_TEMPORARY_SEQUENCE,
142 	    	STMT_CREATE_SERVER, STMT_CREATE_TABLESPACE, STMT_CREATE_TEXT_SEARCH_CONFIGURATION, STMT_CREATE_TEXT_SEARCH_DICTIONARY,
143 	    	STMT_CREATE_TEXT_SEARCH_PARSER,STMT_CREATE_TEXT_SEARCH_TEMPLATE, STMT_CREATE_TEXT_SEARCH, 
144 	    	STMT_CREATE_TRIGGER, STMT_CREATE_TYPE,
145 	    	STMT_CREATE_USER_MAPPING, STMT_CREATE_USER
146 		};
147 	    
148 	    static final String[] STMT_DROP_AGGREGATE = {DROP, "AGGREGATE"};
149 	    static final String[] STMT_DROP_CAST = {DROP, "CAST"};
150 	    static final String[] STMT_DROP_CONSTRAINT_TRIGGER = {DROP, "CONSTRAINT", "TRIGGER"};
151 	    static final String[] STMT_DROP_CONVERSION = {DROP, "CONVERSION"};
152 	    static final String[] STMT_DROP_DATABASE = {DROP, "DATABASE"};
153 	    static final String[] STMT_DROP_FOREIGN_DATA_WRAPPER = {DROP, "FOREIGN", "DATA", "WRAPPER"};
154 	    static final String[] STMT_DROP_FUNCTION = {DROP, "FUNCTION"};
155 	    static final String[] STMT_DROP_GROUP = {DROP, "GROUP"};
156 	    static final String[] STMT_DROP_INDEX = {DROP, "INDEX"};
157 	    static final String[] STMT_DROP_LANGUAGE = {DROP, "LANGUAGE"};
158 	    static final String[] STMT_DROP_PROCEDURAL_LANGUAGE = {DROP, "PROCEDURAL", "LANGUAGE"};
159 	    static final String[] STMT_DROP_OPERATOR = {DROP, "OPERATOR"};
160 	    static final String[] STMT_DROP_OPERATOR_CLASS = {DROP, "OPERATOR", "CLASS"};
161 	    static final String[] STMT_DROP_OPERATOR_FAMILY = {DROP, "OPERATOR", "FAMILY"};
162 	    static final String[] STMT_DROP_OWNED_BY = {DROP, "OWNED", "BY"};
163 	    static final String[] STMT_DROP_ROLE = {DROP, "ROLE"};
164 	    static final String[] STMT_DROP_RULE = {DROP, "RULE"};
165 	    static final String[] STMT_DROP_SEQUENCE = {DROP, "SEQUENCE"};
166 	    static final String[] STMT_DROP_SERVER = {DROP, "SERVER"};
167 	    static final String[] STMT_DROP_TABLESPACE = {DROP, "TABLESPACE"};
168 		static final String[] STMT_DROP_TEXT_SEARCH_CONFIGURATION = {DROP, "TEXT", "SEARCH", "CONFIGURATION"};
169 		static final String[] STMT_DROP_TEXT_SEARCH_DICTIONARY = {DROP, "TEXT", "SEARCH", "DICTIONARY"};
170 		static final String[] STMT_DROP_TEXT_SEARCH_PARSER = {DROP, "TEXT", "SEARCH", "PARSER"};
171 		static final String[] STMT_DROP_TEXT_SEARCH_TEMPLATE = {DROP, "TEXT", "SEARCH", "TEMPLATE"};
172 		static final String[] STMT_DROP_TEXT_SEARCH = {DROP, "TEXT", "SEARCH"};
173 		static final String[] STMT_DROP_TRIGGER = {DROP, "TRIGGER"};
174 	    static final String[] STMT_DROP_TYPE = {DROP, "TYPE"};
175 	    static final String[] STMT_DROP_USER = {DROP, "USER"};
176 	    static final String[] STMT_DROP_USER_MAPPING = {DROP, "USER", "MAPPING"};
177 
178 	    
179 	    static final String[][] DROP_PHRASES = { 
180 	    	STMT_DROP_AGGREGATE, STMT_DROP_CAST, STMT_DROP_CONSTRAINT_TRIGGER, STMT_DROP_CONVERSION,
181 	    	STMT_DROP_DATABASE, STMT_DROP_FOREIGN_DATA_WRAPPER, STMT_DROP_FUNCTION,
182 	    	STMT_DROP_GROUP, STMT_DROP_INDEX, STMT_DROP_PROCEDURAL_LANGUAGE,
183 	    	STMT_DROP_LANGUAGE, STMT_DROP_OPERATOR_CLASS, STMT_DROP_OPERATOR_FAMILY, STMT_DROP_OWNED_BY,
184 	    	STMT_DROP_OPERATOR, STMT_DROP_ROLE, STMT_DROP_RULE, STMT_DROP_SEQUENCE,
185 	    	STMT_DROP_SERVER, STMT_DROP_TABLESPACE, STMT_DROP_TEXT_SEARCH_CONFIGURATION, STMT_DROP_TEXT_SEARCH_DICTIONARY,
186 	    	STMT_DROP_TEXT_SEARCH_PARSER,STMT_DROP_TEXT_SEARCH_TEMPLATE, STMT_DROP_TEXT_SEARCH, STMT_DROP_TRIGGER, STMT_DROP_TYPE,
187 	    	STMT_DROP_USER_MAPPING, STMT_DROP_USER
188 		};
189 	    
190 	    static final String[] STMT_SET_CONSTRAINTS = {"SET", "CONSTRAINTS"};
191 	    static final String[] STMT_SET_ROLE = {"SET", "ROLE"};
192 	    static final String[] STMT_SET_SESSION_AUTHORIZATION= {"SET", "SESSION", "AUTHORIZATION"};
193 	    static final String[] STMT_SET_TRANSACTION = {"SET", "TRANSACTION"};
194 	    
195 	    static final String[][] SET_PHRASES = { 
196 	    	STMT_SET_CONSTRAINTS, STMT_SET_ROLE, STMT_SET_SESSION_AUTHORIZATION, STMT_SET_TRANSACTION
197 		};
198 	    
199 	    static final String[] STMT_ABORT = {"ABORT"};
200 	    static final String[] STMT_ANALYZE = {"ANALYZE"};
201 	    static final String[] STMT_CLUSTER = {"CLUSTER"};
202 	    static final String[] STMT_COMMENT_ON = {"COMMENT", "ON"};
203 	    static final String[] STMT_COMMIT = {"COMMIT"};
204 	    static final String[] STMT_COPY = {"COPY"};
205 	    static final String[] STMT_DEALLOCATE_PREPARE = {"DEALLOCATE", "PREPARE"};
206 	    static final String[] STMT_DEALLOCATE = {"DEALLOCATE"};
207 	    static final String[] STMT_DECLARE = {"DECLARE"};
208 	    static final String[] STMT_DISCARD = {"DISCARD"};
209 	    static final String[] STMT_EXPLAIN_ANALYZE = {"EXPLAIN", "ANALYZE"};
210 	    static final String[] STMT_EXPLAIN = {"EXPLAIN"};
211 	    static final String[] STMT_FETCH = {"FETCH"};
212 	    static final String[] STMT_LISTEN = {"LISTEN"};
213 	    static final String[] STMT_LOAD = {"LOAD"};
214 		static final String[] STMT_LOCK_TABLE = {"LOCK", "TABLE"};
215 	    static final String[] STMT_MOVE = {"MOVE"};
216 	    static final String[] STMT_NOTIFY = {"NOTIFY"};
217 	    static final String[] STMT_PREPARE = {"PREPARE"};
218 	    static final String[] STMT_PREPARE_TRANSATION = {"PREPARE", "TRANSATION"};
219 	    static final String[] STMT_REASSIGN_OWNED = {"REASSIGN", "OWNED"};
220 	    static final String[] STMT_REINDEX = {"REINDEX"};
221 	    static final String[] STMT_RELEASE_SAVEPOINT = {"RELEASE", "SAVEPOINT"};
222 	    static final String[] STMT_REVOKE = {"REVOKE"};
223 	    static final String[] STMT_ROLLBACK = {"ROLLBACK"};
224 	    static final String[] STMT_ROLLBACK_PREPARED = {"ROLLBACK", "PREPARED"};
225 	    static final String[] STMT_ROLLBACK_TO_SAVEPOINT = {"ROLLBACK", "TO", "SAVEPOINT"};
226 	    static final String[] STMT_SELECT_INTO = {"SELECT", "INTO"};
227 
228 	    static final String[] STMT_SHOW = {"SHOW"};
229 	    static final String[] STMT_TRUNCATE = {"TRUNCATE"};
230 	    static final String[] STMT_UNLISTEN = {"UNLISTEN"};
231 	    static final String[] STMT_VACUUM = {"VACUUM"};
232 	    //static final String[] STMT_VALUES = {"VALUES"};
233 	    
234 	    static final String[][] MISC_PHRASES = {
235 	    	STMT_ABORT, STMT_ANALYZE, STMT_CLUSTER, STMT_COMMENT_ON, STMT_COMMIT, STMT_COPY, STMT_DEALLOCATE_PREPARE, STMT_DEALLOCATE,
236 	    	STMT_DECLARE, STMT_DISCARD, STMT_EXPLAIN_ANALYZE, STMT_EXPLAIN, STMT_FETCH, STMT_LISTEN, STMT_LOAD, STMT_LOCK_TABLE,
237 	    	STMT_MOVE, STMT_NOTIFY, STMT_PREPARE, STMT_PREPARE_TRANSATION, STMT_REASSIGN_OWNED, STMT_REINDEX, 
238 	    	STMT_RELEASE_SAVEPOINT, STMT_REVOKE, STMT_ROLLBACK_TO_SAVEPOINT, STMT_ROLLBACK_PREPARED, 
239 	    	STMT_ROLLBACK, STMT_SELECT_INTO, STMT_SHOW, STMT_TRUNCATE, STMT_UNLISTEN, STMT_VACUUM   //, STMT_VALUES
240 		};
241 	    
242 	    // CREATE TABLE, CREATE VIEW, CREATE INDEX, CREATE SEQUENCE, CREATE TRIGGER and GRANT
243 	    public final static Name[] VALID_SCHEMA_CHILD_STMTS = {
244 	    	StandardDdlLexicon.TYPE_CREATE_TABLE_STATEMENT, 
245 	    	StandardDdlLexicon.TYPE_CREATE_VIEW_STATEMENT,
246 	    	StandardDdlLexicon.TYPE_GRANT_ON_TABLE_STATEMENT,
247 	    	PostgresDdlLexicon.TYPE_CREATE_INDEX_STATEMENT,
248 	    	PostgresDdlLexicon.TYPE_CREATE_SEQUENCE_STATEMENT,
249 	    	PostgresDdlLexicon.TYPE_CREATE_TRIGGER_STATEMENT,
250 	    	PostgresDdlLexicon.TYPE_GRANT_ON_SEQUENCE_STATEMENT,
251 	    	PostgresDdlLexicon.TYPE_GRANT_ON_SCHEMA_STATEMENT
252 	  	};
253 	    
254 	    public final static Name[] COMPLEX_STMT_TYPES = {
255 	    	PostgresDdlLexicon.TYPE_CREATE_FUNCTION_STATEMENT
256 	    };
257 	}
258 	
259 		//SPEC  Name				Aliases		Description
260 		//
261 		//	X	bigint					int8		signed eight-byte integer
262 		//		bigserial				serial8		autoincrementing eight-byte integer
263 		//	X	bit [ (n) ]	 						fixed-length bit string
264 		//	X	bit varying [ (n) ]		varbit		variable-length bit string
265 		//		boolean					bool		logical Boolean (true/false)
266 		//		box	 								rectangular box on a plane
267 		//		bytea	 							binary data ("byte array")
268 		//	X	character varying [ (n) ]	varchar [ (n) ]	variable-length character string
269 		//	X	character [ (n) ]		char [ (n) ]	fixed-length character string
270 		//		cidr	 							IPv4 or IPv6 network address
271 		//		circle	 							circle on a plane
272 		//	X	date	 							calendar date (year, month, day)
273 		//	X	double precision		float8		double precision floating-point number (8 bytes)
274 		//		inet	 							IPv4 or IPv6 host address
275 		//	X	integer					int, int4	signed four-byte integer
276 		//	X	interval [ fields ] [ (p) ]	 		time span
277 		//		line	 							infinite line on a plane
278 		//		lseg	 							line segment on a plane
279 		//		macaddr	 							MAC (Media Access Control) address
280 		//		money	 							currency amount
281 		//	X	numeric [ (p, s) ]		decimal [ (p, s) ]	exact numeric of selectable precision
282 		//		path	 							geometric path on a plane
283 		//		point	 							geometric point on a plane
284 		//		polygon	 							closed geometric path on a plane
285 		//	X	real					float4		single precision floating-point number (4 bytes)
286 		//	X	smallint				int2		signed two-byte integer
287 		//		serial					serial4		auto incrementing four-byte integer
288 		//		text	 							variable-length character string
289 		//		time [ (p) ] [ without time zone ]	 	time of day (no time zone)
290 		//	X	time [ (p) ] with time zone	timetz		time of day, including time zone
291 		//		timestamp [ (p) ] [ without time zone ]	 	date and time (no time zone)
292 		//	X	timestamp [ (p) ] with time zone	timestamptz	date and time, including time zone
293 		//		tsquery	 							text search query
294 		//		tsvector	 						text search document
295 		//		txid_snapshot	 					user-level transaction ID snapshot
296 		//		uuid	 							universally unique identifier
297 		//	X	xml	 								XML data
298 		//      interval hour to minute
299 	
300 	interface PostgresDataTypes {
301 		static final String[] DTYPE_BIGSERIAL = {"BIGSERIAL"};
302 		static final String[] DTYPE_BOX = {"BOX"};
303 		static final String[] DTYPE_BYTEA = {"BYTEA"};
304 		static final String[] DTYPE_CIDR = {"CIDR"}; 
305 		static final String[] DTYPE_CIRCLE = {"CIRCLE"}; 
306 		static final String[] DTYPE_INET = {"INET"}; 
307 		static final String[] DTYPE_LINE = {"LINE"}; 
308 		static final String[] DTYPE_LSEG = {"LSEG"}; 
309 		static final String[] DTYPE_MACADDR = {"MACADDR"}; 
310 		static final String[] DTYPE_MONEY = {"MONEY"}; 
311 		static final String[] DTYPE_PATH = {"PATH"}; 
312 		static final String[] DTYPE_POINT = {"POINT"}; 
313 		static final String[] DTYPE_POLYGON = {"POLYGON"}; 
314 		static final String[] DTYPE_SERIAL = {"SERIAL"}; 
315 		static final String[] DTYPE_TEXT = {"TEXT"}; 
316 		static final String[] DTYPE_TSQUERY = {"TSQUERY"}; 
317 		static final String[] DTYPE_TSVECTOR = {"TSVECTOR"}; 
318 		static final String[] DTYPE_TXID_SNAPSHOT = {"TXID_SNAPSHOT"}; 
319 		static final String[] DTYPE_UUID = {"UUID"}; 
320 		static final String[] DTYPE_XML = {"XML"}; 
321 		static final String[] DTYPE_BOOLEAN = {"BOOLEAN"}; 
322 		static final String[] DTYPE_BOOL = {"BOOL"}; 
323 		static final String[] DTYPE_FLOAT4 = {"FLOAT4"}; 
324 		static final String[] DTYPE_FLOAT8 = {"FLOAT8"}; 
325 		static final String[] DTYPE_INT2 = {"INT2"}; 
326 		static final String[] DTYPE_INT4 = {"INT4"}; 
327 		static final String[] DTYPE_INT8 = {"INT8"}; 
328 		static final String[] DTYPE_SERIAL4 = {"SERIAL4"};
329 		static final String[] DTYPE_SERIAL8 = {"SERIAL8"}; 
330 		static final String[] DTYPE_TIMESTAMPZ = {"TIMESTAMPZ"}; 
331 		static final String[] DTYPE_VARBIT = {"VARBIT"}; 
332 
333 		
334 		static final List<String[]> CUSTOM_DATATYPE_START_PHRASES = 
335 	  		Arrays.asList(new String[][] {
336 	  				DTYPE_BIGSERIAL, DTYPE_BOOL, DTYPE_BOOLEAN, DTYPE_BOX, DTYPE_BYTEA,
337 	  				DTYPE_CIDR, DTYPE_CIRCLE, DTYPE_FLOAT4, DTYPE_FLOAT8, DTYPE_INET, DTYPE_INT2, DTYPE_INT4, DTYPE_INT8,
338 	  				DTYPE_LINE, DTYPE_LSEG, DTYPE_MACADDR, DTYPE_MONEY, DTYPE_PATH, DTYPE_POINT, DTYPE_POLYGON,
339 	  				DTYPE_SERIAL, DTYPE_SERIAL4, DTYPE_SERIAL8, DTYPE_TEXT, DTYPE_TIMESTAMPZ, DTYPE_TSQUERY,
340 	  				DTYPE_TSVECTOR, DTYPE_TXID_SNAPSHOT, DTYPE_UUID, DTYPE_XML
341 	  	  	});
342 		
343 	  	static final List<String> CUSTOM_DATATYPE_START_WORDS = 
344 	  		Arrays.asList(new String[] {
345 	  				"BIGSERIAL", "BOX", "BOOLEAN", "BOX", "BYTEA",
346 	  				"CIDR", "CIRCLE", "FLOAT4", "FLOAT8", "INET", "INT2", "INT4", "INT8",
347 	  				"LINE", "LSEG", "MACADDR", "MONEY", "PATH", "POINT", "POLYGON",
348 	  				"SERIAL", "SERIAL4", "SERIAL8", "TEXT", "TIMESTAMPZ", "TSQUERY",
349 	  				"TSVECTOR", "TXID_SNAPSHOT", "UUID", "XML"
350 	  	  	});
351 	}
352 }