Thread: About OID and the commands/operators STRING( ... ) ..AS and +

About OID and the commands/operators STRING( ... ) ..AS and +

From
"Jarmo Paavilainen"
Date:
Hi,

I suspect that OID are reused, but how fast are they reused?

And does PostgreSQL support the STRING and AS command?

What I want to do is:

SELECT STRING( "IntegerKeyColumn" ) + STRING( "StringKeyColumn" ) +
TRING( "DoubleKeyColumn" ) AS STROID FROM "MyTable"

...and I want to be able to:

SELECT IntegerKeyColumn FROM "MyTable" WHERE
    STRING( "IntegerKeyColumn" ) + STRING( "StringKeyColumn" ) +
TRING( "DoubleKeyColumn" ) = [the result from previous select]

I would try it myself, but my PostgreSQL installation stopped working
(actually the whole computer is shutdown).

// Jarmo


Re: About OID and the commands/operators STRING( ... ) ..AS and +

From
Stephan Szabo
Date:
On Sat, 23 Sep 2000, Jarmo Paavilainen wrote:

> Hi,
>
> I suspect that OID are reused, but how fast are they reused?

IIRC, they are not reused at all.

> And does PostgreSQL support the STRING and AS command?

What does STRING do?  I don't see a function with that name, but
it's possible we have it with a different name.
If it's just cast value to a string, then use text(field) or
field::text.



About OID and the commands/operators STRING( ... )..AS and +

From
"Jarmo Paavilainen"
Date:
...
> > I suspect that OID are reused, but how fast are they reused?
>
> IIRC, they are not reused at all.

Not even if a row is deleted?
Wont PostgreSQL run out of OID after a while (maybe long time, but anyway).

...
> > And does PostgreSQL support the STRING and AS command?
...
> What does STRING do?  I don't see a function with that name, but
> it's possible we have it with a different name.
> If it's just cast value to a string, then use text(field) or

Cast to string... Exactly what I was looking for, thanx. (Maybe STRING(...)
is Sybase stuff).

// Jarmo


Re: About OID and the commands/operators STRING( ... )..AS and +

From
Stephan Szabo
Date:
On Sat, 23 Sep 2000, Jarmo Paavilainen wrote:

>
> ...
> > > I suspect that OID are reused, but how fast are they reused?
> >
> > IIRC, they are not reused at all.
>
> Not even if a row is deleted?
> Wont PostgreSQL run out of OID after a while (maybe long time, but anyway).

Theoretically yes.  I think they will theoretically rollover, but
it's not going to fill holes, it'll attempt reuse (except oid=0 i think)

> ...
> > > And does PostgreSQL support the STRING and AS command?
> ...
> > What does STRING do?  I don't see a function with that name, but
> > it's possible we have it with a different name.
> > If it's just cast value to a string, then use text(field) or
>
> Cast to string... Exactly what I was looking for, thanx. (Maybe STRING(...)
> is Sybase stuff).

You'll also need to coalesce to handle nulls (unless nulls are not
allowed), and that construct could be dangerous,
(int, string, numeric) being (1, '2', '1.0') vs (12, '', '1.0')