Ejemplo n.º 1
0
        protected override string GetRenameTableSql(DiscoveredTable discoveredTable, string newName)
        {
            var syntax = new PostgreSqlSyntaxHelper();

            return(@"ALTER TABLE " + discoveredTable.GetFullyQualifiedName() + @"
                RENAME TO " + syntax.EnsureWrapped(newName));
        }
Ejemplo n.º 2
0
        public string GetTopXSqlForColumn(IHasRuntimeName database, IHasFullyQualifiedNameToo table,
                                          IHasRuntimeName column, int topX,
                                          bool discardNulls)
        {
            var syntax = new PostgreSqlSyntaxHelper();

            string sql = "SELECT " + syntax.EnsureWrapped(column.GetRuntimeName()) + " FROM " + table.GetFullyQualifiedName();

            if (discardNulls)
            {
                sql += " WHERE " + syntax.EnsureWrapped(column.GetRuntimeName()) + " IS NOT NULL";
            }

            sql += " fetch first " + topX + " rows only";
            return(sql);
        }