hasura / hasura/graphql-engine

Function Definition in console has misformatted dollar quoting string constants

Open
#7,787 2 comments 0 reactions 0 assignees View on GitHub
c/console estimate/S k/bug support/needs-action
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.0.8

### Environment

Local console. Repros on deployed console as well.

### What is the expected behavior?

Function definitions that use [dollar quoting](https://www.postgresql.org/docs/9.5/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING) are displayed in the console in a way that can be copied into a SQL console and applied.

### Keywords

Dollar quoting, function definition

### What is the current behavior?

Dollar quoted strings like `$function$` are rendered as `$ function $`, which is not a valid dollar-quoted string constant.

### How to reproduce the issue?

1. Track a table: ```create table test_table (id int);```
2. Track a SQL function:
```sql
create or replace function public.test_fn() returns test_table AS $function$ begin return null; end; $function$ LANGUAGE "plpgsql";
```

3. Access http://HASURA/console/data/default/schema/public/functions/test_fn/modify
4. See the function text in the Function Definition: section. Copy the code into a `psql` console and expect the function to be applied.

### Any possible solutions?

If I open the editor, the function is rendered correctly. This seems to be a problem rendering inside the `

` tag in the function definition display page.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.