Artifact a7b599ea0a720faaac18ead991d4070fa5d6b881:
0000: 44 20 32 30 31 33 2d 30 38 2d 31 33 54 31 32 3a D 2013-08-13T12: 0010: 34 38 3a 34 31 2e 32 34 33 0a 4c 20 74 75 74 6f 48:41.243.L tuto 0020: 72 69 61 6c 0a 55 20 73 61 6e 64 72 6f 0a 57 20 rial.U sandro.W 0030: 31 30 36 30 35 0a 3c 68 33 3e 61 62 6f 75 74 20 10605.<h3>about 0040: 56 69 72 74 75 61 6c 50 47 3c 2f 68 33 3e 0d 0a VirtualPG</h3>.. 0050: 3c 62 3e 56 69 72 74 75 61 6c 50 47 3c 2f 62 3e <b>VirtualPG</b> 0060: 20 69 73 20 61 20 3c 69 3e 6c 6f 61 64 61 62 6c is a <i>loadabl 0070: 65 20 64 79 6e 61 6d 69 63 20 65 78 74 65 6e 73 e dynamic extens 0080: 69 6f 6e 20 6d 6f 64 75 6c 65 3c 2f 69 3e 20 66 ion module</i> f 0090: 6f 72 20 62 6f 74 68 20 3c 62 3e 53 51 4c 69 74 or both <b>SQLit 00a0: 65 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 53 70 61 e</b> and <b>Spa 00b0: 74 69 61 4c 69 74 65 3c 2f 62 3e 3b 20 69 74 73 tiaLite</b>; its 00c0: 20 69 6e 74 65 6e 64 65 64 20 73 63 6f 70 65 20 intended scope 00d0: 69 73 20 73 75 70 70 6f 72 74 69 6e 67 20 64 69 is supporting di 00e0: 72 65 63 74 20 64 61 74 61 20 65 78 63 68 61 6e rect data exchan 00f0: 67 65 20 66 6f 72 6d 2f 74 6f 20 3c 62 3e 50 6f ge form/to <b>Po 0100: 73 74 67 72 65 53 51 4c 3c 2f 62 3e 20 61 6e 64 stgreSQL</b> and 0110: 20 3c 62 3e 50 6f 73 74 47 49 53 3c 2f 62 3e 20 <b>PostGIS</b> 0120: 74 61 72 67 65 74 73 20 73 69 6d 70 6c 79 20 75 targets simply u 0130: 73 69 6e 67 20 62 61 73 69 63 2c 20 70 6c 61 69 sing basic, plai 0140: 6e 20 3c 69 3e 53 51 4c 20 73 74 61 74 65 6d 65 n <i>SQL stateme 0150: 6e 74 73 3c 2f 69 3e 2e 3c 62 72 3e 0d 0a 54 68 nts</i>.<br>..Th 0160: 65 20 65 78 74 65 6e 73 69 6f 6e 20 6d 6f 64 75 e extension modu 0170: 6c 65 20 73 69 6d 70 6c 79 20 69 73 20 61 6e 20 le simply is an 0180: 6f 72 64 69 6e 61 72 79 20 3c 69 3e 64 79 6e 61 ordinary <i>dyna 0190: 6d 69 63 20 6c 69 62 72 61 72 79 3c 2f 69 3e 20 mic library</i> 01a0: 28 3c 62 3e 2e 64 6c 6c 3c 2f 62 3e 20 6f 6e 20 (<b>.dll</b> on 01b0: 57 69 6e 64 6f 77 73 2c 20 3c 62 3e 2e 73 6f 3c Windows, <b>.so< 01c0: 2f 62 3e 20 6f 6e 20 55 6e 69 78 20 61 6e 64 20 /b> on Unix and 01d0: 4c 69 6e 75 78 2c 20 3c 62 3e 2e 64 79 6c 69 62 Linux, <b>.dylib 01e0: 3c 2f 62 3e 20 6f 6e 20 4d 61 63 20 4f 73 20 58 </b> on Mac Os X 01f0: 29 3b 20 73 6f 20 74 68 65 20 66 69 72 73 74 20 ); so the first 0200: 74 68 69 6e 67 20 74 6f 20 62 65 20 64 6f 6e 65 thing to be done 0210: 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 61 63 74 in order to act 0220: 69 76 61 74 65 20 74 68 69 73 20 65 78 74 65 6e ivate this exten 0230: 73 69 6f 6e 20 69 73 20 6c 6f 61 64 69 6e 67 20 sion is loading 0240: 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e the correspondin 0250: 67 20 6c 69 62 72 61 72 79 20 66 72 6f 6d 20 61 g library from a 0260: 20 76 61 6c 69 64 20 53 51 4c 69 74 65 2f 53 70 valid SQLite/Sp 0270: 61 74 69 61 4c 69 74 65 20 63 6f 6e 6e 65 63 74 atiaLite connect 0280: 69 6f 6e 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e ion...<verbatim> 0290: 0d 0a 53 45 4c 45 43 54 20 6c 6f 61 64 5f 65 78 ..SELECT load_ex 02a0: 74 65 6e 73 69 6f 6e 28 27 6c 69 62 76 69 72 74 tension('libvirt 02b0: 75 61 6c 70 67 2d 31 27 29 3b 0d 0a 2d 2d 2d 2d ualpg-1');..---- 02c0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 3c 2f 76 65 72 62 --..NULL..</verb 02d0: 61 74 69 6d 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 atim>..<table bg 02e0: 63 6f 6c 6f 72 3d 22 23 66 66 66 66 65 38 22 20 color="#ffffe8" 02f0: 77 69 64 74 68 3d 22 31 30 30 25 22 3e 0d 0a 3c width="100%">..< 0300: 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65 tr><td align="ce 0310: 6e 74 65 72 22 3e 3c 62 3e 55 73 65 66 75 6c 20 nter"><b>Useful 0320: 68 69 6e 74 73 20 61 6e 64 20 73 75 67 67 65 73 hints and sugges 0330: 74 69 6f 6e 73 3a 20 74 72 6f 75 62 6c 65 73 68 tions: troublesh 0340: 6f 6f 74 69 6e 67 3c 2f 62 3e 3c 2f 74 64 3e 3c ooting</b></td>< 0350: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 3c 68 /tr>..<tr><td><h 0360: 72 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 r></td></tr>..<t 0370: 72 3e 3c 74 64 3e 0d 0a 54 68 69 73 20 6f 70 65 r><td>..This ope 0380: 72 61 74 69 6f 6e 20 63 6f 75 6c 64 20 65 76 65 ration could eve 0390: 6e 74 75 61 6c 6c 79 20 66 61 69 6c 20 66 6f 72 ntually fail for 03a0: 20 73 65 76 65 72 61 6c 20 64 69 66 66 65 72 65 several differe 03b0: 6e 74 20 72 65 61 73 6f 6e 73 3a 20 68 65 72 65 nt reasons: here 03c0: 20 61 72 65 20 74 68 65 20 6d 6f 73 74 20 66 72 are the most fr 03d0: 65 71 75 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a equents:..<ul>.. 03e0: 3c 6c 69 3e 59 6f 75 20 61 72 65 20 75 73 69 6e <li>You are usin 03f0: 67 20 73 6f 6d 65 20 6f 64 64 20 76 65 72 73 69 g some odd versi 0400: 6f 6e 20 6f 66 20 53 51 4c 69 74 65 33 2f 6c 69 on of SQLite3/li 0410: 62 73 71 6c 69 74 65 33 20 66 6f 72 62 69 64 64 bsqlite3 forbidd 0420: 69 6e 67 20 74 6f 20 6c 6f 61 64 20 61 6e 79 20 ing to load any 0430: 64 79 6e 61 6d 69 63 20 65 78 74 65 6e 73 69 6f dynamic extensio 0440: 6e 73 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 66 65 ns.<br>..This fe 0450: 61 74 75 72 65 20 63 6f 75 6c 64 20 65 76 65 6e ature could even 0460: 74 75 61 6c 6c 79 20 62 65 20 64 69 73 61 62 6c tually be disabl 0470: 65 64 20 61 74 20 62 75 69 74 20 74 69 6d 65 3b ed at buit time; 0480: 20 69 66 20 74 68 69 73 20 69 73 20 79 6f 75 72 if this is your 0490: 20 63 61 73 65 20 79 6f 75 20 73 69 6d 70 6c 65 case you simple 04a0: 20 68 61 76 65 20 74 6f 20 73 77 69 74 63 68 20 have to switch 04b0: 74 6f 20 73 6f 6d 65 20 64 69 66 66 65 72 65 6e to some differen 04c0: 74 20 53 51 4c 69 74 65 20 74 6f 6f 6c 6b 69 74 t SQLite toolkit 04d0: 20 73 75 70 70 6f 72 74 69 6e 67 20 64 79 6e 61 supporting dyna 04e0: 6d 69 63 20 65 78 74 65 6e 73 69 6f 6e 20 6f 72 mic extension or 04f0: 20 62 75 69 6c 64 20 6f 6e 65 20 62 79 20 79 6f build one by yo 0500: 75 72 73 65 6c 66 2e 3c 2f 6c 69 3e 0d 0a 3c 6c urself.</li>..<l 0510: 69 3e 54 68 65 20 6f 70 65 72 61 74 69 6e 67 20 i>The operating 0520: 73 79 73 74 65 6e 20 63 6f 75 6c 64 20 62 65 20 systen could be 0530: 75 6e 61 62 6c 65 20 74 6f 20 63 6f 72 72 65 63 unable to correc 0540: 74 6c 79 20 6c 6f 63 61 74 65 20 74 68 65 20 64 tly locate the d 0550: 79 6e 61 6d 69 63 20 6c 69 62 72 61 72 79 20 74 ynamic library t 0560: 6f 20 62 65 20 6c 6f 61 64 65 64 2e 3c 62 72 3e o be loaded.<br> 0570: 0d 0a 54 68 65 20 6d 6f 73 74 20 72 65 63 65 6e ..The most recen 0580: 74 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 53 51 t versions of SQ 0590: 4c 69 74 65 20 61 72 65 20 73 6d 61 72 74 20 65 Lite are smart e 05a0: 6e 6f 75 67 68 20 74 6f 20 61 75 74 6f 6d 61 74 nough to automat 05b0: 69 63 61 6c 6c 79 20 68 61 6e 64 6c 65 20 61 6e ically handle an 05c0: 79 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 y platform speci 05d0: 66 69 63 20 73 75 66 66 69 78 3a 20 73 6f 20 79 fic suffix: so y 05e0: 6f 75 20 61 72 65 20 6e 6f 20 6c 6f 6e 67 65 72 ou are no longer 05f0: 20 72 65 71 75 69 72 65 64 20 74 6f 20 73 70 65 required to spe 0600: 63 69 66 79 20 61 6e 79 20 3c 62 3e 2e 64 6c 6c cify any <b>.dll 0610: 3c 2f 62 3e 20 6f 72 20 3c 62 3e 2e 73 6f 3c 2f </b> or <b>.so</ 0620: 62 3e 20 73 75 66 66 69 78 2e 20 49 66 20 79 6f b> suffix. If yo 0630: 75 20 77 68 69 73 68 20 74 6f 20 64 6f 20 73 6f u whish to do so 0640: 2c 20 79 6f 75 20 63 61 6e 20 65 76 65 6e 74 75 , you can eventu 0650: 61 6c 6c 79 20 73 70 65 63 69 66 79 20 74 68 65 ally specify the 0660: 20 66 75 6c 6c 20 70 61 74 68 20 6c 65 61 64 69 full path leadi 0670: 6e 67 20 74 6f 20 74 68 65 20 64 79 6e 61 6d 69 ng to the dynami 0680: 63 20 6c 69 62 72 61 72 79 2c 20 74 68 69 73 20 c library, this 0690: 69 6e 63 6c 75 64 69 6e 67 20 61 6e 79 20 73 75 including any su 06a0: 66 66 69 78 2e 3c 62 72 3e 0d 0a 41 6e 79 77 61 ffix.<br>..Anywa 06b0: 79 20 74 68 65 20 64 65 66 61 75 6c 74 20 62 65 y the default be 06c0: 68 61 76 69 6f 75 72 20 6f 66 20 3c 62 3e 6c 6f haviour of <b>lo 06d0: 61 64 5f 65 78 74 65 6e 73 69 6f 6e 28 29 3c 2f ad_extension()</ 06e0: 62 3e 20 69 73 20 74 68 65 20 6f 6e 65 20 74 6f b> is the one to 06f0: 20 73 65 61 72 63 68 20 74 68 65 20 72 65 71 75 search the requ 0700: 69 72 65 64 20 64 79 6e 61 6d 69 63 20 6c 69 62 ired dynamic lib 0710: 72 61 72 79 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 rary following t 0720: 68 65 20 73 74 61 6e 64 61 72 64 20 70 6c 61 74 he standard plat 0730: 66 6f 72 6d 20 73 70 65 63 69 66 69 63 20 72 75 form specific ru 0740: 6c 65 73 2e 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 les...</li>..<li 0750: 3e 54 68 65 20 64 79 6e 61 6d 69 63 20 6c 69 62 >The dynamic lib 0760: 72 61 72 79 20 69 74 73 65 6c 66 20 63 6f 75 6c rary itself coul 0770: 64 20 62 65 20 63 6f 72 72 65 63 74 6c 79 20 6c d be correctly l 0780: 6f 63 61 74 65 64 2c 20 62 75 74 20 73 6f 6d 65 ocated, but some 0790: 20 66 75 72 74 68 65 72 20 64 65 70 65 6e 64 69 further dependi 07a0: 6e 67 20 6c 69 62 72 61 72 79 20 63 6f 75 6c 64 ng library could 07b0: 20 6e 6f 74 2c 20 74 68 75 73 20 66 6f 72 62 69 not, thus forbi 07c0: 64 64 69 6e 67 20 74 6f 20 6c 6f 61 64 20 74 68 dding to load th 07d0: 65 20 6d 61 69 6e 20 6c 69 62 72 61 72 79 2e 3c e main library.< 07e0: 62 72 3e 0d 0a 3c 75 3e 50 6c 65 61 73 65 20 6e br>..<u>Please n 07f0: 6f 74 65 3c 2f 75 3e 3a 20 3c 62 3e 56 69 72 74 ote</u>: <b>Virt 0800: 75 61 6c 50 47 3c 2f 62 3e 20 64 65 70 65 6e 64 ualPG</b> depend 0810: 73 20 6f 6e 20 74 68 65 20 50 6f 73 74 67 72 65 s on the Postgre 0820: 53 51 4c 20 6f 77 6e 20 63 6c 69 65 6e 74 20 6c SQL own client l 0830: 69 62 72 61 72 79 20 28 3c 62 3e 6c 69 62 70 71 ibrary (<b>libpq 0840: 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 </b>).</li>..<li 0850: 3e 49 6e 20 61 6e 79 20 63 61 73 65 2c 20 69 66 >In any case, if 0860: 20 79 6f 75 20 61 72 65 20 75 73 69 6e 67 20 73 you are using s 0870: 6f 6d 65 20 69 6e 74 65 72 61 63 74 69 76 65 20 ome interactive 0880: 74 6f 6f 6c 20 73 75 63 68 20 61 73 20 3c 62 3e tool such as <b> 0890: 73 71 6c 69 74 65 33 3c 2f 62 3e 2c 20 3c 62 3e sqlite3</b>, <b> 08a0: 73 70 61 74 69 61 6c 69 74 65 3c 2f 62 3e 20 6f spatialite</b> o 08b0: 72 20 3c 62 3e 73 70 61 74 69 61 6c 69 74 65 5f r <b>spatialite_ 08c0: 67 75 69 3c 2f 62 3e 20 73 6f 6d 65 20 75 73 65 gui</b> some use 08d0: 66 75 6c 20 61 6e 64 20 6d 65 61 6e 69 6e 67 66 ful and meaningf 08e0: 75 6c 6c 20 65 72 72 6f 72 20 6d 65 73 73 61 67 ull error messag 08f0: 65 20 77 69 6c 6c 20 73 75 72 65 6c 79 20 62 65 e will surely be 0900: 20 64 69 73 70 6c 61 79 65 64 20 65 78 70 6c 61 displayed expla 0910: 69 6e 69 6e 67 20 74 68 65 20 66 61 69 6c 75 72 ining the failur 0920: 65 20 63 61 75 73 65 2e 3c 62 72 3e 0d 0a 54 68 e cause.<br>..Th 0930: 69 73 20 63 6f 75 6c 64 20 6e 6f 74 20 62 65 20 is could not be 0940: 73 75 70 70 6f 72 74 65 64 20 77 68 69 6c 65 20 supported while 0950: 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 6f attempting to lo 0960: 61 64 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e 20 ad an extension 0970: 66 72 6f 6d 20 73 6f 6d 65 20 6c 61 6e 67 75 61 from some langua 0980: 67 65 20 62 69 6e 64 69 6e 67 20 28 65 2e 67 2e ge binding (e.g. 0990: 20 3c 62 3e 2e 4e 45 54 3c 2f 62 3e 2c 20 3c 62 <b>.NET</b>, <b 09a0: 3e 50 79 74 68 6f 6e 3c 2f 62 3e 20 6f 72 20 3c >Python</b> or < 09b0: 62 3e 4a 61 76 61 3c 2f 62 3e 29 2e 0d 0a 49 6e b>Java</b>)...In 09c0: 20 74 68 69 73 20 63 61 73 65 20 61 74 74 65 6d this case attem 09d0: 70 74 69 6e 67 20 74 6f 20 69 64 65 6e 74 69 66 pting to identif 09e0: 79 20 74 68 65 20 72 65 61 6c 20 65 72 72 6f 72 y the real error 09f0: 20 63 61 75 73 65 20 63 6f 75 6c 64 20 62 65 20 cause could be 0a00: 72 65 61 6c 6c 79 20 70 61 69 6e 66 75 6c 20 64 really painful d 0a10: 75 65 20 74 6f 20 70 6f 6f 72 20 61 6e 64 20 73 ue to poor and s 0a20: 6c 6f 70 70 79 20 64 69 61 67 6e 6f 73 74 69 63 loppy diagnostic 0a30: 20 73 75 70 70 6f 72 74 2e 3c 2f 6c 69 3e 0d 0a support.</li>.. 0a40: 3c 6c 69 3e 54 68 65 72 65 20 61 72 65 20 6e 6f <li>There are no 0a50: 20 75 6e 69 76 65 72 73 61 6c 20 72 75 6c 65 73 universal rules 0a60: 20 64 69 63 74 61 74 69 6e 67 20 77 68 65 72 65 dictating where 0a70: 20 74 6f 20 70 6c 61 63 65 20 79 6f 75 72 20 65 to place your e 0a80: 78 74 65 6e 73 69 6f 6e 20 6d 6f 64 75 6c 65 73 xtension modules 0a90: 3b 20 61 20 67 6f 6f 64 20 73 75 67 67 65 73 74 ; a good suggest 0aa0: 69 6f 6e 20 69 73 20 74 6f 20 61 6c 77 61 79 73 ion is to always 0ab0: 20 70 6c 61 63 65 20 61 6c 6c 20 74 68 65 6d 20 place all them 0ac0: 69 6e 20 74 68 65 20 6d 6f 73 74 20 61 70 70 72 in the most appr 0ad0: 6f 70 72 69 61 74 65 20 73 79 73 74 65 6d 20 64 opriate system d 0ae0: 69 72 65 63 74 6f 72 79 2e 3c 2f 6c 69 3e 0d 0a irectory.</li>.. 0af0: 3c 2f 75 6c 3e 0d 0a 3c 62 3e 49 6d 70 6f 72 74 </ul>..<b>Import 0b00: 61 6e 74 20 6e 6f 74 69 63 65 3c 2f 62 3e 3a 20 ant notice</b>: 0b10: 74 68 65 20 76 65 72 79 20 72 65 63 65 6e 74 20 the very recent 0b20: 53 51 4c 69 74 65 20 3c 62 3e 33 2e 37 2e 31 37 SQLite <b>3.7.17 0b30: 3c 2f 62 3e 20 69 6e 64 74 72 6f 64 75 63 65 64 </b> indtroduced 0b40: 20 6d 61 6e 79 20 69 6e 74 65 72 65 73 69 74 69 many interesiti 0b50: 6e 67 20 61 64 76 61 6e 63 65 64 20 66 65 61 74 ng advanced feat 0b60: 75 72 65 73 20 74 6f 20 3c 62 3e 6c 6f 61 64 5f ures to <b>load_ 0b70: 65 78 74 65 6e 73 69 6f 6e 28 29 3c 2f 62 3e 3b extension()</b>; 0b80: 0d 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f ..earlier versio 0b90: 6e 73 20 6f 66 20 53 51 4c 69 74 65 20 63 6f 75 ns of SQLite cou 0ba0: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 73 ld probably be s 0bb0: 6f 6d 65 77 61 79 20 6c 69 6d 69 74 65 64 2e 0d omeway limited.. 0bc0: 0a 49 66 20 74 68 69 73 20 69 73 20 79 6f 75 72 .If this is your 0bd0: 20 63 61 73 65 2c 20 70 6c 65 61 73 65 20 63 6f case, please co 0be0: 6e 73 69 64 65 72 20 74 68 61 74 3a 0d 0a 3c 75 nsider that:..<u 0bf0: 6c 3e 0d 0a 3c 6c 69 3e 73 70 65 63 69 66 79 69 l>..<li>specifyi 0c00: 6e 67 20 61 6e 79 20 3c 62 3e 2e 64 6c 6c 3c 2f ng any <b>.dll</ 0c10: 62 3e 2c 20 3c 62 3e 2e 73 6f 3c 2f 62 3e 20 6f b>, <b>.so</b> o 0c20: 72 20 3c 62 3e 2e 64 79 6c 69 62 3c 2f 62 3e 20 r <b>.dylib</b> 0c30: 73 75 66 66 69 78 20 63 6f 75 6c 64 20 62 65 20 suffix could be 0c40: 73 74 72 69 63 74 6c 79 20 72 65 71 75 69 72 65 strictly require 0c50: 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 73 20 d.</li>..<li>as 0c60: 69 74 20 63 6f 75 6c 64 20 62 65 20 72 65 71 75 it could be requ 0c70: 69 72 65 64 20 74 6f 20 65 78 70 6c 69 63 69 74 ired to explicit 0c80: 6c 79 20 73 70 65 63 69 66 79 20 74 68 65 20 65 ly specify the e 0c90: 78 74 65 6e 73 69 6f 6e 20 65 6e 74 72 79 20 70 xtension entry p 0ca0: 6f 69 6e 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e oint.</li>..<li> 0cb0: 61 63 63 6f 72 64 69 6e 67 6c 79 20 74 6f 20 61 accordingly to a 0cc0: 6c 6c 20 74 68 69 73 2c 20 79 6f 75 27 6c 6c 20 ll this, you'll 0cd0: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 71 75 probably be requ 0ce0: 69 72 65 64 20 74 6f 20 70 61 73 73 20 61 72 67 ired to pass arg 0cf0: 75 6d 65 6e 74 73 20 6c 69 6b 65 20 74 6f 20 66 uments like to f 0d00: 6f 6c 6c 6f 77 69 6e 67 20 6f 6e 65 73 20 74 6f ollowing ones to 0d10: 20 3c 62 3e 6c 6f 61 64 5f 65 78 74 65 6e 73 69 <b>load_extensi 0d20: 6f 6e 28 29 3c 2f 62 3e 20 77 68 69 6c 65 20 75 on()</b> while u 0d30: 73 69 6e 67 20 73 6f 6d 65 20 6f 62 73 6f 6c 65 sing some obsole 0d40: 20 53 51 4c 69 74 65 33 20 76 65 72 73 69 6f 6e SQLite3 version 0d50: 2e 3c 2f 6c 69 3e 0d 0a 3c 76 65 72 62 61 74 69 .</li>..<verbati 0d60: 6d 3e 0d 0a 53 45 4c 45 43 54 20 6c 6f 61 64 5f m>..SELECT load_ 0d70: 65 78 74 65 6e 73 69 6f 6e 28 27 2f 75 73 72 2f extension('/usr/ 0d80: 6c 6f 63 61 6c 2f 6c 69 62 2f 6c 69 62 76 69 72 local/lib/libvir 0d90: 74 75 61 6c 70 67 2e 73 6f 27 2c 20 27 73 71 6c tualpg.so', 'sql 0da0: 69 74 65 33 5f 76 69 72 74 75 61 6c 70 67 5f 69 ite3_virtualpg_i 0db0: 6e 69 74 27 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a nit');..------.. 0dc0: 4e 55 4c 4c 0d 0a 3c 2f 76 65 72 62 61 74 69 6d NULL..</verbatim 0dd0: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e 3c >..</ul>..</td>< 0de0: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 /tr>..</table><b 0df0: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 63 72 r>..<hr>..<h3>cr 0e00: 6f 73 73 2d 44 42 4d 53 20 64 61 74 61 20 65 78 oss-DBMS data ex 0e10: 63 68 61 6e 67 65 3a 20 53 51 4c 20 61 6e 64 20 change: SQL and 0e20: 56 69 72 74 75 61 6c 50 6f 73 74 67 72 65 73 20 VirtualPostgres 0e30: 74 61 62 6c 65 73 3c 2f 68 33 3e 0d 0a 41 66 74 tables</h3>..Aft 0e40: 65 72 20 73 75 63 63 65 73 66 75 6c 6c 79 20 6c er succesfully l 0e50: 6f 61 64 69 6e 67 20 74 68 65 20 3c 62 3e 76 69 oading the <b>vi 0e60: 72 74 75 61 6c 70 67 3c 2f 62 3e 20 64 79 6e 61 rtualpg</b> dyna 0e70: 6d 69 63 20 65 78 74 65 6e 73 69 6f 6e 20 79 6f mic extension yo 0e80: 75 20 61 72 65 20 6e 6f 77 20 72 65 61 64 79 20 u are now ready 0e90: 74 6f 20 63 72 65 61 74 65 20 3c 62 3e 56 69 72 to create <b>Vir 0ea0: 74 75 61 6c 50 6f 73 74 67 65 73 3c 2f 62 3e 20 tualPostges</b> 0eb0: 74 61 62 6c 65 73 2e 3c 62 72 3e 0d 0a 54 68 65 tables.<br>..The 0ec0: 73 65 20 61 72 65 20 3c 69 3e 71 75 69 74 65 20 se are <i>quite 0ed0: 61 6c 6d 6f 73 74 3c 2f 69 3e 20 6f 72 64 69 6e almost</i> ordin 0ee0: 61 72 79 20 44 42 20 74 61 62 6c 65 73 20 61 73 ary DB tables as 0ef0: 20 61 6e 79 20 6f 74 68 65 72 3b 20 79 6f 75 20 any other; you 0f00: 63 61 6e 20 65 78 65 63 75 74 65 20 61 6e 79 20 can execute any 0f10: 72 65 67 75 6c 61 72 20 53 51 4c 20 73 74 61 74 regular SQL stat 0f20: 65 6d 65 6e 74 20 28 3c 69 3e 53 45 4c 45 43 54 ement (<i>SELECT 0f30: 3c 2f 69 3e 2c 20 3c 69 3e 49 4e 53 45 52 54 3c </i>, <i>INSERT< 0f40: 2f 69 3e 2c 20 3c 69 3e 55 50 44 41 54 45 3c 2f /i>, <i>UPDATE</ 0f50: 69 3e 20 6f 72 20 3c 69 3e 44 45 4c 45 54 45 3c i> or <i>DELETE< 0f60: 2f 69 3e 29 20 62 79 20 73 70 65 63 69 66 79 69 /i>) by specifyi 0f70: 6e 67 20 74 68 65 73 65 20 56 69 72 74 75 61 6c ng these Virtual 0f80: 20 54 61 62 6c 65 73 20 61 73 20 74 68 65 20 73 Tables as the s 0f90: 65 6c 65 63 74 65 64 20 74 61 72 67 65 74 2e 3c elected target.< 0fa0: 62 72 3e 0d 0a 54 68 65 72 65 20 69 73 20 6f 6e br>..There is on 0fb0: 6c 79 20 61 20 73 74 72 6f 6e 67 20 64 69 66 66 ly a strong diff 0fc0: 65 72 65 6e 63 65 20 64 69 73 74 69 6e 67 75 69 erence distingui 0fd0: 73 68 69 6e 67 20 61 20 3c 62 3e 56 69 72 74 75 shing a <b>Virtu 0fe0: 61 6c 50 6f 73 74 67 72 65 73 3c 2f 62 3e 20 74 alPostgres</b> t 0ff0: 61 62 6c 65 3b 20 69 74 27 73 20 70 68 79 73 69 able; it's physi 1000: 63 61 6c 20 6c 6f 63 61 74 69 6f 6e 20 69 73 6e cal location isn 1010: 27 74 20 77 69 74 68 69 6e 20 74 68 65 20 63 75 't within the cu 1020: 72 72 65 6e 74 6c 79 20 63 6f 6e 6e 65 63 74 65 rrently connecte 1030: 64 20 53 51 4c 69 74 65 20 44 42 2c 20 62 75 74 d SQLite DB, but 1040: 20 69 73 20 69 6e 73 74 65 61 64 20 77 69 74 68 is instead with 1050: 69 6e 20 73 6f 6d 65 20 3c 62 3e 50 6f 73 74 67 in some <b>Postg 1060: 72 65 53 51 4c 3c 2f 62 3e 20 44 42 4d 53 2e 3c reSQL</b> DBMS.< 1070: 62 72 3e 0d 0a 53 6f 20 61 20 56 69 72 74 75 61 br>..So a Virtua 1080: 6c 50 6f 73 74 67 72 65 73 20 74 61 62 6c 65 20 lPostgres table 1090: 65 66 66 65 63 74 69 76 65 6c 79 20 61 63 74 73 effectively acts 10a0: 20 61 73 20 61 20 3c 69 3e 62 72 69 64 67 65 3c as a <i>bridge< 10b0: 2f 69 3e 20 6a 6f 69 6e 69 6e 67 20 53 51 4c 69 /i> joining SQLi 10c0: 74 65 20 61 6e 64 20 50 6f 73 74 67 72 65 73 2c te and Postgres, 10d0: 20 61 6e 64 20 61 6c 6c 6f 77 69 6e 67 20 74 6f and allowing to 10e0: 20 70 65 72 66 6f 72 6d 20 61 6e 79 20 6b 69 6e perform any kin 10f0: 64 20 6f 66 20 63 72 6f 73 73 20 64 61 74 61 20 d of cross data 1100: 65 78 63 68 61 6e 67 65 20 28 3c 69 3e 69 6e 20 exchange (<i>in 1110: 62 6f 74 68 20 64 69 72 65 63 74 69 6f 6e 73 3c both directions< 1120: 2f 69 3e 29 20 69 6e 20 74 68 65 20 65 61 73 69 /i>) in the easi 1130: 65 73 74 20 77 61 79 2e 0d 0a 3c 76 65 72 62 61 est way...<verba 1140: 74 69 6d 3e 0d 0a 43 52 45 41 54 45 20 56 49 52 tim>..CREATE VIR 1150: 54 55 41 4c 20 54 41 42 4c 45 20 70 67 5f 69 6e TUAL TABLE pg_in 1160: 20 0d 0a 20 20 20 20 55 53 49 4e 47 20 56 69 72 .. USING Vir 1170: 74 75 61 6c 50 6f 73 74 67 72 65 73 20 28 27 68 tualPostgres ('h 1180: 6f 73 74 3d 6c 6f 63 61 6c 68 6f 73 74 20 70 6f ost=localhost po 1190: 72 74 3d 35 34 33 32 20 64 62 6e 61 6d 65 3d 67 rt=5432 dbname=g 11a0: 69 73 20 75 73 65 72 3d 73 61 6e 64 72 6f 20 70 is user=sandro p 11b0: 61 73 73 77 6f 72 64 3d 73 65 63 72 65 74 27 2c assword=secret', 11c0: 20 6d 79 5f 73 63 68 65 6d 61 2c 20 6d 79 5f 74 my_schema, my_t 11d0: 61 62 6c 65 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 able);..</verbat 11e0: 69 6d 3e 0d 0a 54 68 69 73 20 53 51 4c 20 73 74 im>..This SQL st 11f0: 61 74 65 6d 65 6e 74 20 77 69 6c 6c 20 63 72 65 atement will cre 1200: 61 74 65 20 69 6e 74 6f 20 74 68 65 20 53 51 4c ate into the SQL 1210: 69 74 65 20 44 42 20 61 20 74 61 62 6c 65 20 6e ite DB a table n 1220: 61 6d 65 64 20 3c 62 3e 70 67 5f 69 6e 3c 2f 62 amed <b>pg_in</b 1230: 3e 3b 20 61 6e 79 77 61 79 20 74 68 65 20 64 61 >; anyway the da 1240: 74 61 20 70 68 79 73 69 63 61 6c 20 73 74 6f 72 ta physical stor 1250: 61 67 65 20 66 6f 72 20 74 68 69 73 20 74 61 62 age for this tab 1260: 6c 65 20 77 69 6c 6c 20 62 65 20 69 6e 74 6f 20 le will be into 1270: 74 68 65 20 50 6f 73 74 67 72 65 73 20 44 42 4d the Postgres DBM 1280: 53 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 S:..<ul>..<li>th 1290: 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 e first argument 12a0: 20 74 6f 20 56 69 72 74 75 61 6c 50 6f 73 74 67 to VirtualPostg 12b0: 72 65 73 20 69 73 20 74 68 65 20 3c 69 3e 63 6f res is the <i>co 12c0: 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 3c nnection string< 12d0: 2f 69 3e 20 72 65 71 75 69 72 65 64 20 69 6e 20 /i> required in 12e0: 6f 72 64 65 72 20 74 6f 20 65 73 74 61 62 6c 69 order to establi 12f0: 73 68 20 61 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 sh a connection 1300: 74 6f 20 74 68 65 20 50 6f 73 74 67 72 65 73 20 to the Postgres 1310: 44 42 4d 53 20 73 65 72 76 65 72 2e 3c 2f 6c 69 DBMS server.</li 1320: 3e 0d 0a 3c 6c 69 3e 73 65 63 6f 6e 64 20 61 6e >..<li>second an 1330: 64 20 74 68 69 72 64 20 61 72 67 75 6d 65 6e 74 d third argument 1340: 73 20 72 65 73 70 65 63 74 69 76 65 6c 79 20 61 s respectively a 1350: 72 65 20 74 68 65 20 3c 69 3e 73 63 68 65 6d 61 re the <i>schema 1360: 20 6e 61 6d 65 3c 2f 69 3e 20 61 6e 64 20 74 68 name</i> and th 1370: 65 20 3c 69 3e 74 61 62 6c 65 20 6e 61 6d 65 3c e <i>table name< 1380: 2f 69 3e 20 69 64 65 6e 74 69 66 79 69 6e 67 20 /i> identifying 1390: 74 68 65 20 50 6f 73 74 67 72 65 73 20 74 61 72 the Postgres tar 13a0: 67 65 74 20 74 61 62 6c 65 2e 3c 2f 6c 69 3e 0d get table.</li>. 13b0: 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 .</ul>..<verbati 13c0: 6d 3e 0d 0a 43 52 45 41 54 45 20 56 49 52 54 55 m>..CREATE VIRTU 13d0: 41 4c 20 54 41 42 4c 45 20 70 67 5f 69 6e 20 0d AL TABLE pg_in . 13e0: 0a 20 20 20 20 55 53 49 4e 47 20 56 69 72 74 75 . USING Virtu 13f0: 61 6c 50 6f 73 74 67 72 65 73 20 28 27 68 6f 73 alPostgres ('hos 1400: 74 61 64 64 72 3d 31 39 32 2e 31 36 38 2e 31 2e taddr=192.168.1. 1410: 39 31 20 70 6f 72 74 3d 35 34 33 32 20 64 62 6e 91 port=5432 dbn 1420: 61 6d 65 3d 67 69 73 20 75 73 65 72 3d 73 61 6e ame=gis user=san 1430: 64 72 6f 20 70 61 73 73 77 6f 72 64 3d 73 65 63 dro password=sec 1440: 72 65 74 27 2c 20 6d 79 5f 73 63 68 65 6d 61 2c ret', my_schema, 1450: 20 6d 79 5f 74 61 62 6c 65 29 3b 0d 0a 3c 2f 76 my_table);..</v 1460: 65 72 62 61 74 69 6d 3e 0d 0a 53 61 6d 65 20 61 erbatim>..Same a 1470: 73 20 61 62 6f 76 65 2c 20 74 68 65 20 74 69 6d s above, the tim 1480: 65 20 65 73 74 61 62 6c 69 73 68 69 6e 67 20 61 e establishing a 1490: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 74 6f 20 61 connection to a 14a0: 20 50 6f 73 74 67 72 65 73 20 69 6e 73 74 61 6e Postgres instan 14b0: 63 65 20 72 75 6e 6e 69 6e 67 20 6f 6e 20 64 69 ce running on di 14c0: 66 66 65 72 65 63 74 20 63 6f 6d 70 75 74 65 72 fferect computer 14d0: 20 6f 6e 20 74 68 65 20 73 61 6d 65 20 6c 6f 63 on the same loc 14e0: 61 6c 20 61 72 65 61 20 6e 65 74 77 6f 72 6b 2e al area network. 14f0: 3c 62 72 3e 0d 0a 50 6c 65 61 73 65 20 63 6f 6e <br>..Please con 1500: 73 75 6c 74 20 74 68 65 20 50 6f 73 74 67 72 65 sult the Postgre 1510: 73 20 6f 77 6e 20 64 6f 63 75 6d 65 6e 74 61 74 s own documentat 1520: 69 6f 6e 20 66 6f 72 20 61 6e 79 20 6f 74 68 65 ion for any othe 1530: 72 20 64 65 74 61 69 6c 20 61 62 6f 75 74 20 3c r detail about < 1540: 69 3e 63 6f 6e 6e 65 63 69 6f 6e 20 73 74 72 69 i>connecion stri 1550: 6e 67 73 3c 2f 69 3e 2e 0d 0a 3c 76 65 72 62 61 ngs</i>...<verba 1560: 74 69 6d 3e 0d 0a 50 52 41 47 4d 41 20 74 61 62 tim>..PRAGMA tab 1570: 6c 65 5f 69 6e 66 6f 28 70 67 5f 69 6e 29 3b 0d le_info(pg_in);. 1580: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 59 6f .</verbatim>..Yo 1590: 75 20 63 61 6e 20 65 78 65 63 75 74 65 20 74 68 u can execute th 15a0: 65 20 61 62 6f 76 65 20 50 52 41 47 4d 41 20 64 e above PRAGMA d 15b0: 69 72 65 63 74 69 76 65 20 69 6e 20 6f 72 64 65 irective in orde 15c0: 72 20 74 6f 20 69 64 65 6e 74 69 66 79 20 61 6c r to identify al 15d0: 6c 20 63 6f 6c 75 6d 6e 73 20 64 65 63 6c 61 72 l columns declar 15e0: 65 64 20 62 79 20 74 68 65 20 50 6f 73 74 67 72 ed by the Postgr 15f0: 65 73 20 74 61 62 6c 65 2c 20 61 6e 64 20 74 68 es table, and th 1600: 65 69 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e eir correspondin 1610: 67 20 64 61 74 61 2d 74 79 70 65 2e 3c 62 72 3e g data-type.<br> 1620: 0d 0a 49 66 20 79 6f 75 20 61 72 65 20 61 63 74 ..If you are act 1630: 75 61 6c 6c 79 20 75 73 69 6e 67 20 3c 62 3e 73 ually using <b>s 1640: 70 61 74 69 61 6c 69 74 65 5f 67 75 69 3c 2f 62 patialite_gui</b 1650: 3e 20 79 6f 75 20 63 61 6e 20 63 68 65 63 6b 20 > you can check 1660: 74 68 65 20 73 61 6d 65 20 69 6e 66 6f 73 20 62 the same infos b 1670: 79 20 75 73 69 6e 67 20 74 68 65 20 61 70 70 72 y using the appr 1680: 6f 70 72 69 61 74 65 20 67 72 61 70 68 69 63 73 opriate graphics 1690: 20 74 6f 6f 6c 73 2e 0d 0a 3c 76 65 72 62 61 74 tools...<verbat 16a0: 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 61 2c 20 62 im>..SELECT a, b 16b0: 2c 20 63 2c 20 43 6f 75 6e 74 28 2a 29 20 41 53 , c, Count(*) AS 16c0: 20 63 6e 74 0d 0a 46 52 4f 4d 20 70 67 5f 69 6e cnt..FROM pg_in 16d0: 0d 0a 57 48 45 52 45 20 65 20 49 53 20 4e 4f 54 ..WHERE e IS NOT 16e0: 20 4e 55 4c 4c 0d 0a 47 52 4f 55 50 20 42 59 20 NULL..GROUP BY 16f0: 61 2c 20 62 2c 20 63 0d 0a 4f 52 44 45 52 20 42 a, b, c..ORDER B 1700: 59 20 63 6e 74 20 44 45 53 43 3b 0d 0a 3c 2f 76 Y cnt DESC;..</v 1710: 65 72 62 61 74 69 6d 3e 0d 0a 59 6f 75 20 63 61 erbatim>..You ca 1720: 6e 20 65 78 65 63 75 74 65 20 61 6e 79 20 6b 69 n execute any ki 1730: 6e 64 20 6f 66 20 3c 62 3e 53 45 4c 45 43 54 3c nd of <b>SELECT< 1740: 2f 62 3e 20 71 75 65 72 79 20 75 73 69 6e 67 20 /b> query using 1750: 61 20 56 69 72 74 75 61 6c 50 6f 73 74 67 72 65 a VirtualPostgre 1760: 73 20 74 61 62 6c 65 2c 20 65 78 61 63 74 6c 79 s table, exactly 1770: 20 61 73 20 69 66 20 69 74 20 77 61 73 20 61 20 as if it was a 1780: 67 65 6e 75 69 6e 65 20 6e 61 74 69 76 65 20 74 genuine native t 1790: 61 62 6c 65 2e 0d 0a 3c 76 65 72 62 61 74 69 6d able...<verbatim 17a0: 3e 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 >..CREATE TABLE 17b0: 69 6d 70 6f 72 74 65 64 5f 66 72 6f 6d 5f 70 67 imported_from_pg 17c0: 20 41 53 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 AS..SELECT * FR 17d0: 4f 4d 20 70 67 5f 69 6e 3b 0d 0a 3c 2f 76 65 72 OM pg_in;..</ver 17e0: 62 61 74 69 6d 3e 0d 0a 41 6e 64 20 79 6f 75 20 batim>..And you 17f0: 63 61 6e 20 6f 62 76 69 6f 75 73 6c 79 20 63 72 can obviously cr 1800: 65 61 74 65 20 61 6e 64 20 70 6f 70 75 6c 61 74 eate and populat 1810: 65 20 61 20 6c 6f 63 61 6c 20 63 6f 70 79 20 6f e a local copy o 1820: 66 20 74 68 65 20 72 65 6d 6f 74 65 20 50 6f 73 f the remote Pos 1830: 74 67 72 65 73 20 74 61 62 6c 65 3a 20 6e 6f 77 tgres table: now 1840: 20 61 6c 6c 20 64 61 74 61 20 61 72 65 20 70 65 all data are pe 1850: 72 6d 61 6e 65 6e 74 6c 79 20 73 74 6f 72 65 64 rmanently stored 1860: 20 77 69 74 68 69 6e 20 79 6f 75 72 20 53 51 4c within your SQL 1870: 69 74 65 20 44 42 2e 0d 0a 3c 76 65 72 62 61 74 ite DB...<verbat 1880: 69 6d 3e 0d 0a 44 52 4f 50 20 54 41 42 4c 45 20 im>..DROP TABLE 1890: 70 67 5f 69 6e 3b 0d 0a 3c 2f 76 65 72 62 61 74 pg_in;..</verbat 18a0: 69 6d 3e 0d 0a 53 6f 20 79 6f 75 20 63 61 6e 20 im>..So you can 18b0: 66 69 6e 61 6c 6c 79 20 64 72 6f 70 20 74 68 65 finally drop the 18c0: 20 56 69 72 74 75 61 6c 50 6f 73 74 67 72 65 73 VirtualPostgres 18d0: 20 74 61 62 6c 65 2c 20 61 6e 64 20 74 68 69 73 table, and this 18e0: 20 77 69 6c 6c 20 69 6d 6d 65 64 69 61 74 65 6c will immediatel 18f0: 79 20 74 65 72 6d 69 6e 61 74 65 20 74 68 65 20 y terminate the 1900: 63 6f 6e 6e 65 63 74 69 6f 6e 20 74 6f 20 74 68 connection to th 1910: 65 20 50 6f 73 74 67 72 65 73 20 44 42 4d 53 2e e Postgres DBMS. 1920: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a <br><br>..<hr>.. 1930: 3c 68 33 3e 64 61 74 61 2d 74 79 70 65 20 6d 61 <h3>data-type ma 1940: 70 70 69 6e 67 20 61 6e 64 20 72 65 6c 61 74 65 pping and relate 1950: 64 20 63 6f 6e 76 65 72 73 69 6f 6e 73 3c 2f 68 d conversions</h 1960: 33 3e 0d 0a 52 61 74 68 65 72 20 6f 62 76 69 6f 3>..Rather obvio 1970: 75 73 6c 79 20 53 51 4c 69 74 65 20 61 6e 64 20 usly SQLite and 1980: 50 6f 73 74 67 72 65 73 20 73 75 70 70 6f 72 74 Postgres support 1990: 73 20 76 65 72 79 20 64 69 66 66 65 72 65 6e 74 s very different 19a0: 20 6b 69 6e 64 20 6f 66 20 64 61 74 61 2d 74 79 kind of data-ty 19b0: 70 65 73 2e 20 54 68 65 20 66 65 77 20 66 6f 6c pes. The few fol 19c0: 6c 6f 77 69 6e 67 20 72 75 6c 65 73 20 61 70 70 lowing rules app 19d0: 6c 79 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 ly:..<ul>..<li>a 19e0: 6e 79 20 6b 69 6e 64 20 6f 66 20 3c 62 3e 49 4e ny kind of <b>IN 19f0: 54 45 47 45 52 3c 2f 62 3e 20 76 61 6c 75 65 20 TEGER</b> value 1a00: 69 73 20 70 72 65 73 65 72 76 65 64 20 61 73 20 is preserved as 1a10: 73 75 63 68 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e such.</li>..<li> 1a20: 74 68 65 20 73 61 6d 65 20 69 73 20 66 6f 72 20 the same is for 1a30: 3c 62 3e 46 4c 4f 41 54 3c 2f 62 3e 20 76 61 6c <b>FLOAT</b> val 1a40: 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ues.</li>..<li>< 1a50: 62 3e 4d 4f 4e 45 59 3c 2f 62 3e 20 61 6e 64 20 b>MONEY</b> and 1a60: 3c 62 3e 4e 55 4d 45 52 49 43 3c 2f 62 3e 20 76 <b>NUMERIC</b> v 1a70: 61 6c 75 65 73 20 61 72 65 20 63 6f 6e 76 65 72 alues are conver 1a80: 74 65 64 20 69 6e 74 6f 20 3c 62 3e 46 4c 4f 41 ted into <b>FLOA 1a90: 54 3c 2f 62 3e 20 76 61 6c 75 65 73 2e 3c 2f 6c T</b> values.</l 1aa0: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 43 48 41 52 3c i>..<li><b>CHAR< 1ab0: 2f 62 3e 20 61 6e 64 20 3c 62 3e 56 41 52 43 48 /b> and <b>VARCH 1ac0: 41 52 3c 2f 62 3e 20 76 61 6c 75 65 73 20 61 72 AR</b> values ar 1ad0: 65 20 61 6c 77 61 79 73 20 63 6f 6e 76 65 72 74 e always convert 1ae0: 65 64 20 69 6e 74 6f 20 3c 62 3e 54 45 58 54 3c ed into <b>TEXT< 1af0: 2f 62 3e 20 76 61 6c 75 65 73 2e 3c 2f 6c 69 3e /b> values.</li> 1b00: 0d 0a 3c 6c 69 3e 3c 62 3e 44 41 54 45 3c 2f 62 ..<li><b>DATE</b 1b10: 3e 2c 20 3c 62 3e 54 49 4d 45 3c 2f 62 3e 20 61 >, <b>TIME</b> a 1b20: 6e 64 20 3c 62 3e 54 49 4d 45 53 54 41 4d 50 3c nd <b>TIMESTAMP< 1b30: 2f 62 3e 20 76 61 6c 75 65 73 20 61 72 65 20 61 /b> values are a 1b40: 6c 77 61 79 73 20 63 6f 6e 76 65 72 74 65 64 20 lways converted 1b50: 69 6e 74 6f 20 3c 62 3e 46 4c 4f 41 54 3c 2f 62 into <b>FLOAT</b 1b60: 3e 20 76 61 6c 75 65 73 20 63 6f 72 72 65 73 70 > values corresp 1b70: 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 3c 61 onding to the <a 1b80: 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 href="http://ww 1b90: 77 2e 73 71 6c 69 74 65 2e 6f 72 67 2f 6c 61 6e w.sqlite.org/lan 1ba0: 67 5f 64 61 74 65 66 75 6e 63 2e 68 74 6d 6c 22 g_datefunc.html" 1bb0: 3e 4a 75 6c 69 61 6e 44 61 79 3c 2f 61 3e 20 6e >JulianDay</a> n 1bc0: 6f 74 61 74 69 6f 6e 20 73 75 70 70 6f 72 74 65 otation supporte 1bd0: 64 20 62 79 20 53 51 4c 69 74 65 2e 3c 62 72 3e d by SQLite.<br> 1be0: 0d 0a 59 6f 75 20 63 61 6e 20 74 68 65 6e 20 69 ..You can then i 1bf0: 6e 76 6f 6b 65 20 74 68 65 20 61 70 70 72 6f 70 nvoke the approp 1c00: 72 69 61 74 65 20 66 75 6e 63 74 69 6f 6e 20 62 riate function b 1c10: 65 74 77 65 65 6e 20 3c 62 3e 44 61 74 65 28 29 etween <b>Date() 1c20: 3c 2f 62 3e 2c 20 3c 62 3e 54 69 6d 65 28 29 3c </b>, <b>Time()< 1c30: 2f 62 3e 20 6f 72 20 3c 62 3e 44 61 74 65 54 69 /b> or <b>DateTi 1c40: 6d 65 28 29 3c 2f 62 3e 20 73 6f 20 74 6f 20 67 me()</b> so to g 1c50: 65 74 20 62 61 63 6b 20 74 68 65 20 73 74 61 6e et back the stan 1c60: 64 61 72 64 20 53 51 4c 20 6e 6f 74 61 74 69 6f dard SQL notatio 1c70: 6e 20 66 6f 72 20 64 61 74 65 73 20 61 6e 64 20 n for dates and 1c80: 74 69 6d 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 times.</li>..<li 1c90: 3e 3c 62 3e 42 4f 4f 4c 3c 2f 62 3e 20 76 61 6c ><b>BOOL</b> val 1ca0: 75 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 63 ues are always c 1cb0: 6f 6e 76 65 72 74 65 64 20 69 6e 74 6f 20 3c 62 onverted into <b 1cc0: 3e 49 4e 54 45 47 45 52 3c 2f 62 3e 20 76 61 6c >INTEGER</b> val 1cd0: 75 65 73 3a 20 3c 62 3e 30 3c 2f 62 3e 20 63 6f ues: <b>0</b> co 1ce0: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 3c rresponding to < 1cf0: 62 3e 46 41 4c 53 45 3c 2f 62 3e 2e 3c 2f 6c 69 b>FALSE</b>.</li 1d00: 3e 0d 0a 3c 6c 69 3e 50 6f 73 74 67 72 65 73 20 >..<li>Postgres 1d10: 73 75 70 70 6f 72 74 73 20 6d 75 6c 74 69 70 6c supports multipl 1d20: 65 20 76 61 6c 75 65 73 20 74 6f 20 62 65 20 73 e values to be s 1d30: 74 6f 72 65 64 20 69 6e 74 6f 20 74 68 65 20 73 tored into the s 1d40: 61 6d 65 20 63 6f 6c 75 6d 6e 20 28 3c 62 3e 41 ame column (<b>A 1d50: 52 52 41 59 3c 2f 62 3e 29 3a 20 53 51 4c 69 74 RRAY</b>): SQLit 1d60: 65 20 68 61 73 20 6e 6f 20 73 69 6d 69 6c 61 72 e has no similar 1d70: 20 63 61 70 61 62 69 6c 69 74 79 2c 20 73 6f 20 capability, so 1d80: 61 6e 79 20 41 52 52 41 59 20 76 61 6c 75 65 20 any ARRAY value 1d90: 77 69 6c 6c 20 73 69 6d 70 6c 79 20 62 65 20 63 will simply be c 1da0: 6f 6e 76 65 72 74 65 64 20 69 6e 74 6f 20 61 20 onverted into a 1db0: 3c 62 3e 54 45 58 54 3c 2f 62 3e 20 73 74 72 69 <b>TEXT</b> stri 1dc0: 6e 67 2c 20 65 2e 67 2e 20 61 73 20 69 6e 20 3c ng, e.g. as in < 1dd0: 62 3e 27 7b 31 2c 32 2c 33 7d 27 3c 2f 62 3e 20 b>'{1,2,3}'</b> 1de0: 6f 72 20 3c 62 3e 27 7b 61 6c 70 68 61 2c 62 65 or <b>'{alpha,be 1df0: 74 61 2c 67 61 6d 6d 61 2c 64 65 6c 74 61 7d 27 ta,gamma,delta}' 1e00: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e </b>.</li>..<li> 1e10: 61 6e 79 20 62 69 6e 61 72 79 20 76 61 6c 75 65 any binary value 1e20: 20 28 61 73 20 65 2e 67 2e 20 3c 62 3e 42 59 54 (as e.g. <b>BYT 1e30: 45 41 3c 2f 62 3e 29 20 77 69 6c 6c 20 62 65 20 EA</b>) will be 1e40: 73 69 6d 70 6c 79 20 63 6f 6e 76 65 72 74 65 64 simply converted 1e50: 20 69 6e 74 6f 20 61 20 3c 62 3e 54 45 58 54 3c into a <b>TEXT< 1e60: 2f 62 3e 20 76 61 6c 75 65 20 63 6f 6e 74 61 69 /b> value contai 1e70: 6e 69 6e 67 20 74 68 65 20 63 6f 72 72 65 73 70 ning the corresp 1e80: 6f 6e 64 69 6e 67 20 68 65 78 61 64 65 63 69 6d onding hexadecim 1e90: 61 6c 20 6e 6f 74 61 74 69 6f 6e 2c 20 65 2e 67 al notation, e.g 1ea0: 2e 20 61 73 20 69 6e 20 3c 62 3e 27 30 31 30 31 . as in <b>'0101 1eb0: 30 30 30 30 32 30 45 38 36 34 30 30 30 30 43 34 000020E8640000C4 1ec0: 46 43 33 34 42 41 38 34 34 38 32 34 34 31 35 30 FC34BA8448244150 1ed0: 43 31 42 35 44 35 34 31 42 38 35 33 34 31 27 3c C1B5D541B85341'< 1ee0: 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e /b>.</li>..</ul> 1ef0: 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e <br>..<hr>..<h3> 1f00: 68 61 6e 64 6c 69 6e 67 20 50 6f 73 74 47 49 53 handling PostGIS 1f10: 20 67 65 6f 6d 65 74 72 69 65 73 3c 2f 68 33 3e geometries</h3> 1f20: 0d 0a 50 6f 73 74 47 49 53 20 6f 77 6e 20 67 65 ..PostGIS own ge 1f30: 6f 6d 65 74 72 69 65 73 20 73 69 6d 70 6c 79 20 ometries simply 1f40: 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 are represented 1f50: 62 79 20 61 20 3c 62 3e 42 59 54 45 41 3c 2f 62 by a <b>BYTEA</b 1f60: 3e 20 76 61 6c 75 65 20 74 6f 20 62 65 20 69 6e > value to be in 1f70: 74 65 72 70 72 65 74 65 72 65 64 20 61 63 63 6f terpretered acco 1f80: 72 64 69 6e 67 6c 79 20 74 6f 20 3c 62 3e 45 57 rdingly to <b>EW 1f90: 4b 42 3c 2f 62 3e 20 66 6f 72 6d 61 74 20 73 70 KB</b> format sp 1fa0: 65 63 69 66 69 63 61 74 69 6f 6e 73 2e 0d 0a 3c ecifications...< 1fb0: 76 65 72 62 61 74 69 6d 3e 0d 0a 43 52 45 41 54 verbatim>..CREAT 1fc0: 45 20 54 41 42 4c 45 20 66 72 6f 6d 5f 70 6f 73 E TABLE from_pos 1fd0: 74 67 69 73 20 41 53 0d 0a 53 45 4c 45 43 54 20 tgis AS..SELECT 1fe0: 2a 20 46 52 4f 4d 20 70 67 5f 69 6e 3b 0d 0a 0d * FROM pg_in;... 1ff0: 0a 55 50 44 41 54 45 20 66 72 6f 6d 5f 70 6f 73 .UPDATE from_pos 2000: 74 67 69 73 20 53 45 54 20 67 65 6f 6d 65 74 72 tgis SET geometr 2010: 79 20 3d 20 47 65 6f 6d 46 72 6f 6d 45 57 4b 42 y = GeomFromEWKB 2020: 28 67 65 6f 6d 65 74 72 79 29 3b 0d 0a 0d 0a 53 (geometry);....S 2030: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 53 ELECT DISTINCT S 2040: 54 5f 47 65 6f 6d 65 74 72 79 54 79 70 65 28 67 T_GeometryType(g 2050: 65 6f 6d 65 74 72 79 29 2c 20 53 54 5f 53 72 69 eometry), ST_Sri 2060: 64 28 67 65 6f 6d 65 74 72 79 29 2c 20 43 6f 6f d(geometry), Coo 2070: 72 64 44 69 6d 65 6e 73 69 6f 6e 28 67 65 6f 6d rdDimension(geom 2080: 65 74 72 79 29 0d 0a 46 52 4f 4d 20 66 72 6f 6d etry)..FROM from 2090: 5f 70 6f 73 74 67 69 73 3b 0d 0a 2d 2d 2d 2d 2d _postgis;..----- 20a0: 2d 2d 2d 2d 2d 2d 2d 0d 0a 4c 49 4e 45 53 54 52 -------..LINESTR 20b0: 49 4e 47 7c 32 35 38 33 32 7c 58 59 0d 0a 0d 0a ING|25832|XY.... 20c0: 53 45 4c 45 43 54 20 52 65 63 6f 76 65 72 47 65 SELECT RecoverGe 20d0: 6f 6d 65 74 72 79 43 6f 6c 75 6d 6e 28 27 66 72 ometryColumn('fr 20e0: 6f 6d 5f 70 6f 73 74 67 69 73 27 2c 20 27 67 65 om_postgis', 'ge 20f0: 6f 6d 65 74 72 79 27 2c 20 32 35 38 33 32 2c 20 ometry', 25832, 2100: 27 4c 49 4e 45 53 54 52 49 4e 47 27 2c 20 27 58 'LINESTRING', 'X 2110: 59 27 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d Y');..---------- 2120: 2d 2d 0d 0a 31 0d 0a 3c 2f 76 65 72 62 61 74 69 --..1..</verbati 2130: 6d 3e 0d 0a 54 68 69 73 20 73 65 71 75 65 6e 63 m>..This sequenc 2140: 65 20 6f 66 20 53 51 4c 20 73 74 61 74 65 6d 65 e of SQL stateme 2150: 6e 74 73 20 28 53 70 61 74 69 61 4c 69 74 65 20 nts (SpatiaLite 2160: 73 75 70 70 6f 72 74 20 69 73 20 73 74 72 69 63 support is stric 2170: 74 6c 79 20 72 65 71 75 69 72 65 64 29 20 77 69 tly required) wi 2180: 6c 6c 20 74 72 61 6e 73 66 65 72 20 61 20 66 75 ll transfer a fu 2190: 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 47 65 lly qualified Ge 21a0: 6f 6d 65 74 72 79 20 74 61 62 6c 65 20 66 72 6f ometry table fro 21b0: 6d 20 50 6f 73 74 47 49 53 20 74 6f 20 53 70 61 m PostGIS to Spa 21c0: 74 69 61 4c 69 74 65 3a 0d 0a 3c 75 6c 3e 0d 0a tiaLite:..<ul>.. 21d0: 3c 6c 69 3e 3c 62 3e 73 74 65 70 20 31 3c 2f 62 <li><b>step 1</b 21e0: 3e 3a 20 66 69 72 73 74 20 77 65 27 6c 6c 20 74 >: first we'll t 21f0: 72 61 6e 73 66 65 72 20 74 68 65 20 77 68 6f 6c ransfer the whol 2200: 65 20 50 6f 73 74 47 49 53 20 74 61 62 6c 65 20 e PostGIS table 2210: 69 6e 74 6f 20 53 51 4c 69 74 65 3b 20 67 65 6f into SQLite; geo 2220: 6d 65 74 72 69 65 73 20 61 72 65 20 73 74 69 6c metries are stil 2230: 6c 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 l represented by 2240: 20 74 68 65 69 72 20 3c 62 3e 45 57 4b 42 3c 2f their <b>EWKB</ 2250: 62 3e 20 68 65 78 61 64 65 63 69 6d 61 6c 20 6e b> hexadecimal n 2260: 6f 74 61 74 69 6f 6e 73 2e 3c 2f 6c 69 3e 0d 0a otations.</li>.. 2270: 3c 6c 69 3e 3c 62 3e 73 74 65 70 20 32 3c 2f 62 <li><b>step 2</b 2280: 3e 3a 20 74 68 65 6e 20 77 65 27 6c 6c 20 75 73 >: then we'll us 2290: 65 20 74 68 65 20 3c 62 3e 47 65 6f 6d 46 72 6f e the <b>GeomFro 22a0: 6d 45 57 4b 42 28 29 3c 2f 62 3e 20 53 51 4c 20 mEWKB()</b> SQL 22b0: 66 75 6e 63 74 69 6f 6e 20 73 6f 20 74 6f 20 67 function so to g 22c0: 65 74 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e et the correspon 22d0: 64 69 6e 67 20 3c 62 3e 53 70 61 74 69 61 4c 69 ding <b>SpatiaLi 22e0: 74 65 27 73 20 42 4c 4f 42 3c 2f 62 3e 20 66 6f te's BLOB</b> fo 22f0: 72 20 65 61 63 68 20 67 65 6f 6d 65 74 72 79 2e r each geometry. 2300: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 73 74 </li>..<li><b>st 2310: 65 70 20 33 3c 2f 62 3e 3a 20 6e 6f 77 20 77 65 ep 3</b>: now we 2320: 20 73 69 6d 70 6c 79 20 68 61 76 65 20 74 6f 20 simply have to 2330: 64 69 73 63 6f 76 65 72 20 74 68 65 20 54 79 70 discover the Typ 2340: 65 2c 20 53 52 49 44 20 61 6e 64 20 44 69 6d 65 e, SRID and Dime 2350: 6e 73 69 6f 6e 73 20 64 65 63 6c 61 72 65 64 20 nsions declared 2360: 62 79 20 74 68 65 73 65 20 67 65 6f 6d 65 74 72 by these geometr 2370: 69 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ies.</li>..<li>< 2380: 62 3e 73 74 65 70 20 34 3c 2f 62 3e 3a 20 61 6e b>step 4</b>: an 2390: 64 20 66 69 6e 61 6c 6c 79 20 77 65 20 63 61 6e d finally we can 23a0: 20 6e 6f 77 20 72 65 63 6f 76 65 72 20 61 20 66 now recover a f 23b0: 75 6c 6c 20 71 75 61 6c 69 66 69 65 64 20 53 70 ull qualified Sp 23c0: 61 74 69 61 4c 69 74 65 27 73 20 6f 77 6e 20 28 atiaLite's own ( 23d0: 3c 69 3e 6e 61 74 69 76 65 3c 2f 69 3e 29 20 47 <i>native</i>) G 23e0: 65 6f 6d 65 74 72 79 20 63 6f 6c 75 6d 6e 2e 3c eometry column.< 23f0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d /li>..</ul><br>. 2400: 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 65 78 70 6f 72 .<hr>..<h3>expor 2410: 74 69 6e 67 20 64 61 74 61 20 66 72 6f 6d 20 53 ting data from S 2420: 51 4c 69 74 65 20 74 6f 20 50 6f 73 74 67 72 65 QLite to Postgre 2430: 2f 50 6f 73 74 47 49 53 3c 2f 68 33 3e 0d 0a 46 /PostGIS</h3>..F 2440: 6f 72 20 72 61 74 68 65 72 20 6f 62 76 69 6f 75 or rather obviou 2450: 73 20 73 65 63 75 72 69 74 79 20 72 65 61 73 6f s security reaso 2460: 6e 73 2c 20 61 6c 6c 20 56 69 72 74 75 61 6c 50 ns, all VirtualP 2470: 6f 73 74 67 72 65 73 20 74 61 62 6c 65 73 20 61 ostgres tables a 2480: 72 65 20 64 65 63 6c 61 72 65 64 20 74 6f 20 62 re declared to b 2490: 65 20 3c 69 3e 72 65 61 64 2d 6f 6e 6c 79 3c 2f e <i>read-only</ 24a0: 69 3e 20 62 79 20 64 65 66 61 75 6c 74 2e 3c 62 i> by default.<b 24b0: 72 3e 0d 0a 54 68 69 73 20 61 63 74 75 61 6c 6c r>..This actuall 24c0: 79 20 6d 65 61 6e 73 20 74 68 61 74 20 79 6f 75 y means that you 24d0: 20 61 72 65 20 65 6e 61 62 6c 65 64 20 74 6f 20 are enabled to 24e0: 65 78 65 63 75 74 65 20 61 6e 79 20 70 6f 73 73 execute any poss 24f0: 69 62 6c 65 20 3c 62 3e 53 45 4c 45 43 54 3c 2f ible <b>SELECT</ 2500: 62 3e 20 71 75 65 72 79 2c 20 62 75 74 20 61 6e b> query, but an 2510: 79 20 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c y <b>INSERT</b>, 2520: 20 3c 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20 6f <b>UPDATE</b> o 2530: 72 20 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 r <b>DELETE</b> 2540: 6f 70 65 72 61 74 69 6f 6e 20 61 66 66 65 63 74 operation affect 2550: 69 6e 67 20 74 68 65 20 50 6f 73 74 67 72 65 73 ing the Postgres 2560: 20 44 42 4d 53 20 69 73 20 73 74 72 69 63 74 6c DBMS is strictl 2570: 79 20 66 6f 72 62 69 64 64 65 6e 2e 0d 0a 3c 76 y forbidden...<v 2580: 65 72 62 61 74 69 6d 3e 0d 0a 43 52 45 41 54 45 erbatim>..CREATE 2590: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 70 VIRTUAL TABLE p 25a0: 67 5f 6f 75 74 20 0d 0a 20 20 20 20 55 53 49 4e g_out .. USIN 25b0: 47 20 56 69 72 74 75 61 6c 50 6f 73 74 67 72 65 G VirtualPostgre 25c0: 73 20 28 27 68 6f 73 74 61 64 64 72 3d 31 39 32 s ('hostaddr=192 25d0: 2e 31 36 38 2e 31 2e 39 31 20 70 6f 72 74 3d 35 .168.1.91 port=5 25e0: 34 33 32 20 64 62 6e 61 6d 65 3d 67 69 73 20 75 432 dbname=gis u 25f0: 73 65 72 3d 73 61 6e 64 72 6f 20 70 61 73 73 77 ser=sandro passw 2600: 6f 72 64 3d 73 65 63 72 65 74 27 2c 20 6d 79 5f ord=secret', my_ 2610: 73 63 68 65 6d 61 2c 20 6d 79 5f 74 61 62 6c 65 schema, my_table 2620: 2c 20 57 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 , W);..</verbati 2630: 6d 3e 0d 0a 41 6e 79 77 61 79 20 79 6f 75 20 63 m>..Anyway you c 2640: 61 6e 20 65 78 70 6c 69 63 69 74 6c 79 20 72 65 an explicitly re 2650: 71 75 65 73 74 20 61 20 56 69 72 74 75 61 6c 50 quest a VirtualP 2660: 6f 73 74 67 72 65 73 20 74 61 62 6c 65 20 74 6f ostgres table to 2670: 20 73 75 70 70 6f 72 74 20 75 6e 63 6f 6e 73 74 support unconst 2680: 72 61 69 6e 65 64 20 3c 69 3e 72 65 61 64 2d 77 rained <i>read-w 2690: 72 69 74 65 3c 2f 69 3e 20 6f 70 65 72 61 74 69 rite</i> operati 26a0: 6f 6e 73 2c 20 74 68 69 73 20 69 6e 63 6c 75 64 ons, this includ 26b0: 69 6e 67 20 61 6e 79 20 3c 62 3e 49 4e 53 45 52 ing any <b>INSER 26c0: 54 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 54 45 T</b>, <b>UPDATE 26d0: 3c 2f 62 3e 20 6f 72 20 3c 62 3e 44 45 4c 45 54 </b> or <b>DELET 26e0: 45 3c 2f 62 3e 20 73 74 61 74 65 6d 65 6e 74 20 E</b> statement 26f0: 61 66 66 65 63 74 69 6e 67 20 74 68 65 20 50 6f affecting the Po 2700: 73 74 67 72 65 73 20 44 42 4d 53 2e 3c 62 72 3e stgres DBMS.<br> 2710: 0d 0a 49 6e 20 74 68 69 73 20 63 61 73 65 20 79 ..In this case y 2720: 6f 75 20 73 69 6d 70 6c 79 20 68 61 76 65 20 74 ou simply have t 2730: 6f 20 70 61 73 73 20 61 20 66 75 72 74 65 72 20 o pass a furter 2740: 66 6f 75 72 74 68 20 61 72 67 75 6d 65 6e 74 20 fourth argument 2750: 69 6e 74 6f 20 74 68 65 20 3c 62 3e 55 53 49 4e into the <b>USIN 2760: 47 3c 2f 62 3e 20 63 6c 61 75 73 65 20 65 78 61 G</b> clause exa 2770: 63 74 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 69 ctly correspondi 2780: 6e 67 20 74 6f 20 74 68 65 20 6c 65 74 74 65 72 ng to the letter 2790: 20 3c 62 3e 57 3c 2f 62 3e 2e 0d 0a 3c 76 65 72 <b>W</b>...<ver 27a0: 62 61 74 69 6d 3e 0d 0a 44 45 4c 45 54 45 20 46 batim>..DELETE F 27b0: 52 4f 4d 20 70 67 5f 6f 75 74 3b 0d 0a 0d 0a 49 ROM pg_out;....I 27c0: 4e 53 45 52 54 20 49 4e 54 4f 20 70 67 5f 6f 75 NSERT INTO pg_ou 27d0: 74 20 28 66 6c 64 5f 61 2c 20 66 6c 64 5f 62 2c t (fld_a, fld_b, 27e0: 20 66 6c 64 5f 63 2c 20 67 65 6f 6d 65 74 72 79 fld_c, geometry 27f0: 29 0d 0a 53 45 4c 45 43 54 20 66 6c 64 5f 61 2c )..SELECT fld_a, 2800: 20 66 6c 64 5f 62 2c 20 66 6c 64 5f 63 2c 20 41 fld_b, fld_c, A 2810: 73 45 57 4b 42 28 67 65 6f 6d 65 74 72 79 29 0d sEWKB(geometry). 2820: 0a 66 72 6f 6d 20 73 6f 6d 65 5f 74 61 62 6c 65 .from some_table 2830: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a ;..</verbatim>.. 2840: 49 6e 20 74 68 65 20 61 62 6f 76 65 20 65 78 65 In the above exe 2850: 6d 70 6c 65 20 77 65 27 6c 6c 20 64 65 6c 65 74 mple we'll delet 2860: 65 20 66 69 72 73 74 20 61 6e 79 20 61 6c 72 65 e first any alre 2870: 61 64 79 20 65 78 69 73 74 69 6e 67 20 72 6f 77 ady existing row 2880: 20 66 72 6f 6d 20 74 68 65 20 50 6f 73 74 47 49 from the PostGI 2890: 53 20 74 61 62 6c 65 3b 20 74 68 65 6e 20 77 65 S table; then we 28a0: 27 6c 6c 20 73 69 6d 70 6c 79 20 74 72 61 6e 73 'll simply trans 28b0: 66 65 72 20 74 68 65 20 77 68 6f 6c 65 20 74 61 fer the whole ta 28c0: 62 6c 65 20 66 72 6f 6d 20 53 70 61 74 69 61 4c ble from SpatiaL 28d0: 69 74 65 20 69 6e 74 6f 20 50 6f 73 74 47 49 53 ite into PostGIS 28e0: 2e 3c 62 72 3e 0d 0a 50 6c 65 61 73 65 20 6e 6f .<br>..Please no 28f0: 74 65 2c 20 77 65 27 6c 6c 20 69 6e 76 6f 6b 65 te, we'll invoke 2900: 20 74 68 65 20 3c 62 3e 41 73 45 57 4b 42 28 29 the <b>AsEWKB() 2910: 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74 69 6f </b> SQL functio 2920: 6e 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 6f n in order to co 2930: 6e 76 65 72 74 20 61 6e 79 20 53 70 61 74 69 61 nvert any Spatia 2940: 4c 69 74 65 27 73 20 6f 77 6e 20 3c 62 3e 42 4c Lite's own <b>BL 2950: 4f 42 3c 2f 62 3e 20 67 65 6f 6d 65 74 72 79 20 OB</b> geometry 2960: 69 6e 74 6f 20 74 68 65 20 65 71 75 69 76 61 6c into the equival 2970: 65 6e 74 20 3c 62 3e 42 59 54 45 41 20 45 57 4b ent <b>BYTEA EWK 2980: 42 3c 2f 62 3e 20 6e 6f 74 61 74 69 6f 6e 20 72 B</b> notation r 2990: 65 71 75 69 72 65 64 20 62 79 20 50 6f 73 74 47 equired by PostG 29a0: 49 53 2e 0a 5a 20 66 62 32 30 62 66 39 34 66 64 IS..Z fb20bf94fd 29b0: 61 36 65 36 31 63 31 39 35 30 36 37 31 37 64 38 a6e61c19506717d8 29c0: 64 61 33 66 34 32 0a da3f42.