Skip to content

Commit e668fc2

Browse files
committed
Small fixes
1 parent 58b7029 commit e668fc2

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

expected/time_interval.out

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
create extension pg_incremental cascade;
22
create schema time_range;
33
set search_path to time_range;
4+
set client_min_messages to warning;
45
-- create a source table
56
create table events (
67
event_id bigint generated always as identity,
@@ -29,7 +30,6 @@ select incremental.create_time_interval_pipeline('event-aggregation', '1 day',
2930
where event_time >= $1 and event_time < $2
3031
group by 1
3132
$$);
32-
NOTICE: pipeline event-aggregation: processing time range from Fri Dec 31 16:00:00 1999 PST to Fri Dec 06 00:00:00 2024 PST
3333
create_time_interval_pipeline
3434
-------------------------------
3535

@@ -50,7 +50,6 @@ select sum(event_count) from events_agg;
5050
insert into events (client_id, path, response_time)
5151
select s, '/page-' || (s % 3), random() from generate_series(1,100) s;
5252
call incremental.execute_pipeline('event-aggregation');
53-
NOTICE: pipeline event-aggregation: no rows to process
5453
select count(*) from events;
5554
count
5655
-------
@@ -65,10 +64,4 @@ select sum(event_count) from events_agg;
6564
(1 row)
6665

6766
drop schema time_range cascade;
68-
NOTICE: drop cascades to 2 other objects
69-
DETAIL: drop cascades to table events
70-
drop cascades to table events_agg
7167
drop extension pg_incremental;
72-
NOTICE: drop cascades to 2 other objects
73-
DETAIL: drop cascades to function incremental._drop_extension_trigger()
74-
drop cascades to event trigger incremental_drop_extension_trigger

pg_incremental--1.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ GRANT SELECT ON incremental.processed_files TO public;
5252

5353
CREATE FUNCTION incremental.create_sequence_pipeline(
5454
pipeline_name text,
55-
sequence_name regclass,
55+
source_table_name regclass,
5656
command text,
5757
schedule text default '* * * * *',
5858
execute_immediately bool default true)

sql/time_interval.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
create extension pg_incremental cascade;
22
create schema time_range;
33
set search_path to time_range;
4+
set client_min_messages to warning;
45

56
-- create a source table
67
create table events (

src/pipeline.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ incremental_create_sequence_pipeline(PG_FUNCTION_ARGS)
5050
if (PG_ARGISNULL(0))
5151
ereport(ERROR, (errmsg("pipeline_name cannot be NULL")));
5252
if (PG_ARGISNULL(1))
53-
ereport(ERROR, (errmsg("sequence_name cannot be NULL")));
53+
ereport(ERROR, (errmsg("source_table_name cannot be NULL")));
5454
if (PG_ARGISNULL(2))
5555
ereport(ERROR, (errmsg("command cannot be NULL")));
5656

@@ -64,14 +64,18 @@ incremental_create_sequence_pipeline(PG_FUNCTION_ARGS)
6464

6565
switch (get_rel_relkind(sequenceId))
6666
{
67+
/*
68+
* We allow source_table_name to be a sequence, and this is
69+
* necessary if there are multiple sequences.
70+
*/
6771
case RELKIND_SEQUENCE:
6872
{
6973
int32 columnNumber = 0;
7074

7175
if (!sequenceIsOwned(sequenceId, DEPENDENCY_AUTO, &sourceRelationId, &columnNumber))
7276
{
7377
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
74-
errmsg("enly sequences that are owned by a table are supported")));
78+
errmsg("only sequences that are owned by a table are supported")));
7579
}
7680

7781
break;

src/sequence.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,15 @@ FindSequenceForRelation(Oid relationId)
319319
ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT),
320320
errmsg("relation \"%s\" does not have any sequences associated "
321321
"with it",
322-
get_rel_name(relationId)),
323-
errhint("Specify the name of the sequence to use for the "
324-
"pipeline as the argument")));
322+
get_rel_name(relationId))));
325323

326324
if (list_length(sequences) > 1)
327325
ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT),
328326
errmsg("relation \"%s\" has multiple sequences associated "
329327
"with it",
330328
get_rel_name(relationId)),
331-
errhint("Specify the name of the sequence to use for the "
332-
"pipeline as the argument")));
329+
errhint("Specify the name of the sequence to use instead of "
330+
"the table name")));
333331

334332
return linitial_oid(sequences);
335333
}

0 commit comments

Comments
 (0)