Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions internal/stackql/astformat/ast_format_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var (

func PostgresSelectExprsFormatter(buf *sqlparser.TrackedBuffer, node sqlparser.SQLNode) {
switch node := node.(type) {
case *sqlparser.ColName:
formatColName(node, buf)
case sqlparser.ColIdent:
formatColIdent(node, buf)
return
Expand Down Expand Up @@ -52,6 +54,14 @@ func formatColIdent(node sqlparser.ColIdent, buf *sqlparser.TrackedBuffer) {
buf.WriteString(fmt.Sprintf(`"%s"`, node.String()))
}

func formatColName(node *sqlparser.ColName, buf *sqlparser.TrackedBuffer) {
tableNameStr := node.Qualifier.GetRawVal()
if tableNameStr != "" {
buf.WriteString(fmt.Sprintf(`"%s".`, tableNameStr))
}
formatColIdent(node.Name, buf)
}

func String(node sqlparser.SQLNode, formatter sqlparser.NodeFormatter) string {
return formattedString(node, formatter)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/stackql/parserutil/parser_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func inferColNameFromExpr(node *sqlparser.AliasedExpr, formatter sqlparser.NodeF
case *sqlparser.ColName:
retVal.Name = expr.Name.String()
retVal.Qualifier = expr.Qualifier.GetRawVal()
decoratedCol := expr.GetRawVal()
decoratedCol := astformat.String(expr, formatter)
// if decoratedCol != retVal.Name {
retVal.Alias = alias
retVal.DecoratedColumn = getDecoratedColRendition(decoratedCol, alias)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
|-------------------------|---------------------|
| kind | name |
|-------------------------|---------------------|
| compute#acceleratorType | nvidia-tesla-t4-vws |
|-------------------------|---------------------|
| compute#acceleratorType | nvidia-tesla-t4 |
|-------------------------|---------------------|
| compute#acceleratorType | nvidia-tesla-p4-vws |
|-------------------------|---------------------|
| compute#acceleratorType | nvidia-tesla-p4 |
|-------------------------|---------------------|
|-------------------------|---------------------|-------------------------|
| kind | name | maximumCardsPerInstance |
|-------------------------|---------------------|-------------------------|
| compute#acceleratorType | nvidia-tesla-t4-vws | 4 |
|-------------------------|---------------------|-------------------------|
| compute#acceleratorType | nvidia-tesla-t4 | 4 |
|-------------------------|---------------------|-------------------------|
| compute#acceleratorType | nvidia-tesla-p4-vws | 4 |
|-------------------------|---------------------|-------------------------|
| compute#acceleratorType | nvidia-tesla-p4 | 4 |
|-------------------------|---------------------|-------------------------|
2 changes: 1 addition & 1 deletion test/robot/functional/stackql_sessions.robot
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ PG Session Server Survives Defective Query
[Teardown] NONE

PG Session Postgres Client V2 Typed Queries
Pass Execution If "${SQL_BACKEND}" == "postgres_tcp" TODO: FIX THIS... Skipping postgres backend test likely due to case sensitivity and incorrect XML property aliasing
Pass Execution If "${SQL_BACKEND}" == "postgres_tcp" TODO: FIX THIS... Skipping postgres backend test likely due to case sensitivity and incorrect XML property aliasing
Should PG Client V2 Session Inline Equal
... ${PSQL_MTLS_CONN_STR_UNIX}
... ${SELECT_AWS_CLOUD_CONTROL_EVENTS_MINIMAL}
Expand Down
2 changes: 1 addition & 1 deletion test/robot/lib/stackql_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def get_registry_cfg(url :str, local_root :str, nop_verify :bool) -> dict:

SELECT_CONTAINER_SUBNET_AGG_DESC = "select ipCidrRange, sum(5) cc from google.container.\"projects.aggregated.usableSubnetworks\" where projectsId = 'testing-project' group by ipCidrRange having sum(5) >= 5 order by ipCidrRange desc;"
SELECT_CONTAINER_SUBNET_AGG_ASC = "select ipCidrRange, sum(5) cc from google.container.\"projects.aggregated.usableSubnetworks\" where projectsId = 'testing-project' group by ipCidrRange having sum(5) >= 5 order by ipCidrRange asc;"
SELECT_ACCELERATOR_TYPES_DESC = "select kind, name from google.compute.acceleratorTypes where project = 'testing-project' and zone = 'australia-southeast1-a' order by name desc;"
SELECT_ACCELERATOR_TYPES_DESC = "select kind, name, maximumCardsPerInstance from google.compute.acceleratorTypes where project = 'testing-project' and zone = 'australia-southeast1-a' order by name desc;"
SELECT_ACCELERATOR_TYPES_DESC_FROM_INTEL_VIEWS = "select kind, name from stackql_intel.\"google.compute.acceleratorTypes\" where project = 'testing-project' and zone like '%%australia-southeast1-a' order by name desc;"
SELECT_ACCELERATOR_TYPES_DESC_FROM_INTEL_VIEWS_SUBQUERY = "SELECT name AS name, count(kind) AS \"COUNT(kind)\" FROM (SELECT * from stackql_intel.\"google.compute.acceleratorTypes\" limit 80) AS virtual_table GROUP BY name ORDER BY \"COUNT(kind)\" DESC LIMIT 1000;"
SELECT_MACHINE_TYPES_DESC = "select name from google.compute.machineTypes where project = 'testing-project' and zone = 'australia-southeast1-a' order by name desc;"
Expand Down