Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • If you don't want trailing spaces why are you using character(n) in the first place? 15 is the field length if you choose character. If that's not what you want, use varchar like everyone else. Commented Feb 5 at 23:05
  • I second Richard's comment, character is a red flag. You almost always want text. See postgresql.org/docs/current/datatype-character.html Commented Feb 5 at 23:25
  • 1
    This question is similar to: Why am I getting a an error when creating a generated column in PostgreSQL?. Specifically he mentions making an immutable version of concat. Or don't use char. If you really need the padding, pad it yourself. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Feb 5 at 23:34
  • @Schwern But if I use pad, I have to specify the length. I would like to find a solution without explicitly specifying the length. What other data type should I try? Commented Feb 6 at 6:09
  • @Schwern And thank you for the link. Now I'm examining the essence of that question. There is probably a similar problem. Commented Feb 6 at 6:34