[BUGS] BUG #5838: tables of the same name in different schemas

2011-01-14 Thread Tyler Kellen

The following bug has been logged online:

Bug reference:  5838
Logged by:  Tyler Kellen
Email address:  ty...@sleekcode.net
PostgreSQL version: 9.0.2
Operating system:   Win7 64
Description:tables of the same name in different schemas
Details: 

Given two objects of the same name in different schemas, when both schemas
are in the search_path, \d only shows the object from the first schema
listed.

Reproduction:
CREATE SCHEMA s1;
CREATE SCHEMA s2;
CREATE TABLE s1.test ( id int );
CREATE TABLE s2.test ( id int );
SET search_path TO s1,s2;
\d
SET search_path TO s2,s1;
\d

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5838: tables of the same name in different schemas

2011-01-14 Thread Heikki Linnakangas

On 14.01.2011 10:07, Tyler Kellen wrote:

Given two objects of the same name in different schemas, when both schemas
are in the search_path, \d only shows the object from the first schema
listed.

Reproduction:
CREATE SCHEMA s1;
CREATE SCHEMA s2;
CREATE TABLE s1.test ( id int );
CREATE TABLE s2.test ( id int );
SET search_path TO s1,s2;
\d
SET search_path TO s2,s1;
\d


That's intentional. \d lists the object that are currently visible in 
your search_path. The object in the schema that's later in search_path 
is being shadowed by the one in the first schema, so it's not visible.


--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5838: tables of the same name in different schemas

2011-01-14 Thread Tom Lane
Heikki Linnakangas  writes:
> On 14.01.2011 10:07, Tyler Kellen wrote:
>> Given two objects of the same name in different schemas, when both schemas
>> are in the search_path, \d only shows the object from the first schema
>> listed.

> That's intentional. \d lists the object that are currently visible in 
> your search_path. The object in the schema that's later in search_path 
> is being shadowed by the one in the first schema, so it's not visible.

You can use "\d *.*" if you want to see objects that are not visible
in the search path.

regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


[BUGS] BUG #5839: pgAdmin makes bad query for creating a table when default value specified

2011-01-14 Thread Aren Cambre

The following bug has been logged online:

Bug reference:  5839
Logged by:  Aren Cambre
Email address:  a...@arencambre.com
PostgreSQL version: 9.0.2
Operating system:   Windows 7 32 bit
Description:pgAdmin makes bad query for creating a table when
default value specified
Details: 

Using pgAdmin 1.12.2, I just tried to create a table with a character
varying(18) column. I put "none" (without the quotes) in the "Default value"
field for that column.

When I press OK to create the table, I get a dialog saying:
  An error has occurred:
  ERROR: column "none" does not exist

This is the SQL that's generated:

CREATE TABLE "raw"."TxDPS geocoding"
(
   "HA_Arrest_Key" character varying(18), 
   gid integer, 
   "whichToUse" character varying(20) NOT NULL DEFAULT none, 
PRIMARY KEY ("HA_Arrest_Key")
) 
WITH (
  OIDS = FALSE
)
;

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5839: pgAdmin makes bad query for creating a table when default value specified

2011-01-14 Thread Tom Lane
"Aren Cambre"  writes:
> Using pgAdmin 1.12.2, I just tried to create a table with a character
> varying(18) column. I put "none" (without the quotes) in the "Default value"
> field for that column.

> When I press OK to create the table, I get a dialog saying:
>   An error has occurred:
>   ERROR: column "none" does not exist

Well, yeah, that's what you'll get.  I don't see a bug here.
If you want the literal string 'none' as default, you should put quotes
around it.  If you don't want a default, you shouldn't put anything
there.

regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5839: pgAdmin makes bad query for creating a table when default value specified

2011-01-14 Thread Aren Cambre
This came from pgAdmin's *Default value* field. This field is supposed to
accept anything other than a string?

Aren

On Fri, Jan 14, 2011 at 9:51 PM, Tom Lane  wrote:

> "Aren Cambre"  writes:
> > Using pgAdmin 1.12.2, I just tried to create a table with a character
> > varying(18) column. I put "none" (without the quotes) in the "Default
> value"
> > field for that column.
>
> > When I press OK to create the table, I get a dialog saying:
> >   An error has occurred:
> >   ERROR: column "none" does not exist
>
> Well, yeah, that's what you'll get.  I don't see a bug here.
> If you want the literal string 'none' as default, you should put quotes
> around it.  If you don't want a default, you shouldn't put anything
> there.
>
>regards, tom lane
>


Re: [BUGS] BUG #5839: pgAdmin makes bad query for creating a table when default value specified

2011-01-14 Thread John R Pierce

On 01/14/11 8:12 PM, Aren Cambre wrote:
This came from pgAdmin's *Default value* field. This field is supposed 
to accept anything other than a string?


default value can be any valid expression



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #5839: pgAdmin makes bad query for creating a table when default value specified

2011-01-14 Thread Dave Page
On Sat, Jan 15, 2011 at 4:36 AM, John R Pierce  wrote:
> On 01/14/11 8:12 PM, Aren Cambre wrote:
>>
>> This came from pgAdmin's *Default value* field. This field is supposed to
>> accept anything other than a string?
>
> default value can be any valid expression

Exactly. pgAdmin doesn't have any way to know whether what you've
entered is a plain string or an expression of some kind, so it leaves
it to you to provide the quoting in this case.


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs