Language specification for Juttle? - specifications

Juttle seems similar to a query language like SQL, but also seems to contain summation, time-series batching, and graphing capabilities. Is there full documentation on the language somewhere?

Jut publishes the Juttle documentation here:
http://juttle.github.io/juttle/

Related

Postgresql Rule vs Trigger

I looked up official documents and researched them, but I still don't know what to use in what situations. Could you tell me a simple example and the difference? What are the advantages of having to write a RULE?
Forget about rules.
The Postgres Wiki recommends to never use them
Why not?
Rules are incredibly powerful, but they don't do what they look like they do. They look like they're some conditional logic, but they actually rewrite a query to modify it or add additional queries to it.
That means that all non-trivial rules are incorrect.
Depesz has more to say about them.
When should you?
Never. While the rewriter is an implementation detail of VIEWs, there is no reason to pry up this cover plate directly.
(emphasis mine)

Is it possible to query the CKAN datastore with comparisons other than exact matching?

Is it possible to pass any of the comparison operators listed here https://www.postgresql.org/docs/9.1/static/functions-comparison.html to the datastore_search api?
I'm aware of the datastore_search_sql function, but it seems like pretty bad practice to be passing sql queries directly from the frontend.
I'm afraid datastore_search only does =. See https://github.com/ckan/ckan/blob/master/ckanext/datastore/backend/postgres.py#L341 This API call is designed for simple filtering and sorting - mirroring the controls in the resource preview widget.
I'm not clear about your situation - frontend sending SQL queries. But I don't see much different between using datastore_search_sql and datastore_search. They are both relatively simple wrappers around Postgres SQL.

How can I add a new data structure in PostgreSQL?

I created my own R-Tree and I would like to add it to PostgreSQL, I was reading about PostGis, However I don't kwow exactly How can I do that.
R-Tree is implemented in PostgreSQL as GiST index for two-dimensional geometric data types. To add your own implementation you should consider using GiST infrastructure too. Citing the documentation:
Traditionally, implementing a new index access method meant a lot of difficult work. It was necessary to understand the inner workings of the database, such as the lock manager and Write-Ahead Log. The GiST interface has a high level of abstraction, requiring the access method implementer only to implement the semantics of the data type being accessed. The GiST layer itself takes care of concurrency, logging and searching the tree structure.
So, first read this chapter to make sure you understand the concepts of index methods, operator classes and families.
Then, read about GiST index and its API. There you can find useful examples that will help you.
Also, a lot of helpful information you can find on development section of PostgreSQL site.
Any programming questions you may address to PostgreSQL developer's mailing list.

How to learn Postgresql and its internals?

I am green on postgresql, so when reading source code of pg, I am very confused....Is there some useful material on postgresql source code? Thank you.
There are some nice presentations about some basic concepts like Datum, V1 Functions Calls and source code
http://www.postgresql.org/developer/coding
http://www.postgresql.org/files/developer/internalpics.pdf
this master thesis is very good document http://www.ic.unicamp.br/~celio/livrobd/postgres/ansi_sql_implementation_postgresql.pdf
http://www.postgresql.org/developer/ext.backend_dirs.html
It seems you are also unversed in using the internet!? ;-) First look should be the project homepage http://www.postgresql.org/. There you will find a "Developers" link which directs you to the available resources. One of them is the Developer FAQ which should be more than sufficient for the beginning.
Seems very usefull book - The Internals of PostgreSQL
A useful link can be found here for Postgres 14 Postgres Professional. It discusses about Isolation, MVCC, Buffer Cache, WAL, Locks and Query Execution.
Also refer a 2 day free course here PostgresPro Course

Where can I get the ANSI or ISO standards for the RDBMS queries?

I want to write some queries which can work in almost all the databases without any SQLExceptions. So, where can I get the ANSI standards to write the queries ?
Not sure that'll help you.
Vendors are touch and go as far as standards implementation and often the standards themselves are imprecise enough such that you could never write a query that would work with all implementors.
For example, SQL 92 defines the concatenation operator as || but neither MySQL nor MSSQL use this (Oracle does). Vendor independent string concatenation is impossible.
Similarly, a standard escape character is not specified so how you handled that might not work in all vendors.
Having said that:
SQL 92:
http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
Wiki article with links to SQL 99 ISO documents:
http://en.wikipedia.org/wiki/SQL:1999
From wikipedia:
The SQL standard is not freely available. The whole standard may be purchased from the ISO as ISO/IEC 9075(1-4,9-11,13,14):2008.
Nevertheless I would not advise you to follow this strategy because no database engine follows any SQL standard (SQL 99, 2003, etc.) to the letter. All of them take liberties in the way they handle instructions or define variables (for example, when comparing two strings different engines handle case sensitivity differently). A method that is very efficient with one engine can be terrible inefficient for another.
A suggestion would be to develop a standard group of queries and develop different classes that contain the specific implementation of that query for a certain target RDBMS.
Hope this helped
Check out the BNF of the core SQL grammars available at http://savage.net.au/SQL/
This is part of the answer - the rest, as pointed out by Kiranu and MattMitchell, is that different vendors implement the standard differently. No DBMS adheres perfectly to even SQL-92, though most are pretty close.
One observation: the SQL standard says nothing about indexes - so there is no standard syntax for creating an index. It also says nothing about how to create a database; each vendor has their own mechanisms for doing that.
The Sql-92 standard is probably the one you want to target. I believe it's supported most of the major RDBMSs.
Here is a less terse link. Sample content:
PostgreSQL Has views. Breaks standard by not allowing updates to views...
DB2 Conforms to at least SQL-92.
MSSQL Conforms to at least SQL-92.
MySQL Conforms to at least SQL-92.
Oracle Conforms to at least SQL-92.
Informix Conforms to at least SQL-92.
Something else you might consider, if you're using .NET, is to use the factory pattern in System.Data.Common which does a good job of abstracting provider specifics for a number of RDBMSs.
If you are trying to make a product that will work against multiple databases I think trying to only use standard sql is not the way to go, as other answers have indicated, due to the different 'interpretations' of the standard. Instead you should if possible have some kind of data access layer in your application which has different implementations specific for each database. Depending on what you are trying to do, there are tools such as Hibernate which will so a lot of the heavy lifting in regards to this for you.