2

I have an issue with psql. I am trying to select the records from a table but psql acts like the table doesnt exist. I have tried finding it and found that it resides in the 'public' schema. I have tried selecting from this table like so:

highways=# SELECT * FROM public.CLUSTER_128000M;

This does not work stating the following:

ERROR: relation 'public.CLUSTER_128000M' does not exist

I know that it definetly exists and that it is definetly in the 'public' schema so how can I perform a select statement on it?

Edit:

This was caused by useing FME to create my tables. As a result FME used " marks on the table names making them case sensitive. To reverse this see the comments below.

7
  • 2
    Did you maybe forget the double quotes around "CLUSTER_128000M" ?
    – sega_sai
    Mar 22, 2012 at 17:02
  • Yes I did. facepalm The examples I have seen did not stipulate double quotes so I did not know it needed them. If you put that as an answer I will accept. Thanks.
    – CSharpened
    Mar 22, 2012 at 17:03
  • 3
    This behaviour is caused by the fact that you created the table using double quotes. Therefor the name is now case-sensitive and you need to use them always. If you avoid using double quotes completely then you'll never run into this issue again.
    – user330315
    Mar 22, 2012 at 17:05
  • Is there any way to rectify this afterwards? The tables were created by FME.
    – CSharpened
    Mar 22, 2012 at 17:08
  • 2
    SQL command to convert to case-insensitive: ALTER TABLE "SOME_NAME" RENAME TO some_name Mar 23, 2012 at 2:53

1 Answer 1

1

This issue was caused by the third party software FME using quotes around the names of the tables at time of creation. The solution to make the tables useable again was to use the following command:

ALTER TABLE "SOME_NAME" RENAME TO some_name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.