📘
TimeLine E3
  • TimeLine E3 Documentation
  • Framework
    • Introduction
    • DataSet Definition
    • Window Handling Object
      • Input/Output arguments
      • Open
      • BindDataControls
      • Item Changes
      • Item Search
      • MenuItemClicked
      • Print
      • ModuleOpened (BlueArrow)
      • BlueArrowArguments
      • New Row
      • Delete Row
      • Save
      • Transactions
      • Locking [deprecated]
      • Locking (new)
      • Resizing a response window
      • ParaPanel
      • Adding DMS Tab to a Module
    • BusinessObject
    • Controls
      • BindingFormat
      • LookupGrid and SearchDef
      • ComboBox
      • RadioButton
      • Multiline Textbox
      • xTextBoxSearch
      • xFileBrowse [v16+]
      • DxDispoColumn
      • DxProgressColumn
      • DxTemplateColumn
      • Change control caption programmatically
      • TabControl
      • Navigation
      • Enable controls programmatically
      • Enable a MenuItem programmatically
      • Filter search values
      • Jumping to another module
      • Messages, Notifications, Log, Exceptions, Translation
      • LoggerSink [deprecated]
      • Log
      • OpenFile, FolderBrowsing and SaveFile
      • Execute Actions while displaying an Hourglass
      • Using Progress
      • Async methods with progress bar
      • Wizard
      • Customizing controls using xBehaviors
      • TLProperty.AllowInReadOnly [v16+]
    • DataSet Operations
    • Business-related functionality
      • Getting the next primary key
      • Hybrids
      • Enums
      • Get Current User
    • SQL
    • SQL (using named parameters)
    • Advanced SQL
    • Expression Binding
    • Server-side logic & customization [v16+]
      • Service Hoster
      • Starting / stopping hosted services
      • Changes to scheduled jobs!
      • Business Object Proxies
      • Business Object API
    • Colors in Expression Bindings [v15+]
    • Theming
      • Icons
  • TimeLine Developer (TLD)
    • Debugging in TLD
    • Targets
    • Custom Project Rework [v16+]
  • TimeLine-specific LL functions
  • Stunnel proxy
    • Pre-requisites
    • 1. Initial setup
    • 2. Generate the server/web certificates
    • 3.a. Generating client certificates using the CSR flow
    • 3.b. Generate client certificates from the server console
    • 4. Setting up the E3 client connection
    • 5. Setting up the browser certificates
  • Configuration
    • Configuring the WCF timeout
  • Troubleshooting the E3 Bridge
  • [Deprecated]
    • TimeLine WEB - deprecated in v16+
      • Prerequisites for running the WASM modules on the server
      • Prerequisites for developing WASM modules with TLD
      • Creating a small web module with TLD
      • Terminal Configuration
    • Customization Examples - deprecated in v16+
    • Codestore [deprecated]
    • Configuring the scheduled jobs timeout - deprecated in v16+
  • ASA to PostgreSQL Migration (V17)
    • PostgreSQL Setup
    • TimeLine Migration Tools
      • SQL Transpiler
      • DataSet Migration
    • ASA17 vs PostgreSQL Syntax differences
    • Alias referencing
    • In-Line SQL Statements
Powered by GitBook
On this page
  1. ASA to PostgreSQL Migration (V17)

ASA17 vs PostgreSQL Syntax differences

PreviousDataSet MigrationNextAlias referencing

Last updated 1 day ago

PostgreSQL Documentation:

As an internal guideline, we have established that the BEST PRACTICE for args in SQL statements should be:

"SELECT column1, column2 FROM table WHERE column1 = :argsName1 AND column2 = : argsName2", new {argsName1 = value1, argsName2 = value2}
ASA 17
PostgreSQL

SELECT FIRST or SELECT TOP 1

SELECT FIRST arbpl_afo.arbpl_nr

FROM arbpl_afo

WHERE arbpl_afo.arbgkat_nr = :arbgkatNr

ORDER BY arbpl_afo.id;

SELECT … LIMIT 1

SELECT arbpl_nr

FROM arbpl_afo

WHERE arbgkat_nr = :arbgkatNr

ORDER BY id

LIMIT 1;

multiple INSERT Statements within the same block

INSERT INTO para (grp, id, wert, kommentar, system) VALUES ( :grp, :id, :wert, :kommentar, :SystemType);

INSERT INTO para (grp, id, wert, kommentar, system) VALUES ( :grp, :id, :wert, :kommentar, :SystemType);

INSERT INTO para (grp, id, wert, kommentar, system) VALUES ( :grp, :id, :wert, :kommentar, :SystemType);

easier way of doing it:

INSERT INTO para (grp, id, wert, kommentar, system) VALUES

( :grp1, :id1, :wert1, :kommentar1, :SystemType1),

( :grp2, :id2, :wert2, :kommentar2, :SystemType2),

( :grp3, :id3, :wert3, :kommentar3, :SystemType3)

SELECT LIST(..)

SELECT List(art.artnr, ORDER BY artnr) FROM art;

SELECT STRING_AGG

SELECT STRING_AGG(artnr, ', ' ORDER BY artnr)

FROM art;

Also useful:

SELECT ARRAY_TO_STRING( ARRAY_AGG(nr), ',' ) FROM planitem

COUNT()

COUNT(*)

ON EXISTING

UPDATE:

INSERT INTO para (grp, id, wert)

ON EXISTING UPDATE

VALUES ('FIFOLAGER', 'rollback_point', '1')

SKIP:

INSERT INTO el_mpn(nr, mpn) ON EXISTING

SKIP VALUES(:nr, :mpn)

UPDATE:

INSERT INTO para(grp, id, wert)

VALUES 'FIFOLAGER', 'rollback_point', '1'

ON CONFLICT ON CONSTRAINT para_pkey

DO UPDATE SET

grp = EXCLUDED.grp,

id = EXCLUDED.id,

wert = EXCLUDED.wert

SKIP:

INSERT INTO el_mpn(nr, mpn)

VALUES (:nr, :mpn)

ON CONFLICT DO NOTHING

NUMBER()

ROW_NUMBER() OVER()

STRING CONCAT

SELECT '123' + '456'…

STRING CONCAT

SELECT '123' || '456'…

CONVERSION

SELECT String(nr) FROM planitem

CONVERSION

SELECT nr::text FROM planitem

SELECT CAST(nr as TEXT) FROM planitem

IF … THEN … ELSE … ENDIF

SELECT val = IF EXISTS (SELECT nr FROM persgrp WHERE fordverb_samkto = '123') THEN 1 ELSE 0 ENDIF

CASE WHEN … THEN … ELSE … END

SELECT CASE WHEN EXISTS ( SELECT nr FROM persgrp WHERE fordverb_samkto = '123' ) THEN 1 ELSE 0 END AS "val"

Datatypes

DOUBLE

LONG VARCHAR

LONG BINARY

Datatypes

FLOAT8

TEXT

BYTEA

UPDATE with reference to multiple tables

UPDATE planitem, planitem_ref

SET planitem.status = 0

WHERE planitem.nr = planitem_ref.nr

AND planitem_ref.bab_typ = 15

UPDATE with reference to multiple tables

UPDATE planitem

SET status = 0

FROM planitem_ref

WHERE planitem.nr = planitem_ref.nr

AND planitem_ref.bab_typ = 15

After the SET keyword you shall not (and cannot) use aliases.

UNION

UNION ALL

DateDiff()

datetime1::date - datetime2::date

(YEAR (lebenslauf.datum) ) AS "jahr"

date_part('year', lebenslauf.datum) AS "jahr"

EXTRACT(YEAR FROM lebenslauf.datum) AS "jahr"

Case Insensitive Comparison

SELECT * FROM users WHERE name = 'gast'

Case Insensitive Comparison

SELECT * FROM users WHERE name ILIKE 'gast'

Tips

“FROM table1 CROSS JOIN table2” is identical to “FROM table1, table2”

Adrian’s advice is to use the CROSS-keyword

https://www.postgresql.org/docs/17/index.html
https://www.postgresql.org/docs/current/sql-keywords-appendix.html