SELECT (current_setting('server_version_num')::int < 140000) AS skip_test \gset \if :skip_test \quit \endif SET timezone TO 'Etc/UTC'; CREATE SERVER wikidata FOREIGN DATA WRAPPER rdf_fdw OPTIONS ( endpoint 'https://query.wikidata.org/sparql'); CREATE FOREIGN TABLE ft ( p rdfnode OPTIONS (variable '?p'), o rdfnode OPTIONS (variable '?o') ) SERVER wikidata OPTIONS ( log_sparql 'true', sparql 'SELECT * {wd:Q192490 ?p ?o . FILTER (?p = )}'); /* * 't1' only partially matches with 'dbpedia_cities', with columns * 'city_name' and 'uri'. * SERVER option 'fetch_size' will be used, as both FOREIGN TABLE and * function call do not set 'fetch_size'. * 'commit_page' is set to 'false', so all retrieved and inserted records * are committed only when the transaction finishes. */ CREATE TABLE public.t1(p rdfnode, o rdfnode); CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t1', verbose => true, commit_page => false ); INFO: setting 'fetch_size' to 100 (default) INFO: == Parameters == foreign_table: 'ft' target_table: 'public.t1' create_table: 'false' fetch_size: 100 begin_offset: 0 max_records: 0 ordering_column: 'NOT SET' ordering sparql variable: '?p' sort_order: 'ASC' INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?p) OFFSET 0 LIMIT 100 INFO: SPARQL returned 58 records. INFO: [0 - 100]: 58 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?p) OFFSET 100 LIMIT 100 INFO: SPARQL returned 0 records. SELECT * FROM public.t1 ORDER BY o::text COLLATE "C"; p | o ----------------------------------------------+--------------------- "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "بوستجري إس كيو إل" "http://www.w3.org/2000/01/rdf-schema#label" | "پستگرسکیوال" "http://www.w3.org/2000/01/rdf-schema#label" | "পোস্টগ্রেএসকিউএল" "http://www.w3.org/2000/01/rdf-schema#label" | "போஸ்கிரெஸ்குயெல்" "http://www.w3.org/2000/01/rdf-schema#label" | "പോസ്റ്റ്ഗ്രേഎസ്ക്യുഎൽ" "http://www.w3.org/2000/01/rdf-schema#label" | "โพสต์เกรสคิวเอล" (58 rows) /* * only a single column of 't2' matches the foreign table 'dbpedia_cities'. * reducing the 'fetch_size' to 2 and setting maximum limit of 9 records. * the SPARQL query will be ordered by 'city_name' */ CREATE TABLE public.t2(p rdfnode, o rdfnode); CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t2', fetch_size => 2, max_records => 9, orderby_column => 'o', verbose => true, commit_page => true ); INFO: == Parameters == foreign_table: 'ft' target_table: 'public.t2' create_table: 'false' fetch_size: 2 begin_offset: 0 max_records: 9 ordering_column: 'o' ordering sparql variable: '?o' sort_order: 'ASC' INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 0 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [0 - 2]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 2 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [2 - 4]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 4 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [4 - 6]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 6 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [6 - 8]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 8 LIMIT 1 INFO: SPARQL returned 1 record. INFO: [8 - 10]: 1 records inserted SELECT * FROM public.t2 ORDER BY o::text COLLATE "C"; p | o ----------------------------------------------+--------------------- "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "بوستجري إس كيو إل" "http://www.w3.org/2000/01/rdf-schema#label" | "পোস্টগ্রেএসকিউএল" (9 rows) /* * 't3' does not exist. it will be created by the function due to * 'create_table => true' as a copy of 'dbedia_cities' */ CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t3', create_table => true, orderby_column => 'o', sort_order => 'DESC', verbose => true ); INFO: Target TABLE "public.t3" created based on FOREIGN TABLE "public.ft": CREATE TABLE public.t3 AS SELECT * FROM public.ft WITH NO DATA; INFO: setting 'fetch_size' to 100 (default) INFO: == Parameters == foreign_table: 'ft' target_table: 'public.t3' create_table: 'true' fetch_size: 100 begin_offset: 0 max_records: 0 ordering_column: 'o' ordering sparql variable: '?o' sort_order: 'DESC' INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY DESC(?o) OFFSET 0 LIMIT 100 INFO: SPARQL returned 58 records. INFO: [0 - 100]: 58 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY DESC(?o) OFFSET 100 LIMIT 100 INFO: SPARQL returned 0 records. SELECT * FROM public.t3 ORDER BY o::text COLLATE "C"; p | o ----------------------------------------------+--------------------- "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "بوستجري إس كيو إل" "http://www.w3.org/2000/01/rdf-schema#label" | "پستگرسکیوال" "http://www.w3.org/2000/01/rdf-schema#label" | "পোস্টগ্রেএসকিউএল" "http://www.w3.org/2000/01/rdf-schema#label" | "போஸ்கிரெஸ்குயெல்" "http://www.w3.org/2000/01/rdf-schema#label" | "പോസ്റ്റ്ഗ്രേഎസ്ക്യുഎൽ" "http://www.w3.org/2000/01/rdf-schema#label" | "โพสต์เกรสคิวเอล" (58 rows) /* * 'public.t4' only partially matches the columns of 'public.ft'. * the non-matching columns will be set to NULL. */ CREATE TABLE public.t4 (p rdfnode, o rdfnode, foo text); CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t4', orderby_column => 'o', fetch_size => 4, max_records => 15 ); INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 0 LIMIT 4 INFO: SPARQL returned 4 records. INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 4 LIMIT 4 INFO: SPARQL returned 4 records. INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 8 LIMIT 4 INFO: SPARQL returned 4 records. INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 12 LIMIT 3 INFO: SPARQL returned 3 records. SELECT * FROM public.t4 ORDER BY o::text COLLATE "C"; p | o | foo ----------------------------------------------+---------------------+----- "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" | "http://www.w3.org/2000/01/rdf-schema#label" | "بوستجري إس كيو إل" | "http://www.w3.org/2000/01/rdf-schema#label" | "পোস্টগ্রেএসকিউএল" | (15 rows) /* * 'public.t5' does not exist. * it will be created, since 'create_table' is set to true. */ CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t5', orderby_column => 'o', create_table => true, fetch_size => 4, max_records => 15 ); INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 0 LIMIT 4 INFO: SPARQL returned 4 records. INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 4 LIMIT 4 INFO: SPARQL returned 4 records. INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 8 LIMIT 4 INFO: SPARQL returned 4 records. INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 12 LIMIT 3 INFO: SPARQL returned 3 records. SELECT * FROM public.t5 ORDER BY o::text COLLATE "C"; p | o ----------------------------------------------+--------------------- "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "بوستجري إس كيو إل" "http://www.w3.org/2000/01/rdf-schema#label" | "পোস্টগ্রেএসকিউএল" (15 rows) /* * the matching columns of 'public.t4' and 'public.t5' * must be identical */ SELECT p,o FROM public.t4 EXCEPT SELECT p,o FROM public.t5; p | o ---+--- (0 rows) /* * setting 'begin_offset' to 10 */ CALL rdf_fdw_clone_table( foreign_table => 'public.ft', target_table => 'public.t6', orderby_column => 'o', create_table => true, begin_offset => 10, fetch_size => 2, max_records => 7, verbose => true ); INFO: Target TABLE "public.t6" created based on FOREIGN TABLE "public.ft": CREATE TABLE public.t6 AS SELECT * FROM public.ft WITH NO DATA; INFO: == Parameters == foreign_table: 'ft' target_table: 'public.t6' create_table: 'true' fetch_size: 2 begin_offset: 10 max_records: 7 ordering_column: 'o' ordering sparql variable: '?o' sort_order: 'ASC' INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 10 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [10 - 12]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 12 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [12 - 14]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 14 LIMIT 2 INFO: SPARQL returned 2 records. INFO: [14 - 16]: 2 records inserted INFO: SPARQL query sent to 'https://query.wikidata.org/sparql': SELECT ?p ?o {wd:Q192490 ?p ?o . FILTER (?p = )} ORDER BY ASC(?o) OFFSET 16 LIMIT 1 INFO: SPARQL returned 1 record. INFO: [16 - 18]: 1 records inserted SELECT * FROM public.t6 ORDER BY o::text COLLATE "C"; p | o ----------------------------------------------+--------------- "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "PostgreSQL" "http://www.w3.org/2000/01/rdf-schema#label" | "پستگرسکیوال" (7 rows) /* * clean up the mess */ DROP TABLE IF EXISTS public.t1, public.t2, public.t3, public.t4, public.t5, public.t6; DROP SERVER wikidata CASCADE; NOTICE: drop cascades to foreign table ft /* == Exceptions == */ CREATE TABLE public.t1_local(id serial, c1_null text, c2_null text); CREATE TABLE public.t2_local(name text, foo text); /* ordinary table instead of foreign table in 'foreign_table' */ CALL rdf_fdw_clone_table( foreign_table => 't1_local', target_table => 't2_local' ); ERROR: invalid relation: 't1_local' is not a foreign table /* foreign table instead of an ordinary table in 'target_table' */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1' ); ERROR: relation "t1" does not exist LINE 1: ...'f' THEN oid ELSE 0 END FROM pg_class WHERE oid = 't1'::regc... ^ QUERY: SELECT CASE relkind WHEN 'f' THEN oid ELSE 0 END FROM pg_class WHERE oid = 't1'::regclass::oid; /* empty target_table */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => '' ); ERROR: no 'target_table' provided /* empty foreign_table */ CALL rdf_fdw_clone_table( foreign_table => '', target_table => 't1_local' ); ERROR: no 'foreign_table' provided /* negative fetch_size */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', fetch_size => -1 ); ERROR: invalid 'fetch_size': -1 HINT: the page size corresponds to the number of records that are retrieved after each iteration and therefore must be a positive number /* negative begin_offset */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => -1 ); ERROR: invalid 'begin_offset': -1 /* invalid ordering_column */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't2_local', orderby_column => 'foo' ); ERROR: relation "t1" does not exist LINE 1: ...'f' THEN oid ELSE 0 END FROM pg_class WHERE oid = 't1'::regc... ^ QUERY: SELECT CASE relkind WHEN 'f' THEN oid ELSE 0 END FROM pg_class WHERE oid = 't1'::regclass::oid; /* target table does not match any column of t1 */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local' ); ERROR: relation "t1" does not exist LINE 1: ...'f' THEN oid ELSE 0 END FROM pg_class WHERE oid = 't1'::regc... ^ QUERY: SELECT CASE relkind WHEN 'f' THEN oid ELSE 0 END FROM pg_class WHERE oid = 't1'::regclass::oid; /* invalid sort_order */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', sort_order => 'foo' ); ERROR: invalid 'sort_order': foo HINT: the 'sort_order' must be either 'ASC' (ascending) or 'DESC' (descending) /* NULL foreign_table */ CALL rdf_fdw_clone_table( foreign_table => NULL, target_table => 't1_local'); ERROR: 'foreign_table' cannot be NULL /* NULL target_table */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => NULL); ERROR: 'target_table' cannot be NULL /* NULL begin_offset */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => NULL); ERROR: 'begin_offset' cannot be NULL HINT: either set it to 0 or ignore the paramter to start the pagination from the beginning /* NULL fetch_size */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => 42, fetch_size => NULL); ERROR: 'fetch_size' cannot be NULL /* NULL max_records */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => 42, fetch_size => 8, max_records => NULL); ERROR: 'max_records' cannot be NULL /* NULL sort_order */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => 42, fetch_size => 8, max_records => 103, orderby_column => 'foo', sort_order => NULL); ERROR: 'sort_order' cannot be NULL /* NULL create_table */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => 42, fetch_size => 8, max_records => 103, orderby_column => 'foo', sort_order => 'DESC', create_table => NULL); ERROR: 'create_table' cannot be NULL /* NULL verbose */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => 42, fetch_size => 8, max_records => 103, orderby_column => 'foo', sort_order => 'DESC', create_table => true, verbose => NULL); ERROR: 'verbose' cannot be NULL /* NULL commit_page */ CALL rdf_fdw_clone_table( foreign_table => 't1', target_table => 't1_local', begin_offset => 42, fetch_size => 8, max_records => 103, orderby_column => 'foo', sort_order => 'DESC', create_table => true, verbose => false, commit_page => NULL); ERROR: 'commit_page' cannot be NULL DROP TABLE IF EXISTS t1_local, t2_local;