* Emit the right error or warning message for a "DROP" command issued on a * non-existent relation */
| 1752 | * non-existent relation |
| 1753 | */ |
| 1754 | static void |
| 1755 | DropErrorMsgNonExistent(RangeVar *rel, char rightkind, bool missing_ok) |
| 1756 | { |
| 1757 | const struct dropmsgstrings *rentry; |
| 1758 | |
| 1759 | if (rel->schemaname != NULL && |
| 1760 | !OidIsValid(LookupNamespaceNoError(rel->schemaname))) |
| 1761 | { |
| 1762 | if (!missing_ok) |
| 1763 | { |
| 1764 | ereport(ERROR, |
| 1765 | (errcode(ERRCODE_UNDEFINED_SCHEMA), |
| 1766 | errmsg("schema \"%s\" does not exist", rel->schemaname))); |
| 1767 | } |
| 1768 | else |
| 1769 | { |
| 1770 | ereport(NOTICE, |
| 1771 | (errmsg("schema \"%s\" does not exist, skipping", |
| 1772 | rel->schemaname))); |
| 1773 | } |
| 1774 | return; |
| 1775 | } |
| 1776 | |
| 1777 | for (rentry = dropmsgstringarray; rentry->kind != '\0'; rentry++) |
| 1778 | { |
| 1779 | if (rentry->kind == rightkind) |
| 1780 | { |
| 1781 | if (!missing_ok) |
| 1782 | { |
| 1783 | ereport(ERROR, |
| 1784 | (errcode(rentry->nonexistent_code), |
| 1785 | errmsg(rentry->nonexistent_msg, rel->relname))); |
| 1786 | } |
| 1787 | else |
| 1788 | { |
| 1789 | if (Gp_role != GP_ROLE_EXECUTE) |
| 1790 | ereport(NOTICE, (errmsg(rentry->skipping_msg, rel->relname))); |
| 1791 | break; |
| 1792 | } |
| 1793 | } |
| 1794 | } |
| 1795 | |
| 1796 | Assert(rentry->kind != '\0'); /* Should be impossible */ |
| 1797 | } |
| 1798 | |
| 1799 | /* |
| 1800 | * Emit the right error message for a "DROP" command issued on a |
no test coverage detected