0

When I create my function in postgres and call it something like getOrder it works just fine. However, when I then do a pg_dump, it dumps it as getorder, thus not preserving the case. That makes everything break if I have to do a restore.

I found I could get it to keep the case if I quote it, like: CREATE FUNCTION "getOrder"()...

but then whenever I call it, I have to actually call it with the quotes, which makes that a pain for things like PHP.

Is there a way to simply tell postgres to leave the case of the method names alone? I know I can solve by calling it something like get_order, but I'd prefer to keep the casing the way I created the function.

Gargoyle
  • 9,590
  • 16
  • 80
  • 145
  • Once dumped as `getorder` you can still do `select getOrder()` and it works. So what do you mean by _that makes everything break_? The common perception is that it doesn't matter. Only when using quotes does it matter but you're making clear that you already know that and don't use them. – Daniel Vérité Sep 04 '13 at 20:22
  • No, it doesn't. If I restore the DB from that dump file, getOrder() doesn't work any longer. – Gargoyle Sep 05 '13 at 19:43
  • If it was true, it would be a flaw in pg_dump, since its purpose is that after restore the db behaves as before. Such an obvious conceptual flaw in pg_dump would be widely known, and it isn't. This theory doesn't pass the sniff test, and you still didn't tell what error you get. – Daniel Vérité Sep 05 '13 at 20:48

1 Answers1

1

No, there is no option to do that. It would break expected behavior badly.

My standing advice is to use legal, lower-case names exclusively and never have to worry about this issue. Be sure to read the chapter about Identifiers and Key Words in the manual.

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228