diff --git a/docs/content/preview/yugabyte-voyager/known-issues/oracle.md b/docs/content/preview/yugabyte-voyager/known-issues/oracle.md index 1fae446fbaea..207a7d5fe546 100644 --- a/docs/content/preview/yugabyte-voyager/known-issues/oracle.md +++ b/docs/content/preview/yugabyte-voyager/known-issues/oracle.md @@ -316,11 +316,61 @@ OR ### %TYPE syntax is unsupported -**GitHub**: [Issue #19169](https://github.com/yugabyte/yugabyte-db/issues/19169) +**GitHub**: [Issue #23619](https://github.com/yugabyte/yugabyte-db/issues/23619) -**Description**: In Oracle, the `%TYPE` is a virtual column that is used to declare a variable, column, or parameter with the same data type as an existing database column. An equivalent does not does exist in PostgreSQL and therefore in YugabyteDB. +**Description**: In Oracle, the `%TYPE` is a virtual column that is used to declare a variable, column, or parameter with the same data type as an existing database column. This syntax is not supported in target YugabyteDB yet and errors out in import schema as follows: -**Workaround**: None. A workaround is currently being explored. +```output +ERROR: invalid type name "employees.salary%TYPE" (SQLSTATE 42601) +``` + +**Workaround**: Fix the syntax to include the actual type name instead of referencing the type of a column. + + +**Example** + +An example of exported schema from the source database is as follows: + +```sql +CREATE TABLE public.employees ( + employee_id integer NOT NULL, + employee_name text, + salary numeric +); + + +CREATE FUNCTION public.get_employee_salary(emp_id integer) RETURNS numeric + LANGUAGE plpgsql + AS $$ +DECLARE + emp_salary employees.salary%TYPE; -- Declare a variable with the same type as employees.salary +BEGIN + SELECT salary INTO emp_salary + FROM employees + WHERE employee_id = emp_id; + + RETURN emp_salary; +END; +$$; +``` + +Suggested change to CREATE FUNCTION is as follows: + +```sql +CREATE FUNCTION public.get_employee_salary(emp_id integer) RETURNS numeric + LANGUAGE plpgsql + AS $$ +DECLARE + Emp_salary NUMERIC; -- Declare a variable with the same type as employees.salary +BEGIN + SELECT salary INTO emp_salary + FROM employees + WHERE employee_id = emp_id; + + RETURN emp_salary; +END; +$$; +``` --- diff --git a/docs/content/preview/yugabyte-voyager/known-issues/postgresql.md b/docs/content/preview/yugabyte-voyager/known-issues/postgresql.md index a9b9f38b4b6d..0f8a84c698eb 100644 --- a/docs/content/preview/yugabyte-voyager/known-issues/postgresql.md +++ b/docs/content/preview/yugabyte-voyager/known-issues/postgresql.md @@ -590,9 +590,9 @@ CREATE INDEX gist_idx ON public.ts_query_table USING gist (query); ### Indexes on some complex data types are not supported -**GitHub**: [Issue #9698](https://github.com/yugabyte/yugabyte-db/issues/9698) +**GitHub**: [Issue #9698](https://github.com/yugabyte/yugabyte-db/issues/9698), [Issue #23829](https://github.com/yugabyte/yugabyte-db/issues/23829) -**Description**: If you have indexes on some complex types such as TSQUERY, TSVECTOR, JSON, UDTs, citext, and so on, those will error out in import schema phase with the following error: +**Description**: If you have indexes on some complex types such as TSQUERY, TSVECTOR, JSONB, UDTs, citext, and so on, those will error out in import schema phase with the following error: ```output ERROR: INDEX on column of type '' not yet supported @@ -623,7 +623,7 @@ CREATE TABLE public.ts_query_table ( CREATE TABLE public.test_json ( id integer, - data json + data jsonb ); CREATE INDEX tsvector_idx ON public.documents (title_tsvector);