pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
What err ???
11+ messages / 7 participants
[nested] [flat]

* What err ???
@ 2002-06-06 20:43  Robson Martins <robson-martins@bol.com.br>
  0 siblings, 5 replies; 11+ messages in thread

From: Robson Martins @ 2002-06-06 20:43 UTC (permalink / raw)
  To: pgsql-admin

What err ???

SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'

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

* Re: What err ???
@ 2002-06-07 13:45  Joel Burton <joel@joelburton.com>
  parent: Robson Martins <robson-martins@bol.com.br>
  4 siblings, 0 replies; 11+ messages in thread

From: Joel Burton @ 2002-06-07 13:45 UTC (permalink / raw)
  To: Robson Martins <robson-martins@bol.com.br>; +Cc: pgsql-admin

On Thu, 6 Jun 2002, Robson Martins wrote:

> What err ???
>
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'

Messages like this are better sent to pgsql-general or pgsql-sql, by the
way.

Two problems:

. Strings are concatenated using ||, not +. 'Cat' || 'Dog' => 'CatDog',
whereas 'Cat' + 'Dog' => ASCII result of this (not what you want)

. IIf() is a nonstandard Microsoft function used in Access. SQL databases
use CASE. See the docs for examples on CASE.

- J.
-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant




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

* Re: What err ???
@ 2002-06-07 14:37  Ross J. Reedstrom <reedstrm@rice.edu>
  parent: Robson Martins <robson-martins@bol.com.br>
  4 siblings, 1 reply; 11+ messages in thread

From: Ross J. Reedstrom @ 2002-06-07 14:37 UTC (permalink / raw)
  To: pgsql-admin

On Thu, Jun 06, 2002 at 05:43:28PM -0300, Robson Martins wrote:
> What err ???
> 
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'

This looks like some other dialect of SQL, not SQL92 (nor PostGreSQL).

I _think_ you want something like:

SELECT RazaoSocial || ' - ' || COALESCE(Bairro || ' ', '') || CGCCli As
Coluna FROM Clientes WHERE RazaoSocial Like '%A%';

The differences are that the text concatenation operator is '||', not '+',
and COALESCE(), which returns it's first non-NULL parameter.

Note that this is _not_ an ADMIN question: it belongs on NOVICE.

Ross
-- 
Ross Reedstrom, Ph.D.                                 reedstrm@rice.edu
Executive Director                                  phone: 713-348-6166
Gulf Coast Consortium for Bioinformatics              fax: 713-348-6182
Rice University MS-39
Houston, TX 77005



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

* Re: What err ???
@ 2002-06-07 15:23  Masaru Sugawara <rk73@sea.plala.or.jp>
  parent: Robson Martins <robson-martins@bol.com.br>
  4 siblings, 0 replies; 11+ messages in thread

From: Masaru Sugawara @ 2002-06-07 15:23 UTC (permalink / raw)
  To: Robson Martins <robson-martins@bol.com.br>; +Cc: pgsql-admin


On Thu, 6 Jun 2002 17:43:28 -0300
"Robson Martins" <robson-martins@bol.com.br> wrote:

> What err ???
> 
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'
> 


Uh, there is no error in MS Access, but are two errors in PG: "+"and "iif()".
You need to use "||" and "CASE WHEN ... THEN ... END".  See docs. 
 

Regard,
Masaru Sugawara






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

* Re: What err ???
@ 2002-06-07 15:49  Nick Fankhauser <nickf@ontko.com>
  parent: Robson Martins <robson-martins@bol.com.br>
  4 siblings, 1 reply; 11+ messages in thread

From: Nick Fankhauser @ 2002-06-07 15:49 UTC (permalink / raw)
  To: Robson Martins <robson-martins@bol.com.br>; pgsql-admin

Try:

SELECT RazaoSocial || ' - ' || coalesce(Bairro || ' ','') || CGCCli As
Coluna FROM Clientes WHERE RazaoSocial Like '%A%';


>SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli
As Coluna FROM
>Clientes WHERE RazaoSocial Like '%A%'


Regards,

Nick


--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/




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

* Re: What err ???
@ 2002-06-07 16:02  Oliver Elphick <olly@lfix.co.uk>
  parent: Robson Martins <robson-martins@bol.com.br>
  4 siblings, 0 replies; 11+ messages in thread

From: Oliver Elphick @ 2002-06-07 16:02 UTC (permalink / raw)
  To: Robson Martins <robson-martins@bol.com.br>; +Cc: pgsql-admin

On Thu, 2002-06-06 at 21:43, Robson Martins wrote:
> What err ???
> 
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You should probably be using COALESCE() here.

The string concatenation operator is not + but ||

All those capital letters will be folded to lower-case.  If you have
actually created things in the database whose names contain capitals,
you will need to enclose those names in double-quotes.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "There is a way that seems right to a man, but in the 
      end it leads to death."       
                                        Proverbs 16:25 

Attachments:

  signature.asc (application/pgp-signature, 188B) download

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

* Re: What err ???
@ 2002-06-07 17:13  Tim Ellis <Tim.Ellis@gamet.com>
  parent: Ross J. Reedstrom <reedstrm@rice.edu>
  0 siblings, 1 reply; 11+ messages in thread

From: Tim Ellis @ 2002-06-07 17:13 UTC (permalink / raw)
  To: Ross J. Reedstrom <reedstrm@rice.edu>; +Cc: pgsql-admin

On Fri, 7 Jun 2002 09:37:08 -0500
"Ross J. Reedstrom" <reedstrm@rice.edu> wrote:

> > SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') +
> > CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'
> 
> This looks like some other dialect of SQL, not SQL92 (nor PostGreSQL).
 . . .
> Note that this is _not_ an ADMIN question: it belongs on NOVICE.

I have a Postgres admin question.

I have a large number of accounting and marketing users that feel Access
is a perfectly legitimate database for them to set up, populate with data
(and nasty wierd queries), then hand over to me to administer (complaining
that it doesn't run fast is usually a first symptom).

I feel "format c:" is a perfectly good response to this scenario.

Now I'm relegated to a corner of the copy room, and my personal
workstation is a Mac Classic which, BTW, I can't get Postgres to compile
on.

Is there some indexing strategy or backup regimen I could implement that
would make all this better?

--
Tim Ellis
DBA, Gamet



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

* Re: What err ???
@ 2002-06-07 18:03  Robson Martins <robson-martins@bol.com.br>
  parent: Nick Fankhauser <nickf@ontko.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Robson Martins @ 2002-06-07 18:03 UTC (permalink / raw)
  To: nickf@ontko.com; pgsql-admin

Ok, Nick.Masaru,Joel.

Very Thanks! Nick.
It helped sufficiently. :-)


Brasil vai ganhar a Copa do Mundo!

Robson Martins
From Brazil

----- Original Message -----
From: "Nick Fankhauser" <nickf@ontko.com>
To: "Robson Martins" <robson-martins@bol.com.br>;
<pgsql-admin@postgresql.org>
Sent: Friday, June 07, 2002 12:49 PM
Subject: RE: [ADMIN] What err ???


> Try:
>
> SELECT RazaoSocial || ' - ' || coalesce(Bairro || ' ','') || CGCCli As
> Coluna FROM Clientes WHERE RazaoSocial Like '%A%';
>
>
> >SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli
> As Coluna FROM
> >Clientes WHERE RazaoSocial Like '%A%'
>
>
> Regards,
>
> Nick
>
>
> --------------------------------------------------------------------------
> Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
> Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/
>
>




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

* Re: What err ???
@ 2002-06-07 21:44  Nick Fankhauser <nickf@ontko.com>
  parent: Tim Ellis <Tim.Ellis@gamet.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Nick Fankhauser @ 2002-06-07 21:44 UTC (permalink / raw)
  To: Tim Ellis <Tim.Ellis@gamet.com>; Ross J. Reedstrom <reedstrm@rice.edu>; +Cc: pgsql-admin


> I have a Postgres admin question.
...
> Is there some indexing strategy or backup regimen I could implement that
> would make all this better?

Tim-

I don't understand the question- are you asking how to make databases
created in access run better on postgresql, or how to move them to
postgresql, or simply how to make the run better in access?

Maybe if you restated the question you'd get some better responses.

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/




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

* Re: What err ???
@ 2002-06-07 23:40  Tim Ellis <Tim.Ellis@gamet.com>
  parent: Nick Fankhauser <nickf@ontko.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Tim Ellis @ 2002-06-07 23:40 UTC (permalink / raw)
  To: nickf@ontko.com; +Cc: reedstrm@rice.edu; pgsql-admin

On Fri, 7 Jun 2002 16:44:16 -0500
"Nick Fankhauser" <nickf@ontko.com> wrote:

> > Is there some indexing strategy or backup regimen I could implement
> > that would make all this better?
>
> I don't understand the question- are you asking how to make databases
> created in access run better on postgresql, or how to move them to
> postgresql, or simply how to make the run better in access?
> 
> Maybe if you restated the question you'd get some better responses.

Sure! No problem.

When boiled down to its essence, my problem is that I have users with
conflicting requirements (runs fast, is stable, and is a Microsoft-written
database).

It drives me nuts, so I want to just format their C: drive and migrate
their data & tables to Postgres (or Oracle or Sybase, it really doesn't
matter -- could be SOLID for all I care).

But I have a very low threshold of ability to communicate with these
users, so I just format their C: drive. Then my bosses put me on a Mac
Classic workstation. And gosh, Postgres doesn't compile on Mac Classic.

Since I'm a Database Administrator, and I like to solve problems by
analysing indexing strategies and modifying backup regimens, I was hoping
there was some technical solution to this very personal administration
problem (ie: users drive me nuts, I delete their data, my bosses relegate
me to the back corner of the copy room).

Okay. I'll fess up. I found it humorous that someone should ask a
question that amounted to: "I copied SQL directly from a Microsoft product
into a non-Microsoft product, and I'm surprised it didn't work." Thus, I
attempted (perhaps more poorly than necessary) to humorously ask another
completely off-base question that alluded to a common administrator's
problem: inability to communicate with users.

It was truly an administrative question, but presented possible technical
solutions that are entirely inappropriate to solve the problem.

Give me a break. It's a slow day. There are only 7 people left in the
office. :)

--
Tim Ellis
DBA, Gamet



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

* Re: What err ???
@ 2002-06-10 14:34  Nick Fankhauser <nickf@ontko.com>
  parent: Tim Ellis <Tim.Ellis@gamet.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Nick Fankhauser @ 2002-06-10 14:34 UTC (permalink / raw)
  To: Tim Ellis <Tim.Ellis@gamet.com>; +Cc: reedstrm@rice.edu; pgsql-admin

> Okay. I'll fess up.

Ok... it was Friday, I was a little slow. It's Monday now... I'm still a
little slow, but I get it now! (chuckle.)

In all seriousness, I usually give people the benefit of the doubt on some
of the weird questions because we have many users who don't use English as
their primary language, and an appropriate question often seems off the wall
in translation.

I also figure that as a recent "newbie" it is my responsibility to field
some of these obvious newbie questions so the serious postgresql gurus can
focus on the more challenging issues. (Like my silly questions!)

-Nick <grinning>

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/




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


end of thread, other threads:[~2002-06-10 14:34 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-06 20:43 What err ??? Robson Martins <robson-martins@bol.com.br>
2002-06-07 13:45 ` Joel Burton <joel@joelburton.com>
2002-06-07 14:37 ` Ross J. Reedstrom <reedstrm@rice.edu>
2002-06-07 17:13   ` Tim Ellis <Tim.Ellis@gamet.com>
2002-06-07 21:44     ` Nick Fankhauser <nickf@ontko.com>
2002-06-07 23:40       ` Tim Ellis <Tim.Ellis@gamet.com>
2002-06-10 14:34         ` Nick Fankhauser <nickf@ontko.com>
2002-06-07 15:23 ` Masaru Sugawara <rk73@sea.plala.or.jp>
2002-06-07 15:49 ` Nick Fankhauser <nickf@ontko.com>
2002-06-07 18:03   ` Robson Martins <robson-martins@bol.com.br>
2002-06-07 16:02 ` Oliver Elphick <olly@lfix.co.uk>

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