"AS" by the syntax of table reference.(8.4 proposal)

From: "Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: "AS" by the syntax of table reference.(8.4 proposal)
Date: 2008-02-08 17:20:16
Message-ID: 02ec01c86a76$df952d80$0301a8c0@HP22720319231
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all.

I thinks to the option of "AS" by the syntax of table reference.
The problem on structure had restricted it until now. Then,
conversion was required of this by the degree of migration from
other DBMS's. It was irritated a little.
I understood that it was an option in SQL2003 and SQL99.

--
<SQL2003> 7.6 <table reference> (p303)
<table or query name> [ [ AS ] <correlation name>
--

I propose this. However, postfix operators is troublesome.
Therefore, This is the inclusion with restriction.
I think that it is a trifling problem. But, The past compatibility
is worried very much. Then, many developers' clear eye is required
for it. However, I need this patch very much.

<about regression error of the after patch>
This is as a result of after patch apply of CVS-HEAD regression.
The cause changed the error position of a grammar interpretation.

--
plpgsql ... FAILED

========================
1 of 114 tests failed.
========================

*** ./expected/plpgsql.out Wed Jul 25 13:19:09 2007
--- ./results/plpgsql.out Fri Jan 25 14:29:34 2008
***************
*** 2337,2343 ****
end loop;
return 5;
end;$$ language plpgsql;
! ERROR: syntax error at or near "fought"
LINE 1: select I fought the law, the law won
^
QUERY: select I fought the law, the law won
--- 2337,2343 ----
end loop;
return 5;
end;$$ language plpgsql;
! ERROR: syntax error at or near "the"
LINE 1: select I fought the law, the law won
^
QUERY: select I fought the law, the law won

======================================================================

<about postfix operator problem>
There is syntax which is not passed. However, It is necessary to make
it c_expr expression. Probably, it is avoided by cautions of a document.

--
regression=# SELECT aa AS "X" FROM a_star LIMIT 1;
X
---
1
(1 row)

regression=# SELECT aa ! AS "X" FROM a_star LIMIT 1;
X
---
1
(1 row)

regression=# SELECT aa ! "X" FROM a_star LIMIT 1;
ERROR: column "X" does not exist
LINE 1: SELECT aa ! "X" FROM a_star LIMIT 1;
^
regression=# SELECT (aa !) "X" FROM a_star LIMIT 1;
X
---
1
(1 row)
--

BTW, this is the syntax which ORACLE and SQLServer don't accept.
It may be the wonderfulness of PostgreSQL. However, Is there any
situation using the function? But, I can't do assertion.

In conclusion, Therefore, this will be left to vote.

Regards,
Hiroshi Saito

Attachment Content-Type Size
as_less_patch application/octet-stream 5.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-02-08 17:22:37 Re: The question of LOCALE at the time of a regression test.
Previous Message Hiroshi Saito 2008-02-08 17:19:46 Re: The question of LOCALE at the time of a regression test.