Search Postgresql Archives

Re: validate synatax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Kroon <plakroon@xxxxxxxxx> writes:

> Hi,
>
> How can I validate any query on PostgreSQL without executing the sql.
> I was able with EXPLAIN to find some errors. However this only worked with a SELECT statement. When i tried to create a TABLE it would not run.
> I do not wish to install external packages. Preferably use only default present features.
>
> http://wiki.postgresql.org/wiki/Introduction_to_VACUUM,_ANALYZE,_EXPLAIN,_and_COUNT#PostgreSQL_EXPLAIN
>
> Any suggestions are welcome.


/yomama
=# create or replace function foo() returns void as $$create table foo()$$ language sql;
CREATE FUNCTION
/yomama
=# create or replace function foo() returns void as $$create table foo() bogus syntax$$ language sql;
ERROR:  syntax error at or near "bogus"
LINE 1: ...nction foo() returns void as $$create table foo() bogus synt...
                                                             ^
/yomama
=# select version();
                                           version                                            
----------------------------------------------------------------------------------------------
 PostgreSQL 9.1.9 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit
(1 row)


>
> Best,
> Peter
>

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@xxxxxxxxxxx
p: 312.241.7800


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux