Giter VIP home page Giter VIP logo

Comments (4)

go-jet avatar go-jet commented on September 15, 2024

Hi @otto-nordander-yubico, I don't think we can do much in jet regarding this limit. Identifier length limit is purely postgres config. And according to google, you can either recompile "compile the PostgreSQL software from source and increase that limit" or "use shorter names". Since the database returns just a NOTICE, we can't report an error. Error is being silenced in db.

from jet.

otto-nordander-yubico avatar otto-nordander-yubico commented on September 15, 2024

Hi @otto-nordander-yubico, I don't think we can do much in jet regarding this limit. Identifier length limit is purely postgres config. And according to google, you can either recompile "compile the PostgreSQL software from source and increase that limit" or "use shorter names". Since the database returns just a NOTICE, we can't report an error. Error is being silenced in db.

I see, I didn't know that it was configurable. It seems that the default is 63 characters, would it be possible to make it configurable in Jet as well so that it would truncate too?
Or perhaps you don't want to add such DB specific configuration.

from jet.

go-jet avatar go-jet commented on September 15, 2024

Identifier length limit is postgres compile time config. Meaning to change the config you need to download postgres source code, change the config and compile postgres your self. This obviously is not a recommended approach.

IMO you can either make you database identifiers smaller or you can re-alias every column manually:

stmt := SELECT(
	tables.ThisIsAnAwkwardlyLongTableName.ThisIsAVeryLongIdentifier.AS("short_table_name.short_ident"),
).FROM(tables.ThisIsAnAwkwardlyLongTableName)

type ShortTableName struct {
	ShortIdent int
}

var dest ShortTableName

err := stmt.Query(db, &dest)

from jet.

otto-nordander-yubico avatar otto-nordander-yubico commented on September 15, 2024

Identifier length limit is postgres compile time config. Meaning to change the config you need to download postgres source code, change the config and compile postgres your self. This obviously is not a recommended approach.

IMO you can either make you database identifiers smaller or you can re-alias every column manually:

stmt := SELECT(
	tables.ThisIsAnAwkwardlyLongTableName.ThisIsAVeryLongIdentifier.AS("short_table_name.short_ident"),
).FROM(tables.ThisIsAnAwkwardlyLongTableName)

type ShortTableName struct {
	ShortIdent int
}

var dest ShortTableName

err := stmt.Query(db, &dest)

Yeah that's very cumbersome and not feasible for me.
I'll look into trying to scan for such occurrences on our end instead.
Thanks for the swift responses, I guess we can close this now.

from jet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.