Re: [pgScript patch] Improved test output + make use of pgAdmin UI for error output

From: Mickael Deloison <mdeloison(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgScript patch] Improved test output + make use of pgAdmin UI for error output
Date: 2009-03-11 17:51:35
Message-ID: 1f8f052b0903111051k35d8907elcbd6064b93a5a28a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

2009/3/11 Dave Page <dpage(at)pgadmin(dot)org>:
> Testing on Windows, it fails the first tests I try :-(
>
> select * from missing_table
>
> I get no error message at all. If I enter garbage, I just get the following:
>
> 1.0: syntax error, unexpected character

This is normal: you do not have anything in the output because the
query must be terminated with a semi-colon.
I will look at that and add an error message.
Add the semi-colon ";" and the query will be executed. An erroneous
query (like this one where the table does not exist) is valid from the
pgScript point of view. It returns a warning saying why the query did
not work but does not stop. I wanted to do like this because sometimes
with pgScript I test invalid queries and I do not want the script to
be stopped.

> If I enter this example from the docs:
>
> SET @A = INTEGER(100, 200);
> PRINT @A; -- Prints an integer between 100 and 200
> PRINT @A; -- Prints another integer between 100 and 200
>
> I get:
>
> 3.9-10: syntax error, unexpected '-'

Add an empty line at the end and the error will go away. This is the
way pgScript detects comments: the regular expression doing that is
"--".*$. I need to see if I can add "End of file" is addition to "$".

> I would expect an error message from the first query, and nicely
> formatted errors from the second and third tests (though actually I
> wouldn't expect an error at all from the docs example). FWIW, other
> (non-erroring) examples work fine:

I need to check whether I can modify how Bison outputs errors in case
a parsing error occurs.

> SET @PROGR(at)M#TITLE = 'pgScript';
> PRINT '';
> PRINT @PROGR(at)M#TITLE + ' features:';
> PRINT '';
> PRINT '  * Regular PostgreSQL commands';
> PRINT '  * Control-of-flow language';
> PRINT '  * Local variables';
> PRINT '  * Random data generators';
>
> gives:
>
> [PGSCRIPT ]
> [PGSCRIPT ] pgScript features:
> [PGSCRIPT ]
> [PGSCRIPT ]   * Regular PostgreSQL commands
> [PGSCRIPT ]   * Control-of-flow language
> [PGSCRIPT ]   * Local variables
> [PGSCRIPT ]   * Random data generators
>
> and
>
> DECLARE @I, @T; -- Variable names begin with a @
> SET @I = 0; -- @I is an integer
> WHILE @I < 20
> BEGIN
>    SET @T = 'table' + CAST (@I AS STRING); -- Casts @I
>    CREATE TABLE @T (id integer primary key, data text);
>
>    SET @I = @I + 1;
> END
>
> Outputs the queries and resulting notices as expected.
>

The problem you mentioned are things to improve but they have always
been there and not linked to a recent patch.

Best regards,
Mickael

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message svn 2009-03-11 18:27:46 SVN Commit by guillaume: r7678 - trunk/pgadmin3/i18n/fr_FR
Previous Message Dave Page 2009-03-11 17:38:40 Re: pgadmin 1.8.4 freeze ?