Skip to content

Commit

Permalink
added some hints
Browse files Browse the repository at this point in the history
  • Loading branch information
lacanoid committed Jun 3, 2021
1 parent 888dc2c commit a3e1ca2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Version 0.13
- file_link() now throws an error if path doesn't have a valid volume prefix
- improved datalinker, also reads volumes from /etc/postgresql-common/pg_datalinker.prefix
- datalinker prefixes can be managed with `pg_datalinker ( init, list, add, del )` command
- datalinker can now revert old files from backups
- datalinker can now revert old files from backups when assigning datalinks with tokens
- datalinker can now unlink+link in one operation
- trim trailing / on directory names for FS datalinks for better file name uniqueness
- dlnewcopy() now stores old token in link
- dlpreviouscopy() looks for this old token first
- store curl_head response code in datalink. This helps in finding broken links and such.

Version 0.12
------------
Expand Down
9 changes: 6 additions & 3 deletions datalink.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1106,16 +1106,19 @@ begin
if not found then
raise exception 'datalink exception'
using errcode = 'HW000',
detail = format('Invalid link control options (%s)',my_lco),
hint = 'see table datalink.link_control_options for valid link control options';
detail = format('Invalid link control options (%s)',my_lco),
hint = 'see table datalink.link_control_options for valid link control options';
end if;

if my_lco is distinct from co.lco then
e := format('select count(%I) from %s where %I is not null limit 1',
my_column_name,cast(my_regclass as text),my_column_name);
execute e into n;
if n > 0 then
raise exception 'Can''t change link control options; % non-null values present in column "%"',n,my_column_name;
raise exception 'datalink exception'
using errcode = 'HW000',
detail = format('Can''t change link control options; %s non-null values present in column "%s"',n,my_column_name),
hint = format('Perhaps you can truncate %s',my_regclass);
end if;

-- update fdw options with new lco
Expand Down
4 changes: 3 additions & 1 deletion test/expected/other.out
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ NOTICE: DATALINK DDL:TRIGGER on sample_datalinks3
update datalink.column_options
set link_control='FILE', integrity='SELECTIVE'
where table_name='sample_datalinks3' and column_name='link';
ERROR: Can't change link control options; 6 non-null values present in column "link"
ERROR: datalink exception
DETAIL: Can't change link control options; 6 non-null values present in column "link"
HINT: Perhaps you can truncate sample_datalinks3
CONTEXT: PL/pgSQL function modlco(regclass,name,dl_lco) line 35 at RAISE
SQL statement "SELECT datalink.modlco(regclass(old.table_name),old.column_name,my_lco)"
PL/pgSQL function dl_trigger_options() line 18 at PERFORM
Expand Down

0 comments on commit a3e1ca2

Please sign in to comment.