Skip to content

Commit

Permalink
bug #765: Fixed function parsing issue in case function's complete bo…
Browse files Browse the repository at this point in the history
…dy is in one single line (#768)

- Also, added an automation test named pg-hasura-ecommerce for this fix
  • Loading branch information
sanyamsinghal authored Feb 7, 2023
1 parent f315f12 commit 9bf2626
Show file tree
Hide file tree
Showing 14 changed files with 34,728 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pg-migtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ jobs:
- name: "TEST: pg-sample-schema-emp"
run: migtests/scripts/run-test.sh pg-tests/pg-sample-employee

- name: "TEST: pg-hasura-ecommerce"
run: migtests/scripts/run-test.sh pg-hasura-ecommerce

Binary file removed migtests/lib/__pycache__/yb.cpython-311.pyc
Binary file not shown.
14 changes: 12 additions & 2 deletions migtests/lib/yb.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ def invalid_index_present(self, table_name, schema_name="public"):
return False


def fetch_all_triggers(self, schema_name="public") -> List[str]:
def fetch_all_triggers(self, schema_name="public") -> set[str]:
cur = self.conn.cursor()
cur.execute(f"SELECT trigger_name FROM information_schema.triggers WHERE trigger_schema = '{schema_name}'")
return [trigger[0] for trigger in cur.fetchall()]
return set(cur.fetchall())

def fetch_all_procedures(self, schema_name="public") -> List[str]:
cur = self.conn.cursor()
Expand All @@ -179,4 +179,14 @@ def fetch_all_function_names(self, schema_name="public") -> List[str]:
def fetch_all_table_rows(self, table_name, schema_name="public") -> set[str]:
cur = self.conn.cursor()
cur.execute(f"SELECT * FROM {schema_name}.{table_name}")
return set(cur.fetchall())

def fetch_all_pg_extension(self, schema_name = "public") -> set[str]:
cur = self.conn.cursor()
cur.execute(f"SELECT extname FROM pg_extension")
return set(cur.fetchall())

def fetch_all_schemas(self) -> set[str]:
cur = self.conn.cursor()
cur.execute(f"SELECT schema_name FROM information_schema.schemata where schema_name !~ '^pg_' and schema_name <> 'information_schema'")
return set(cur.fetchall())
6 changes: 6 additions & 0 deletions migtests/scripts/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ main() {
export_data
ls -l ${EXPORT_DIR}/data

step "Fix data."
if [ -x "${TEST_DIR}/fix-data" ]
then
"${TEST_DIR}/fix-data" ${EXPORT_DIR}
fi

step "Create target database."
run_ysql yugabyte "DROP DATABASE IF EXISTS ${TARGET_DB_NAME};"
run_ysql yugabyte "CREATE DATABASE ${TARGET_DB_NAME}"
Expand Down
Loading

0 comments on commit 9bf2626

Please sign in to comment.