Thread: Parser or documentation bug?

Parser or documentation bug?

From
Adriaan Joubert
Date:
Hi,

    I'm trying to define a new bit type with a length of two bytes, and to
define a set of operators on this type. I've hit the following problem:
I cannot define a | operator, as the parser doesn't like it.

tt=> drop operator | (Bit2,Bit2);
ERROR:  parser: parse error at or near "|"
tt=> create operator | (
  leftarg = Bit2,
  rightarg = Bit2,
  procedure = bit2or
);
ERROR:  parser: parse error at or near "|"

If I use || it works. So either the man page or the parser are at fault
here. I'm currently using the snapshot from last Friday. I can also do a
create by enclosing the | in double-quotes, as in "|", but I cannot use
it, and I cannot drop it.

Cheers,

Adriaan

MSysConf grief

From
Lincoln Spiteri
Date:
Hello,

I am trying to link to a Postgres table from MS Access using the insight ODBC
driver (6.40.0004). When I try to link I get the following error:

The servers MsysConf exists but is in an incorrect format.

This used to work before. Strangely enough this works with NT, same driver.

Any ideas,

Regards

Lincoln

--
------------------------------------------------------------------------------

Lincoln Spiteri

Manufacturing Systems
STMicroelectronics, Malta

e-mail: lincoln.spiteri@st.com

------------------------------------------------------------------------------

PL Problems.

From
Adriaan Joubert
Date:
I have my marvelous bit type working now, and now I find out I cannot
use it in PL scripts.

tt=> create table test (a int4, b bit2);
CREATE
tt=> CREATE FUNCTION mytrig () RETURNS opaque AS
'
tt-> '
tt'> DECLARE
tt'>   def_state CONSTANT BIT2 := 'b0001'::BIT2;
tt'> BEGIN
tt'>   new.b = def_state;
tt'>   RETURN new;
tt'> END;
tt'> ' LANGUAGE 'plpgsql';
ERROR:  parser: parse error at or near "b0001"
tt=>

I've tried all combinations I could think of, always with the same
result.

Is this a restriction in PL? I would have thought that the types are
simply looked up in the systems tables, or do I have to do something
else?

Any help greatly appreciated! Even if only to tell me that this doesn't
work in which case I can convert back to using integers.

Cheers,

Adriaan

Re: [GENERAL] PL Problems.

From
Adriaan Joubert
Date:
> tt=> create table test (a int4, b bit2);
> CREATE
> tt=> CREATE FUNCTION mytrig () RETURNS opaque AS
> '
> tt-> '
> tt'> DECLARE
> tt'>   def_state CONSTANT BIT2 := 'b0001'::BIT2;
> tt'> BEGIN
> tt'>   new.b = def_state;
> tt'>   RETURN new;
> tt'> END;
> tt'> ' LANGUAGE 'plpgsql';
> ERROR:  parser: parse error at or near "b0001"
> tt=>
>

Aaaah, Stupidity! I need double quotes around the strings, i.e.
''b0001''....

Sorry for the bandwith.

BTW, is their interest in having a 2 byte bit type as a contributed type
along the lines of int8? I could package it up, and post it. It supports
all the binary operations, i.e. & | ^ ~ << and >>. Only problem I would
like to resolve is why I cannot define the or operator as |.

Adriaan