auxten/postgresql-parser
auxten/postgresql-parser has 317 GitHub stars and 62 forks. Star changes are not measured yet. Last checked 2026-11-11 00:23 UTC. Last push 2026-05-30.
Pure Golang PostgreSQL (SQL:2011, SQL:2008, SQL:2003, SQL:1999, and SQL-92 Standard) Parser
What you can do
- Pure golang implementation
- Almost full support of PostgreSQL (cockroachdb style PostgreSQL)
- For SQL lineage analysis see go-sql-lineage
Crecimiento de estrellas medido
- in 24h
- Actualización retrasada
- in 7 days
- Recopilando historial
- in 15 days
- Recopilando historial
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
OriginalWhat's this
PostgreSQL style Parser splitted from CockroachDB
See: Complex SQL format example
I tried to import github.com/cockroachdb/cockroach/pkg/sql/parser, but the dependencies is too complex to make it work.
To make things easy, I did these things:
- Copy all the
pkg/sql/parser,pkg/sql/lexand simplify the dependencies - Simplify the Makefile to just generate the goyacc stuff
- Add the goyacc generated files in parser and lex to make
go getwork easily, see the.gitignorefiles - Trim the
etcddependency, see thego.mod - Rename all test file except some
pkg/sql/parsertests - Add all necessary imports to vendor
- Remove the
panicof meeting unregistried functions, see the WrapFunction - Other nasty things make the parser just work that I forgot :p
Who is using this
Features
- Pure golang implementation
- Almost full support of PostgreSQL (
cockroachdbstyle PostgreSQL) - For SQL lineage analysis see go-sql-lineage
SQL Standard Compliance
The code is derived from CockroachDB v20.1.11 which supports most of the major features of SQL:2011. See:
How to use
package main
import (
"log"
"github.com/auxten/postgresql-parser/pkg/sql/parser"
"github.com/auxten/postgresql-parser/pkg/walk"
)
func main() {
sql := `select marr
from (select marr_stat_cd AS marr, label AS l
from root_loan_mock_v4
order by root_loan_mock_v4.age desc, l desc
limit 5) as v4
LIMIT 1;`
w := &walk.AstWalker{
Fn: func(ctx interface{}, node interface{}) (stop bool) {
log.Printf("node type %T", node)
return false
},
}
stmts, err := parser.Parse(sql)
if err != nil {
return
}
_, _ = w.Walk(stmts, nil)
return
}
SQL parser
This project contains code that is automatically generated using goyacc.
goyacc reads the SQL expressions (sql.y) and generates a parser which could be used to tokenize a given input.
You could update the generated code using the generate target inside the project's Makefile.
$ make generate
Progress
- 2021-02-16
github.com/auxten/postgresql-parser/pkg/sql/parserUnit tests works now! - 2021-03-08 Add walker package.
- 2022-08-03 Remove vendored dependencies by @mostafa in https://github.com/auxten/postgresql-parser/pull/19
Todo
- Fix more unit tests
- Make built-in function parsing work
Explorar proyectos relacionados
Asabeneh/30-Days-Of-Python
El reto de programación 30 Days of Python es una guía paso a paso para aprender el lenguaje de programación Python en 30 días. Este reto puede llevar más de 100 días. Sigue tu propio ritmo. Estos vídeos también pueden ayudarte: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,560 estrellasgrafana/grafana
Plataforma abierta y componible de observabilidad y visualización de datos. Visualiza métricas, registros y trazas de múltiples fuentes, como Prometheus, Loki, Elasticsearch, InfluxDB, Postgres y muchas más.
77,830 estrellasredis/redis
Para los desarrolladores que crean aplicaciones en tiempo real basadas en datos, Redis es la opción preferida, la más rápida y la de más funciones como caché, servidor de estructuras de datos y motor de consultas de documentos y vectores.
77,395 estrellasapache/superset
Apache Superset es una plataforma de visualización y exploración de datos.
75,473 estrellas