pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Sidney-Woollett <johnsw@wardbrook.com>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Ericson Smith <eric@did-it.com>
Cc: pgsql-general@postgresql . org <pgsql-general@postgresql.org>
Subject: Re: Is my MySQL Gaining ?
Date: Mon, 29 Dec 2003 23:41:22 -0000 (GMT)
Message-ID: <4329.192.168.0.64.1072741282.squirrel@mercury.wardbrook.com> (raw)
In-Reply-To: <20031229213912.GD19279@wolff.to>
References: <20031229151814.46230.qmail@web20801.mail.yahoo.com>
	<1072714860.1687.121.camel@localhost.localdomain>
	<1072728193.3ff0888143061@webmail.vcsn.com>
	<1072729267.1687.136.camel@localhost.localdomain>
	<3FF093B4.2040904@did-it.com>
	<20031229210938.GB19279@wolff.to>
	<3FF09A2E.8010904@did-it.com>
	<3FF09C96.4050901@did-it.com>
	<20031229213912.GD19279@wolff.to>

Actually, sometimes these questions will be postgres specific, and this is
where the docs are too light.

An example is an update statement using values from a correlated subquery.
Here's example code in pgsql:

  update PHOTO.WPImage
  set WPImageStateID = 3,
  Width = WPImageHeader.Width,
  Height = WPImageHeader.Height,
  ContentType = WPImageHeader.ContentType,
  ContentLength = WPImageHeader.ContentLength
  where WPImage.WDResourceID = WPImageHeader.WDResourceID
  and WPImage.WDResourceID = pResourceID
  and WPImage.WPSizeTypeID = 0;

In Oracle this might be written:

  update PHOTO.WPImage i
  set WPImageStateID = 3,
  (Width, Height, ContentType, ContentLength) = (
    select Width, Height, ContentType, ContentLength
    from PHOTO.WPImageHeader ih
    where ih.WDResourceID = i.WDResourceID)
  where WPImage.WDResourceID = pResourceID
  and WPImage.WPSizeTypeID = 0;

You'll notice that the syntax is entirely different, and very relevant for
inclusion in the docs for each database's update statement.

I've mentioned it before but here it is again, contrast this explanation
of the UPDATE command in postgres with Oracle's explanation. Which one
would explain how to make use of a correlated subquery without resorting
to more googling or the list?

postgres: http://www.postgres.org/docs/current/interactive/sql-update.html

Oracle: http://miami.int.gu.edu.au/dbs/7016/a85397/state27a.htm#2067717

My point is not so much that the docs are difficult for newbies (and they
probably are), but that they just lack sufficient meat which really ought
to be included.

John Sidney-Woollett

Bruno Wolff III said:
> On Mon, Dec 29, 2003 at 16:28:54 -0500,
>   Ericson Smith <eric@did-it.com> wrote:
>> As far as the documentation goes, you know that its bad when you have to
>> lookup SQL examples on the MySQL site  to use with Postgresql. I'm no
>> SQL (never read fully my "SQL for Smarties" book) guru, so every little
>> bit helps. If we have a great (not just good, or adequate) documentation
>> site, then the uptake will be better. So why not let pool some funds
>> from members of the list and get some professional help? My wallet is
>> open and ready.
>
> That kind of question will generally not be postgres specific (unless
> you are asking about syntax which is compactly described for each
> SQL command). It might be better to provide references to web sites
> that provide general information about SQL (if there are any good ones),
> rather than to spend a lot of resources trying to teach people generic
> stuff about SQL and RDBMS.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>




view thread (188+ messages)  latest in thread

Message-ID: <4329.192.168.0.64.1072741282.squirrel@mercury.wardbrook.com>
Permalink:  ../4329.192.168.0.64.1072741282.squirrel@mercury.wardbrook.com/
Also on:    postgresql.org/message-id/4329.192.168.0.64.1072741282.squirrel@mercury.wardbrook.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: johnsw@wardbrook.com, bruno@wolff.to, eric@did-it.com
  Subject: Re: Is my MySQL Gaining ?
  In-Reply-To: <4329.192.168.0.64.1072741282.squirrel@mercury.wardbrook.com>
  References: <20031229151814.46230.qmail@web20801.mail.yahoo.com> <1072714860.1687.121.camel@localhost.localdomain> <1072728193.3ff0888143061@webmail.vcsn.com> <1072729267.1687.136.camel@localhost.localdomain> <3FF093B4.2040904@did-it.com> <20031229210938.GB19279@wolff.to> <3FF09A2E.8010904@did-it.com> <3FF09C96.4050901@did-it.com> <20031229213912.GD19279@wolff.to> <4329.192.168.0.64.1072741282.squirrel@mercury.wardbrook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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