Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs][Voyager] Minor fixes in known-issues PG/Oracle pages #23842

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 53 additions & 3 deletions docs/content/preview/yugabyte-voyager/known-issues/oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 with error:
priyanshi-yb marked this conversation as resolved.
Show resolved Hide resolved

**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;
$$;
```

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<TYPE_NAME>' not yet supported
Expand Down Expand Up @@ -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);
Expand Down