{"action":"created","issue":{"url":"https://api.github.com/repos/greenplum-db/gpdb/issues/1432","repository_url":"https://api.github.com/repos/greenplum-db/gpdb","labels_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/1432/labels{/name}","comments_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/1432/comments","events_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/1432/events","html_url":"https://github.com/greenplum-db/gpdb/pull/1432","id":194615853,"number":1432,"title":"Avoid emitting NOTICE on implicit function creation/drop during ALTER TABLE","user":{"login":"danielgustafsson","id":321790,"avatar_url":"https://avatars.githubusercontent.com/u/321790?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgustafsson","html_url":"https://github.com/danielgustafsson","followers_url":"https://api.github.com/users/danielgustafsson/followers","following_url":"https://api.github.com/users/danielgustafsson/following{/other_user}","gists_url":"https://api.github.com/users/danielgustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgustafsson/subscriptions","organizations_url":"https://api.github.com/users/danielgustafsson/orgs","repos_url":"https://api.github.com/users/danielgustafsson/repos","events_url":"https://api.github.com/users/danielgustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/danielgustafsson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-09T14:57:08Z","updated_at":"2016-12-09T16:13:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/1432","html_url":"https://github.com/greenplum-db/gpdb/pull/1432","diff_url":"https://github.com/greenplum-db/gpdb/pull/1432.diff","patch_url":"https://github.com/greenplum-db/gpdb/pull/1432.patch"},"body":"When a table which had an attribute whose type has been dropped process the ALTER TABLE command queue, a \"hidden\" type will be created, and immediately dropped, during ALTER TABLE processing. This will emit several NOTICEs which can be confusing to the user as it's an autogenerated name and the DROP TYPE can have happened at a previous time. Below is an example of the output:\r\n\r\n```SQL\r\ncreate table <tablename> (a integer, b <typename>);\r\ndrop type <typename>;\r\n  ...\r\nalter table <tablename> set with(reorganize = true) distributed randomly;\r\nNOTICE:  return type pg_atsdb_<oid>_2_3 is only a shell\r\nNOTICE:  argument type pg_atsdb_<oid>_2_3 is only a shell\r\nNOTICE:  drop cascades to function pg_atsdb_<oid>_2_3_out(pg_atsdb_<oid>_2_3)\r\nNOTICE:  drop cascades to function pg_atsdb_<oid>_2_3_in(cstring)\r\n```\r\nIn order to override the messagelevel and mute the emission of these NOTICEs, extend CREATE FUNCTION and set INTERNAL depedency on the functions based on the type.\r\n\r\nBy passing in quiet as a new WITH parameter CreateFunction() is instructed to not emit NOTICE messages for shell types.\r\n\r\n```SQL\r\nCREATE FUNCTION f .. WITH (quiet);\r\n```\r\nThe in and out functions for the type will be marked as INTERNAL dependency which will instruct the backend to drop them during CASCADE without emitting NOTICEs. INTERNAL dependency implies that the objects are considered an internal implementation detail of an object and since these functions are useless without the type (and to be frank, useless with the type as well given the nature of the type) they can be considered as such.\r\n\r\nAlso remove output from expected testfiles and perform minor cleanups."},"comment":{"url":"https://api.github.com/repos/greenplum-db/gpdb/issues/comments/266052814","html_url":"https://github.com/greenplum-db/gpdb/pull/1432#issuecomment-266052814","issue_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/1432","id":266052814,"user":{"login":"hlinnaka","id":191602,"avatar_url":"https://avatars.githubusercontent.com/u/191602?v=3","gravatar_id":"","url":"https://api.github.com/users/hlinnaka","html_url":"https://github.com/hlinnaka","followers_url":"https://api.github.com/users/hlinnaka/followers","following_url":"https://api.github.com/users/hlinnaka/following{/other_user}","gists_url":"https://api.github.com/users/hlinnaka/gists{/gist_id}","starred_url":"https://api.github.com/users/hlinnaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hlinnaka/subscriptions","organizations_url":"https://api.github.com/users/hlinnaka/orgs","repos_url":"https://api.github.com/users/hlinnaka/repos","events_url":"https://api.github.com/users/hlinnaka/events{/privacy}","received_events_url":"https://api.github.com/users/hlinnaka/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T16:13:21Z","updated_at":"2016-12-09T16:13:21Z","body":"Actually, why do we need to reconsturct the dropped columns here at all? This code is used for ALTER TABLE SET DISTRIBUTED BY, which has to read through all data, re-distribute it, and write it again. If we're rewriting all the data, anyway, shouldn't we squeeze away all dropped columns, like other table-rewriting ALTER TABLE operations do?"}}
{"actor":{"display_login":"hlinnaka"}}