public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Cannot drop column
5+ messages / 4 participants
[nested] [flat]

* Re: Cannot drop column
@ 2024-12-18 18:51  Viral Shah <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Viral Shah @ 2024-12-18 18:51 UTC (permalink / raw)
  To: Rich Shepard <[email protected]>; +Cc: pgsql-general

Since your column name has an Upper case character, you will have to use
double quotes to drop it. Try alter table statustypes drop column "Suspect";

Thanks,
Viral



On Wed, Dec 18, 2024 at 1:47 PM Rich Shepard <[email protected]>
wrote:

> I'm not seeing why postgres won't drop a table's column:
>
> bustrac=# select * from statustypes order by stat_name;
>       stat_name
> --------------------
>   Client
>   Lead
>   No further contact
>   Opportunity
>   Proposal submitted
>   Prospect
>   Qualified
>   Referral
>   Suspect
> (9 rows)
>
> bustrac=# alter table statustypes drop column Suspect;
> ERROR:  column "suspect" of relation "statustypes" does not exist
> bustrac=#
>
> What have I done incorrectly?
>
> TIA,
>
> Rich
>
>
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Cannot drop column
@ 2024-12-18 19:04  Rich Shepard <[email protected]>
  parent: Viral Shah <[email protected]>
  0 siblings, 2 replies; 5+ messages in thread

From: Rich Shepard @ 2024-12-18 19:04 UTC (permalink / raw)
  To: pgsql-general

On Wed, 18 Dec 2024, Viral Shah wrote:

> Since your column name has an Upper case character, you will have to use
> double quotes to drop it. Try alter table statustypes drop column "Suspect";

Viral,

Huh! I've not before encountered this in the 30+ years I've used postgres.

Thanks for the lesson.

Regards,

Rich






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Cannot drop column
@ 2024-12-18 19:09  Rich Shepard <[email protected]>
  parent: Rich Shepard <[email protected]>
  1 sibling, 1 reply; 5+ messages in thread

From: Rich Shepard @ 2024-12-18 19:09 UTC (permalink / raw)
  To: pgsql-general

On Wed, 18 Dec 2024, Rich Shepard wrote:

>> Since your column name has an Upper case character, you will have to use
>> double quotes to drop it. Try alter table statustypes drop column
>> "Suspect";

> Thanks for the lesson.

But,

bustrac=# alter table statustypes drop column "Suspect"; 
ERROR:  column "Suspect" of relation "statustypes" does not exist
bustrac=#

Double quoting didn't resolve the issue.

Rich






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Cannot drop column
@ 2024-12-18 19:09  David G. Johnston <[email protected]>
  parent: Rich Shepard <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2024-12-18 19:09 UTC (permalink / raw)
  To: Rich Shepard <[email protected]>; +Cc: pgsql-general

On Wednesday, December 18, 2024, Rich Shepard <[email protected]>
wrote:

> On Wed, 18 Dec 2024, Rich Shepard wrote:
>
> Since your column name has an Upper case character, you will have to use
>>> double quotes to drop it. Try alter table statustypes drop column
>>> "Suspect";
>>>
>>
> Thanks for the lesson.
>>
>
> But,
>
> bustrac=# alter table statustypes drop column "Suspect"; ERROR:  column
> "Suspect" of relation "statustypes" does not exist
> bustrac=#
>
> Double quoting didn't resolve the issue.
>

Red Ron’s email…

David J.


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Cannot drop column
@ 2024-12-18 21:34  Adrian Klaver <[email protected]>
  parent: Rich Shepard <[email protected]>
  1 sibling, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2024-12-18 21:34 UTC (permalink / raw)
  To: Rich Shepard <[email protected]>; pgsql-general



On 12/18/24 11:04 AM, Rich Shepard wrote:
> On Wed, 18 Dec 2024, Viral Shah wrote:
> 
>> Since your column name has an Upper case character, you will have to use
>> double quotes to drop it. Try alter table statustypes drop column 
>> "Suspect";
> 
> Viral,
> 
> Huh! I've not before encountered this in the 30+ years I've used postgres.

It has been that way for a long time:

https://www.postgresql.org/docs/7.0/syntax525.htm

Your issue though is as Ron pointed out:

alter table statustypes drop column Suspect

That is trying to drop a column named "Suspect" when in fact the column 
name is stat_name. 'Suspect' is a value in the column.

> 
> Thanks for the lesson.
> 
> Regards,
> 
> Rich
> 
> 

-- 
Adrian Klaver
[email protected]






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2024-12-18 21:34 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-18 18:51 Re: Cannot drop column Viral Shah <[email protected]>
2024-12-18 19:04 ` Rich Shepard <[email protected]>
2024-12-18 19:09   ` Rich Shepard <[email protected]>
2024-12-18 19:09     ` David G. Johnston <[email protected]>
2024-12-18 21:34   ` Adrian Klaver <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox