1-- POINT
2select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
3          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
4          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
5 'POINT EMPTY'
6::text as g ) as foo;
7select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
8          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
9          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
10 'POINT Z EMPTY'
11::text as g ) as foo;
12select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
13          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
14          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
15 'POINT M EMPTY'
16::text as g ) as foo;
17select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
18          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
19          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
20 'POINT ZM EMPTY'
21::text as g ) as foo;
22select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
23          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
24          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
25 'POINT(0 0)'
26::text as g ) as foo;
27select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
28          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
29          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
30 'POINT Z (1 2 3)'
31::text as g ) as foo;
32select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
33          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
34          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
35 'POINT M (1 2 3)'
36::text as g ) as foo;
37select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
38          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
39          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
40 'POINT ZM (1 2 3 4)'
41::text as g ) as foo;
42
43-- MULTIPOINT
44select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
45          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
46          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
47 'MULTIPOINT EMPTY'
48::text as g ) as foo;
49select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
50          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
51          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
52 'MULTIPOINT Z EMPTY'
53::text as g ) as foo;
54select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
55          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
56          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
57 'MULTIPOINT M EMPTY'
58::text as g ) as foo;
59select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
60          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
61          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
62 'MULTIPOINT ZM EMPTY'
63::text as g ) as foo;
64select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
65          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
66          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
67 'MULTIPOINT((0 0), (2 0))'
68::text as g ) as foo;
69select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
70          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
71          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
72 'MULTIPOINT Z ((0 0 0), (2 0 1))'
73::text as g ) as foo;
74select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
75          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
76          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
77 'MULTIPOINT M ((0 0 2), (2 0 1))'
78::text as g ) as foo;
79select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
80          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
81          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
82 'MULTIPOINT ZM ((0 1 2 3), (3 2 1 0))'
83::text as g ) as foo;
84
85-- LINESTRING
86select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
87          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
88          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
89 'LINESTRING EMPTY'
90::text as g ) as foo;
91select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
92          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
93          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
94 'LINESTRING Z EMPTY'
95::text as g ) as foo;
96select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
97          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
98          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
99 'LINESTRING M EMPTY'
100::text as g ) as foo;
101select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
102          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
103          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
104 'LINESTRING ZM EMPTY'
105::text as g ) as foo;
106select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
107          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
108          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
109 'LINESTRING(0 0, 1 1)'
110::text as g ) as foo;
111select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
112          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
113          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
114 'LINESTRING Z (0 0 2, 1 1 3)'
115::text as g ) as foo;
116select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
117          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
118          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
119 'LINESTRING M (0 0 2, 1 1 3)'
120::text as g ) as foo;
121select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
122          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
123          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
124 'LINESTRING ZM (0 0 2 3, 1 1 4 5)'
125::text as g ) as foo;
126
127-- MULTILINESTRING
128select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
129          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
130          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
131 'MULTILINESTRING EMPTY'
132::text as g ) as foo;
133select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
134          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
135          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
136 'MULTILINESTRING Z EMPTY'
137::text as g ) as foo;
138select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
139          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
140          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
141 'MULTILINESTRING M EMPTY'
142::text as g ) as foo;
143select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
144          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
145          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
146 'MULTILINESTRING ZM EMPTY'
147::text as g ) as foo;
148select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
149          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
150          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
151 'MULTILINESTRING((0 0, 2 0))'
152::text as g ) as foo;
153select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
154          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
155          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
156 'MULTILINESTRING((0 0, 2 0), (1 1, 2 2))'
157::text as g ) as foo;
158select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
159          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
160          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
161 'MULTILINESTRING Z ((0 0 1, 2 0 2), (1 1 3, 2 2 4))'
162::text as g ) as foo;
163select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
164          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
165          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
166 'MULTILINESTRING M ((0 0 1, 2 0 2), (1 1 3, 2 2 4))'
167::text as g ) as foo;
168select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
169          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
170          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
171 'MULTILINESTRING ZM ((0 0 1 5, 2 0 2 4), (1 1 3 3, 2 2 4 2))'
172::text as g ) as foo;
173
174-- POLYGON
175select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
176          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
177          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
178 'POLYGON EMPTY'
179::text as g ) as foo;
180select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
181          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
182          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
183 'POLYGON Z EMPTY'
184::text as g ) as foo;
185select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
186          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
187          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
188 'POLYGON M EMPTY'
189::text as g ) as foo;
190select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
191          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
192          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
193 'POLYGON ZM EMPTY'
194::text as g ) as foo;
195select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
196          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
197          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
198 'POLYGON((0 0,1 0,1 1,0 1,0 0))'
199::text as g ) as foo;
200select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
201          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
202          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
203 'POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))'
204::text as g ) as foo;
205select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
206          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
207          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
208 'POLYGON Z ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))'
209::text as g ) as foo;
210select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
211          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
212          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
213 'POLYGON M ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))'
214::text as g ) as foo;
215select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
216          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
217          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
218 'POLYGON ZM ((0 0 1 -1,10 0 2 -2,10 10 2 -2,0 10 2 -4,0 0 1 -1),(2 2 5 0,2 5 4 1,5 5 3 2,5 2 3 1,2 2 5 0))'
219::text as g ) as foo;
220
221-- MULTIPOLYGON
222select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
223          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
224          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
225 'MULTIPOLYGON EMPTY'
226::text as g ) as foo;
227select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
228          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
229          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
230 'MULTIPOLYGON Z EMPTY'
231::text as g ) as foo;
232select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
233          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
234          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
235 'MULTIPOLYGON M EMPTY'
236::text as g ) as foo;
237select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
238          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
239          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
240 'MULTIPOLYGON ZM EMPTY'
241::text as g ) as foo;
242select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
243          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
244          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
245 'MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))'
246::text as g ) as foo;
247select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
248          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
249          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
250 'MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3),(2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))'
251::text as g ) as foo;
252select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
253          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
254          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
255 'MULTIPOLYGON M (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3),(2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))'
256::text as g ) as foo;
257select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
258          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
259          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
260 'MULTIPOLYGON ZM (((0 0 3 2,10 0 3 2,10 10 3 2,0 10 3 2,0 0 3 2),(2 2 3 2,2 5 3 2,5 5 3 2,5 2 3 2,2 2 3 2)))'
261::text as g ) as foo;
262
263-- GEOMETRYCOLLECTION
264select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
265          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
266          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
267 'GEOMETRYCOLLECTION EMPTY'
268::text as g ) as foo;
269select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
270          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
271          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
272 'GEOMETRYCOLLECTION Z EMPTY'
273::text as g ) as foo;
274select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
275          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
276          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
277 'GEOMETRYCOLLECTION M EMPTY'
278::text as g ) as foo;
279select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
280          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
281          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
282 'GEOMETRYCOLLECTION ZM EMPTY'
283::text as g ) as foo;
284select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
285          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
286          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
287 'GEOMETRYCOLLECTION ZM (POINT ZM (0 0 0 0),LINESTRING ZM (0 0 0 0,1 1 1 1))'
288::text as g ) as foo;
289select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
290          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
291          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
292 'GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1))'
293::text as g ) as foo;
294select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
295          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
296          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
297 'GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1),GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1)))'
298::text as g ) as foo;
299select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
300          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
301          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
302 'GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1),POINT M EMPTY,GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1)))'
303::text as g ) as foo;
304select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
305          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
306          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
307 'GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1),GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1),POINT M EMPTY,GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1))),POINT M EMPTY,GEOMETRYCOLLECTION M (POINT M (0 0 0),LINESTRING M (0 0 0,1 1 1)))'
308::text as g ) as foo;
309
310-- CIRCULARSTRING
311select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
312          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
313          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
314 'CIRCULARSTRING EMPTY'
315::text as g ) as foo;
316select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
317          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
318          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
319 'CIRCULARSTRING Z EMPTY'
320::text as g ) as foo;
321select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
322          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
323          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
324 'CIRCULARSTRING M EMPTY'
325::text as g ) as foo;
326select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
327          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
328          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
329 'CIRCULARSTRING ZM EMPTY'
330::text as g ) as foo;
331select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
332          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
333          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
334 'CIRCULARSTRING (0 0,1 1, 2 0)'
335::text as g ) as foo;
336select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
337          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
338          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
339 'CIRCULARSTRING M (0 0 1,1 1 1, 2 0 1)'
340::text as g ) as foo;
341select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
342          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
343          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
344 'CIRCULARSTRING ZM (0 0 1 2,1 1 1 2, 2 0 1 2)'
345::text as g ) as foo;
346
347-- COMPOUNDCURVE
348select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
349          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
350          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
351 'COMPOUNDCURVE EMPTY'
352::text as g ) as foo;
353select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
354          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
355          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
356 'COMPOUNDCURVE Z EMPTY'
357::text as g ) as foo;
358select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
359          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
360          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
361 'COMPOUNDCURVE M EMPTY'
362::text as g ) as foo;
363select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
364          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
365          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
366 'COMPOUNDCURVE ZM EMPTY'
367::text as g ) as foo;
368select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
369          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
370          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
371 'COMPOUNDCURVE (CIRCULARSTRING (0 0,1 1,2 0),LINESTRING(2 0,4 1))'
372::text as g ) as foo;
373select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
374          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
375          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
376 'COMPOUNDCURVE Z (CIRCULARSTRING Z (0 0 1,1 1 1,2 0 1),LINESTRING Z (2 0 0,4 1 1))'
377::text as g ) as foo;
378select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
379          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
380          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
381 'COMPOUNDCURVE M (CIRCULARSTRING M (0 0 1,1 1 1,2 0 1),LINESTRING M (2 0 0,4 1 1))'
382::text as g ) as foo;
383select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
384          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
385          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
386 'COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 1 2,1 1 1 2,2 0 1 2),LINESTRING ZM (2 0 0 0,4 1 1 1))'
387::text as g ) as foo;
388
389-- CURVEPOLYGON
390select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
391          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
392          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
393 'CURVEPOLYGON EMPTY'
394::text as g ) as foo;
395select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
396          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
397          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
398 'CURVEPOLYGON Z EMPTY'
399::text as g ) as foo;
400select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
401          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
402          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
403 'CURVEPOLYGON M EMPTY'
404::text as g ) as foo;
405select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
406          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
407          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
408 'CURVEPOLYGON ZM EMPTY'
409::text as g ) as foo;
410select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
411          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
412          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
413 'CURVEPOLYGON ZM (COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 1 2,1 1 1 2,2 0 1 2),LINESTRING(2 0 1 2,1 -1 1 1,0 0 1 2)))'
414::text as g ) as foo;
415
416-- MULTICURVE
417select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
418          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
419          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
420 'MULTICURVE EMPTY'
421::text as g ) as foo;
422select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
423          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
424          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
425 'MULTICURVE Z EMPTY'
426::text as g ) as foo;
427select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
428          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
429          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
430 'MULTICURVE M EMPTY'
431::text as g ) as foo;
432select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
433          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
434          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
435 'MULTICURVE ZM EMPTY'
436::text as g ) as foo;
437select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
438          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
439          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
440 'MULTICURVE ZM (COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 1 2,1 1 1 2,2 0 1 2),LINESTRING(2 0 1 2,1 -1 1 1,0 0 1 2)))'
441::text as g ) as foo;
442
443-- MULTISURFACE
444select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
445          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
446          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
447 'MULTISURFACE EMPTY'
448::text as g ) as foo;
449select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
450          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
451          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
452 'MULTISURFACE Z EMPTY'
453::text as g ) as foo;
454select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
455          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
456          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
457 'MULTISURFACE M EMPTY'
458::text as g ) as foo;
459select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
460          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
461          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
462 'MULTISURFACE ZM EMPTY'
463::text as g ) as foo;
464select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
465          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
466          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
467 'MULTISURFACE ZM (CURVEPOLYGON ZM (COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 1 2,1 1 1 2,2 0 1 2),LINESTRING(2 0 1 2,1 -1 1 1,0 0 1 2))),POLYGON((10 10 10 10,10 12 10 10,12 12 10 10,12 10 10 10,10 10 10 10)))'
468::text as g ) as foo;
469
470-- POLYHEDRALSURFACE
471select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
472          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
473          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
474 'POLYHEDRALSURFACE EMPTY'
475::text as g ) as foo;
476select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
477          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
478          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
479 'POLYHEDRALSURFACE Z EMPTY'
480::text as g ) as foo;
481select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
482          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
483          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
484 'POLYHEDRALSURFACE M EMPTY'
485::text as g ) as foo;
486select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
487          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
488          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
489 'POLYHEDRALSURFACE ZM EMPTY'
490::text as g ) as foo;
491
492-- TRIANGLE
493select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
494          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
495          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
496 'TRIANGLE EMPTY'
497::text as g ) as foo;
498select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
499          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
500          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
501 'TRIANGLE Z EMPTY'
502::text as g ) as foo;
503select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
504          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
505          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
506 'TRIANGLE M EMPTY'
507::text as g ) as foo;
508select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
509          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
510          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
511 'TRIANGLE ZM EMPTY'
512::text as g ) as foo;
513
514-- TIN
515select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
516          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
517          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
518 'TIN EMPTY'
519::text as g ) as foo;
520select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
521          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
522          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
523 'TIN Z EMPTY'
524::text as g ) as foo;
525select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
526          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
527          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
528 'TIN M EMPTY'
529::text as g ) as foo;
530select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
531          st_orderingequals(g::geometry, ST_GeomFromWKB(ST_AsBinary(g::geometry))),
532          encode(st_asbinary(g::geometry, 'xdr'), 'hex') FROM ( SELECT
533 'TIN ZM EMPTY'
534::text as g ) as foo;
535
536
537-- Crashes (#4767, #4768, #4771, #4772)
538SELECT st_mpointfromwkb('\x'::BYTEA);
539SELECT geometry('\x'::bytea);
540SELECT st_geomcollfromwkb('\x'::bytea);
541SELECT st_geomfromewkb('\x'::bytea);
542SELECT st_wkbtosql('\x');
543SELECT st_mpolyfromwkb('\x'::BYTEA);
544SELECT st_mlinefromwkb('\x'::bytea);
545SELECT st_mlinefromwkb('\x'::bytea,1);