-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50850: importccl: add support for SQLFns in pgdump r=mjibson a=mjibson SQLFns are functions users can call from SQL that create and execute SQL. AddGeometryColumn, for example, creates an ADD COLUMN statement and executes it. Add support for these in IMPORT PGDUMP by detecting them, running them, and feeding them back in to the table statement reader. Release note (sql change): add support for AddGeometryColumn and other functions that mutate schema in IMPORT PGDUMP. Co-authored-by: Matt Jibson <[email protected]>
- Loading branch information
Showing
3 changed files
with
207 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- The two comments below removing gid are there because IMPORT doesn't | ||
-- support DEFAULT functions (#48253). This function is otherwise exactly | ||
-- what shp2pgsql produces. | ||
|
||
SET CLIENT_ENCODING TO UTF8; | ||
SET STANDARD_CONFORMING_STRINGS TO ON; | ||
BEGIN; | ||
CREATE TABLE "nyc_census_blocks" (--gid serial, | ||
"blkid" varchar(15), | ||
"popn_total" float8, | ||
"popn_white" float8, | ||
"popn_black" float8, | ||
"popn_nativ" float8, | ||
"popn_asian" float8, | ||
"popn_other" float8, | ||
"boroname" varchar(32)); | ||
--ALTER TABLE "nyc_census_blocks" ADD PRIMARY KEY (gid); | ||
SELECT AddGeometryColumn('','nyc_census_blocks','geom','26918','MULTIPOLYGON',2); | ||
INSERT INTO "nyc_census_blocks" ("blkid","popn_total","popn_white","popn_black","popn_nativ","popn_asian","popn_other","boroname",geom) VALUES ('360850009001000','97','51','32','1','5','8','Staten Island','010600002026690000010000000103000000010000000A00000051AC161881A22141A31409CF1F2A51415F4321458DA2214100102A3F1D2A51418C34807C0BA221414E3E89F5122A5141782D605495A12141780D1CE92A2A51410D1C9C6770A121410F2D6074322A5141441560E0B0A02141A00099C72F2A51412365B4789AA021419F60A7BB342A514160E3E8FA66A0214118B4C0CE402A5141EA4BF3EEC7A12141A3023D61452A514151AC161881A22141A31409CF1F2A5141'); | ||
INSERT INTO "nyc_census_blocks" ("blkid","popn_total","popn_white","popn_black","popn_nativ","popn_asian","popn_other","boroname",geom) VALUES ('360850020011000','66','52','2','0','7','5','Staten Island','0106000020266900000100000001030000000100000007000000083B4A6F79A8214127EC57B49926514151B51BB7CEA72141B2EAD6F38A2651416F429640B9A72141449FCB1C89265141163AA64D56A72141B89E2B7C9B26514150509213EDA72141DCC9A351A826514184FA4C6017A82141B9AE24F0AB265141083B4A6F79A8214127EC57B499265141'); | ||
INSERT INTO "nyc_census_blocks" ("blkid","popn_total","popn_white","popn_black","popn_nativ","popn_asian","popn_other","boroname",geom) VALUES ('360850040001000','62','14','18','2','25','3','Staten Island','010600002026690000010000000103000000010000000600000082DCED72969D2141563247C49E2651417C120440079D214123319BFC8626514179D4895B6A9C2141F3667FC995265141C0428AC2C29C214159EB5C75AC265141CB126202D69C214180215728B126514182DCED72969D2141563247C49E265141'); | ||
COMMIT; |