pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Shortcut?
3+ messages / 3 participants
[nested] [flat]

* Shortcut?
@ 2001-05-30 00:05 Phuong Ma <pma@commandprompt.com>
  2001-05-30 01:19 ` Re: Shortcut? D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Phuong Ma @ 2001-05-30 00:05 UTC (permalink / raw)
  To: pgsql-sql

I'm running Postgres 7.1.  I read in the documentation that the from
clause can be omitted from a select statement.  The example given in the
documentation is:
SELECT distributors.* WHERE name = 'Westwood';

I tried it on tables in our database, but it doesn't work.  Is that part
of earlier versions of Postgres?

Thanks



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

* Re: Shortcut?
  2001-05-30 00:05 Shortcut? Phuong Ma <pma@commandprompt.com>
@ 2001-05-30 01:19 ` D'Arcy J.M. Cain <darcy@druid.net>
  2001-05-30 04:21   ` Re: Shortcut? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: darcy@druid.net @ 2001-05-30 01:19 UTC (permalink / raw)
  To: Phuong Ma <pma@commandprompt.com>; +Cc: pgsql-sql

Thus spake Phuong Ma
> I'm running Postgres 7.1.  I read in the documentation that the from
> clause can be omitted from a select statement.  The example given in the
> documentation is:
> SELECT distributors.* WHERE name = 'Westwood';
> 
> I tried it on tables in our database, but it doesn't work.  Is that part
> of earlier versions of Postgres?

I assume you mean this.

  SELECT distributors.* WHERE distributors.name = 'Westwood';

I know that this example from my own database works.

devel=# SELECT country.country_name
devel-#     WHERE country.country_id = province.country_id AND
devel-#         province.prov = 'ON';
 country_name 
--------------
 Canada
(1 row)

Can you tell me where you found that example.  I couldn't find it in the
documentation sources.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



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

* Re: Shortcut?
  2001-05-30 00:05 Shortcut? Phuong Ma <pma@commandprompt.com>
  2001-05-30 01:19 ` Re: Shortcut? D'Arcy J.M. Cain <darcy@druid.net>
@ 2001-05-30 04:21   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2001-05-30 04:21 UTC (permalink / raw)
  To: darcy@druid.net; +Cc: Phuong Ma <pma@commandprompt.com>; pgsql-sql

darcy@druid.net (D'Arcy J.M. Cain) writes:
> Thus spake Phuong Ma
>> SELECT distributors.* WHERE name = 'Westwood';
>> I tried it on tables in our database, but it doesn't work.  Is that part
>> of earlier versions of Postgres?

> I assume you mean this.
>   SELECT distributors.* WHERE distributors.name = 'Westwood';

Yes: you must mention a table in FROM to make its field names available
for reference without qualification.  I think we may have tightened that
in recent releases --- the current political climate is to discourage
use of tables without FROM, since SQL92 doesn't allow it at all.

> Can you tell me where you found that example.  I couldn't find it in the
> documentation sources.

A quick glimpse shows that we still have it in ref/select.sgml (try
'Westward' instead of 'Westwood').  Will fix.

			regards, tom lane



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


end of thread, other threads:[~2001-05-30 04:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-30 00:05 Shortcut? Phuong Ma <pma@commandprompt.com>
2001-05-30 01:19 ` D'Arcy J.M. Cain <darcy@druid.net>
2001-05-30 04:21   ` Tom Lane <tgl@sss.pgh.pa.us>

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