Unable to access table named "user"
Unable to access table named "user"
От:
Joe Kramer <cckramer@gmail.com>
Дата:
Hi, I have table named user (lower case) in public schema. I can access it using Pgadmin as SELECT * from "user"; SELECT * from "public.user"; SELECT * FROM public.user; I can't find any way to access this table from Jdbc. Tried to access as public.user, user in single and double quotes, nothing helps. I get exceptions like ERROR: relation "public.user" does not exist ERROR: relation "user" does not exist Also tried to execute "SET search_path TO public" beforehand in same jdbc connection, makes no difference. Is there any way? Thanks.
Re: Unable to access table named "user"
От:
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Дата:
Joe Kramer wrote: > Hi, > > I have table named user (lower case) in public schema. > I can access it using Pgadmin as > SELECT * from "user"; SELECT * from "public.user"; SELECT * FROM public.user; Odd, I would not expect the 2nd variant to work, unless you also have a table called "public.user", ie with a dot in the name. > I can't find any way to access this table from Jdbc. > Tried to access as public.user, user in single and double quotes, nothing helps. > I get exceptions like > ERROR: relation "public.user" does not exist > ERROR: relation "user" does not exist > > Also tried to execute "SET search_path TO public" beforehand in same > jdbc connection, makes no difference. > > Is there any way? These should all work: SELECT * FROM "user" SELECT * FROM public.user SELECT * FROM public."user" -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Re: Unable to access table named "user"
От:
dmp <danap@ttc-cmc.net>
Дата:
> Joe Kramer wrote:
>
>> Hi,
>>
>> I have table named user (lower case) in public schema.
>> I can access it using Pgadmin as
>> SELECT * from "user"; SELECT * from "public.user"; SELECT * FROM
>> public.user;
>
>
> Odd, I would not expect the 2nd variant to work, unless you also have
> a table called "public.user", ie with a dot in the name.
>
>> I can't find any way to access this table from Jdbc.
>> Tried to access as public.user, user in single and double quotes,
>> nothing helps.
>> I get exceptions like
>> ERROR: relation "public.user" does not exist
>> ERROR: relation "user" does not exist
>>
>> Also tried to execute "SET search_path TO public" beforehand in same
>> jdbc connection, makes no difference.
>>
>> Is there any way?
>
>
> These should all work:
> SELECT * FROM "user"
> SELECT * FROM public.user
> SELECT * FROM public."user"
>
> --
> Heikki Linnakangas
> EnterpriseDB http://www.enterprisedb.com
--
-- MyJSQLView SQL Dump
-- Version: 3.01
-- WebSite: http://myjsqlview.org
--
-- Host: 127.0.0.1
-- Generated On: 2009.05.12 AD at 07:09:47 MDT
-- SQL version: PostgreSQL 8.3.3
-- Database: key_tables
--
-- ------------------------------------------
--
-- Dumping data for table "public"."keY_tAble2"
--
LOCK TABLE "public"."keY_tAble2";
INSERT INTO "public"."keY_tAble2" ("Host", "Db", "Username",
"select_priv") VALUES ('cindy', 'sample', 'danap', 't');
danap.